I am developing a vision application that is using the color chart below and camera to extract color of each patch in the chart. In order to do that, I have to first detect the chart area in an image and match the area with existing template which contains locations of patches.

My question: I need to detect the color patch area by recognizing four corners of the chart. You can see the corners that the small inset rectangles indicate in the image below. I know one way to go about it is to let user to select those corners by clicking it. But is there any way to automatically detect four corners from the image.

enter image description here

  • $\begingroup$ Just curious, where can one acquire such a color reference chart? $\endgroup$ – hotpaw2 Apr 11 '12 at 19:19
  • $\begingroup$ @hotpaw2 As almost always, google. Search for the term "it8 target" $\endgroup$ – Tae-Sung Shin Apr 11 '12 at 19:45

You can house hough lines to detect the color area

  • First detect all lines
  • Lines with longest length would be the outer most ones
  • Pick the top horizontal line and do template match for the squares.
  • Once you find the squares, traverse downwards toll you reach the other set of squares.
  • Mark all points where the squares were found
  • You now have an enclosing area for the color chart.

Each 2D array of a color component (RGB, et.al.) is fairly high contrast and distinctive. So I might try using a complex 2D FFT of each color component to determine the scale and offset of the photo image versus that of a reference image. Then use those to adjust the measured/known coordinates of the corners and/or patches in the reference image to produce coordinates in the photo.

You might have to first hand measure some coordinates on a reference image using a bitmap editor.


As a first step - i would remove all the clutter with gray and text. Starting from all four sides i will stop till majority of the pixels are of uniquely known "gray" color.

This will leave you with only the checker board consisting of different colors. You expect about 22x12 - about 264 colors.

A simplest method would be to apply simpler palatalization algorithm. If you would have to translate this in a GIF image - it applies color quantization with each cluster of color represented as the centroid color.

This would be specifically easy in your case because the source is already a palate of some kind and you can make a good decent guess to start.

Check this out:

NeuQuant: http://members.ozemail.com.au/~dekker/NEUQUANT.HTML

Octree Color Quantization: http://www.cubic.org/docs/octree.htm. See this also.

These are only some references; but you will find ready to use code in most libraries that use such image formats. (BMP, PNG, and GIF supports such representations). Also check out libpng and libjpeg for some quick implementations.


Why not look for the boundaries of the chart, instead of corners? You can try using an edge detector and then finding straight lines using the Hough Transform.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.