Estimate Brightness of an image Opencv

前端 未结 4 641
被撕碎了的回忆
被撕碎了的回忆 2020-12-14 03:08

I have been trying to obtain the image brightness in Opencv, and so far I have used calcHist and considered the average of the histogram values. However, I feel this is not

4条回答
  •  一生所求
    2020-12-14 03:23

    I was about to ask the same, but then found out, that similar question gave no satisfactory answers. All answers I've found on SO deal with human observation of a single pixel RGB vs HSV.

    From my observations, the subjective brightness of an image also depends strongly on the pattern. A star in a dark sky may look more bright than a cloudy sky by day, while the average pixel value of the first image will be much smaller.

    The images I use are grey-scale cell-images produced by a microscope. The forms vary considerably. Sometimes they are small bright dots on very black background, sometimes less bright bigger areas on not so dark background.

    My approach is:

    • Find histogram maximum (HMax) using threshold for removing hot pixels.
    • Calculate mean values of all pixel between HMax * 2/3 and HMax

    The ratio 2/3 could be also increased to 3/4 (which reduces the range of pixels considered as bright).

    The approach works quite well, as different cell-patterns with same titration produce similar brightness.

    P.S.: What I actually wanted to ask is, whether there is a similar function for such a calculation in OpenCV or SimpleCV. Many thanks for any comments!

提交回复
热议问题