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

test_watershed.cpp

00001 /* Copyright (c) 2001 A. Jalba */
00002 
00003 #include <tip.h>
00004 
00005 //   Example program for the watershed transform.
00006 //
00007 //   Usage:
00008 //      test_watershed <input_image>
00009 //
00010 
00011 int main(int argc, char **argv)
00012 {
00013   // Test for the correct number of arguments in the command line.
00014   if (argc != 2) {
00015     cout << "Usage: " << argv[0] << " <input_image>" << endl;
00016     exit(0);
00017   }
00018  
00019   ByteImage im;
00020   IntImage out;
00021 
00022   // Read an image from the file specified by "argv[1]" and display it.     
00023   im.readImage(argv[1]);
00024   im.showImage();
00025 
00026   // Apply watershed transform on the input image using 4-connectivity and 
00027   // store the result in another image.
00028   Watershed(im, FOUR, out);
00029   out.showImage();
00030 
00031   char l;
00032   cin >> l;                                                                     
00033   
00034   im.closeWindow();
00035   out.closeWindow();
00036   return 1;
00037 }