# Tinted Image/Wrong WHITEBALANCE\_TEMPERATURE: Streaming Module + ZED Node conflict on video settings

**URL:** <https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862>\
**Category:** ROS1\
**Tags:** python, streaming, sdk\
**Created:** [May 3, 2024, 10:53pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862 "2024-05-03T22:53:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdcast](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/j/5f8ce5/32.png) [@jdcast](https://community.stereolabs.com/u/jdcast)\
**Post date:** [May 3, 2024, 10:53pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/1 "2024-05-03T22:53:11Z")

</div>

I’m seeing the following behavior for an Orin NX + GMSL2 + ZED X Mini + ZED SDK 4.1.0 and Driver [stereolabs](https://www.stereolabs.com/)-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:

 ![image](https://community.stereolabs.com/uploads/default/original/2X/b/b5fe999ccd9257540c6dbc196e5b3c7262588eb4.jpeg)

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:

 ![image](https://community.stereolabs.com/uploads/default/original/2X/b/b84623d65befc4d7b82cf0c9193a413ea42d138e.jpeg)

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?

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [May 6, 2024, 2:44pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/2 "2024-05-06T14:44:16Z")

</div>

Hi @jdcast

Can you check the automatic white balance setting of your ZED Node?  
Is it possible that it disable the setting?

---

<div class="post-metadata">

**Author:** ![jdcast](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/j/5f8ce5/32.png) [@jdcast](https://community.stereolabs.com/u/jdcast)\
**Post date:** [May 6, 2024, 3:46pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/3 "2024-05-06T15:46:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [May 6, 2024, 3:52pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/4 "2024-05-06T15:52:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jdcast](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/j/5f8ce5/32.png) [@jdcast](https://community.stereolabs.com/u/jdcast)\
**Post date:** [May 6, 2024, 9:19pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/5 "2024-05-06T21:19:09Z")

</div>

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:

```auto
 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);

```

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [May 7, 2024, 8:16am UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/6 "2024-05-07T08:16:55Z")

</div>

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`?

---

<div class="post-metadata">

**Author:** ![jdcast](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/j/5f8ce5/32.png) [@jdcast](https://community.stereolabs.com/u/jdcast)\
**Post date:** [May 7, 2024, 12:49pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/7 "2024-05-07T12:49:36Z")

</div>

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:

```auto
 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.

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [May 7, 2024, 1:27pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/8 "2024-05-07T13:27:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jdcast](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/j/5f8ce5/32.png) [@jdcast](https://community.stereolabs.com/u/jdcast)\
**Post date:** [May 7, 2024, 2:54pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/9 "2024-05-07T14:54:28Z")

</div>

Hi @Myzhar,

Two cases:

1. If I start the sender sample, then start the receiver sample and then only adjust by `+`, I see a value of 2801.

2. If I start the sender sample, then start the receiver sample and then hit `r` for reset (triggering `cam.set_camera_settings(sl.VIDEO_SETTINGS.WHITEBALANCE_TEMPERATURE, -1))`), I see that the old value was 2800 and the new value becomes -1. I can further confirm this by subsequently pressing `+`, which gives a value of 0 (pressing `-` does not appear to allow to go below 0 though).

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [May 7, 2024, 2:58pm UTC](https://community.stereolabs.com/t/tinted-image-wrong-whitebalance-temperature-streaming-module-zed-node-conflict-on-video-settings/5862/10 "2024-05-07T14:58:15Z")

</div>

Thank you for the information.  
This is a wrong behavior indeed.
