dissolve.cxx
|
|
Dissolve two image files (gray scale or color)
Usage: dissolve infile1 infile2 outfile
#include <vigra/multi_array.hxx>
#include <vigra/multi_math.hxx>
#include <iostream>
using namespace vigra;
int main (int argc, char ** argv)
{
if(argc != 4)
{
std::cout << "Usage: " << argv[0] << " infile1 infile2 outfile" << std::endl;
return 1;
}
try
{
info2(argv[2]);
imageArray2(info2.
shape());
Shape2 resultShape = min(info1.shape(), info2.
shape());
Shape2 start1 = (info1.shape() - resultShape) / 2,
end1 = start1 + resultShape;
Shape2 start2 = (info2.
shape() - resultShape) / 2,
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;
}