$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Image Labeling

Functions

template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::background (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
template<typename V , typename L >
mln::trait::ch_value< L, V >::ret mln::labeling::colorize (const V &value, const Image< L > &labeled_image, const typename L::value &nlabels)
template<typename V , typename L >
mln::trait::ch_value< L, V >::ret mln::labeling::colorize (const V &value, const Image< L > &labeled_image)
template<typename L >
mln::trait::ch_value< L,
mln::value::rgb8 >::ret 
mln::labeling::colorize (const Image< L > &input, const typename L::value &nlabels)
template<typename A , typename I , typename L >
util::array< typename A::result > mln::labeling::compute (const Accumulator< A > &a, const Image< I > &input, const Image< L > &label, const typename L::value &nlabels)
template<typename A , typename I , typename L >
util::array< typename
mln::internal::meta_accu_ret_result_helper
< A, typename I::value >
::result > 
mln::labeling::compute (const Meta_Accumulator< A > &a, const Image< I > &input, const Image< L > &label, const typename L::value &nlabels)
template<typename A , typename L >
util::array< typename A::result > mln::labeling::compute (const Accumulator< A > &a, const Image< L > &label, const typename L::value &nlabels)
template<typename A , typename L >
util::array< typename
mln::internal::meta_accu_ret_result_helper
< A, typename L::psite >
::result > 
mln::labeling::compute (const Meta_Accumulator< A > &a, const Image< L > &label, const typename L::value &nlabels)
template<typename A , typename I , typename L >
util::array< typename A::result > mln::labeling::compute (util::array< A > &a, const Image< I > &input, const Image< L > &label, const typename L::value &nlabels)
template<typename A , typename I , typename L >
mln::trait::ch_value< L,
typename A::result >::ret 
mln::labeling::compute_image (const util::array< typename A::result > &a, const Image< I > &input, const Image< L > &labels, const typename L::value &nlabels)
template<typename A , typename I , typename L >
mln::trait::ch_value< L,
typename A::result >::ret 
mln::labeling::compute_image (const Accumulator< A > &accu, const Image< I > &input, const Image< L > &labels, const typename L::value &nlabels)
template<typename A , typename I , typename L >
mln::trait::ch_value< L,
typename
mln::internal::meta_accu_ret_result_helper
< A, typename I::value >
::result >::ret 
mln::labeling::compute_image (const Meta_Accumulator< A > &accu, const Image< I > &input, const Image< L > &labels, const typename L::value &nlabels)
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::flat_zones (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::foreground (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
template<typename I , typename L >
mln::trait::concrete< I >::ret mln::labeling::mean_colors (const Image< I > &input, const Image< L > &lbl, typename L::value nlabels)
template<typename L >
util::array< typename L::value > mln::labeling::n_max (const Image< L > &lbl, const typename L::value &nlabels, unsigned n)
template<typename I >
mln::trait::concrete< I >::ret mln::labeling::pack (const Image< I > &label, typename I::value &new_nlabels, fun::i2v::array< typename I::value > &repack_fun)
template<typename I >
mln::trait::concrete< I >::ret mln::labeling::pack (const Image< I > &label, typename I::value &new_nlabels)
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::regional_maxima (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::regional_minima (const Image< I > &input, const Neighborhood< N > &nbh, L &nlabels)
template<typename I , typename F >
mln::trait::concrete< I >::ret mln::labeling::relabel (const Image< I > &label, const typename I::value &nlabels, typename I::value &new_nlabels, const Function_v2b< F > &fv2b)
template<typename I , typename F >
mln::trait::concrete< I >::ret mln::labeling::relabel (const Image< I > &label, const typename I::value &nlabels, const Function_v2v< F > &fv2v)
template<typename I , typename F >
void mln::labeling::relabel_inplace (Image< I > &label, const typename I::value &nlabels, const Function_v2b< F > &fv2b)
template<typename I , typename F >
void mln::labeling::relabel_inplace (Image< I > &label, const typename I::value &nlabels, const Function_v2v< F > &fv2v)
template<typename I , typename J >
mln::trait::concrete< I >::ret mln::labeling::superpose (const Image< I > &lhs, const typename I::value &lhs_nlabels, const Image< J > &rhs, const typename J::value &rhs_nlabels, typename I::value &new_nlabels)
template<typename I , typename N , typename L >
mln::trait::ch_value< I, L >::ret mln::labeling::value (const Image< I > &input, const typename I::value &val, const Neighborhood< N > &nbh, L &nlabels)
template<typename I , typename N , typename L , typename A >
util::couple
< mln::trait::ch_value< I, L >
::ret, util::couple
< util::array< typename
A::result >, util::array< A > > > 
mln::labeling::value_and_compute (const Image< I > &input, const typename I::value &val, const Neighborhood< N > &nbh, L &nlabels, const Accumulator< A > &accu)
template<typename V , typename I >
mln::trait::ch_value< I, V >::ret mln::labeling::wrap (const V &value_type, const Image< I > &input)
template<typename I >
mln::trait::ch_value< I,
mln::value::label_8 >::ret 
mln::labeling::wrap (const Image< I > &input)

Detailed Description

All labeling routines provided in Milena.

Function Documentation

template<typename I , typename N , typename L >
mln::trait::ch_value< I , L >::ret mln::labeling::background ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the background part in a binary image.

Parameters
[in]inputThe input image.
[in]nbhThe connexity of the background.
[out]nlabelsThe number of labels.
Returns
The label image.
Precondition
The input image has to be binary (checked at compile-time).

This routine actually calls mln::labeling::value with the value set to false.

See Also
mln::labeling::value
template<typename V , typename L >
mln::trait::ch_value< L , V >::ret mln::labeling::colorize ( const V &  value,
const Image< L > &  labeled_image,
const typename L::value &  nlabels 
)

Create a new color image from a labeled image and fill each component with a random color.

litera::black is used for component 0, e.g. the background. Min and max values for RGB values can be set through the global variables mln::labeling::colorize_::min_value and mln::labeling::colorize_::max_value.

Parameters
[in]valuevalue type used in the returned image.
[in]labeled_imageA labeled image (
See Also
labeling::blobs).
Parameters
[in]nlabelsNumber of labels.
template<typename V , typename L >
mln::trait::ch_value< L , V >::ret mln::labeling::colorize ( const V &  value,
const Image< L > &  labeled_image 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The number of labels is re-computed.

 \warning Computing the number of labels shall add extra
 computation time.
template<typename L >
mln::trait::ch_value< L , mln::value::rgb8 >::ret mln::labeling::colorize ( const Image< L > &  input,
const typename L::value &  nlabels 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Colorize labeled image with value::rgb8.

template<typename A , typename I , typename L >
util::array<typename A ::result> mln::labeling::compute ( const Accumulator< A > &  a,
const Image< I > &  input,
const Image< L > &  label,
const typename L::value &  nlabels 
)

Compute an accumulator onto the pixel values of the image input. for each component of the image label.

Parameters
[in]aAn accumulator.
[in]inputThe input image.
[in]labelThe labeled image.
[in]nlabelsThe number of labels in label.
Returns
A util::array of accumulator result (one result per label).
template<typename A , typename I , typename L >
util::array<typename mln::internal::meta_accu_ret_result_helper< A , typename I ::value >::result> mln::labeling::compute ( const Meta_Accumulator< A > &  a,
const Image< I > &  input,
const Image< L > &  label,
const typename L::value &  nlabels 
)

Compute an accumulator onto the pixel values of the image input. for each component of the image label.

Parameters
[in]aA meta-accumulator.
[in]inputThe input image.
[in]labelThe labeled image.
[in]nlabelsThe number of labels in label.
Returns
A util::array of accumulator result (one result per label).
template<typename A , typename L >
util::array<typename A ::result> mln::labeling::compute ( const Accumulator< A > &  a,
const Image< L > &  label,
const typename L::value &  nlabels 
)

Compute an accumulator onto the pixel sites of each component domain of label.

Parameters
[in]aAn accumulator.
[in]labelThe labeled image.
[in]nlabelsThe number of labels in label.
Returns
A util::array of accumulator result (one result per label).
template<typename A , typename L >
util::array<typename mln::internal::meta_accu_ret_result_helper< A , typename L ::psite >::result> mln::labeling::compute ( const Meta_Accumulator< A > &  a,
const Image< L > &  label,
const typename L::value &  nlabels 
)

Compute an accumulator onto the pixel sites of each component domain of label.

Parameters
[in]aA meta-accumulator.
[in]labelThe labeled image.
[in]nlabelsThe number of labels in label.
Returns
A util::array of accumulator result (one result per label).
template<typename A , typename I , typename L >
util::array<typename A ::result> mln::labeling::compute ( util::array< A > &  a,
const Image< I > &  input,
const Image< L > &  label,
const typename L::value &  nlabels 
)

Compute an accumulator onto the pixel values of the image input. for each component of the image label.

Parameters
[in]aAn array of accumulator.
[in]inputThe input image.
[in]labelThe labeled image.
[in]nlabelsThe number of labels in label.
Returns
A util::array of accumulator result (one result per label).
template<typename A , typename I , typename L >
mln::trait::ch_value< L , typename A ::result >::ret mln::labeling::compute_image ( const util::array< typename A::result > &  a,
const Image< I > &  input,
const Image< L > &  labels,
const typename L::value &  nlabels 
)

Compute an accumulator onto the pixel values of the image input. for each component of the image label.

Parameters
[in]aThe mln::p_array of accumulator result.
[in]inputThe input image (values).
[in]labelsThe label image.
[in]nlabelsThe count of labels.
Returns
The image where labels are replaced by the result of the accumulator.
template<typename A , typename I , typename L >
mln::trait::ch_value< L , typename A ::result >::ret mln::labeling::compute_image ( const Accumulator< A > &  accu,
const Image< I > &  input,
const Image< L > &  labels,
const typename L::value &  nlabels 
)
inline

Compute an accumulator onto the pixel values of the image input. for each component of the image label.

Parameters
[in]accuThe accumulator.
[in]inputThe input image (values).
[in]labelsThe label image.
[in]nlabelsThe count of labels.
Returns
The image where labels are replaced by the result of the accumulator.
template<typename A , typename I , typename L >
mln::trait::ch_value< L , typename mln::internal::meta_accu_ret_result_helper< A , typename I ::value >::result >::ret mln::labeling::compute_image ( const Meta_Accumulator< A > &  accu,
const Image< I > &  input,
const Image< L > &  labels,
const typename L::value &  nlabels 
)
inline

Compute an accumulator onto the pixel values of the image input. for each component of the image label.

Parameters
[in]accuThe meta-accumulator.
[in]inputThe input image (values).
[in]labelsThe label image.
[in]nlabelsThe count of labels.
Returns
The image where labels are replaced by the result of the accumulator.
template<typename I , typename N , typename L >
mln::trait::ch_value< I , L >::ret mln::labeling::flat_zones ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the flat zones of an image.

Parameters
[in]inputThe input image.
[in]nbhThe connexity of the flat zones.
[out]nlabelsThe number of labels.
Returns
The label image.
template<typename I , typename N , typename L >
mln::trait::ch_value< I , L >::ret mln::labeling::foreground ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the object part in a binary image.

Parameters
[in]inputThe input image.
[in]nbhThe connexity of the foreground.
[out]nlabelsThe number of labels.
Returns
The label image.
Precondition
The input image has to be binary (checked at compile-time).

This routine actually calls mln::labeling::value with the value set to true.

See Also
mln::labeling::value
template<typename I , typename L >
mln::trait::concrete< I >::ret mln::labeling::mean_colors ( const Image< I > &  input,
const Image< L > &  lbl,
typename L::value  nlabels 
)

Construct an image of mean values from a labeled image.

Parameters
[in]inputAn image.
[in]lblA labeled image.
[in]nlabelsThe number of computed labels.
template<typename L >
util::array<typename L ::value> mln::labeling::n_max ( const Image< L > &  lbl,
const typename L::value &  nlabels,
unsigned  n 
)

Construct from a count accumulator of a labeled image an array with the ordered n biggest labels.

Returns
an array starting at index 1
Warning
The biggest value is stored at index 0. It usually represents the background and should be ignored. However, it is still accessible if necessary.
template<typename I >
mln::trait::concrete< I >::ret mln::labeling::pack ( const Image< I > &  label,
typename I::value &  new_nlabels,
fun::i2v::array< typename I::value > &  repack_fun 
)

Relabel a labeled image in order to have a contiguous labeling.

Parameters
[in]labelThe labeled image.
[out]new_nlabelsThe number of labels after relabeling.
[out]repack_funThe function used to repack the labels.
Returns
The relabeled image.
template<typename I >
mln::trait::concrete< I >::ret mln::labeling::pack ( const Image< I > &  label,
typename I::value &  new_nlabels 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Rely on a default relabeling function that guaranty contiguous labeling.

Warning
Don't expect any label from label to be preserved.
See Also
make::relabelfun
template<typename I , typename N , typename L >
mln::trait::ch_value< I , L >::ret mln::labeling::regional_maxima ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the regional maxima of an image.

Parameters
[in]inputThe input image.
[in]nbhThe connexity of the regional maxima.
[out]nlabelsThe number of labeled regions.
Returns
The label image.
template<typename I , typename N , typename L >
mln::trait::ch_value< I , L >::ret mln::labeling::regional_minima ( const Image< I > &  input,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the regional minima of an image.

Parameters
[in]inputThe input image.
[in]nbhThe connexity of the regional minima.
[out]nlabelsThe number of labeled regions.
Returns
The label image.
template<typename I , typename F >
mln::trait::concrete< I >::ret mln::labeling::relabel ( const Image< I > &  label,
const typename I::value &  nlabels,
typename I::value &  new_nlabels,
const Function_v2b< F > &  fv2b 
)

Remove components and relabel a labeled image.

Parameters
[in]labelthe labeled image.
[in]nlabelsthe number of labels in label.
[out]new_nlabelsthe number of labels after relabeling.
[in]fv2bfunction returning whether a label must be replaced by the background.
Returns
the relabeled image.
template<typename I , typename F >
mln::trait::concrete< I >::ret mln::labeling::relabel ( const Image< I > &  label,
const typename I::value &  nlabels,
const Function_v2v< F > &  fv2v 
)

Remove components and relabel a labeled image.

Parameters
[in]labelthe labeled image.
[in]nlabelsthe number of labels in label.
[in]fv2vfunction returning the new component id for each pixel value.
Returns
the relabeled image.
template<typename I , typename F >
void mln::labeling::relabel_inplace ( Image< I > &  label,
const typename I::value &  nlabels,
const Function_v2b< F > &  fv2b 
)

Remove components and relabel a labeled image inplace.

Parameters
[in,out]labelthe labeled image.
[in]nlabelsthe number of labels in label.
[in]fv2bfunction returning whether a label must be replaced by the background.
template<typename I , typename F >
void mln::labeling::relabel_inplace ( Image< I > &  label,
const typename I::value &  nlabels,
const Function_v2v< F > &  fv2v 
)

Remove components and relabel a labeled image inplace.

Parameters
[in,out]labelthe labeled image.
[in]nlabelsthe number of labels in label.
[in]fv2vfunction returning the new component id for each pixel value.
template<typename I , typename J >
mln::trait::concrete< I >::ret mln::labeling::superpose ( const Image< I > &  lhs,
const typename I::value &  lhs_nlabels,
const Image< J > &  rhs,
const typename J::value &  rhs_nlabels,
typename I::value &  new_nlabels 
)

Superpose two labeled image.

Labels in lhs are preserved in the output. Labels of rhs are renumbered from the last label value of lhs. It avoids duplicate label values in several components.

Parameters
[in]lhsA labeled image.
[in]lhs_nlabelsThe number of labels in lhs.
[in]rhsA labeled image.
[in]rhs_nlabelsThe number of labels in rhs.
[out]new_nlabelsThe number of labels in the output image.
Returns
An image with all the components of rhs and lhs.
Precondition
rhs and lhs must have the same domain.
The value type of rhs must be convertible towards lhs's.
template<typename I , typename N , typename L >
mln::trait::ch_value< I , L >::ret mln::labeling::value ( const Image< I > &  input,
const typename I::value &  val,
const Neighborhood< N > &  nbh,
L &  nlabels 
)

Connected component labeling of the image sites at a given value.

Parameters
[in]inputThe input image.
[in]valThe value to consider.
[in]nbhThe connectivity of components.
[out]nlabelsThe number of labels.
Returns
The label image.
template<typename I , typename N , typename L , typename A >
util::couple<mln::trait::ch_value< I , L >::ret, util::couple<util::array<typename A ::result>, util::array<A> > > mln::labeling::value_and_compute ( const Image< I > &  input,
const typename I::value &  val,
const Neighborhood< N > &  nbh,
L &  nlabels,
const Accumulator< A > &  accu 
)

Connected component labeling of the image sites at a given value.

Parameters
[in]inputThe input image.
[in]valThe value to consider.
[in]nbhThe connectivity of components.
[out]nlabelsThe number of labels.
[in]accuThe accumulator to be computed.
Returns
The label image.
template<typename V , typename I >
mln::trait::ch_value< I , V >::ret mln::labeling::wrap ( const V &  value_type,
const Image< I > &  input 
)

Wrap labels such as 0 -> 0 and [1, lmax] maps to [1, Lmax] (using modulus).

Parameters
[in]value_typeThe type used to wrap the label type.
[in]inputThe label image.
Returns
A new image with values wrapped with type V.
template<typename I >
mln::trait::ch_value< I , mln::value::label_8 >::ret mln::labeling::wrap ( const Image< I > &  input)

Wrap labels such as 0 -> 0 and [1, lmax] maps to [1, Lmax] (using modulus). Use label_8 as label type.

Parameters
[in]inputThe label image.
Returns
A new image with values wrapped with type label_8.