| profile.cxx |  | 
Find the gray value profile along the image diagonal by means of a vigra::LineIterator 
 Usage: example_profile infile, generates profile.gif
                
 
#include <iostream>
#include <vigra/stdimage.hxx>
#include <vigra/imageiteratoradapter.hxx>
using namespace vigra; 
int main(int argc, char ** argv)
{
    if(argc != 2)
    {
        std::cout << "Usage: " << argv[0] << " infile" << std::endl;
        
        return 1;
    }
    
    try
    {
        
        vigra_precondition(info.
isGrayscale(), 
"Sorry, cannot operate on color images");
        
            
        
        
        int length = (w < h) ? h : w;
        
        
        
        
        out = 255;
        
         
        
        
        
        
        
        for(; line != end; ++line, ++column.x)
        {
            
            
            for(
int y=0; y <= *line; ++y, --row.
y)  *row = 0;
 
        }
        
        std::cout << "Writing profile.gif" << std::endl;
    }
    catch (std::exception & e)
    {
        std::cout << e.what() << std::endl;
        return 1;
    }
    
    return 0;
}