Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

## FilterWiener documentation Beginner
139 Views

Hi,

I am refering to https://software.intel.com/en-us/ipp-dev-reference-filterwiener where is described how Wiener Filter is computed using local mean and variance.
I wonder if final computation: Y(i,j) = m(i,j) + (s(i,j)^2-v) / s(i,j)^2 * [X(i,j) - m(i,j)] is there correctly described ?
And what happens if s(i,j) = 0 as there is division by zero ?

Because when I try do it in myself I get other results as when I call this function.
It seems me, that there is used: Y(i,j) = m(i,j) + s(i,j)^2 / (s(i,j)^2 + v) * [X(i,j) - m(i,j)]

Thanks

3 Replies Employee
139 Views

IPP implementation is identical to Matlab one - you can check formulas in Matlab "help" available online. As regarding division by zero - it can .occur only in case if all the image is filled with some const and auto-detected noise is less than IPP_EPS_32F - this "bad" case is checked internally and if true - filtering is substituted with the simple copy function.

regards, Igor Beginner
139 Views

Thank you Igor.

Yes I found it : https://www.mathworks.com/help/images/ref/wiener2.html#f6-72193
Only small formal note to formula: in numerator is "sigma" with "i,j" indexes, but in denominator is only "sigma" witout indexes, which is bit confusing as far as they both refer to same value.

Dividing by zero can occurs in any uniform region which is same size as kernel, where his variation is equal zero, does not ? As "sigma" in denominator represents local variance and local variance can be zero not only for uniform image, but also for image where uniform regions exists ... or I miss something ? Employee
139 Views

"Dividing by zero can occurs in any uniform region which is same size as kernel, where his variation is equal zero, does not ?" - Yes, may be, will check on some synthetic image, but haven't ever faced with such case on the real images. Currently IPP doesn't perform such check - below is a fragment of px code:

#define genWiener_C1( flvr, iT )\
static void owniWiener_##flvr##_C1R( iT* pS1, Ipp32f* pM, Ipp32f* pV,\
iT* pD, Ipp32f shum, int width )\
{\
int w;\
for( w = 0; w < width; w++ ){\
pD = (iT)( pM + (( pV - shum ) / pV ) * ( pS1 - pM ));\
}\
}

genWiener_C1( 8u32f, Ipp8u )
genWiener_C1( 16s32f, Ipp16s )
genWiener_C1( 32f, Ipp32f )

regards, Igor 