VIGRA - Algorithms to Transform Images

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

| Algorithms to Transform Images |
--- | --- | ---

## Functions
template<...> void | transformImage (SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor sa, DestImageIterator dest_upperleft, DestAccessor da, Functor const &f)
| Apply unary point transformation to each pixel.
template<...> void | transformImageIf (SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor sa, MaskImageIterator mask_upperleft, MaskAccessor ma, DestImageIterator dest_upperleft, DestAccessor da, Functor const &f)
| Apply unary point transformation to each pixel within the ROI (i.e., where the mask is non-zero).
template<...> void | gradientBasedTransform (SrcImageIterator srcul, SrcImageIterator srclr, SrcAccessor sa, DestImageIterator destul, DestAccessor da, Functor const &grad)
| Calculate a function of the image gradient.

## Detailed Description

Apply functor to calculate a pixelwise transformation of one image

## Function Documentation

void gradientBasedTransform (...)

| Calculate a function of the image gradient. The gradient and the function represented by `Functor f` are calculated in one go: for each location, the symmetric difference in x- and y-directions (asymmetric difference at the image borders) are passed to the given functor, and the result is written the destination image. Functors to be used with this function include MagnitudeFunctor and RGBGradientMagnitudeFunctor. Declarations: pass arguments explicitly:
        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor, class Functor>
            void
            gradientBasedTransform(SrcImageIterator srcul, SrcImageIterator srclr, SrcAccessor sa,
                          DestImageIterator destul, DestAccessor da, Functor const & f)
        }
use argument objects in conjunction with Argument Object Factories:
        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor, class Functor>
            void
            gradientBasedTransform(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                           pair<DestImageIterator, DestAccessor> dest, Functor const & const & f)
        }
Usage: #include "vigra/transformimage.hxx"
        vigra::FImage src(w,h), magnitude(w,h);
        ...

        gradientBasedTransform(srcImageRange(src), destImage(magnitude),
                                    vigra::MagnitudeFunctor<float>());
Required Interface:
        SrcImageIterator is, isend;
        DestImageIterator id;

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        typename NumericTraits<typename SrcAccessor::value_type>::RealPromote
            diffx, diffy;

        diffx = src_accessor(is, Diff2D(-1,0)) - src_accessor(is, Diff2D(1,0));
        diffy = src_accessor(is, Diff2D(0,-1)) - src_accessor(is, Diff2D(0,1));

        Functor f;

        dest_accessor.set(f(diffx, diffy), id);

void transformImage (...)

| Apply unary point transformation to each pixel. The transformation given by the functor is applied to every source pixel and the result written into the corresponding destination pixel. The function uses accessors to access the pixel data. Note that the unary functors of the STL can be used in addition to the functors specifically defined in Functors to Transform Images. Creation of new functors is easiest by using Functor Expressions. Declarations: pass arguments explicitly:
        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor, class Functor>
            void
            transformImage(SrcImageIterator src_upperleft,
                   SrcImageIterator src_lowerright, SrcAccessor sa,
                   DestImageIterator dest_upperleft, DestAccessor da,
                   Functor const & f)
        }
use argument objects in conjunction with Argument Object Factories:
        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor, class Functor>
            void
            transformImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                   pair<DestImageIterator, DestAccessor> dest,
                   Functor const & f)
        }
Usage: #include "vigra/transformimage.hxx" Namespace: vigra
        #include <cmath>         // for sqrt()

        vigra::transformImage(srcImageRange(src),
                              destImage(dest),
                              (double(*)(double))&std::sqrt );
Required Interface:
        SrcImageIterator src_upperleft, src_lowerright;
        DestImageIterator      dest_upperleft;
        SrcImageIterator::row_iterator sx = src_upperleft.rowIterator();
        DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        Functor functor;

        dest_accessor.set(functor(src_accessor(sx)), dx);

void transformImageIf (...)

| Apply unary point transformation to each pixel within the ROI (i.e., where the mask is non-zero). The transformation given by the functor is applied to every source pixel in the ROI (i.e. when the return vlaue of the mask's accessor is not zero) and the result is written into the corresponding destination pixel. The function uses accessors to access the pixel data. Note that the unary functors of the STL can be used in addition to the functors specifically defined in Functors to Transform Images. Creation of new functors is easiest by using Functor Expressions. Declarations: pass arguments explicitly:
        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class MaskImageIterator, class MaskAccessor,
                  class DestImageIterator, clas DestAccessor,
                  class Functor>
            void
            transformImageIf(SrcImageIterator src_upperleft,
                SrcImageIterator src_lowerright, SrcAccessor sa,
                MaskImageIterator mask_upperleft, MaskAccessor ma,
                DestImageIterator dest_upperleft, DestAccessor da,
                Functor const & f)
        }
use argument objects in conjunction with Argument Object Factories:
        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class MaskImageIterator, class MaskAccessor,
                  class DestImageIterator, clas DestAccessor,
                  class Functor>
            void
            transformImageIf(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                     pair<MaskImageIterator, MaskAccessor> mask,
                     pair<DestImageIterator, DestAccessor> dest,
                     Functor const & f)
        }
Usage: #include "vigra/transformimage.hxx" Namespace: vigra
        #include <cmath>         // for sqrt()

        vigra::transformImageIf(srcImageRange(src),
                                maskImage(mask),
                                destImage(dest),
                                (double(*)(double))&std::sqrt );
Required Interface:
        SrcImageIterator src_upperleft, src_lowerright;
        DestImageIterator  dest_upperleft;
        MaskImageIterator mask_upperleft;
        SrcImageIterator::row_iterator sx = src_upperleft.rowIterator();
        MaskImageIterator::row_iterator mx = mask_upperleft.rowIterator();
        DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;
        MaskAccessor mask_accessor;
        Functor functor;

        if(mask_accessor(mx))
           dest_accessor.set(functor(src_accessor(sx)), dx);

© Ullrich Köthe (koethe@informatik.uni-hamburg.de) Cognitive Systems Group, University of Hamburg, Germany | html generated using doxygen and Python VIGRA 1.5.0 (7 Dec 2006)