开发者

Counting fully bound holes in a bitmap image?

开发者 https://www.devze.com 2023-03-03 16:22 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消