How to multiply 2 fftw_complex arrays

我的未来我决定 提交于 2019-12-11 06:39:57

问题


Heading

Hi, I'm trying to multiply two arrays of fftw_complex types, how should i do it?

Here's the code:

fftw_complex *rInF, *gInF, *bInF;
fftw_complex *rOutF, *gOutF, *bOutF;
for(int i=0;i<m_image->width()*m_image->height();i++)
{


    //realis
    rInF[i][0] = rIn[i][0]*rInMask[i][0] - rIn[i][1]*rInMask[i][1];
    gInF[i][0] = gIn[i][0]*gInMask[i][0] - gIn[i][1]*gInMask[i][1];
    bInF[i][0] = bIn[i][0]*bInMask[i][0] - bIn[i][1]*bInMask[i][1];
    //imaginalis
    rInF[i][1] = rIn[i][1]*rInMask[i][0] + rIn[i][0]*rInMask[i][1];
    gInF[i][1] = gIn[i][1]*gInMask[i][0] + gIn[i][0]*gInMask[i][1];
    bInF[i][1] = bIn[i][1]*bInMask[i][0] + bIn[i][0]*bInMask[i][1];
}

I have 2 arrays for each RGB channel(from two images which give us- 2R,2G,2B).

rIn,gIn,bIn and rInMask,gInMask,bInMask are OK. I want to multiply two complex numbers and assign the vaule of multiplication to the rInF, gInF and bInF.

Later I'll make a backward fftw and have convolution in frequency domain.(<- that's not important).

The application just shuts down and doesn't give me any errors.

来源:https://stackoverflow.com/questions/14802180/how-to-multiply-2-fftw-complex-arrays

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!