c++ wavelet libraries

35
C++ Wavelet Libraries Documentation Download Table of Contents 1:Overview 1.1:Changes from previous version 1.2:Wavelet Libraries in Win32 Environment 1.2.1:Microsoft Visual C++ 1.2.2:GNU-GCC (MinGW) Based Compilation 1.3:Working in LINUX Environment 1.4:Licensing 2:List of Functions 2.1:1D DWT/IDWT Functions Periodic Extension Symmetric Extension 2.2:1D SWT/ISWT Functions 2.3:2D DWT/IDWT Functions Periodic Extension Symmetric Extension 2.4:2D SWT Functions 2.5:Convolution 2.6:Wavelet Filters 2.7:1D Vector Manipulation 2.8:2D Vector Manipulation 3:Sample Codes 3.1:1D DWT/IDWT Example Code 3.2:1D Linear vs Nonlinear Approximation 3.3:1D Stationary Wavelet Transform 3.4:2D DWT/IDWT Demo Code 3.5:Image Approximation Demo 3.6:2D SWT Demo 1 Overview This release of C++ Wavelet Libraries is focused on speed and ease of use. Libraries are available on LINUX and Win32 Platforms. Available features include 1D DWT and IDWT Implementation (Two Modes) 2D DWT and IDWT Implementation (Two Modes) 1D SWT and ISWT Implementation ( Stationary Wavelet Transform) 2D SWT Implementation Implemented using FFTW3 Library Shared(.so) and static(.a) libraries for Linux Shared(.dll) and static(.a) libraries for Win32 GCC (MinGW). Shared(.dll) libraries for Microsoft VC++ C++ Wavelet Libraries http://wavelet2d.sourceforge.net/ 1 of 35 27-May-15 4:23 AM

Upload: mohan-awad

Post on 17-Sep-2015

155 views

Category:

Documents


10 download

DESCRIPTION

c==

TRANSCRIPT

  • C++ Wavelet LibrariesDocumentation

    DownloadTable of Contents1:Overview1.1:Changes from previous version1.2:Wavelet Libraries in Win32 Environment1.2.1:Microsoft Visual C++1.2.2:GNU-GCC (MinGW) Based Compilation1.3:Working in LINUX Environment1.4:Licensing2:List of Functions2.1:1D DWT/IDWT FunctionsPeriodic ExtensionSymmetric Extension2.2:1D SWT/ISWT Functions2.3:2D DWT/IDWT FunctionsPeriodic ExtensionSymmetric Extension2.4:2D SWT Functions2.5:Convolution2.6:Wavelet Filters2.7:1D Vector Manipulation2.8:2D Vector Manipulation3:Sample Codes3.1:1D DWT/IDWT Example Code3.2:1D Linear vs Nonlinear Approximation3.3:1D Stationary Wavelet Transform3.4:2D DWT/IDWT Demo Code3.5:Image Approximation Demo3.6:2D SWT Demo

    1OverviewThis release of C++ Wavelet Libraries is focused on speed and ease of use. Libraries are available on LINUX andWin32 Platforms. Available features include

    1D DWT and IDWT Implementation (Two Modes)2D DWT and IDWT Implementation (Two Modes)1D SWT and ISWT Implementation ( Stationary Wavelet Transform)2D SWT ImplementationImplemented using FFTW3 LibraryShared(.so) and static(.a) libraries for LinuxShared(.dll) and static(.a) libraries for Win32 GCC (MinGW).Shared(.dll) libraries for Microsoft VC++

    C++ Wavelet Libraries http://wavelet2d.sourceforge.net/

    1 of 35 27-May-15 4:23 AM

  • Dynamic Libraries are labeled wavelet2d while static libraries are labeled wavelet2s.

    1.1Changes from previous versionFFTW3 Library is used to improve computation speed.No GNUPLOT outputs are generated.Periodic and Symmetric functions take same arguments. They will still be accessed by the same names,though.(dwt ,dwt_sym etc.)Focus on shared libraries. No static libraries for MSVC++ although MinGW and LINUX version will come withstatic as well as shared libraries.

    1.2Wavelet Libraries in Win32 Environment

    1.2.1Microsoft Visual C++

    This package contains two DLLs for MSVC++ - one Debug and one Release version.The list of required files in order to complie wavelet2d based programs-

    Header File- wavelet2d.hImport Library- wavelet2d.libWavelet DLL - wavelet2d.dllFFTW DLL - libfftw3-3.dll

    Header file is in the source (src) folder. Wavelet Libraries are in the respective Debug and Release folders. FFTWDLL is in the FFTW3 folder. Alternatively, you may chose to install FFT library from www.fftw.org. The FFTWsource codes are also available at FFTW website under GNU-GPL license.In order to use wavelet libraries, the easiest way is to add import library (wavelet2d.lib) to additional dependency inyour project which in turn will handle the DLLs for you. The two DLLs must be in your program path.If you are newto MSVC, you may want to learn more about DLL search path atDLL Search pathYou may also chose to directly call DLLs from your program.Regardless of how you handle DLLs, mixing debug andrelease versions is not a good idea.Both versions are named wavelet2d.dll so putting them in system path is not a goodidea either. Preferred way is to use Visual Studio project settings to link to the wavelet2d.lib file and put the releaseand debug wavelet2d dlls along with libfftw-3.3dll in the directory containing the respective release and debugexecutables of your project. Import library will open the DLLs.

    1.2.2GNU-GCC (MinGW) Based Compilation

    If you use GCC compiler either through MSYS or from one of the IDEs(Codeblocks, Eclipse, QTcreator, Netbeansetc.),I have also added both debug and release versions of wavelet2d DLLs and wavelet2s static libraries. RequiredFiles for MinGW DLLS-

    Header Files- wavelet2d.hImport Library- libwavelet2d.dll.aWavelet DLL - libwavelet2d.dllFFTW DLL - libfftw3-3.dll (Import library is also included)

    It is recommended that you link to the Release and Debug folders as they are. Once you link to import library andspecify the folder location, wavelet import library should automatically open the two DLLs. Mixing Debug andRelease versions shouldnt pose any problems in this case.Working with MinGW Static libraries is even more straightforward. You need to include wavelet2s.h header in your

    C++ Wavelet Libraries http://wavelet2d.sourceforge.net/

    2 of 35 27-May-15 4:23 AM

  • program , link to static *.a library and you are set.

    1.3Working in LINUX EnvironmentThis package contains two wavelet libraries- libwavelet2d.so.1.0 (shared) and libwavelet2s.a (static) compiledessentially from the same source code. Source code is available in the src folder.

    1.

    You may need to link to header files that are included with their resepctive libraries. They are also available inthe src folder.

    2.

    You may want to install shared library in one of your existing paths to make compilation easier. You can createsym links once inside the folder( say /usr/local/lib) by using following commands

    3.

    ln -sf libwavelet2d.so.1.0 libwavelet2d.soln -sf libwavelet2d.so.1.0 libwavelet2d.so.1ldconfig

    You will probably need superuser privileges to perform previous steps. If you don't have su privilege then you canmove libwavelet2d.so.1.0 to your work folder or where your source code is, create sym links as before and then putyour folder in the path during runtime.

    ln -sf libwavelet2d.so.1.0 libwavelet2d.soln -sf libwavelet2d.so.1.0 libwavelet2d.so.1export LD_LIBRARY_PATH=.

    libwavelet2s.a Working with static library is pretty straightforward. You will only need to include wavelet2s.h in yourprogram and specify the library (-lwavelet2s flag) , include path (-I[path to wavelet2s.h] flag) and library path (-L[pathto libwavelet2s.a] flag).

    1.4LicensingThese libraries are licensed under GNU-GPL v2.0 (or any later version). See COPYRIGHT and COPYING files formore information. These libraries statically and dynamically link to FFTW-3.2.2 static library, FFTW3-3.3 static librayand FFTw-3.2.2 dynamic libraries in different implementations. More information, fftw libraries and associated filesfor this version are available at www.fftw.org. I have not modified fftw source codes in any way shape or form so youmay want to download copies of source code and other files from the FFTW website itself if you are so inclined.However, you will find FFTW3 licensing and copyright information in the fftw3 folder.Copyright:

    /*Copyright (C) 2011 Rafat Hussain

    This program is free software; you can redistribute it and/or modify it under the terms of the GNU General PublicLicense as published by the Free Software Foundation; version 2 or any later version.This program is distributed in thehope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License formore details. You should have received a copy of the GNU General Public License along with this program; if not,write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

    2List of Functions2.11D DWT/IDWT FunctionsBoth periodic and symmetric extension methods for Decimated DWT take exactly same input arguments.The

    C++ Wavelet Libraries http://wavelet2d.sourceforge.net/

    3 of 35 27-May-15 4:23 AM

  • difference is that Output vector in periodic extension has usually the same size (~N) as the input vector(N) whileoutput vector in symmetric extension case has redundancies with length depending on size of filter used.

    Periodic Extension

    1.DWT: void* dwt(vector &sig, int J, string nm, vector &dwt_output,vector &flag,vector &length )where,sig:: Input Signal vectorJ:: Decomposition levelsnm:: Wavelet Name (See filtcoef for available wavelet families)length:: Lengths of respective approximation and detail vectors are stored in this integer vector.dwt_output:: Output of Discrete Wavelet Transform. It stores coefficients in following format:[A(J) D(J) D(J-1) ..... D(1)]A(J) is the approximation coefficient vector at the Jth level while D(n) are the detail coefficient vectors at the nth level.length contains the lengths of corresponding vectors. Last entry of the length vector is the length of the originalsignal.flag:: Housekeeping vector. In this implementation it contains two values-

    flag[0] is 0 if the signal is even and it is 1 if signal is odd and if it is made even by repeating the last value onemore timeflag[1] - contains the decomposition levels.

    Housekeeping vector is a double vector as it was originally meant to store more values than it currently does.