Ask Your Question

Color constancy in different illumination condition

asked 2013-03-12 14:47:40 -0500

berak gravatar image

updated 2015-09-16 18:08:38 -0500

Hi all. In a paper I'm reading is written: "RGB images taken from the camera are first passed through a pre-processing stage which helps to maintain the colour constancy in different illumination conditions." (focus is road signs recognition in a real time system). Is there a method in OpenCV to do this?

Best regards Costantino

edit retag flag offensive close merge delete



please accept my apologies, i accidentally deleted your question, instead of my comment ;(

berak gravatar imageberak ( 2013-03-12 14:49:13 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2013-03-13 08:49:28 -0500

The standard way of handling this variation is by performing a normalization of the lightning.

  • The easiest way is to use cv::equalizeHist / cvEqualizeHist. This will equilize the contrast over the input images.
  • Gamma correction can be done using cv::pow / cvPow
  • Difference of Gaussian approach can be done with cv::gaussianBlur / cvSmooth to get two different images then use cv::sub / cvSub to get the Difference of Gaussian.

But there are many other ways (including a Contrast Stretch, a Log filter, CLAHE, or even White Color Balancing or Retinex), that can work better or worse depending on your opinion and your project.

Some guidance:

edit flag offensive delete link more


Thanks for the reply.


Costantino gravatar imageCostantino ( 2013-03-13 10:16:43 -0500 )edit

answered 2013-05-07 04:58:56 -0500

You can check this paper:

Tan, X., and Triggs, B. "Enhanced local texture feature sets for face recognition under difficult lighting conditions.". IEEE Transactions on Image Processing 19 (2010), 1635–650.

Source code is here

edit flag offensive delete link more


Thanks a lot Costantino

Costantino gravatar imageCostantino ( 2013-05-14 13:04:56 -0500 )edit

Thanks for the source code! Awesome

Entreco gravatar imageEntreco ( 2013-05-15 09:24:15 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2013-03-12 14:47:40 -0500

Seen: 6,085 times

Last updated: Oct 14 '14