开发者

2D bitmap neighbour grouping

开发者 https://www.devze.com 2023-03-12 22:54 出处:网络
Let\'s say I have a 2D array of 1bit pixels, for example an image bitmap. I would like to find groups/cl开发者_开发问答usters of 2x2 or larger. The groups can take any free form shape larger than that

Let's say I have a 2D array of 1bit pixels, for example an image bitmap. I would like to find groups/cl开发者_开发问答usters of 2x2 or larger. The groups can take any free form shape larger than that.

Any recommended algorithms for this? For the group boundaries I thinking about 'marching squares' but how about counting the area of each group?


Yes: use simple logic to find a "seed" of 4 set bits, then use flood-fill to discover the whole region and calculate its volume area.

0

精彩评论

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