Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In the OpenCV RGB histogram the three channels are individually scaled between 0..histimage.rows (see the three normalize() lines). As the blue has a lot of saturated values in the sky (255), it will be scaled lower in the histogram.

You can correct this by getting the global maximum (the highest value of r_hist, g_hist and b_hist) and using this value to normalize the three histograms using this value:

b_hist=b_hist*histimage.rows/global_max;