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.
精彩评论