Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   Related Pages   Examples  

test_reflect.cpp

00001 /* Copyright (c) 2001 S.E. Grigorescu */
00002 
00003 #include <iostream.h>
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include <tip.h>
00007 
00008 //   Example program for the "Reflect" function.
00009 //
00010 //   Usage:
00011 //      test_reflect <input_image>
00012 //
00013 
00014 int main(int argc, char *argv[])
00015 {
00016   // Test for the correct number of arguments in the command line.
00017   if (argc != 2) {
00018     cout << "Usage: " << argv[0] << " <input_image>" << endl;
00019     exit(0);
00020   }
00021 
00022   // Read an image from the file specified by "argv[1]" and display it.
00023   Image< float > im1; 
00024   im1.readImage(argv[1]);
00025   im1.setName("test_image");
00026   im1.showImage();
00027  
00028   // Reflect the input image along the vertical axis and store the result in a second image.
00029   Image< float > im2; 
00030   Reflect(im1, "vertical", im2); 
00031   im2.setName("test_image_1");
00032   im2.showImage();
00033 
00034   // Reflect the input image along the horizontal axis in place.
00035   Image< float > im3 = im1;
00036   Reflect(im3, "horizontal");
00037   im3.setName("test_image_2");
00038   im3.showImage();
00039  
00040   char l;
00041   cin >> l;
00042   im1.closeWindow();
00043   im2.closeWindow();
00044   im3.closeWindow();                                    
00045   return(1);
00046 }