Class DWTUtil


  • public class DWTUtil
    extends Object
    Class to handle Wavelet filters and other DWT utilities.

    This class is conversion of C to Java for the file "wavelet.c" file provided by Peter Meerwald at:http://www.cosy.sbg.ac.at/~pmeerw/Watermarking/

    Refer to his thesis on watermarking: Peter Meerwald, Digital Image Watermarking in the Wavelet Transfer Domain, Master's Thesis, Department of Scientific Computing, University of Salzburg, Austria, January 2001.

    • Method Detail

      • waveletTransform

        public static ImageTree waveletTransform​(Image origImg,
                                                 int level,
                                                 FilterGH[] filterGHList,
                                                 int method)
        Method to perform the wavelet transform
        Parameters:
        origImg - Original image
        level - Decomposition level
        filterGHList - List of filters
        method - Wavelet filtering method
        Returns:
        Data after performing wavelet transform
      • decomposition

        public static void decomposition​(Image inputImg,
                                         Image coarseImg,
                                         Image horizontalImg,
                                         Image verticalImg,
                                         Image diagonalImg,
                                         Filter filterG,
                                         Filter filterH,
                                         int method)
        Method to decompose the image
        Parameters:
        inputImg - Input image
        coarseImg - Coarse image
        horizontalImg - Horizontal image
        verticalImg - Vertical image
        diagonalImg - Diagonal image
        filterG - G filter
        filterH - H filter
        method - Wavelet filtering method
      • convoluteLines

        public static void convoluteLines​(Image outputImg,
                                          Image inputImg,
                                          Filter filter,
                                          int method)
        Method to convolute lines
        Parameters:
        outputImg - Output image
        inputImg - Input image
        filter - Filter to use
        method - Wavelet filtering method
      • convoluteRows

        public static void convoluteRows​(Image outputImg,
                                         Image inputImg,
                                         Filter filter,
                                         int method)
        Method to convolute rows
        Parameters:
        outputImg - Output image
        inputImg - Input image
        filter - Filter to use
        method - Wavelet filtering method
      • filterCutOff

        public static void filterCutOff​(Image inputImg,
                                        int inStart,
                                        int inLen,
                                        int inStep,
                                        Image outputImg,
                                        int outStart,
                                        int outLen,
                                        int outStep,
                                        Filter filter)
        Method to apply cut-off filter
        Parameters:
        inputImg - Input image
        inStart - Start point for input image
        inLen - Length of data for input image
        inStep - Step for loop for input image
        outputImg - Output image
        outStart - Start point for output image
        outLen - Length of data for output image
        outStep - Step for loop for output image
        filter - Filter
      • filterInvCutOff

        public static void filterInvCutOff​(Image inputImg,
                                           int inStart,
                                           int inLen,
                                           int inStep,
                                           Image outputImg,
                                           int outStart,
                                           int outLen,
                                           int outStep,
                                           Filter filter)
        Method to apply inverse cut-off filter
        Parameters:
        inputImg - Input image
        inStart - Start point for input image
        inLen - Length of data for input image
        inStep - Step for loop for input image
        outputImg - Output image
        outStart - Start point for output image
        outLen - Length of data for output image
        outStep - Step for loop for output image
        filter - Filter
      • filterPeriodical

        public static void filterPeriodical​(Image inputImg,
                                            int inStart,
                                            int inLen,
                                            int inStep,
                                            Image outputImg,
                                            int outStart,
                                            int outLen,
                                            int outStep,
                                            Filter filter)
        Method to apply periodical filter
        Parameters:
        inputImg - Input image
        inStart - Start point for input image
        inLen - Length of data for input image
        inStep - Step for loop for input image
        outputImg - Output image
        outStart - Start point for output image
        outLen - Length of data for output image
        outStep - Step for loop for output image
        filter - Filter
      • filterInvPeriodical

        public static void filterInvPeriodical​(Image inputImg,
                                               int inStart,
                                               int inLen,
                                               int inStep,
                                               Image outputImg,
                                               int outStart,
                                               int outLen,
                                               int outStep,
                                               Filter filter)
        Method to apply inverse periodical filter
        Parameters:
        inputImg - Input image
        inStart - Start point for input image
        inLen - Length of data for input image
        inStep - Step for loop for input image
        outputImg - Output image
        outStart - Start point for output image
        outLen - Length of data for output image
        outStep - Step for loop for output image
        filter - Filter
      • filterMirror

        public static void filterMirror​(Image inputImg,
                                        int inStart,
                                        int inLen,
                                        int inStep,
                                        Image outputImg,
                                        int outStart,
                                        int outLen,
                                        int outStep,
                                        Filter filter)
        Method to apply mirror filter
        Parameters:
        inputImg - Input image
        inStart - Start point for input image
        inLen - Length of data for input image
        inStep - Step for loop for input image
        outputImg - Output image
        outStart - Start point for output image
        outLen - Length of data for output image
        outStep - Step for loop for output image
        filter - Filter
      • filterInvMirror

        public static void filterInvMirror​(Image inputImg,
                                           int inStart,
                                           int inLen,
                                           int inStep,
                                           Image outputImg,
                                           int outStart,
                                           int outLen,
                                           int outStep,
                                           Filter filter)
        Method to apply inverse mirror filter
        Parameters:
        inputImg - Input image
        inStart - Start point for input image
        inLen - Length of data for input image
        inStep - Step for loop for input image
        outputImg - Output image
        outStart - Start point for output image
        outLen - Length of data for output image
        outStep - Step for loop for output image
        filter - Filter
      • inverseTransform

        public static Image inverseTransform​(ImageTree tree,
                                             FilterGH[] filterGHList,
                                             int method)
        Method to perform inverse wavelet transform
        Parameters:
        tree - Forward transformed DWT data
        filterGHList - List of filters
        method - Wavelet filter method
        Returns:
        Inverse transformed image data
      • invDecomposition

        public static void invDecomposition​(Image sumImg,
                                            Image coarseImg,
                                            Image horizontalImg,
                                            Image verticalImg,
                                            Image diagonalImg,
                                            FilterGH filterGH,
                                            int method)
        Method to perform inverse decomposition
        Parameters:
        sumImg - Sum image
        coarseImg - Coarse image
        horizontalImg - Horizontal image
        verticalImg - Vertical image
        diagonalImg - Diagonal image
        filterGH - Filter
        method - Wavelet filter method
      • findDeepestLevel

        public static int findDeepestLevel​(int width,
                                           int height)
        Method to get the deepest level possible for given image width and height
        Parameters:
        width - Image width
        height - Image height
        Returns:
        Deepest possible level
      • setPixel

        public static void setPixel​(Image image,
                                    int x,
                                    int y,
                                    double val)
        Set pixel value in the image
        Parameters:
        image - Image
        x - X position of pixel
        y - Y position of pixel
        val - Pixel value
      • getPixel

        public static double getPixel​(Image image,
                                      int x,
                                      int y)
        Get pixel value from the image
        Parameters:
        image - Image
        x - X position of pixel
        y - Y position of pixel
        Returns:
        Pixel value