#include <iostream>
#include <vigra/stdimage.hxx>
#include <vigra/imageiteratoradapter.hxx>
int main(int argc, char ** argv)
{
if(argc != 2)
{
std::cout << "Usage: " << argv[0] << " infile" << std::endl;
return 1;
}
try
{
ImageImportInfo info(argv[1]);
vigra_precondition(info.isGrayscale(), "Sorry, cannot operate on color images");
int w = info.width();
int h = info.height();
int length = (w < h) ? h : w;
out = 255;
LineIterator<BImage::Iterator> line(in.upperLeft(), in.lowerRight());
LineIterator<BImage::Iterator> end(in.lowerRight(), in.lowerRight());
for(; line != end; ++line, ++column.x)
{
for(int y=0; y <= *line; ++y, --row.y) *row = 0;
}
std::cout << "Writing profile.gif" << std::endl;
exportImage(srcImageRange(out), ImageExportInfo(
"profile.gif"));
}
catch (std::exception & e)
{
std::cout << e.what() << std::endl;
return 1;
}
return 0;
}
BasicImageIterator< PIXELTYPE, PIXELTYPE ** > Iterator
Definition: basicimage.hxx:532
void importImage(...)
Read an image from a file.
void exportImage(...)
Write an image to a file.
image import and export functions
std::string impexListFormats()
List the image formats VIGRA can read and write.
BasicImage< UInt8 > BImage
Definition: stdimage.hxx:62