Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I make color calibration in opencv using a colorchecker?

I have a image of the colorchecker get by a digital camera, how i use this to calibrate the images using opencv?

follow below the colorchecker image:

enter image description here

like image 484
aliel Avatar asked Sep 19 '13 14:09

aliel


1 Answers

Are you asking how to do color calibration or how to do it with OpenCV?

In order to do color calibration you use the last row (gray tones) of the calibration board. Here is what you should do for color calibration step by step:

  1. Capture an image and take small regions inside the gray regions. 10x10 pixels in the middle should be fine. After this step you will have 6 10x10 regions.
  2. Take the average value of the 10x10 region for each gray region. After this step you will have 6 average values, 1 for each gray region. And remember, each value is an RGB value, like the values given below each color.
  3. Check the average values and try to match the values with given values. In the first try most probably the average values are different then the given values. Actually making them match is the calibration operation. To make them match you should change the gains of your camera. Change gain of each channel and try to match the average values with given values.
  4. After you change the camera gains for each channel, repeat these until it converges and camera is calibrated.

You can check if the calibration is done correctly by taking a small region from another color and check its average value with its given value. If they matches or pretty much same, then you have color calibrated your camera successfully.

All you need to do is being able to set camera gains, after that just capture images and try to match values and find correct camera gains.

If you understand the process, doing this using OpenCV should be piece of cake.

[EDIT]

Well, I don't know any ways to calculate the gain. But the most easy way is brute force. You can do something like this;

suppose your gain values vary between 0.0 and 3.0, specify a step value such as 0.1 and try all values. You should have a for loop like this:

for (double redGain=0.0; redGain <= 3.0; redGain += 0.1)
   for (double greenGain=0.0; greenGain <= 3.0; greenGain += 0.1)
      for (double blueGain=0.0; blueGain<= 3.0; blueGain+= 0.1)
         setCameraGain(redGain, greenGain, bluegain);
         // do the rest of the stuff
      end
   end
end
like image 196
guneykayim Avatar answered Sep 19 '22 07:09

guneykayim