mirror_tutorial.cxx
|
|
Mirror an image file (horizontal or vertical)
Usage: mirror_tutorial infile outfile
#include <iostream>
#include <vigra/multi_array.hxx>
#include <vigra/basicgeometry.hxx>
using namespace vigra;
int main(int argc, char ** argv)
{
if(argc != 3)
{
std::cout << "Usage: " << argv[0] << " infile outfile" << std::endl;
std::cout <<
"(grayscale only, supported formats: " <<
impexListFormats() <<
")" << std::endl;
return 1;
}
std::cout << "How to mirror image?\n";
std::cout << "1 - top to bottom (= about horizontal axis)\n";
std::cout << "2 - left to right (= about vertical axis)\n";
int mode;
std::cin >> mode;
try
{
if(mode == 1)
{
for (
int y=0; y<info.
height(); y++)
{
newImageArray.bind<1>(y) = imageArray.bind<1>(info.
height()-1-y);
}
}
else
{
}
}
catch (std::exception & e)
{
std::cout << e.what() << std::endl;
return 1;
}
return 0;
}