[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| Local Minima and Maxima |

## Functions
template<... >
void | extendedLocalMaxima (...)
| Find local maximal regions in an image.
template<... >
void | extendedLocalMinima (...)
| Find local minimal regions in an image.
template<... >
void | localMaxima (...)
| Find local maxima in an image.
template<... >
void | localMinima (...)
| Find local minima in an image.

## Detailed Description

Detect local minima and maxima of the gray level, including extremal plateaus larger than 1 pixel

## Function Documentation

template<... >
void vigra::localMinima | ( |  | ... | ) |

Find local minima in an image.

The minima are found only when the have a size of one pixel. Use extendedLocalMinima() to find minimal plateaus. Minima are marked in the destination image with the given marker value (default is 1), all other destination pixels remain unchanged. `SrcAccessor::value_type` must be less-comparable. A pixel at the image border will never be marked as minimum. Pass vigra::EightNeighborCode or vigra::FourNeighborCode to determine the neighborhood where pixel values are compared. The function uses accessors.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class DestValue = DestAccessor::value_type,
                      class Neighborhood = EightNeighborCode>
            void
            localMinima(SrcIterator sul, SrcIterator slr, SrcAccessor sa,
                        DestIterator dul, DestAccessor da,
                        DestValue marker = NumericTraits<DestValue>::one(),
                        Neighborhood neighborhood = EightNeighborCode())
        }

use argument objects in conjunction with Argument Object Factories :

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class DestValue = DestAccessor::value_type,
                      class Neighborhood = EightNeighborCode>
            void
            localMinima(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                        pair<DestIterator, DestAccessor> dest,
                        DestValue marker = NumericTraits<DestValue>::one(),
                        Neighborhood neighborhood = EightNeighborCode())
        }

Usage:

#include <vigra/localminmax.hxx>
Namespace: vigra

        vigra::BImage src(w,h), minima(w,h);

        // init destiniation image
        minima = 0;

        vigra::localMinima(srcImageRange(src), destImage(minima));

Required Interface:

        SrcImageIterator src_upperleft, src_lowerright;
        DestImageIterator dest_upperleft;

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        SrcAccessor::value_type u = src_accessor(src_upperleft);

        u < u

        DestValue marker;
        dest_accessor.set(marker, dest_upperleft);

template<... >
void vigra::localMaxima | ( |  | ... | ) |

Find local maxima in an image.

The maxima are found only when the have a size of one pixel. Use extendedLocalMaxima() to find maximal plateaus. Maxima are marked in the destination image with the given marker value (default is 1), all other destination pixels remain unchanged. `SrcAccessor::value_type` must be less-comparable. A pixel at the image border will never be marked as maximum. The function uses accessors.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class DestValue = DestAccessor::value_type,
                      class Neighborhood = EightNeighborCode>
            void
            localMaxima(SrcIterator sul, SrcIterator slr, SrcAccessor sa,
                        DestIterator dul, DestAccessor da,
                        DestValue marker = NumericTraits<DestValue>::one(),
                        Neighborhood neighborhood = EightNeighborCode())
        }

use argument objects in conjunction with Argument Object Factories :

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class DestValue = DestAccessor::value_type,
                      class Neighborhood = EightNeighborCode>
            void
            localMaxima(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                        pair<DestIterator, DestAccessor> dest,
                        DestValue marker = NumericTraits<DestValue>::one(),
                        Neighborhood neighborhood = EightNeighborCode())
        }

Usage:

#include <vigra/localminmax.hxx>
Namespace: vigra

        vigra::BImage src(w,h), maxima(w,h);

        // init destiniation image
        maxima = 0;

        vigra::localMaxima(srcImageRange(src), destImage(maxima));

Required Interface:

        SrcImageIterator src_upperleft, src_lowerright;
        DestImageIterator dest_upperleft;

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        SrcAccessor::value_type u = src_accessor(src_upperleft);

        u < u

        DestValue marker;
        dest_accessor.set(marker, dest_upperleft);

template<... >
void vigra::extendedLocalMinima | ( |  | ... | ) |

Find local minimal regions in an image.

This function finds regions of uniform pixel value whose neighboring regions are all have smaller values (minimal plateaus of arbitrary size). By default, the pixels in a plateau have exactly identical values. By passing an `EqualityFunctor` with tolerance, one can allow for plateaus that are not quite constant (this is often necessary with float pixel values). Pass vigra::EightNeighborCode or vigra::FourNeighborCode to determine the neighborhood where pixel values are compared.

Minimal regions are marked in the destination image with the given marker value (default is 1), all other destination pixels remain unchanged. `SrcAccessor::value_type` must be equality-comparable and less-comparable. A pixel or region touching the image border will never be marked as minimum or minimal plateau. The function uses accessors.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class DestValue = DestAccessor::value_type,
                      class Neighborhood = EightNeighborCode,
                      class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
            void
            extendedLocalMinima(SrcIterator sul, SrcIterator slr, SrcAccessor sa,
                                DestIterator dul, DestAccessor da,
                                DestValue marker = NumericTraits<DestValue>::one(),
                                Neighborhood neighborhood = EightNeighborCode(),
                                EqualityFunctor equal = EqualityFunctor())
        }

use argument objects in conjunction with Argument Object Factories :

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class DestValue = DestAccessor::value_type,
                      class Neighborhood = EightNeighborCode,
                      class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
            void
            extendedLocalMinima(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                                pair<DestIterator, DestAccessor> dest,
                                DestValue marker = NumericTraits<DestValue>::one(),
                                Neighborhood neighborhood = EightNeighborCode(),
                                EqualityFunctor equal = EqualityFunctor())
        }

Usage:

#include <vigra/localminmax.hxx>
Namespace: vigra

        // optional: define an equality functor
        template <class T>
        struct EqualWithToleranceFunctor
        {
            EqualWithToleranceFunctor(T tolerance)
            : t(tolerance)
            {}

            bool operator()(T l, T r) const
            {
                return vigra::abs(l-r) <= t;
            }

            T t;
        };

        vigra::BImage src(w,h), minima(w,h);

        // init destiniation image
        minima.init(0);

        vigra::extendedLocalMinima(srcImageRange(src), destImage(minima));

        // allow plateaus with tolerance
        minima.init(0);
        vigra::extendedLocalMinima(srcImageRange(src), destImage(minima), 1.0,
                                   EqualWithToleranceFunctor<unsigned char>(1));

Required Interface:

        SrcImageIterator src_upperleft, src_lowerright;
        DestImageIterator dest_upperleft;

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        SrcAccessor::value_type u = src_accessor(src_upperleft);

        EqualityFunctor equal;
        u == u
        equal(u, u);
        u < u

        DestValue marker;
        dest_accessor.set(marker, dest_upperleft);

template<... >
void vigra::extendedLocalMaxima | ( |  | ... | ) |

Find local maximal regions in an image.

This function finds regions of uniform pixel value whose neighboring regions are all have smaller values (maximal plateaus of arbitrary size). By default, the pixels in a plateau have exactly identical values. By passing an `EqualityFunctor` with tolerance, one can allow for plateaus that are not quite constant (this is often necessary with float pixel values). Pass vigra::EightNeighborCode or vigra::FourNeighborCode to determine the neighborhood where pixel values are compared.

Maximal regions are marked in the destination image with the given marker value (default is 1), all other destination pixels remain unchanged. `SrcAccessor::value_type` must be equality-comparable and less-comparable. A pixel or region touching the image border will never be marked as maximum or maximal plateau. The function uses accessors.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class DestValue = DestAccessor::value_type,
                      class Neighborhood = EightNeighborCode,
                      class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
            void
            extendedLocalMaxima(SrcIterator sul, SrcIterator slr, SrcAccessor sa,
                                DestIterator dul, DestAccessor da,
                                DestValue marker = NumericTraits<DestValue>::one(),
                                Neighborhood neighborhood = EightNeighborCode(),
                                EqualityFunctor equal = EqualityFunctor())
        }

use argument objects in conjunction with Argument Object Factories :

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class DestValue = DestAccessor::value_type,
                      class Neighborhood = EightNeighborCode,
                      class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
            void
            extendedLocalMaxima(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                                pair<DestIterator, DestAccessor> dest,
                                DestValue marker = NumericTraits<DestValue>::one(),
                                Neighborhood neighborhood = EightNeighborCode(),
                                EqualityFunctor equal = EqualityFunctor())
        }

Usage:

#include <vigra/localminmax.hxx>
Namespace: vigra

        // optional: define an equality functor
        template <class T>
        struct EqualWithToleranceFunctor
        {
            EqualWithToleranceFunctor(T tolerance)
            : t(tolerance)
            {}

            bool operator()(T l, T r) const
            {
                return vigra::abs(l-r) <= t;
            }

            T t;
        };

        vigra::BImage src(w,h), maxima(w,h);

        // init destiniation image
        maxima.init(0);

        vigra::extendedLocalMaxima(srcImageRange(src), destImage(maxima));

        // allow plateaus with tolerance
        maxima.init(0);
        vigra::extendedLocalMaxima(srcImageRange(src), destImage(maxima), 1.0,
                                   EqualWithToleranceFunctor<unsigned char>(1));

Required Interface:

        SrcImageIterator src_upperleft, src_lowerright;
        DestImageIterator dest_upperleft;

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        SrcAccessor::value_type u = src_accessor(src_upperleft);

        EqualityFunctor equal;
        u == u
        equal(u, u);
        u < u

        DestValue marker;
        dest_accessor.set(marker, dest_upperleft);

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python VIGRA 1.6.0 (13 Aug 2008)