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

FFT

erano111
Beginner
291 Views
Hello
I have two matrixs:
1- 8*8 block with a cross:
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
1 1 1 1 1 1 1 1
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
2- bigger BW image, assume dims = 200*300 pixels.
On matlab I'm using the line:
output = real(ifft2(fft2(BWimg) .* fft2(Block,200,300)));
I wish to apply it with IPP.
When I used ippiFFTFwd_RToPack and ippiFFTInv_PackToR for the big BW image the output is like input (this is OK) so the FFT and inverse FFT did the job.
When Iused ippiFFTFwd_RToPack and ippiFFTInv_PackToR for the small block (8*8) or even when I put the cross on bigger 200*300 image, the output is zeros.
Any suggestions?
Thanks,
Eran
0 Kudos
1 Reply
igorastakhov
New Contributor II
291 Views
Hello Eran,

what data type do you use? As you can see below - everything is OK for 32f:

#include

#include "ipps.h"

#include "ippi.h"

#define ORDER 3

#define SIZE 8

int main(){

Ipp32f cross[SIZE * SIZE] =

{ 0, 0, 0, 1, 0, 0, 0, 0,

0, 0, 0, 1, 0, 0, 0, 0,

0, 0, 0, 1, 0, 0, 0, 0,

1, 1, 1, 1, 1, 1, 1, 1,

0, 0, 0, 1, 0, 0, 0, 0,

0, 0, 0, 1, 0, 0, 0, 0,

0, 0, 0, 1, 0, 0, 0, 0,

0, 0, 0, 1, 0, 0, 0, 0 };

Ipp32f crossFFT_FWD[SIZE * SIZE], crossFFT_INV[SIZE * SIZE];

IppiFFTSpec_R_32f *ctxFft = NULL;

int FftBufSize, i, j;

Ipp8u* pMemBuf;

IppStatus status;

status = ippiFFTInitAlloc_R_32f( &ctxFft, ORDER, ORDER, IPP_FFT_DIV_INV_BY_N, ippAlgHintNone);

status = ippiFFTGetBufSize_R_32f( ctxFft, &FftBufSize );

pMemBuf = ippsMalloc_8u( FftBufSize );

status = ippiFFTFwd_RToPack_32f_C1R( cross, SIZE*sizeof(Ipp32f), crossFFT_FWD, SIZE*sizeof(Ipp32f), ctxFft, pMemBuf );

status = ippiFFTInv_PackToR_32f_C1R( crossFFT_FWD, SIZE*sizeof(Ipp32f), crossFFT_INV, SIZE*sizeof(Ipp32f), ctxFft, pMemBuf );

for( j = 0; j < SIZE; j++ ){

for( i = 0; i < SIZE; i++ ){

printf( " %.1f", crossFFT_INV[j * SIZE + i] );

}

printf("\n");

}

return 0;

}


Output:

0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0

0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0

0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0

1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0

0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0

0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0

0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0

Press any key to continue . . .

Regards ,
Igor

0 Kudos
Reply