How to fix this white balancing issue? I have seen some examples on python but couldn’t implement them to c++. And as far as I saw, there is not a built in function other than this WhiteBalance on openCV.
Try to set the white balance in the camera with cap.set():
CAP_PROP_AUTO_WB - enable/ disable auto white-balance
CAP_PROP_WB_TEMPERATURE - white-balance color temperature
It’s better to do it in camera because it can work with raw data, which has much better color resolution than the captured and compressed captured images.
Here you have a list of typical white balance values:
Yes because i was getting some silly-broken captures before that. It was working fine on the camera app but was broken on the opencv. So i looked and saw that the app was using GRBG, that’s why I converted the bayer image.
I am working on Linux - Ubuntu. I thought I could change the parameters through v4l2. I think I should open the camera by specifying V4L2 for the changes to be set on the opencv. But it crashes when I write v4l2 with the following error.
void VideoStreamer::openVideoCamera()
{
cap.open(0, CAP_V4L2); //I also tried with just writing CAP_V4L2 but it didnt work.
}
OpenCV(4.5.3-dev) opencv-master/modules/imgproc/src/demosaicing.cpp:1721: error: (-215:Assertion failed) scn == 1 && (dcn == 3 || dcn == 4) in function 'demosaicing’