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

| Algorithms to Combine Images |

## Functions

template<... >
void | combineThreeImages (...)
| Combine three source images into destination image. More...
template<... >
void | combineTwoImages (...)
| Combine two source images into destination image. More...
template<... >
void | combineTwoImagesIf (...)
| Combine ROI of two source images into destination image. More...

## 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

## ◆ combineTwoImages()

void vigra::combineTwoImages | ( |  | ... | ) |

Combine two source images into destination image.

After the introduction of arithmetic and algebraic array expressions, this function is rarely needed. Moreover, combineTwoMultiArrays() provides the same functionality for arbitrary dimensional arrays.

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. 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 2D array views:

namespace vigra {
template <class T11, class S11,
class T12, class S12,
class T2, class S2,
class Functor>
void
combineTwoImages(MultiArrayView<2, T11, S11> const & src1,
MultiArrayView<2, T12, S12> const & src2,
MultiArrayView<2, T2, S2> dest,
Functor const & f);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
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
MultiArray<2, float> src1(width, height), src2(width, height),
dest(width, height);
... // fill source images
combineTwoImages(src1, src2, dest,
std::plus<float>());

show deprecated examples

#include <functional> // for plus
FImage src1(width, height), src2(width, height),
dest(width, height);
... // fill source images
vigra::combineTwoImages(
srcIterRange(src1.upperLeft(), src1.lowerRight()),
srcIter(src2.upperLeft()),
destIter(dest.upperLeft()),
std::plus<float>());
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);

See also
  Functors to Transform Images, vigra::multi_math, Functor Expressions

## ◆ combineTwoImagesIf()

void vigra::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 corresponding value of the mask array is non-zero) and the result written into the corresponding destination pixel. This is typically used for operations like add and subtract. 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 2D array views:

namespace vigra {
template <class T11, class S11,
class T12, class S12,
class TM, class SM,
class T2, class S2,
class Functor>
void
combineTwoImagesIf(MultiArrayView<2, T11, S11> const & src1,
MultiArrayView<2, T12, S12> const & src2,
MultiArrayView<2, TM, SM> const & mask,
MultiArrayView<2, T2, S2> dest,
Functor const & f);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
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
MultiArray<2, float> src1(width, height), src2(width, height), mask(width, height),
dest(width, height);
... // fill source and mask images
combineTwoImagesIf(src1, src2, mask, dest,
std::plus<float>());

show deprecated examples

#include <functional> // for plus
FImage src1(width, height), src2(width, height), mask(width, height),
dest(width, height);
... // fill source and mask images
vigra::combineTwoImagesIf(
srcIterRange(src1.upperLeft(), src1.lowerRight()),
srcIter(src2.upperLeft()),
maskIter(mask.upperLeft()),
destIter(dest.upperLeft()),
std::plus<SrcValueType>());
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);

See also
  Functors to Transform Images, vigra::multi_math, Functor Expressions

## ◆ combineThreeImages()

void vigra::combineThreeImages | ( |  | ... | ) |

Combine three source images into destination image.

After the introduction of arithmetic and algebraic array expressions, this function is rarely needed. Moreover, combineThreeMultiArrays() provides the same functionality for arbitrary dimensional arrays.

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

Declarations:

pass 2D array views:

namespace vigra {
template <class T11, class S11,
class T12, class S12,
class T13, class S13,
class T2, class S2,
class Functor>
void
combineThreeImages(MultiArrayView<2, T11, S11> const & src1,
MultiArrayView<2, T12, S12> const & src2,
MultiArrayView<2, T13, S13> const & src3,
MultiArrayView<2, T2, S2> dest,
Functor const & f);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
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

#include <vigra/functorexpression.hxx>
MultiArray<2, float> src1(width, height), src2(width, height), src3(width, height),
dest(width, height);
... // fill source images
using namespace vigra::functor; // activate VIGRA's lambda library
combineThreeImages(src1, src2, src3, dest,
Arg1()*exp(-abs(Arg2()-Arg3())));

show deprecated examples

FImage src1(width, height), src2(width, height), src3(width, height),
dest(width, height);
... // fill source images
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);

See also
  Functors to Transform Images, vigra::multi_math, Functor Expressions

© 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.11.0