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

test_thresh.cpp

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