e****f 发帖数: 296 | 1 I have a question and hope someone smart here can help me out.
I have a binary 2-dimensional image, say 16 by 16 pixels. The pixel values
are either 0 or 1 and are randomly distributed. We define a cluster as: for
those non-zero pixels, if they share at least one side with each other, they
form a cluster of connectivity-1. What is the simple algorithm to search
for these clusters and find the largest one (larget number of pixels in one
cluster)?
Your help is highly appreciated! | e****f 发帖数: 296 | | t******a 发帖数: 1200 | 3 Your problem is officially called "connected component labeling", just
google
it. the easiest algorithm is called the two-pass union-find algorithm.
for
they
one
【在 e****f 的大作中提到】![](/moin_static193/solenoid/img/up.png) : I have a question and hope someone smart here can help me out. : I have a binary 2-dimensional image, say 16 by 16 pixels. The pixel values : are either 0 or 1 and are randomly distributed. We define a cluster as: for : those non-zero pixels, if they share at least one side with each other, they : form a cluster of connectivity-1. What is the simple algorithm to search : for these clusters and find the largest one (larget number of pixels in one : cluster)? : Your help is highly appreciated!
| e****f 发帖数: 296 | 4 thanks, already found it. |
|