Counting fully bound holes in a bitmap image?
I have a monochrome bitmap image, and I wish to find fully bound holes in the image. Only holes that are fully bound by black pixels should be included:
0000000000
0001111100
0010000010
0001000110
0000111100
0000000000
开发者_JS百科
has one hole
but
0100000010
0100000110
0011111100
0000000000
would have 0
This is somewhat similar to CCL (Connected Component Labelling). If you invert the bitmap then you are just looking for 4-connected blobs which do not touch the edge of the image frame.
精彩评论