0

I've got the following image: enter image description here

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

Thank you

Geox
  • 89
  • 7
  • Can you put origin image (without your describe)? – dimay Mar 23 '21 at 08:23
  • " I've tried floodfill and findcontours in opencv" We can only tell you what is wrong with the code if you actually show us the code. ", but it doesn't seem to work." Well, what happened when you tried the code, and how is that different from what yo want? – Karl Knechtel Mar 23 '21 at 08:25
  • Morphology close. P.S. Always post a clean original image so others can use it to demonstrate. Please read the information guides in the **help center** (https://stackoverflow.com/help), in particular, "How to Ask A Good Question" (https://stackoverflow.com/help/how-to-ask) and "How to create a Minimal, Reproducible Example" (https://stackoverflow.com/help/minimal-reproducible-example). – fmw42 Mar 23 '21 at 16:12

2 Answers2

1

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".

enter image description here

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

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
0

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

SnoopyDog
  • 33
  • 9