Was it helpful?

Solution

While OpenCV does have Histogram functions, I am not sure I would bother using it in this case. It seems like all you do is split the image in a number of sections and then calculate the amount of white in it. Some kind of funky spatial histogram. I am pretty sure that no OpenCV function to do that directly exists.

So I suggest running through every pixel in each section and count the number of white pixels (and, if the regions are of different sizes, count the black pixels as well). Then it is simply a matter of drawing it which can be done easily using the rectangle drawing function. If you read the documentation you'll find it's really quite informative.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow