简体   繁体   中英

How to find that image is more or less homogeneous w.r.t color (hue)?

UPDATE:

I have segmented the image into different regions. For each region, I need to know whether it is more or less homogeneous in terms of color.

What could be the possible strategies to do so?

previous: I want to check the color variance (preferably hue variance) of an image to find out the images made up of homogeneous colors (ie the images which have only one or two color).

I understand that one strategy could be to create a hue-histogram for that and then I can found the count of each color but I have several images altogether and I cannot create a hue-histogram of 180 bins for each image because then it would be computationally expensive for whole code.

Is there any inbuilt openCV method OR other simpler method to find out whether the image consist of homogeneous color only OR several colors?

Something, which can calculate the variance of hue-image would also be fine. I could not find something like variance(image);

PS: I am writing the code in C++.

The variance can be computed without an histogram, as the average squared values minus the square of the averaged values. It takes a single pass over the image, with two accumulators. Choose a data type that will not overflow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM