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

composite.cxx

Create a composite image (gray scale or color)
Usage: composite infile outfile

#include <vigra/multi_array.hxx>
#include <vigra/impex.hxx>
#include <vigra/multi_math.hxx>
#include <vigra/basicgeometry.hxx>
using namespace vigra;
int main (int argc, char ** argv)
{
// read image given as first argument
int w = info.width(),
h = info.height();
// process grayscale image
if (info.isGrayscale())
{
// instantiate arrays for image data and for composite image of appropriate size
// copy image data into array
importImage(info, imageArray);
// topleft corner of composite image contains the original image
exportArray.subarray(Shape2(0,0), info.shape()) = imageArray;
// topright corner contains the vertically reflected image
MultiArrayView<2, UInt8> topright = exportArray.subarray(Shape2(w,0), Shape2(2*w, h));
reflectImage(imageArray, topright, vertical);
// reflect the upperhalf horizontally to the lowerhalf
reflectImage(upperhalf, lowerhalf, horizontal);
// write image data to the file given as second argument
exportImage(exportArray, ImageExportInfo(argv[2]));
}
// process color image
else
{
// instantiate arrays for image data and for composite image of appropriate size
// copy image data into array
importImage(info, imageArray);
// topleft corner of composite image contains the original image
exportArray.subarray(Shape2(0,0), info.shape()) = imageArray;
// topright corner contains the vertically reflected image
reflectImage(imageArray, topright, vertical);
// reflect the upperhalf horizontally to the lowerhalf
reflectImage(upperhalf, lowerhalf, horizontal);
// write image data to the file given as second argument
exportImage(exportArray, ImageExportInfo(argv[2]));
}
return 0;
}
Argument object for the function exportImage().
Definition imageinfo.hxx:134
Argument object for the function importImage().
Definition imageinfo.hxx:391
Class for a single RGB value.
Definition rgbvalue.hxx:128
TinyVectorView< VALUETYPE, TO-FROM > subarray() const
Definition tinyvector.hxx:887
image import and export functions

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