Bad color when capturing image from WEC7

I’m just trying to grab a frame from a USB camera on a Windows Embedded Compact 7 machine and all seems to work pretty well except that the colors are off. If you look at the attached image you should see on the lower right side there is a reddish tint, then more green towards the left. If I switch to grayscale it looks great. I just need to fix the colors.

Is there a setting that I’m missing or something else I can use to fix this?

I have just a basic implementation:

cv::Mat image;
VideoCapture.open(0);
VideoCapture >> image;
cv::imwrite(path, image);

I’m pretty new to OpenCV but will greatly appreciate any help.

Thanks

  • there’s an environment variable to debug it:

    set OPENCV_VIDEOIO_DEBUG=1

  • try to switch backends:

    VideoCapture(0, CAP_DSHOW); // CAP_MSMF is the default, iirc

  • try to get to the global properties page (switch off white-balancing, etc):
    cap.get(CAP_PROP_SETTINGS)

  • try to find a better driver for your webcam