1 | initial version |
there's a really simple way to do this. as long as the back ground is always white, u can do this, u don't even need to use morphology for this
take a point near the edge of the image, a white pixel
do a floodfill giving new color with new color as black and low and high thresholds as cvScalarAll(0) in case, u can do it on all possible corners if u think the leaf might be till the edge
so now u are left with only the leaf with white holes still present now, use threshold with a very low threshold, say, low threshold=1 and high threshold=255 and set mode as binary making all non zero points white so u'll get ur required image