#include <vigra/multi_array.hxx>
#include <vigra/multi_math.hxx>
#include <iostream>
int main (int argc, char ** argv)
{
if(argc != 4)
{
std::cout << "Usage: " << argv[0] << " infile1 infile2 outfile" << std::endl;
std::cout << "(supported formats: " << impexListFormats() << ")" << std::endl;
return 1;
}
try
{
info2(argv[2]);
imageArray2(info2.
shape());
importImage(info1, imageArray1);
importImage(info2, imageArray2);
Shape2 resultShape = min(info1.shape(), info2.
shape());
Shape2 start1 = (info1.shape() - resultShape) / 2,
end1 = start1 + resultShape;
end2 = start2 + resultShape;
using namespace multi_math;
exportArray = 0.5*subImageArray1 + 0.5*subImageArray2;
}
catch (std::exception & e)
{
std::cout << e.what() << std::endl;
return 1;
}
return 0;
}
Argument object for the function exportImage().
Definition imageinfo.hxx:134
Argument object for the function importImage().
Definition imageinfo.hxx:391
MultiArrayShape< 2 >::type shape() const
Main MultiArray class containing the memory management.
Definition multi_fwd.hxx:131
Class for fixed size vectors.
Definition tinyvector.hxx:1008
image import and export functions