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

| Algorithms to Combine Images |
--- | --- | ---

## Functions

template<...> void | combineTwoImages (SrcImageIterator1 src1_upperleft, SrcImageIterator1 src1_lowerright, SrcAccessor1 sa1, SrcImageIterator2 src2_upperleft, SrcAccessor2 sa2, DestImageIterator dest_upperleft, DestAccessor da, Functor const &f)
| Combine two source images into destination image.
template<...> void | combineTwoImagesIf (SrcImageIterator1 src1_upperleft, SrcImageIterator1 src1_lowerright, SrcAccessor1 sa1, SrcImageIterator2 src2_upperleft, SrcAccessor2 sa2, MaskImageIterator mask_upperleft, MaskAccessor ma, DestImageIterator dest_upperleft, DestAccessor da, Functor const &f)
| Combine ROI of two source images into destination image.
template<...> void | combineThreeImages (SrcImageIterator1 src1_upperleft, SrcImageIterator1 src1_lowerright, SrcAccessor1 sa1, SrcImageIterator2 src2_upperleft, SrcAccessor2 sa2, SrcImageIterator3 src3_upperleft, SrcAccessor3 sa3, DestImageIterator dest_upperleft, DestAccessor da, Functor const &f)
| Combine three source images into destination image.

## Detailed Description

Apply functor to calculate a pixelwise transformation depending on multiple images. Note that the binary functors of the STL may be used with these functions.

## Function Documentation

void combineThreeImages (...)

Combine three source images into destination image.

The transformation given by the functor is applied to the source pixels and the result written into the corresponding destination pixel. The function uses accessors to access the pixel data. Creation of new functors is easiest by using Functor Expressions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcImageIterator1, class SrcAccessor1,
                  class SrcImageIterator2, class SrcAccessor2,
                  class SrcImageIterator3, class SrcAccessor3,
                  class DestImageIterator, class DestAccessor,
                  class Functor>
            void
            combineThreeImages(SrcImageIterator1 src1_upperleft,
                       SrcImageIterator1 src1_lowerright, SrcAccessor1 sa1,
                       SrcImageIterator2 src2_upperleft, SrcAccessor2 sa2,
                       SrcImageIterator3 src2_upperleft, SrcAccessor3 sa3,
                       DestImageIterator dest_upperleft, DestAccessor da,
                       Functor const & f)
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            template <class SrcImageIterator1, class SrcAccessor1,
                  class SrcImageIterator2, class SrcAccessor2,
                  class SrcImageIterator3, class SrcAccessor3,
                  class DestImageIterator, class DestAccessor,
                  class Functor>
            void
            combineThreeImages(triple<SrcImageIterator1, SrcImageIterator1, SrcAccessor1> src1,
                     pair<SrcImageIterator2, SrcAccessor2> src2,
                     pair<SrcImageIterator3, SrcAccessor3> src3,
                     pair<DestImageIterator, DestAccessor> dest,
                     Functor const & f)
        }

Usage:

#include "vigra/combineimages.hxx"
Namespace: vigra

        vigra::combineThreeImages(
                    srcIterRange(src1.upperLeft(), src1.lowerRight()),
                    srcIter(src2.upperLeft()),
                    srcIter(src3.upperLeft()),
                    destIter(dest.upperLeft()),
                    SomeThreeArgumentFunctor());

Required Interface:

        SrcImageIterator1 src1_upperleft, src1_lowerright;
        SrcImageIterator2 src2_upperleft;
        SrcImageIterator3 src3_upperleft;
        DestImageIterator dest_upperleft;
        SrcImageIterator1::row_iterator sx1 = src1_upperleft.rowIterator();
        SrcImageIterator2::row_iterator sx2 = src2_upperleft.rowIterator();
        SrcImageIterator3::row_iterator sx3 = src3_upperleft.rowIterator();
        DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();

        SrcAccessor1 src1_accessor;
        SrcAccessor2 src2_accessor;
        SrcAccessor3 src3_accessor;
        DestAccessor dest_accessor;

        Functor functor;

        dest_accessor.set(
              functor(src1_accessor(sx1),
                      src2_accessor(sx2),
                      src3_accessor(sx3)),
              dx);

void combineTwoImages (...)

Combine two source images into destination image.

The transformation given by the functor is applied to the source pixels and the result written into the corresponding destination pixel. This is typically used for operations like add and subtract. The function uses accessors to access the pixel data. Note that the binary functors of the STL can be used in addition to the functors specifically defined in Functors to Combine Images. Creation of new functors is easiest by using Functor Expressions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcImageIterator1, class SrcAccessor1,
                  class SrcImageIterator2, class SrcAccessor2,
                  class DestImageIterator, class DestAccessor,
                  class Functor>
            void
            combineTwoImages(SrcImageIterator1 src1_upperleft,
                     SrcImageIterator1 src1_lowerright, SrcAccessor1 sa1,
                     SrcImageIterator2 src2_upperleft, SrcAccessor2 sa2,
                     DestImageIterator dest_upperleft, DestAccessor da,
                     Functor const & f)
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            template <class SrcImageIterator1, class SrcAccessor1,
                  class SrcImageIterator2, class SrcAccessor2,
                  class DestImageIterator, class DestAccessor,
                  class Functor>
            void
            combineTwoImages(triple<SrcImageIterator1, SrcImageIterator1, SrcAccessor1> src1,
                     pair<SrcImageIterator2, SrcAccessor2> src2,
                     pair<DestImageIterator, DestAccessor> dest,
                     Functor const & f)
        }

Usage:

#include "vigra/combineimages.hxx"
Namespace: vigra

        #include <functional>     // for plus

        vigra::combineTwoImages(
                    srcIterRange(src1.upperLeft(), src1.lowerRight()),
                    srcIter(src2.upperLeft()),
                    destIter(dest.upperLeft()),
                    std::plus<SrcValueType>());

Note that `SrcValueType` must be replaced with the appropriate type (e.g. the promote type of the input images' pixel type, see also Numeric and Promotion Traits)

Required Interface:

        SrcImageIterator1 src1_upperleft, src1_lowerright;
        SrcImageIterator2 src2_upperleft;
        DestImageIterator dest_upperleft;
        SrcImageIterator1::row_iterator sx1 = src1_upperleft.rowIterator();
        SrcImageIterator2::row_iterator sx2 = src2_upperleft.rowIterator();
        DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();

        SrcAccessor1 src1_accessor;
        SrcAccessor2 src2_accessor;
        DestAccessor dest_accessor;

        Functor functor;

        dest_accessor.set(
              functor(src1_accessor(sx1), src2_accessor(sx2)),
              dx);

void combineTwoImagesIf (...)

Combine ROI of two source images into destination image.

The transformation given by the functor is applied to all source pixels in the ROI (i.e. whenever the return value of the mask's accessor is not zero) and the result written into the corresponding destination pixel. This is typically used for operations like add and subtract. The function uses accessors to access the pixel data. Note that the binary functors of the STL can be used in addition to the functors specifically defined in Functors to Combine Images. Creation of new functors is easiest by using Functor Expressions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcImageIterator1, class SrcAccessor1,
                  class SrcImageIterator2, class SrcAccessor2,
                  class MaskImageIterator, class MaskAccessor,
                  class DestImageIterator, clas DestAccessor,
                  class Functor>
            void
            combineTwoImagesIf(SrcImageIterator1 src1_upperleft,
                       SrcImageIterator1 src1_lowerright, SrcAccessor1 sa1,
                       SrcImageIterator2 src2_upperleft, SrcAccessor2 sa2,
                       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 SrcImageIterator1, class SrcAccessor1,
                  class SrcImageIterator2, class SrcAccessor2,
                  class MaskImageIterator, class MaskAccessor,
                  class DestImageIterator, clas DestAccessor,
                  class Functor>
            void
            combineTwoImagesIf(triple<SrcImageIterator1, SrcImageIterator1, SrcAccessor1> src1,
                       pair<SrcImageIterator2, SrcAccessor2> src2,
                       pair<MaskImageIterator, MaskAccessor> mask,
                       pair<DestImageIterator, DestAccessor> dest,
                       Functor const & f)
        }

Usage:

#include "vigra/combineimages.hxx"
Namespace: vigra

        #include <functional>     // for plus

        vigra::combineTwoImagesIf(
                    srcIterRange(src1.upperLeft(), src1.lowerRight()),
                    srcIter(src2.upperLeft()),
                    maskIter(mask.upperLeft()),
                    destIter(dest.upperLeft()),
                    std::plus<SrcValueType>());

Note that `SrcValueType` must be replaced with the appropriate type (e.g. the promote type of the input images' pixel type, see also Numeric and Promotion Traits)

Required Interface:

        SrcImageIterator1 src1_upperleft, src1_lowerright;
        SrcImageIterator2 src2_upperleft;
        MaskImageIterator mask_upperleft;
        DestImageIterator dest_upperleft;
        SrcImageIterator1::row_iterator sx1 = src1_upperleft.rowIterator();
        SrcImageIterator2::row_iterator sx2 = src2_upperleft.rowIterator();
        MaskImageIterator::row_iterator mx = mask_upperleft.rowIterator();
        DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();

        SrcAccessor1 src1_accessor;
        SrcAccessor2 src2_accessor;
        MaskAccessor mask_accessor;
        DestAccessor dest_accessor;

        Functor functor;

        if(mask_accessor(mx))
           dest_accessor.set(
              functor(src1_accessor(sx1), src2_accessor(sx2)),
              dx);

© 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)