Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6709 Discussions

Where can I get some sample codes on how to use Deconvolution(RL) functions?

kyzclockwise
Beginner
670 Views

Hi,

I have checked the IPP website, and cannot find sample code for image deconvolution. Can you give me a code snippeton how to use DeconvLR?

And i also have a question. Since that my deblur kernel is 2d, I don't know how to set "int kernelSize" in the function "DeconvLRInitAlloc". Should i perform 1d deconvolution twice?

Thanks, Feng

0 Kudos
8 Replies
kyzclockwise
Beginner
670 Views
could someone help me on this?
0 Kudos
johnx
Beginner
670 Views
Me too. The Intel's document is not clear at all. For the DeconvFFT, what is the FFTOrder?
0 Kudos
Vladimir_Dudnik
Employee
670 Views

Hello,

there is comment from our expert:

About DeconvLR.

Kernel size.

Yes, kernel is 2D. In fact it has the same width and height so int kernelSize means this size. So kernel has kernelSize width and kernelSize height.

About using DeconvLR there isnt any special.

Just suppose that you already have blurred image in array pSrc and its size roi and step in this image (in bytes!) is srcStep.

The destination image is similar.

Also you know that this image has been blurred with kernel from array pKernel and its width and height are kersize.

IppiDeconvLR_32f_C1R* pDeconvLR;

maxroi.width = roi.width + kersize - 1; // this maxroi need to allocate buffer for calculation in ippiDeconvLRInitAlloc_32f_C1R

maxroi.height = roi.height + kersize - 1; // because source image will be temporary extended during this calculation.

// In this code it has the smallest size, but of course its possible to set it to the maximum of rois for several images

ippiDeconvLRInitAlloc_32f_C1R(&pDeconvLR, pKernel, kersize, maxroi, 0.0001f);

// Allocate memory and initialize structure

ippiDeconvLR_32f_C1R(pSrc, srcStep, pDst, dstStep, roi, 50, pDeconvLR);

// Execute deconvolution using source image using, Kernel and 50 iteration for algorithm

ippiDeconvLRFree_32f_C1R(pDeconvLR);// Free allocated memory

As the result you will get deconvoled image in pDst.

About DeconvFFT.

Because this function based on FFT so it needs the similar parameters as FFT function has.

In this deconvolution function FFT order should be under the next condition:

2 FFT order >= (roi.width + kernelSize-1)

where roi.width is the width of convolled image and kernelSize is the width (or height because they are equal) of kernel for this convolution.

Regards,
Vladimir

0 Kudos
johnx
Beginner
670 Views

Thanks for your good explanation. I had it running. I have one more questions for this.

1. Does it support kernel size >32 for deconvLR? I tested a code with your suggestion. It crashes at kersize=32 but runs fine at kersize=31.

John

0 Kudos
Vladimir_Dudnik
Employee
670 Views

Hi John,

there is comment from our expert:

Generally this function does not have restriction by kernel size (exclude case outgoing of range int data type that is used as indexes in buffers). It had been successfully tested internally with different kersizeincluding 32. Could you please provide code example where this function crashes at kersize = 32?

Regards,
Vladimir

0 Kudos
kiranatus
Beginner
670 Views
Thanks for your good explanation. I had it running. I have one more questions for this.

1. Does it support kernel size >32 for deconvLR? I tested a code with your suggestion. It crashes at kersize=32 but runs fine at kersize=31.

John

I'm actually having trouble getting it to work. Using DeconvLR with some kersize (not > 32, but with 72) it crashes. DeconvFFT and DeconLR both does not give some expecting results. Can you please give me a some listing of how to use them right. Also what is threshold range and how calculate FFTorder in DeconvFFT and iterations number in DeconvLR to get good res? How I shall calc threshold in both case?
I'm really don't get it how to use Deconv right.

Thanks in advance,
Sergey

0 Kudos
kiranatus
Beginner
670 Views
I mistaken. It crashes with kersize 32 for LR and 72 for FFT. Could you please give me some example? Also Deconv functions borrow a lot of processing time.So should be?

Sergey.
0 Kudos
golub973
Beginner
670 Views
I have spent a lot of time time trying to make convolution work but unsuccessfully.

IppiSize maxroi={Image32f.Width(),Image32f.Height()};
IppiSize roi={maxroi.width-kernelSize,maxroi.height-kernelSize};

CIppiImage Result32f(roi.width,roi.height,1,pp32f);

ippiDeconvLRInitAlloc_32f_C1R(&pDeconvLR, (const Ipp32f*) KernelImage32f.DataPtr(), kernelSize, maxroi,(Ipp32f) 0.0000001f);

ippiDeconvLR_32f_C1R((const Ipp32f*) Image32f.DataPtr(), Image32f.Step(), (Ipp32f*)Result32f.DataPtr(), Result32f.Step(), roi, 5, pDeconvLR);


is not working, for example. Intel documentation is insufficient.
Is there any chance that somebody knows how to do ipp convolution properly?

0 Kudos
Reply