Search code examples
opencvcamerawebcamvideo-capture

How to make two camera pictures look similar (Brightness, White Balance,...)


I have two webcams (both are Logitech C615). I want to adjust the webcams in a way that they make nearly the same picture in same environment. (the reason is that I want to render this images onto an occulus rift).

I'm using OpenCV to connect the cameras. My first innocent try was to get all the CV_CAP_PROPs from the one cam and set the values to the other cam. That doesn't work very well.

Is there may already a function I could use or can you give me another approach?

--- EDIT: histogram equalization ---

That's the result:

enter image description here The result is better than before but as you can see the hue is different.


Solution

  • Try to convert them to YCrCb and equalize just the Y channel (and convert them back to BGR if you need to). This should equalize the brightness of both images.

    Snippet:

    cv::cvtColor( frame, frame, CV_BGR2YCrCb);
        cv::split( frame, channels);
    cv::equalizeHist( channels[0], channels[0] );
        cv::merge( channels, 3, frame );
    cv::cvtColor( frame, frame, CV_YCrCb2BGR );