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

test_wavelet.cpp

/* Copyright (c) 2001 C. Grigorescu */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tip.h>

//   Example program for the "WaveletTransform" class.
//
//   Usage:
//      test_wavelet <input_image> 
//

int main(int argc, char *argv[])
{
  // Test for the correct number of arguments in the command line.
  if (argc != 2) {
    cout << "Usage: " << argv[0] << " <input_image>" << endl;
    exit(0);
  }

  char l;

  // Read an image as floating point image and display it.
  FloatImage im0;
  im0.readImage(argv[1]);
  im0.showImage();
  cin >> l;;

  // Initialize the WaveletTransform object with the input image; 
  // specify the wavelet type used for the transformation.
  WaveletTransform a(im0, BIOR_1_3);

  // Perform a 3-level decomposition (direct FWT).
  a.fwt(3);

  // Display the result of the FWT.
  im0.showImage();
  cin >> l;;

  // Perform the 3-level reconstruction (inverse FWT).
  a.ifwt(3);
  im0.showImage();
  cin >> l;;
  
  im0.closeWindow();

  return(1);
}