Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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   

has one hole

but

0100000010
0100000110
0011111100
0000000000

would have 0

like image 867
Razor Storm Avatar asked May 05 '11 09:05

Razor Storm


1 Answers

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.

like image 184
Paul R Avatar answered Oct 30 '22 05:10

Paul R