- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello,

Given an Image how can I apply an IIR filter on it using Intel IPP?

What would be the fastest way?

The image is 32 Bit Float and I want the output to be 32 Bit float as well.

Thank You.

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Royi,

I don't know what is your goal. The easiest way is to apply ippsIIR in a loop "row-by-row". Guess you can't interpret an image as one continuous vector, therefore you should reset IIR delay line before each new row processing.

regards, Igor

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi,

I use Intel IPP because than I know the code take advantage of Vectorization and handling the Cache Strategy.

Doing on my own misses the point.

Unless you can show me the building blocks to do it which will work.

I wish you added IIR options to Image Processing IPP, better yet, just support any kind of filter (FIR and IIIR) by setting the a_k and b_k coefficients.

Also, why doesn't the 'SumWindowColumn' and 'SumWindowRow' doesn't support 32F images?

Could you add support + a normalization factor?

Thank You.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Royi,

The right way to submit a request for some feature that is necessary for your business but missing in the library - is to go to the Intel Premier Support (IPS) site and put your request there. Only official way guarantees that your request will be considered. IPP forum has another purpose and all requests here are considered only as a wish rather than a request.

BTW - are you going to implement recursive Gaussian filter via IIR? Just note that it makes sense only if radius of your filter is significantly greater than 16, otherwise separable filtering via FilterRow/ColumnPipeline is significantly faster...

regards, Igor

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Igor,

Yes, I want to speed up Gaussian Blur.

The problem is I want to do it on 32F Image.

What would you suggest?

I need speedup for STD of 3-8 which means radius of 'ceil(5 * 3-8)' nemaly radius of the Window of 15 - 40.

Thank You.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Royi,

something like this:

status = ippsIIRInitAlloc_32f( &pStatef, tapsf, 4, NULL );

status = ippsIIRInitAlloc_32f( &pStateb, tapsb, 4, NULL );

y = ippsMalloc_32f( IPP_MAX( iSize.width, iSize.height ));

z = ippsMalloc_32f( IPP_MAX( iSize.width, iSize.height ));

for( h = 0; h < iSize.height; h++ ){

x = (Ipp32f*)( (Ipp8u*)pTmp + h * tmpStep );

d = (Ipp32f*)( (Ipp8u*)pTmpD + h * tmpStep );

status = ippsIIR_32f( x, d, iSize.width, pStatef );

status = ippsFlip_32f( x, z, iSize.width );

status = ippsIIR_32f( z, y, iSize.width, pStateb );

status = ippsFlip_32f_I( y, iSize.width );

status = ippsAdd_32f_I( y, d,iSize.width );

status = ippsIIRSetDlyLine_32f( pStatef, NULL );

status = ippsIIRSetDlyLine_32f( pStateb, NULL );

}

ippiTranspose_32f_C1R( pTmpD, tmpDStep, pTmpT, tmpTStep, iSize );

for( h = 0; h < iSize.width; h++ ){

x = (Ipp32f*)( (Ipp8u*)pTmpT + h * tmpTStep );

d = (Ipp32f*)( (Ipp8u*)pTmpY + h * tmpYStep );

status = ippsIIR_32f( x, d, iSize.height, pStatef );

status = ippsFlip_32f( x, z, iSize.height );

status = ippsIIR_32f( z, y, iSize.height, pStateb );

status = ippsFlip_32f_I( y, iSize.height );

status = ippsAdd_32f_I( y, d,iSize.height );

status = ippsIIRSetDlyLine_32f( pStatef, NULL );

status = ippsIIRSetDlyLine_32f( pStateb, NULL );

}

ippiTranspose_32f_C1R( pTmpY, tmpYStep, pTmpD, tmpDStep, tSize );

x = (Ipp32f*)( (Ipp8u*)pTmpD + ((kernelSize-1)/2) * tmpDStep + ((kernelSize-1)/2) * sizeof( Ipp32f ));

ippiCopy_32f_C1R( x, tmpDStep, pDst, dstStep, roiSize );

tapsf - forward direction IIR taps, tapsb - backward direction IIR taps (BTW - which article/approach are you going to use?)

regards, Igor

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Igor,

I will certainly give it a try.

I implemented in MATLAB this article:

http://dsp.stackexchange.com/questions/22075/recursive-implementation-of-the-gaussian-filter

Nice trick to speed things up, is to use the IIR filter Initial Condition to avoid padding the matrix.

Thank You.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello Igor,

Does the calculation inside the filter is done in Double or does it depend on the input data?

I'm using data which is Single and I get different results than MATLAB Filter.

It seems MATLAB uses double for calculation inside the Filter itself.

Otherwise, I can't explain the difference.

Thank You.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Royi,

which one filter we are talking about now? If IIR - the is IIR64f_32f that uses 64f coefficients and converts all input data to 64f, performs all calculations in 64f, and converts result back to 32f. The word "different" doesn't provide a measure - the question is "how much"... The problem can be because of incorrect usage of IPP ("huge difference" - absolutely different result), or problem can be because of different order of internal calculations and because of this - difference in several ulps for the first points, that can increase up to infinity at the vector end (because IIR has Infinite impulse response). So could you be more specific?

regards, Igor

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Igor,

We're using "ippsIIR_32f" as suggested above.

The error I'm talking about is above 1e-2 (For input in the range [0, 1], as images).

Here are the coefficients:

vNumCoeff =

1.5064049e-05

vDenCoeff =

1.0000000 -2.9456182 2.8927090 -0.9470758

The input vector I use for instance is generated by 'rand(1000, 1)`.

What do you think?

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