Atrous Algorithm (cv-java-android)

asked 2014-04-04 13:33:16 -0500

updated 2015-10-07 07:24:04 -0500

Hi, i'm developing an algorithm that require some wavelet planes. I wrote this code:

private Mat getAtrousPlane(Mat img, byte n)
{
    Mat grayImg = new Mat(img.height(), img.width(), CvType.CV_8UC1);
    Imgproc.cvtColor(img, grayImg, Imgproc.COLOR_RGB2GRAY);

    Mat wavelet = new Mat(img.height(), img.width(), CvType.CV_8UC1);
    Mat k = Mat.zeros(2*n+3,2*n+3,CvType.CV_8UC1);

    int kw = k.width();
    int kh = k.height();

    k.put(0, 0, 1);
    k.put(n+2, 0, 2);
    k.put(kh, 0, 1);

    k.put(0, n+2, 2);
    k.put(n+2, n+2, 4);
    k.put(kh, n+2, 2);

    k.put(0, kw, 1);
    k.put(n+2, kw, 2);
    k.put(kh, kw, 1);


    Imgproc.filter2D(grayImg, wavelet, -1, k);

    return wavelet;
}

where img is an RGB image and n is the level of the wavelet plane to calculate. The problem is that the result is not the same as that obtained with an equivalent matlab script. Can someone help me on calculating wavelet planes?

Bye

edit retag flag offensive close merge delete