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

details Local Minima and Maxima VIGRA


Namespaces

namespace  vigra::detail
namespace  vigra::detail

Functions

template<...> void localMinima (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, DestValue marker, Neighborhood neighborhood)
 Find local minima in an image.

template<...> void localMaxima (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, DestValue marker, Neighborhood neighborhood)
 Find local maxima in an image.

template<...> void extendedLocalMinima (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, DestValue marker, Neighborhood neighborhood, EqualityFunctor equal)
 Find local minimal regions in an image.

template<...> void extendedLocalMaxima (SrcIterator sul, SrcIterator slr, SrcAccessor sa, DestIterator dul, DestAccessor da, DestValue marker, Neighborhood neighborhood, EqualityFunctor equal)
 Find local maximal regions in an image.



Detailed Description


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


Function Documentation


  void 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 Utilities to manage pixel neighborhoods or Utilities to manage pixel neighborhoods 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);


  void 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 Utilities to manage pixel neighborhoods or Utilities to manage pixel neighborhoods 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);


  void 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);


  void 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 Utilities to manage pixel neighborhoods or Utilities to manage pixel neighborhoods 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);

© Ullrich Köthe (koethe@informatik.uni-hamburg.de)
Cognitive Systems Group, University of Hamburg, Germany

html generated using doxygen and Python
VIGRA 1.4.0 (21 Dec 2005)