Request for Changes-77: New application for wavelet and fft domain transform

From OTBWiki
Jump to: navigation, search

New application for wavelet and fourier domain transform

Status

  • Author: Rashad Kanavath
  • Additional Contributors: Julien Michel
  • Submitted on 06.12.2015
  • Proposed target release : 5.10.0
  • Adopted : +3 from Julien, Victor, Guillaume
  • Merged : 2d0b525ce4a7e1ba951b30339fac8cfe406ddc48

Summary

Add a new application for wavelet and fourier domain transform

Rationale

This RFChanges introduce a new application into otb apps tree. This application make use of otbWaveletImageFilter and otbWaveletInverseImageFilter code written by Julien. These two classes does the transformation of otb input image for any wavelet operator supported by OTBWavelet module. FFT transofrm is done using itk:FFTImageFilter and itk::FFTInverseImageFilter

Implementation details

Here is the output of application run without any parameters

$ ./bin/otbcli_DomainTransform                                                                                                                   
ERROR: Waiting for at least one parameter...
This is the DomainTransform application, version 5.9.0
Domain Transform application for wavelet and fourier

Complete documentation: http://www.orfeo-toolbox.org/Applications/DomainTransform.html

Parameters: 
        -progress          <boolean>        Report progress 
MISSING -in                <string>         Input Image  (mandatory)
        -ram               <int32>          Available RAM (Mb)  (optional, off by default, default value is 128)
        -mode              <string>         mode [fft/wavelet] (mandatory, default value is wavelet)
        -mode.wavelet.form <string>         Select wavelet form. default is HAAR [haar/db4/db6/db8/db12/db20/sb24/sb44/sym8] (mandatory, default value is haar)
        -mode.wavelet.nlevels <int32>          Number of decomposition levels  (mandatory, default value is 2)
        -dir              <string>         direction: fwd/inv [fwd/inv] (mandatory, default value is fwd)
MISSING -out               <string> [pixel] Output Image  [pixel=uint8/uint16/int16/uint32/int32/float/double] (default value is float) (mandatory)
        -inxml             <string>         Load otb application from xml file  (optional, off by default)

Examples: 
otbcli_DomainTransform -in input.tif -mode wavelet -dir fwd -mode.wavelet.form haar -out output_wavelet_haar.tif


Parameter key Description
in This will take an input image to be transformed image. For FFT inverse transform, it expects a complex image as two-band image in which first band represent real part and second band represent imaginary part.
mode This parameter allows one to select between fft(fourier) and wavelet (No default value is given)
dir This parameter allows to select between forward and inverse transform. "dir" stands for direction. Possible values are fwd(foward) and inv (inverse).
mode.wavelet.form Select wavelet form. default is HAAR [haar/db4/db6/db8/db12/db20/sb24/sb44/sym8] (mandatory, default value is haar)
mode.wavelet.nlevels Number of decomposition levels (mandatory, default value is 2)
out This parameter holds the output file name to which transformed image will be written. This has a slightly different behaviour depending on transform type. For Wavelet, output is a single band image for both forward and inverse transform. For FFT forward transform, output is two band image where first band represents real part and second band represents imaginary part of a complex image.

Classes and files

  • Modules/Filtering/Wavelet/include
    • otbWaveletImageFilter
    • otbWaveletInverseImageFilter
    • otbWaveletsBandsListToWaveletsSynopsisImageFilter
    • otbWaveletsSynopsisImageToWaveletsBandsListFilter

Applications

Modules/Applications/AppDomainTransform/app

  • otDomainTransform.cxx (otbapp_DomainTransform)

Tests

  • Modules/Filtering/Wavelet/test
    • otbWaveletImageToImageFilter

This test code will take an input image an perform wavelet transform on input image. And the output of this is fed to wavelet inverse image filter which does inverse transform using same wavelet operator. Final output from wavelet inverse filter produces same image as input image. Wavelet form of HAAR is used in testing.

Documentation

Additional notes

In Wavelet inverse transform, otbWaveletFilterBank and otbSubSampleImageFilter are forced to run in single thread environment even though filters are multi-threaded. This has been done because of multiple image allocation inside its ThreadedGenerateData. No fix is available on my side. Changing this code might require rewrite of most/all parts of classes in Modules/Filtering/Wavelet.