- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page