Hi all! I am very noob in Qt and I'd like to get the fft of an image to do some edge detection with a high pass filter. I'm using Qt Creator 3 on Windows 8, and the code I'm posting crashes with this output:

Starting C:\Users\Appretince\Documents\NWU\4de Jaar\1ste Sem\EERI315(413)- Seinteorie II\Prak1\Qt\build-Part2_Image-Desktop_Qt_5_2_0_MinGW_32bit-Debug\debug\Part2_Image.exe...

The program has unexpectedly finished.

C:\Users\Appretince\Documents\NWU\4de Jaar\1ste Sem\EERI315(413)- Seinteorie II\Prak1\Qt\build-Part2_Image-Desktop_Qt_5_2_0_MinGW_32bit-Debug\debug\Part2_Image.exe crashed

It bombs out on the in and out declaration, I think it might be that I'm using the fftw_malloc wrong. This is my code:

QImage gray_image(ui->dspGrayscale->pixmap()->toImage());
ui->dspFourierMag->setPixmap(QPixmap::fromImage(gray_image));
ui->dspFourierPhs->setPixmap(QPixmap::fromImage(gray_image));

fftw_complex *in, *out;
fftw_plan p;
width=gray_image.width();
height=gray_image.height();
QImage fmag_image(gray_image.size(),QImage::Format_RGB32) ;
QImage fphs_image(gray_image.size(),QImage::Format_RGB32) ;
in=(fftw_complex *)fftw_malloc(sizeof(fftw_complex)*width*height);
out=(fftw_complex *)fftw_malloc(sizeof(fftw_complex)*width*height);

p=fftw_plan_dft_2d(width,height,in,out,FFTW_FORWAR D,FFTW_MEASURE);
k=0;

for(x=0;x<width;x++)
{
for(y=0;y<height;y++)
{
in[k][0]=gray_image.pixel(x,y); //Real part of input
in[k++][1]=0; //Imaginary part of input
}
}

fftw_execute(p);
k=0;

for(x=0;x<width;x++)
{
for(y=0;y<height;y++)
{
fpixel=out[k][0];
fmag_image.setPixel(x,y,fpixel);

fpixel=out[k++][1];
fphs_image.setPixel(x,y,fpixel);
}
}

fftw_destroy_plan(p);
ui->dspFourierMag->setPixmap(QPixmap::fromImage(fmag_image));
ui->dspFourierPhs->setPixmap(QPixmap::fromImage(fphs_image));

Any help would be much appreciated. Thank you.