I would probably have implemented connected ocmponents using a morphology kernal, rather than 4 or 8 conectedness. But it is a welcome addition, that has been long awaited for.
How is it implemented. Flood filling, or a 2 pass table method?
It is a good that you include the original color of the area. How is 'color fuzz' handled, such as in JPEG images?
is the fuzz on the first new color found, or are neighbours compared? what happens if you apply it to a image with
a very gental gradient oc colors where the end colors of thegradient differ by more than the fuzz factor?
Is the 'centroid' guranteed to be a pixel in the connected area, or just the center of the bounding area (which may fall on a hole in the connected area).
New Connected Components Labeling
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
New Connected Components Labeling
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: New Connected Components Labeling
Our algorithm follows the standard connected component labeling algorithm. Pick a pixel and inspect its neighbors, put any candidate neighbors on the stack, and unwind the stack. Some people use queues, we used a stack because we could use a 1D array to simulate a stack which does not require a next / previous pointer, saving memory.I would probably have implemented connected components using a morphology kernel, rather than 4 or 8 conectedness. But it is a welcome addition, that has been long awaited for.
How is it implemented. Flood filling, or a 2 pass table method?
The -fuzz option affects the neighbor similarity function as one expects. For example, -fuzz 0 expects neighbors to have exactly the same color to be considered a connected component, whereas -fuzz 10 will identify "close" colors as similar.It is a good that you include the original color of the area. How is 'color fuzz' handled, such as in JPEG images?
We have not tried it, let us know.is the fuzz on the first new color found, or are neighbours compared? what happens if you apply it to a image with
a very gental gradient oc colors where the end colors of thegradient differ by more than the fuzz factor?
We simply sum the coordinates of each pixel of a particular label and divide by its area. We suppose it might fall into a hole but have not tested.Is the 'centroid' guranteed to be a pixel in the connected area, or just the center of the bounding area (which may fall on a hole in the connected area).
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: New Connected Components Labeling
Hmmm.. Okay a very simple flood fill thechnique. Though probably not very efficent.
Summing coordinates however could very quickly cause overflow problems in larger images.
Summing coordinates however could very quickly cause overflow problems in larger images.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: New Connected Components Labeling
We could always use your help improving / replacing the algorithm. In particular, what morphology kernel would you use?