繁体   English   中英

使用fftw和opencv进行ftf可视化

[英]fft visualization using fftw and opencv

即时通讯使用以下代码来生成使用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
}

您需要填充每个通道的RGB,但是当执行y+= fftvis->nChannels时,您将跳过通道数据。
同样, data+= step; 会跳过数据的step字节,如果正确对齐处理,则没有必要。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM