zivid / zivid-ros

Official ROS driver for Zivid 3D cameras
BSD 3-Clause "New" or "Revised" License
62 stars 45 forks source link

Difference in Image Contrast: Zivid Studio vs. ROS2 /capture Service #118

Open kumar-sanjeeev opened 4 days ago

kumar-sanjeeev commented 4 days ago

Description:

Hello,

We are using the Zivid 2+ M60 model and have observed a discrepancy while working with the camera. Specifically, there is a noticeable difference in image contrast between images captured using Zivid Studio and those captured via the ROS2 /capture service , despite using same camera settings. We would like to confirm whether this is expected behavior or if we might be missing something.

Scenario 1:

Scenario 2:

apartridge commented 4 days ago

Hi @kumar-sanjeeev, thanks for your ticket.

The color difference comes from Studio showing the colors using sRGB color space, which makes it appear brighter (and more correct on the monitor). In the ROS driver the colors outputted have not been converted to sRGB. You can read more about it at https://support.zivid.com/en/latest/support/color-inconsistency-after-sdk-update.html#for-all-cameras-after-updating-to-sdk-2-11 and https://support.zivid.com/en/latest/reference-articles/color-spaces-and-output-formats.html.

We will look at add an option (topic) to the ROS driver to retrieve the colors in sRGB format. Those colors would then look identical as in Studio (for the same settings). You can then use that topic to get colors that match Studio. However, for your color processing you need to evaluate if you want to use colors in linear format or in SRGB format, depending on what your color processing pipeline is optimized for.

A workaround for now is to set the Gamma setting in Studio to 0.45 which approximately equals sRGB. ROS colors would then look similar to the Studio colors when Gamma was 1.0 (Studio colors would then look very bright with Gamma 0.45).

A fix in the code would be to replace Zivid::ColorRGBA with Zivid::ColorSRGB in https://github.com/zivid/zivid-ros/blob/master/zivid_camera/src/zivid_camera.cpp and https://github.com/zivid/zivid-ros/blob/master/zivid_camera/include/zivid_camera/zivid_camera.hpp. This would change the output for the color/image_color topic to use sRGB instead of linear RGB, but it would not affect the points/xyzrgba topic.