Reconstruction of the convolved output for fft2d

Hello,

I posted a relevant question about 2d convolution a

while ago but no one answered :(… so here’s another one!

Better typed I hope…

In the convolutionFFT2d example, how do we reconstruct the

convolved output after the ifft?

I mean in terms of indexing…

What I m doing now to put the results in the correct order

is something like this (this loop was already in the example

by the way) :

[codebox]for(y = 0; y < DATA_H; y++){

     for(x = 0; x < DATA_W; x++){

conv_GPU << h_ResultGPU[y * FFT_W + x].x << “,” << endl;

    }

}[/codebox]

[i]where h_‘ResultGPU’ is the complex array that

contains the results and ‘conv_GPU’ is an ofstream

that writes the values to a text file

which i plot in matlab.

DATA_W * DATA_H is the length of the largest

of the two inputs so i think it reads all the components

I’m interested in from the output.

For both the signals I’m using sizes like 256x256, 512x256, 1024x512 etc.

Quite large…[/i]

The result is not correct though…

I m also doing the comparison with the CPU convolution

and it prints out “TEST PASSED” !!??

I really can’t get my head around this

and I ve tried so many things…

It basically looks as if some blocks of samples in the output,

have a different offset rather than zero…which produces a really

bad distortion.

[u]Do i need to do any more normalization or special indexing

to obtain the correct output values in the correct order

(apart from times 1/N which is in the example anyway…)?[/u]

Is this convolution taking care of all elements (rows and columns)?

Hope there’s someone that can

help a bit with these stuff please?

Any old signal processing wizard? :geek:

Sorries for the number questions…

P.S.

I ve attached a plot of a part of the 2d convolution result

and another of a part of the 1d convolution result

(which is working fine), in case you notice

something in it visually…any common errors.

Both convolutions use the same inputs and same

kernels but they don’t look the same at all.

Thanks for looking,

Filippos

Hello,

I have this problem too.

How can I solve this?

my test Matrix is:

Image:
1 1 1 1 1
1 1 1 1 1
1 1 0 1 1
1 1 1 1 1
1 1 1 1 1
Kernel:
1 1 1
1 1 1
1 1 1

And I get this values with this cicle.

8 8 8 9 9
8 8 8 9 9
8 8 8 9 9
9 9 9 9 9
9 9 9 9 9

for(y = 0; y < DATA_H; y++){
   for(x = 0; x < DATA_W; x++){
       cout << h_ResultGPU[y * FFT_W + x] << " " << endl;
   }
   cout << endl;
}

Seems correct values in wrong place.
the correct is

9 9 9 9 9
9 8 8 8 9
9 8 8 8 9
9 8 8 8 9
9 9 9 9 9

someone know the right way to reconstruct this result?

Problem Solved.

I had one error in Kernel centre indexes.

KernelX and KernelY need to be Kernel center location.