- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to filter RGB noisy image (8u_C3) with wiener filter in IPP.
There are many sample codes of wiener filtering gray image. but I cann't find sample code for color image.
Sample Code below is wiener filtering in IPP manual.
In the sample code, there is no part for image border. There is no image border for filtering.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void func_wiener()
{
Ipp32f pSrc[256*256];
Ipp32f pDst[256*256];
int srcStep = 256*sizeof(Ipp32f);
int dstStep = 256*sizeof(Ipp32f);
IppiSize roiSize = {256, 256};
IppiSize dstRoiSize = {256, 256};
IppiSize maskSize = {3, 3};
int pBufferSize;
int channels = 1;
unsigned int pSeed = 3;
IppiPoint anchor = {1, 1};
Ipp32f noise[1] = {0.5};
ippiImageJaehne_32f_C1R(pSrc, srcStep, roiSize); // source image
//source image + RandUniform noise
ippiAddRandUniform_Direct_32f_C1IR(pSrc, srcStep, roiSize, 0, 1, &pSeed);
ippiFilterWienerGetBufferSize( dstRoiSize, maskSize, channels,
&pBufferSize);
Ipp8u* pBuffer = ippsMalloc_8u(pBufferSize);
ippiFilterWiener_32f_C1R( pSrc, srcStep, pDst, dstStep, dstRoiSize,
maskSize, anchor, noise, pBuffer);
ippsFree(pBuffer);
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I write the code below... but the code is not working. Compling OK, But not working.
Could you tell me theerror of my code ?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
IppiSize psize_4k;
psize_4k.height = 2160;
psize_4k.width = 3840;
IppiSize maskSize={3,3};
IppiPoint anchor={1,1};
Ipp32f noise[3] ={0.5};
Ipp8u *pimg_dst1 = (Ipp8u*)dst1->imageData;
Ipp8u *pimg_dst2 = (Ipp8u*)dst2->imageData;
ippiFilterWienerGetBufferSize(psize_4k, maskSize, 3, &pBufferSize);
Ipp8u *pBuffer = ippsMalloc_8u(pBufferSize);
ippiFilterWiener_8u_C3R(pimg_dst1, psize_4k.width*3, pimg_dst2, psize_4k.width*3, psize_4k, maskSize, anchor, noise, pBuffer);
ippsFree(pBuffer);
There are many sample codes of wiener filtering gray image. but I cann't find sample code for color image.
Sample Code below is wiener filtering in IPP manual.
In the sample code, there is no part for image border. There is no image border for filtering.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void func_wiener()
{
Ipp32f pSrc[256*256];
Ipp32f pDst[256*256];
int srcStep = 256*sizeof(Ipp32f);
int dstStep = 256*sizeof(Ipp32f);
IppiSize roiSize = {256, 256};
IppiSize dstRoiSize = {256, 256};
IppiSize maskSize = {3, 3};
int pBufferSize;
int channels = 1;
unsigned int pSeed = 3;
IppiPoint anchor = {1, 1};
Ipp32f noise[1] = {0.5};
ippiImageJaehne_32f_C1R(pSrc, srcStep, roiSize); // source image
//source image + RandUniform noise
ippiAddRandUniform_Direct_32f_C1IR(pSrc, srcStep, roiSize, 0, 1, &pSeed);
ippiFilterWienerGetBufferSize( dstRoiSize, maskSize, channels,
&pBufferSize);
Ipp8u* pBuffer = ippsMalloc_8u(pBufferSize);
ippiFilterWiener_32f_C1R( pSrc, srcStep, pDst, dstStep, dstRoiSize,
maskSize, anchor, noise, pBuffer);
ippsFree(pBuffer);
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I write the code below... but the code is not working. Compling OK, But not working.
Could you tell me theerror of my code ?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
IppiSize psize_4k;
psize_4k.height = 2160;
psize_4k.width = 3840;
IppiSize maskSize={3,3};
IppiPoint anchor={1,1};
Ipp32f noise[3] ={0.5};
Ipp8u *pimg_dst1 = (Ipp8u*)dst1->imageData;
Ipp8u *pimg_dst2 = (Ipp8u*)dst2->imageData;
ippiFilterWienerGetBufferSize(psize_4k, maskSize, 3, &pBufferSize);
Ipp8u *pBuffer = ippsMalloc_8u(pBufferSize);
ippiFilterWiener_8u_C3R(pimg_dst1, psize_4k.width*3, pimg_dst2, psize_4k.width*3, psize_4k, maskSize, anchor, noise, pBuffer);
ippsFree(pBuffer);
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I would refer you to IPP documentation regarding Wiener filter, which include sample code. You need to pay attanetion that IPP functions required border values to be available in the memory. That means you need to build border around your image before apply IPP operation required border pixels.
Please also pay attention that step parameter for 3-channels images not always equivalent 3*width. It should take into account padding bytes which your memory buffer where you keep image may have. For example, BMP format requires image rows start from even address, this cause padding bytes at the end of row for some image sizes.
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply.
But I can not find border for filtering in sample code of IPP manual.
Sample code for Wiener filter is as below. There is no image border for filtering.
I guess the function - 'ippiFilterWienerGetBufferSize' is tocalculate the momory size for image border.
Please reply !
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void func_wiener()
{
Ipp32f pSrc[256*256];
Ipp32f pDst[256*256];
int srcStep = 256*sizeof(Ipp32f);
int dstStep = 256*sizeof(Ipp32f);
IppiSize roiSize = {256, 256};
IppiSize dstRoiSize = {256, 256};
IppiSize maskSize = {3, 3};
int pBufferSize;
int channels = 1;
unsigned int pSeed = 3;
IppiPoint anchor = {1, 1};
Ipp32f noise[1] = {0.5};
ippiImageJaehne_32f_C1R(pSrc, srcStep, roiSize); // source image
//source image + RandUniform noise
ippiAddRandUniform_Direct_32f_C1IR(pSrc, srcStep, roiSize, 0, 1, &pSeed);
ippiFilterWienerGetBufferSize( dstRoiSize, maskSize, channels,
&pBufferSize);
Ipp8u* pBuffer = ippsMalloc_8u(pBufferSize);
ippiFilterWiener_32f_C1R( pSrc, srcStep, pDst, dstStep, dstRoiSize,
maskSize, anchor, noise, pBuffer);
ippsFree(pBuffer);
}
But I can not find border for filtering in sample code of IPP manual.
Sample code for Wiener filter is as below. There is no image border for filtering.
I guess the function - 'ippiFilterWienerGetBufferSize' is tocalculate the momory size for image border.
Please reply !
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void func_wiener()
{
Ipp32f pSrc[256*256];
Ipp32f pDst[256*256];
int srcStep = 256*sizeof(Ipp32f);
int dstStep = 256*sizeof(Ipp32f);
IppiSize roiSize = {256, 256};
IppiSize dstRoiSize = {256, 256};
IppiSize maskSize = {3, 3};
int pBufferSize;
int channels = 1;
unsigned int pSeed = 3;
IppiPoint anchor = {1, 1};
Ipp32f noise[1] = {0.5};
ippiImageJaehne_32f_C1R(pSrc, srcStep, roiSize); // source image
//source image + RandUniform noise
ippiAddRandUniform_Direct_32f_C1IR(pSrc, srcStep, roiSize, 0, 1, &pSeed);
ippiFilterWienerGetBufferSize( dstRoiSize, maskSize, channels,
&pBufferSize);
Ipp8u* pBuffer = ippsMalloc_8u(pBufferSize);
ippiFilterWiener_32f_C1R( pSrc, srcStep, pDst, dstStep, dstRoiSize,
maskSize, anchor, noise, pBuffer);
ippsFree(pBuffer);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
did you noticed IPP image-processing-functions sample where you may find call of wiener filter with color images?
Regards,
Vladimir
did you noticed IPP image-processing-functions sample where you may find call of wiener filter with color images?
Regards,
Vladimir
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page