Hi,
I’m tring to draw out the output from a 2d R2C CUFFT as a bitmap but I’m getting a strange result. I know that to get the full output I need to reconstruct the redundant coefficients, but even the basic output from cufftExecR2C() is displaying incorrectly. As you can see it’s getting skewed by two pixels on each row (the points should form vertical columns). The data is thresholded which is why there are no grey tones, but other than that there is no processing being done.
The function FFT() opens the input image, does the FFT and takes the magnitude of the (complex) result, and returns that.
float *FFT_out;
FFT_out = FFT(512, 512);
int array_size = 512*512;
int *FFT_out_int; //new FFT output data which will all be between 0 and 255
FFT_out_int = (int*)malloc(array_size * sizeof(int));
for (int i = 0; i < array_size; i++)
{
if (FFT_out[i] < 500)
FFT_out_int[i] = 0;
else
FFT_out_int[i] = 255;
}
//create bitmap from FFT output data:
Bitmap^ FFT_out_bmp = gcnew Bitmap(512,512);
int i = 0;
Color pixel_colour;
for (int r = 0; r < 512 ; r++)
{
for (int c = 0; c < 512; c++)
{
pixel_colour = Color::FromArgb(FFT_out_int[i], FFT_out_int[i], FFT_out_int[i]);
FFT_out_bmp->SetPixel(c,r,pixel_colour);
++i;
}
}
FFT_out_bmp->Save("C:\...\output_FFT.bmp");
I have no idea what is going wrong, but if anyone else has any thoughts or has ever seen this before I’d really appreciate hearing from you.
Many thanks,
Andy
