The connected component labelling of a binary image is a transformation directly associated with the notion of connectivity. It consists in setting each pixel belonging to a connected component of the input binary image to a specific grey level value, different values being considered for each connected component (the background components are usually not processed and they keep their original value, i.e., zero). The resulting image is called a label image.
The notion of labelling extends directly to grey scale image. In this latter case, a distinct label is given to each grey scale connected component (flat zone) of the image.
- See also
- [16] P. Soille, Morphological Image Analysis, 2003, p. 35-38
|
template<class T1 , class T2 > |
size_t | label (const Image< T1 > &imIn, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE) |
| label() - Image labelization
|
|
template<class T1 , class T2 > |
size_t | lambdaLabel (const Image< T1 > &imIn, const T1 &lambdaVal, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE) |
| lambdaLabel() - Lambda-flat zones labelization
|
|
template<class T1 , class T2 > |
size_t | fastLabel (const Image< T1 > &imIn, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE) |
| fastLabel() - Image labelization (faster, use OpenMP)
|
|
◆ label()
template<class T1 , class T2 >
size_t label |
( |
const Image< T1 > & |
imIn, |
|
|
Image< T2 > & |
imOut, |
|
|
const StrElt & |
se = DEFAULT_SE |
|
) |
| |
label() - Image labelization
- Parameters
-
[in] | imIn | : input image |
[out] | imOut | : output image |
[in] | se | : structuring element |
- Returns
- the number of labels (or 0 if error)
- Note
- The range of type T2 of the output image shall be big enough to accomodate all label values (the number of disjoint regions in the input image.
◆ lambdaLabel()
template<class T1 , class T2 >
size_t lambdaLabel |
( |
const Image< T1 > & |
imIn, |
|
|
const T1 & |
lambdaVal, |
|
|
Image< T2 > & |
imOut, |
|
|
const StrElt & |
se = DEFAULT_SE |
|
) |
| |
lambdaLabel() - Lambda-flat zones labelization
In this mode of labeling, two neighbour pixels have the same label if there is a path between them at which the value difference from pixel to pixel doesn't exceed lambdaVal
- Parameters
-
[in] | imIn | : input image |
[in] | lambdaVal | : lambda value |
[out] | imOut | : output image |
[in] | se | : structuring element |
- Returns
- the number of labels (or 0 if error)
- Note
- shall include an example of how to use this...
◆ fastLabel()
template<class T1 , class T2 >
size_t fastLabel |
( |
const Image< T1 > & |
imIn, |
|
|
Image< T2 > & |
imOut, |
|
|
const StrElt & |
se = DEFAULT_SE |
|
) |
| |
fastLabel() - Image labelization (faster, use OpenMP)
- Parameters
-
[in] | imIn | : input image |
[out] | imOut | : output image |
[in] | se | : structuring element |
- Returns
- the number of labels (or 0 if error)
◆ labelWithProperty()
template<typename T1 , typename T2 , typename T3 >
size_t labelWithProperty |
( |
const Image< T1 > & |
imRegions, |
|
|
const Image< T2 > & |
imIn, |
|
|
Image< T3 > & |
imLabelOut, |
|
|
const string |
property = "area" , |
|
|
bool |
doRescale = false , |
|
|
double |
scale = 1. , |
|
|
const StrElt & |
se = DEFAULT_SE |
|
) |
| |
labelWithProperty() - Image labelization with the value of the property of each connected components in the imRegions image
.
The intensity of each pixel will correspond to the value of the property.
- Parameters
-
[in] | imRegions | : an image with regions to be labeled |
[in] | imIn | : image where to take values to evaluate properties |
[out] | imLabelOut | : output image |
[in] | property | : the property to use as label. One of : "area", "volume", "max", "min", "mean", "stddev", "median", "mode", "nbvalues", "entropy" |
[in] | doRescale | : values are rescaled to fullfit the range of the output image (T3) : ([min, max] => [1, max(T3)] ) |
[in] | scale | : coefficient to multiply property result of each region |
[in] | se | : structuring element |
- Returns
- the number of labels (or 0 if error)
- Note
- The image
imRegions
is labeled and blobs are assigned to it before evaluating the property of each region. The structuring element is needed just to the labeling operation.
- The same label can be assigned to different regions not connected regions in the image if they have the same property value.
- the number of regions in imRegions shall be smaller than the maximum value of the type T3
- The range of values of the output image (T3) shall be big enough to accomodate all property values. If not, use parametersTT} or
doRescale
scale
and doRescale
parameters are useful for visualisation purposes or when the goal isn't the real value of the property but their relative values (order of values). These parameters allows to use image with smaller data types. scale
is ignored when doRescale
is set.
- if the property is area then
imIn
and imRegions
are the same.
◆ labelWithArea()
template<class T1 , class T2 >
size_t labelWithArea |
( |
const Image< T1 > & |
imIn, |
|
|
Image< T2 > & |
imOut, |
|
|
const StrElt & |
se = DEFAULT_SE |
|
) |
| |
labelWithArea() - Image labelization with the size (area) of each connected components
- Parameters
-
[in] | imIn | : input image |
[out] | imOut | : output image |
[in] | se | : structuring element |
- Returns
- the number of labels (or 0 if error)
- Warning
- This function is obsolete. Use labelWithProperty() :
size_t labelWithProperty(const Image< T1 > &imRegions, const Image< T2 > &imIn, Image< T3 > &imLabelOut, const string property="area", bool doRescale=false, double scale=1., const StrElt &se=DEFAULT_SE)
labelWithProperty() - Image labelization with the value of the property of each connected components ...
Definition DMorphoLabel.hpp:739
- Note
- The range of values of the output image (T2) shall be big enough to accomodate all label values.
- The same value can be assigned to different disconnected regions in the image if they have the same area.
◆ labelWithVolume()
template<class T1 , class T2 >
size_t labelWithVolume |
( |
const Image< T1 > & |
imIn, |
|
|
const Image< T2 > & |
imLabelIn, |
|
|
Image< T2 > & |
imLabelOut, |
|
|
const StrElt & |
se = DEFAULT_SE |
|
) |
| |
labelWithVolume() - Image labelization with the volume (sum of values) of each connected components in the imLabelIn image
- Parameters
-
[in] | imIn | : input image |
[in] | imLabelIn | : an image with regions defined in imIn |
[out] | imLabelOut | : output image |
[in] | se | : structuring element |
- Returns
- the number of labels (or 0 if error)
- Warning
- This function is obsolete. Use labelWithProperty()
- Note
- The range of values of the output image (T2) shall be big enough to accomodate all label values.
- The same value can be assigned to different disconnected regions in the image if they have the same volume.
◆ labelWithMax()
template<class T1 , class T2 >
size_t labelWithMax |
( |
const Image< T1 > & |
imIn, |
|
|
const Image< T2 > & |
imLabelIn, |
|
|
Image< T2 > & |
imLabelOut, |
|
|
const StrElt & |
se = DEFAULT_SE |
|
) |
| |
labelwithMax() - Image labelization with the maximum values of each connected components in the imLabelIn image
- Parameters
-
[in] | imIn | : input image |
[in] | imLabelIn | : an image with regions defined in imIn |
[out] | imLabelOut | : output image |
[in] | se | : structuring element |
- Returns
- the number of labels (or 0 if error)
- Warning
- This function is obsolete. Use labelWithProperty()
- Note
- The range of values of the output image (T2) shall be big enough to accomodate all label values.
- The same value can be assigned to different disconnected regions in the image if they have the maximum value.
◆ labelWithMean()
template<class T1 , class T2 >
size_t labelWithMean |
( |
const Image< T1 > & |
imIn, |
|
|
const Image< T2 > & |
imLabelIn, |
|
|
Image< T1 > & |
imLabelOut, |
|
|
const StrElt & |
se = DEFAULT_SE |
|
) |
| |
labelWithMean() - Image labelization with the mean values of each connected components in the imLabelIn image
- Parameters
-
[in] | imIn | : input image |
[in] | imLabelIn | : an image with regions defined in imIn |
[out] | imLabelOut | : output image |
[in] | se | : structuring element |
- Returns
- the number of labels (or 0 if error)
- Warning
- This function is obsolete. Use labelWithProperty()
- Note
- The range of values of the output image (T2) shall be big enough to accomodate all label values.
- The same label can be assigned to different regions not connected regions in the image if they have the same mean value.
◆ neighbors()
template<class T1 , class T2 >
RES_T neighbors |
( |
const Image< T1 > & |
imIn, |
|
|
Image< T2 > & |
imOut, |
|
|
const StrElt & |
se = DEFAULT_SE |
|
) |
| |
neighbors() - Neighbors count
Return for each pixel the number of different values in the neighborhood.
Usefull in order to find interfaces or multiple points between basins (see basins())
- Parameters
-
[in] | imIn | : input image |
[out] | imOut | : output image |
[in] | se | : structuring element |