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

test_wavelet.cpp

00001 /* Copyright (c) 2001 C. Grigorescu */
00002 
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 #include <string.h>
00006 #include <tip.h>
00007 
00008 //   Example program for the "WaveletTransform" class.
00009 //
00010 //   Usage:
00011 //      test_wavelet <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   char l;
00023 
00024   // Read an image as floating point image and display it.
00025   FloatImage im0;
00026   im0.readImage(argv[1]);
00027   im0.showImage();
00028   cin >> l;;
00029 
00030   // Initialize the WaveletTransform object with the input image; 
00031   // specify the wavelet type used for the transformation.
00032   WaveletTransform a(im0, BIOR_1_3);
00033 
00034   // Perform a 3-level decomposition (direct FWT).
00035   a.fwt(3);
00036 
00037   // Display the result of the FWT.
00038   im0.showImage();
00039   cin >> l;;
00040 
00041   // Perform the 3-level reconstruction (inverse FWT).
00042   a.ifwt(3);
00043   im0.showImage();
00044   cin >> l;;
00045   
00046   im0.closeWindow();
00047 
00048   return(1);
00049 }