Invert an image file (gray scale or color)
Usage: invert infile outfile
#include <iostream>
#include <vigra/multi_array.hxx>
#include <vigra/multi_math.hxx>
int main (int argc, char ** argv)
{
if(argc != 3)
{
std::cout << "Usage: " << argv[0] << " infile outfile" << std::endl;
std::cout << "(supported formats: " << impexListFormats() << ")" << std::endl;
return 1;
}
try
{
using namespace multi_math;
{
importImage(info, imageArray);
imageArray = 255-imageArray;
}
else
{
importImage(info, imageArray);
imageArray = temp - imageArray;
}
}
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_array.hxx:2477
Class for a single RGB value.
Definition: rgbvalue.hxx:128
image import and export functions