1700981335 Publish time 2023-12-9 02:09:12

RaspTank_pro - Camera R-B color swapped

Camera displays with swapped colors as BGR instead of RGB.What to do?

1700981335 Publish time 2023-12-9 05:07:47

Though I may have found a solution here in FPV.py

for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
swap bgr for rgb.Doesn't work.Try again.

1700981335 Publish time 2023-12-9 05:38:13

Playing the camera with VLC via VNC desktop shows the correct colors.
Is this a problem with the webpage rather than the capture?

The VLC codec shows it is playing with YUV420, not RGB.I can get it to do MJPEG but only to YUV420.
Switching on the auto brightness, auto gain etc. makes the image very much better.Need to set these in the camera server code.

1700981335 Publish time 2023-12-10 02:26:12

It appears that FPV.py is not used at all for image streaming.FPV used by wevSServer.py hereFPV_Thread only gets used by server, not webServer.
Tested by removing this linethat sends the image.

Where is the image coming from?



1700981335 Publish time 2023-12-10 03:00:44

The function by webServer is in camera_opencv hereTested putting a rgb to bgr conversion in and it worked.
I don't yet know if the problem is at frame delivery or camera capture. So I don't know where to put the conversion.

1700981335 Publish time 2023-12-10 05:08:04

Getting somewhere when changing settings in camera_opencv.py

Added camera capture settings to reduce resolution and frame rate.That significantly improves performance of everything.
Added setting to adjust exposure an gain.This makes the image much brighter in low light conditions.Still experimenting with this.
Auto exposure and balance doesn't appear to work yet.



      camera.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
      camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
      camera.set(cv2.CAP_PROP_FPS, 10)
      camera.set(cv2.CAP_PROP_EXPOSURE, 3000)
      camera.set(cv2.CAP_PROP_GAIN, 10)   
#      camera.set(cv2.CAP_PROP_AUTO_WB, 1)
#      camera.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1)
#      camera.set(cv2.CAP_PROP_CONVERT_RGB, 1)

1709110985 Publish time 2024-2-28 17:05:11

It seems that VLC is using YUV420 rather than RGB when it plays videos.As far as I can tell, it can only handle YUV420 MJPEG.
Auto brightness, auto gain, and other similar features greatly improve the picture quality.These variables must be defined in the camera server program.
Pages: [1]
View full version: RaspTank_pro - Camera R-B color swapped