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

| Algorithms to Copy Images |

## Functions
template<... >
void | copyImage (...)
| Copy source image into destination image. More...
template<... >
void | copyImageIf (...)
| Copy source ROI into destination image. More...

## Detailed Description

Copy images or regions

## Function Documentation

void vigra::copyImage | ( |  | ... | ) |

Copy source image into destination image.

If necessary, type conversion takes place. Some variants of this function use accessors to access the pixel data.

See copyMultiArray() for a dimension-independent version of this algorithm.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
copyImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}

pass Image Iterators and Data Accessors :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
copyImage(SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor sa,
DestImageIterator dest_upperleft, DestAccessor da)
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
copyImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest)
}

Usage:

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

Use MultiArrayView API:

MultiArray<2, int> src(Shape2(100, 200)),
dest(Shape2(100, 200));
...
copyImage(src, dest);
// equivalent to
dest = src;

Use iterator-based API with accessor:

MultiArray<2, RGBValue<unsigned char> > src(Shape2(100, 200)),
MultiArray<2, float> dest(Shape2(100, 200));
// convert RGB to gray values in the fly
copyImage(srcImageRange(src, RGBToGrayAccessor<RGBValue<unsigned char> >()),
destImage(dest));

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;
dest_accessor.set(src_accessor(sx), dx);

void vigra::copyImageIf | ( |  | ... | ) |

Copy source ROI into destination image.

Pixel values are copied whenever the return value of the mask's accessor is not zero. If necessary, type conversion takes place. Some variants of this function use accessors to access the pixel data.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class TM, class SM,
class T2, class S2>
void
copyImageIf(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TM, SM> const & mask,
MultiArrayView<2, T2, S2> dest);
}

pass Image Iterators and Data Accessors :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class MaskImageIterator, class MaskAccessor,
class DestImageIterator, clas DestAccessor>
void
copyImageIf(SrcImageIterator src_upperleft,
SrcImageIterator src_lowerright, SrcAccessor sa,
MaskImageIterator mask_upperleft, MaskAccessor ma,
DestImageIterator dest_upperleft, DestAccessor da)
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class MaskImageIterator, class MaskAccessor,
class DestImageIterator, clas DestAccessor>
void
copyImageIf(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<MaskImageIterator, MaskAccessor> mask,
pair<DestImageIterator, DestAccessor> dest)
}

Usage:

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

Use MultiArrayView API:

MultiArray<2, int> src(Shape2(100, 200)),
mask(Shape2(100, 200)),
dest(Shape2(100, 200));
...
copyImageIf(src, mask, dest);

Use iterator-based API with accessor:

MultiArray<2, RGBValue<unsigned char> > src(Shape2(100, 200)),
MultiArray<2, unsigned char> mask(Shape2(100, 200));
MultiArray<2, float> dest(Shape2(100, 200));
// convert RGB to gray values in the fly
copyImageIf(srcImageRange(src, RGBToGrayAccessor<RGBValue<unsigned char> >()),
maskImage(mask), destImage(dest));

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(src_accessor(sx), dx);

© 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.1 (Fri May 19 2017)