camera1394 icon indicating copy to clipboard operation
camera1394 copied to clipboard

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

Open jack-oquin opened this issue 10 years ago • 13 comments

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 avatar Sep 01 '14 17:09 jack-oquin

@efernandez: please post any follow-up information here

jack-oquin avatar Sep 01 '14 21:09 jack-oquin

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. :)

efernandez avatar Sep 01 '14 22:09 efernandez

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).

jack-oquin avatar Sep 01 '14 22:09 jack-oquin

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.

protobits avatar Apr 09 '15 19:04 protobits

@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.

jack-oquin avatar Apr 10 '15 19:04 jack-oquin

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 [email protected] 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 .

protobits avatar Apr 11 '15 00:04 protobits

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 avatar Apr 14 '15 20:04 jack-oquin

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

jack-oquin avatar Apr 14 '15 20:04 jack-oquin

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 [email protected] 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 .

protobits avatar Apr 14 '15 20:04 protobits

Did you also set bayer_method to ""?

What video_mode are you using? Is this Format 7?

jack-oquin avatar Apr 15 '15 18:04 jack-oquin

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 [email protected] 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 .

protobits avatar Apr 15 '15 18:04 protobits

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

jack-oquin avatar Apr 15 '15 18:04 jack-oquin

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.

jack-oquin avatar Apr 15 '15 19:04 jack-oquin