How I make color calibration in opencv using a colorchecker?

。_饼干妹妹 提交于 2021-02-07 03:33:10

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/18897730/how-i-make-color-calibration-in-opencv-using-a-colorchecker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!