简体   繁体   中英

Color black holes to white in binary image

I've got the following image: 在此处输入图像描述

I want to fill in the black hole and make it white. How can I fill in this hole?

Thank you

You could floodfill with white starting at the top-left corner, which will leave you with this - which should allow you to locate the "hole" .

在此处输入图像描述

I have bordered artificially with red so you can see the extent of the image.

apply this method Anyone knows an algorithm for finding "shapes" in 2d arrays?

Images are basically arrays and you can apply this algorithm with little bit modification in order to find holes and set every black pixel in closed shape and set blacks to white

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