开发者

how to use opencv to get binaryzation image's histogram

开发者 https://www.devze.com 2022-12-18 00:53 出处:网络
for example I have a binaryzation image like this alt text http://www.iebayer.c开发者_如何学运维om/forum/attachments/month_1001/100127142364234cbfc9c9c793.jpg

for example I have a binaryzation image like this alt text http://www.iebayer.c开发者_如何学运维om/forum/attachments/month_1001/100127142364234cbfc9c9c793.jpg

I want get histogram like this! alt text http://www.iebayer.com/forum/attachments/month_1001/100127142301dc4f49420b2389.jpg how to do it use opencv.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消