Community
cancel
Showing results for 
Search instead for 
Did you mean: 
dwinfield
Beginner
133 Views

Wavelet

Hi,
I'm trying to use ippiWTFwd. I'm confused when comparing the example in the manual, the 2d-wavelet-transform example, and the demo program. The demo program appears to put a border around the results = to the highest number of filter taps. Also, the demo appears to make an ROI in the input image and I'm guessing doesn't use ippiWrapBorder.

I'm basically taking a rectangle (x,y,w,h) as shown below and resizing it to 2x scale so the decimated results will be the same size as the initial rectangle -- see below. The resulting x, y, and xyimages are almost 0 on any image I sent to the ippiWTFwd-- Am I doing something wrong?

THANKS

double CCamera::CalcWaveletFromRect(int x, int y, int w, int h)

{

int len = w*h;

Ipp32f pTapsLow[3] = {0.25, 0.5, 0.25};

int lenLow = 3;

int anchorLow = 1;

Ipp32f pTapsHigh[3] = {0.75, -0.25, -0.125};

int lenHigh = 3;

int anchorHigh = 1;

// Border (split top/bottom and right/left) is highest value lenLow and lenHigh

int border = 6;

IppiWTFwdSpec_32f_C1R* pSpec;

ippiWTFwdInitAlloc_32f_C1R(&pSpec, pTapsLow, lenLow, anchorLow, pTapsHigh, lenHigh, anchorHigh);

Ipp8u *pBuffer;

int bufSize;

ippiWTFwdGetBufSize_C1R(pSpec, &bufSize);

pBuffer = ippsMalloc_8u(bufSize);

Ipp32f *pnew = new Ipp32f[w*h*4];

IppiSize ROIbig;

ROIbig.height = h*2;

ROIbig.width = w*2;

int ROIoffset = y*m_Width+x;

IppiSize ROIrect;

ROIrect.height = h;

ROIrect.width = w;

IppiRect rect;

rect.x = x;

rect.y = y;

rect.width = w;

rect.height = h;

m_Status = ippiResize_32f_C1R(m_buffer32f, m_ROI, m_Width*4, rect, pnew, w*2*4, ROIbig, 2.0, 2.0, IPPI_INTER_CUBIC);

Ipp32f *imgborder;

imgborder = new Ipp32f[(w+border)*(h+border)*4];

IppiSize ROIborder;

ROIborder.height = (h+border)*2;

ROIborder.width = (w+border)*2;

ippiSet_32f_C1R(0.0, imgborder, (w+border)*2*4, ROIborder);

m_Status = ippiCopyWrapBorder_32f_C1R(pnew, w*2*4, ROIbig, imgborder, (w+border)*2*4, ROIborder, border/2, border/2);

Ipp32f *pDetailXDst = new Ipp32f[w*h];

Ipp32f *pDetailYDst = new Ipp32f[w*h];

Ipp32f *pDetailXYDst = new Ipp32f[w*h];

Ipp32f *pApproxDst = new Ipp32f[w*h];

IppiSize dstROISize;

dstROISize.height = h;

dstROISize.width = w;

m_Status = ippiWTFwd_32f_C1R(imgborder + (border/2*(w+border)*2+border/2)*4, (w+border)*2*4,

pApproxDst, w*4, pDetailXDst, w*4, pDetailYDst, w*4, pDetailXYDst, w*4, dstROISize, pSpec, pBuffer);

int val, loc;

int val2, loc2;

for (int col = x; col

{

for (int row = 0; row

{

val = y + row;

//val = row;

loc = val*m_Width + col;

val2 = row;

loc2 = row*w +(col-x);

m_ImgGray->imageData[loc] = (char)pDetailYDst[loc2];

m_buffer8[loc] = (Ipp8u)pDetailYDst[loc2];

}

}

return 0.0;

}

0 Kudos
2 Replies
Mikhail_Kulikov__Int
New Contributor I
133 Views

Hi,

if I understand your code correctly, you are trying to decompose image, which is enlarged exactly by factor 2.0 (and cubic interpolation). In other words the result is enlarged picture, but smoothed, so such an image is actually will not contain high-frequency part of spectrum. In this case it's natural that details component of wavelet transforms contains mostly zero (or close to zero) data.
Please check that approximation contains valid data, than switch interpolation to NN (not the best for many pictures, but no smoothing) some non-zero data will appear in details component especially when original pictures really have high-frequency part of spectrum.

Regards,
Mikhail
Chaubey__Nidhi
Beginner
133 Views

Hi,

I m using ippi-7.0.dll. I m runing example given in the manual, the 2d-wavelet-transform, in C#. Till fwd WT results are matched with given manual results. for Inv WT  ippiWTInvInitAlloc_32f_C1R and ippiWTInvGetBufSize_C1R give ippstatus = ippstsNoErr.

But for ippiWTInv_32f_C1R give ippstatus = ippstsContxtMatchErr.I tred so many wrap options and match the code with manual also, but its not working.

Plz help me.

 

Reply