简体   繁体   中英

unite white pixels region into a single region opencv c++

I'm using opencv and I need to obtain a single region of white pixels starting from many regions, like in the image:

有很多白色区域的图像

what I want to get is a single region of white pixels. can be that some regions have to be discarded, but is another point. now I'd like to know if there is a way to unite all the regions, even in a not convex poly, because it can be done later.

I know that this is probably not the best way to do it but it's a way.

As you said, the region you are interested in will always be squared. I suggest you take a look at the Square Detector application that ships with OpenCV.

If you are looking for demos, check this answer .

Why don't you calculate the convex hull of your pixels? As far as I can see this is included in opencv.

在此处输入图片说明

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