次のコードを使用して、FFTW と OpenCV を使用してフーリエ変換の視覚化を生成します。ただし、画像の上部のみを正しく取得しています。コードに何か問題があるかどうかを誰かが説明できますか?
fft は fftw_execute データを格納します。
int nl= fftvis->height; // number of lines
// total number of element per line
int nc= fftvis->width * fftvis->nChannels;
// get the pointer to the image buffer
unsigned char *data= reinterpret_cast<unsigned char *>
(fftvis->imageData);
k =0;
for (int x=1; x<nl; x++) {
for (int y=0; y<nc; y+= fftvis->nChannels) {
data[y] = 10*log(sqrt((pow(fft[k++][0],2) + pow(fft[k++][1],2))));
//k+=1;
} // end of line
data+= step;
// next line
}