|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.hiof.imagepr.features.ConnectedComponents
ConnectedComponents is a class for labeling connected components of a binary image, with respect to the 4-neighborhood (default), the or the 8-neighborhood definition. This class offers two algorithms, a recursive one and the so called classical algorithm. See "Computer Vision" chapter 3.4 by Linda G. Shapiro and George C. Stockman, for a description of the algorithms.
The classical algorithm was described by Rosenfeld and Pfaltz. In this class this is combined with a union-find structure as given in "Computer Vision" chapter 3.4 by Linda G. Shapiro and George C. Stockman.
The recursive algorithm will fail for pictures with large connected components due to the limited recursive depth possible in Java.
Field Summary | |
static int |
CLASSICAL
Option for the classical algorithm |
static int |
N4
Option for finding 4-connected components. |
static int |
N8
Option for finding 8-connected components. |
static int |
RECURSIVE
Option for the recursive algorithm |
Constructor Summary | |
ConnectedComponents(BinaryImage bImage)
Constructor which sets the BinaryImage to process. |
|
ConnectedComponents(BinaryImage bImage,
int nbhood)
Constructor wich sets the BinaryImage to process and the type of connection to use. |
|
ConnectedComponents(BinaryImage bImage,
int nbhood,
int algorithm)
Constructor which sets the BinaryImage to process and the type of connection to use. |
Method Summary | |
IntensityImage |
getCompImage()
Returns the labeled image in which the value of each pixel is the label of its connected component. |
BinaryImage |
getCompNo(int label)
Returns an image with only one of the connected components. |
int |
getLabel()
Returns the value of the label of the last connected component found in the image. |
void |
setMaxLabels(int max)
Set maximum number of labels used with the classical algorithm. |
void |
showAllComponents()
Show all components in a window, with a unique colour for each component. |
void |
showAllComponents(java.awt.Color mincolor,
java.awt.Color maxcolor)
Show all components in a window, with a unique colour for each component. |
void |
showCompNo(int label)
Show a component in a window. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int N4
public static final int N8
public static final int CLASSICAL
public static final int RECURSIVE
Constructor Detail |
public ConnectedComponents(BinaryImage bImage)
bImage
- Image to processpublic ConnectedComponents(BinaryImage bImage, int nbhood)
bImage
- Image to processnbhood
- Type of neighbourhoodpublic ConnectedComponents(BinaryImage bImage, int nbhood, int algorithm)
bImage
- Image to processnbhood
- Type of connectionalgorithm
- Type of algorithmMethod Detail |
public void setMaxLabels(int max)
max
- Maximum number of labelspublic IntensityImage getCompImage()
public int getLabel()
public BinaryImage getCompNo(int label)
label
- The label of the component.
public void showCompNo(int label)
label
- The label of the component.public void showAllComponents()
public void showAllComponents(java.awt.Color mincolor, java.awt.Color maxcolor)
mincolor
- The color of the first component.maxcolor
- The color of the last component.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |