简体   繁体   中英

grouping pixels by color using opencv

I have grey scale images with objects darker than the background with each object and the background having the same shade throughout itself. There are mainly 3-4 "groups of shades" in each picture. I want to group these pixels to find the approximate background shade (brightness) to later extract it.

在此处输入图片说明

And a side question: How can I calculate the angles on a contour produced by findContours.or maybe the minimum angle on a contour.

I think that you can set a range to group pixels. For example, all the pixel which have intensity value in the range (50 - 100) should have the intensity value 100. Similarly, all the pixels which have intensity value in the range (100-150) should have intensity value 150. And so on.

After doing the above procedure, you can have have only 3-4 fixed values for all pixels (as you have mentioned that there are 3-4 groups in each image.)

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