TerrariumPI icon indicating copy to clipboard operation
TerrariumPI copied to clipboard

[BUG]: Camera washed out white after a few hours of use

Open threedom opened this issue 8 months ago • 3 comments

Setup:

  • TerrariumPI version: 4.12.2
  • Install: [Manual]
  • Raspberry PI: 4b
  • OS: Bullseys

Describe the bug I've been using a USB webcam for about a year now. More recently - I've noticed it around 5 months ago - the camera quality turns from normal to washed out after about 12-24h of usage. Unplugging and plugging back in the camera fixes that, a raspberry restart does too. After some time it returns to the same washed out look. I unfortunately only have one camera here to test this so I'm not sure if this might be a camera hardware issue.

Washed out picture: Image

Normal picture (after unplugging camera) Image

threedom avatar Apr 22 '25 14:04 threedom

Hmm, seems that the white balance is getting whiter? Not sure how to explain. But I get the feeling that the white balance is doing something strange.

I need to look into this.

theyosh avatar Apr 27 '25 07:04 theyosh

After some testing, I cannot find anything that looks to fix this. But if you a bit handy with an editor, we can change some code on your side, to see if it does something for you.

Edit the file /home/pi/TerrariumPI/hardware/webcam/usb_webcam.py and change after line 32 add: camera.set(cv2.CAP_PROP_AUTO_WB, 1.0) Make sure the spacing is the same as the line above. This should force auto white balancing. And you can change the line sleep(self._WARM_UP) to sleep(self._WARM_UP*2) to increase the warmup time, which could help the white balance.

More I cannot find.

theyosh avatar May 04 '25 11:05 theyosh

Did you had time to test the above code change?

Another option could be to try to use https://commandmasters.com/commands/v4l2-ctl-linux/

Or replace the webcam with a different one to see if it is broken.

But I am unable to fix this in code.

theyosh avatar May 29 '25 14:05 theyosh

Closing due to no response

theyosh avatar Jun 24 '25 06:06 theyosh