ros-drivers / camera1394

ROS driver for devices supporting the IEEE 1394 Digital Camera (IIDC) protocol.
http://www.ros.org/wiki/camera1394
17 stars 35 forks source link

camera1394: Debayering mono8 for cameras that say not to support raw8 Bayer pattern #42

Open jack-oquin opened 10 years ago

jack-oquin commented 10 years ago

Carried over from code.ros.org Trac ticket #5494 reported by efernandez:

It seems that some IEEE1394 cameras have raw8 Bayer pattern formats/modes, but that just say to have mono8.

In ROS, when images are mono8 it's not possible to use the debayering capability of the image pipeline.

IMHO, one solution (or workaround) consists on forcing debayering for mono8.

Below are some links decribing the problem in more detail:

http://answers.ros.org/question/37862/force-raw8-for-debayering/

-- Enrique

It's a Basler A102fc camera.

jack-oquin commented 10 years ago

@efernandez: please post any follow-up information here

efernandez commented 10 years ago

At this moment I don't have access to such camera, but the problem is simple. Maybe the camera should report that is actually using bayer some way, instead of saying mono8. However, allowing to debayer mono8 doesn't look that complicated. :)

jack-oquin commented 10 years ago

I don't have access to one, either.

This looks like a valid issue, so let's leave it open in hopes that someone with a suitable device can provide a pull request (and test it).

protobits commented 9 years ago

Hi, I have one of such cameras, the Firefly MV. It appears that when I select debayer_method as "", raw images are produced, however the encoding reported by camera1394 is mono8, where it should be bayer_rggb8. I have another node consuming republishing the images from camera1394, changing the encoding to bayer_rggb8 and the rest of the ROS pipeline works as expected. It is a trivial fix. Maybe a parameter can be added such as "force_bayer" so that whenever debayer_method is "", this encoding is written before publishing.

jack-oquin commented 9 years ago

@v01d: That's good. Can you provide a pull request that fixes this?

I don't understand the problem well enough to fix it myself, but I can provide suggestions if you need help understanding the current code.

protobits commented 9 years ago

Well in my case the problem is that when you select raw output from camera1394, images are published to ros as mono8. The rest of the ros image pipeline reads this as a monochromatic image. The correct encoding should be bayer_rggb8, which for some reason does not work in camera1394 (I'm not sure why). If the camera is responsible by not informing correctly its mode I would simply force it to publish images as raw, whenever raw mode is selected in camera1394.

I will try to modify camera1394, but I'm not sure if I'm able to provide a solution which does not break anything else.

On Fri, Apr 10, 2015 at 4:07 PM, jack-oquin notifications@github.com wrote:

@v01d https://github.com/v01d: That's good. Can you provide a pull request that fixes this?

I don't understand the problem well enough to fix it myself, but I can provide suggestions if you need help understanding the current code.

— Reply to this email directly or view it on GitHub https://github.com/ros-drivers/camera1394/issues/42#issuecomment-91653655 .

jack-oquin commented 9 years ago

We definitely want a solution that does not break anything else.

What about adding a parameter that overrides the driver's normal encoding logic?

jack-oquin commented 9 years ago

What happens if you explicitly set bayer_pattern to "rggb"?

protobits commented 9 years ago

If I set rggb, the image comes out debayered (in color) and camera1394 publishes images as rgb8 encoding. If I set bayer_pattern to "", the image comes out in raw, however the encoding is mono8 (which should be bayer_rggb8). I'm not sure if this is the expected behavior, regarding the values of bayer_pattern.

On Tue, Apr 14, 2015 at 5:49 PM, jack-oquin notifications@github.com wrote:

What happens if you explicitly set bayer_pattern to "rggb"?

— Reply to this email directly or view it on GitHub https://github.com/ros-drivers/camera1394/issues/42#issuecomment-93055659 .

jack-oquin commented 9 years ago

Did you also set bayer_method to ""?

What video_mode are you using? Is this Format 7?

protobits commented 9 years ago

I tried setting bayer_method blank and does not make a difference. I was not setting video_mode but choosing a video_mode does not change the behavior. Neither does setting the format7 parameters to select bayer format.

On Wed, Apr 15, 2015 at 3:02 PM, jack-oquin notifications@github.com wrote:

Did you also set bayer_method to ""?

What video_mode are you using? Is this Format 7?

— Reply to this email directly or view it on GitHub https://github.com/ros-drivers/camera1394/issues/42#issuecomment-93505636 .

jack-oquin commented 9 years ago

I am having trouble figuring out exactly what parameters you are using. Would you list them all?

jack-oquin commented 9 years ago

Ignoring Format 7 issues, it should work as described in this tutorial.

I would like to understand which combination of those parameters fails with your camera.