I’m seeing the following behavior for an Orin NX + GMSL2 + ZED X Mini + ZED SDK 4.1.0 and Driver stereolabs-zedx_0.6.4-MAX96712-L4T35.3.1_arm64.deb:
When using the streaming_sender.py sample in the ZED SDK at usr/local/zed/samples/camera streaming/sender/python/
one its own and then viewing using the streaming_receiver.py sample at usr/local/zed/samples/camera streaming/receiver/python/
, the image shows fine as given below:
However, if I then start a zed node using roslaunch zed_wrapper zedxm.launch stream:="127.0.0.1:30000" __ns:=zedxm1
on the orin and then try to view the stream as before using the receiver sample, the image gains a tint such as below:
This behavior actually happens even without the ZED node in the loop, if I just change the WHITEBALANCE_TEMPERATURE video setting using the receiver sample’s simple keyboard-based control GUI. What’s worse, is that using the same GUI, seemingly no matter the value I choose, the image never corrects.
I’ve tried adjusting the whitebalance temperature in the launch configuration of the ZED node to a number of values, including -1, along with auto whitebalance set to False. However, these values don’t seem to be either used or respected and the problem persists.
However, I can manage to get the image to correct itself if reset the WHITEBALANCE_TEMPERATURE video setting value to -1 using cam.set_camera_settings(sl.VIDEO_SETTINGS.WHITEBALANCE_TEMPERATURE, -1)
Having to do add this reset on connection in a node such as the ZED node, feels like a hack to get things working and also intrusive if I just want to be able to use the off-the-shelf code.
Is there a better solution?
Hi @jdcast
Can you check the automatic white balance setting of your ZED Node?
Is it possible that it disable the setting?
Hi @Myzhar
The issue arises even when using just the sender/receiver examples located at: /usr/local/zed/samples/camera streaming/ by simply using the text-based GUI to change the whitebalance to any value. If the receiver changes the whitebalance at all after start of the sender.py using the text-based GUI, the image becomes tinted and is unrecoverable (i.e. no matter which whitebalance value is used, the tint remains). The only way to recover the image that I’ve found is to use the receiver’s reset function ‘r’ (i.e. cam.set_camera_settings(sl.VIDEO_SETTINGS.WHITEBALANCE_TEMPERATURE, -1)
).
OK, if cam.set_camera_settings(sl.VIDEO_SETTINGS.WHITEBALANCE_TEMPERATURE, -1)
can work as a workaround for your issue, I recommend using it.
I logged this thread as a ZED SDK bug, the team will analyze it in detail and fix this weird behavior in one of the next release.
Thank you for the detailed information.
Hi @Myzhar
Do the c++ and python APIs do the same thing when trying to set whitebalance temperature to a value of -1?
I’m noticing the following code block, placed at the end of onInit() within zed_wrapper_nodelet.cpp, changes the whitebalance temperature to 2800 and not -1 and most importantly, doesn’t remove the tint as does calling the equivalent python code:
sl::ERROR_CODE err1;
sl::ERROR_CODE err2;
//ros::Duration(5.0).sleep(); // Delay for 5 seconds, doesn't help
err1 = mZed.setCameraSettings(sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE, -1);
int value;
err2 = mZed.getCameraSettings(sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE, value);
NODELET_WARN_STREAM("+-+-+-+-Error setting parameter WHITEBALANCE_TEMPERATURE " << ": " << sl::toString(err1) << ", " << sl::toString(err2) <<", value: " << value);
Hi @jdcast
When you set -1
to sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE
it is the same as setting sl::VIDEO_SETTINGS::WHITEBALANCE_AUTO
to true
.
So here
err1 = mZed.setCameraSettings(sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE, -1);
you enable Automatic White Balance.
While here
err2 = mZed.getCameraSettings(sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE, value);
you disable it and you set the temperature to manual with value
degrees, that could explain the greenish effect.
What is the value of value
?
Hi @Myzhar
My understanding from the API is that err2 = mZed.getCameraSettings(sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE, value);
only grabs the current value but doesn’t set it?
The value I see it returning is 2800.
However, if I instead use the python API, i.e. cam.set_camera_settings(sl.VIDEO_SETTINGS.WHITEBALANCE_TEMPERATURE, -1))
, the value does seem to change to -1 and the greenish effect is removed.
For example, I can start the sender and receiver samples located at /usr/local/zed/samples/camera_streaming
. This does not initially produce any tint.
Then start start an unmodified zed_wrapper_nodelet.cpp (with whitebalance_auto in its params yaml set to either true or false…no difference here observed). This produces a tint.
Then call the streaming_receiver.py’s ‘r’ GUI function which calls err2 = mZed.setCameraSettings(sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE, -1);
and the tint is removed.
If I instead try to use just the following code block at the end of zed_wrapper_nodelet.py to reset the WHITEBALANCE_TEMPERATURE
instead of the streaming_receiver sample (which I assume is the equivalent C++ code of that in the streaming_receiver example), I do not see the tint removed:
sl::ERROR_CODE err2;
//ros::Duration(5.0).sleep(); // Delay for 5 seconds, doesn't help
err1 = mZed.setCameraSettings(sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE, -1);
int value;
err2 = mZed.getCameraSettings(sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE, value);
NODELET_WARN_STREAM("+-+-+-+-Error setting parameter WHITEBALANCE_TEMPERATURE " << ": " << sl::toString(err1) << ", " << sl::toString(err2) <<", value: " << value);
I should note again that if just the sender/receiver samples are used (no zed_wrapper_nodelet), then the tint will appear if the receiver’s GUI is used to change the whitebalance_temperature using the +
/-
keys.
Hi @jdcast
my apologize, I read setCameraSettings
instead of getCameraSettings
for the second command.
If you call setCameraSettings
for sl::VIDEO_SETTINGS::WHITEBALANCE_TEMPERATURE
with -1
as value
and then you call getCameraSettings
, the expected value you obtain is not -1
, but the current value of the White Balance temperature calculated by the White Balance algorithm running on the ISP.
What do you obtain with Python? -1
or a White Balance temperature value?
Thank you for the information.
This is a wrong behavior indeed.