これは正しいです?p1
はソース画像と宛先画像であり、グレースケール画像で作業していて「ith」チャンネルp2
にアクセスしているため、3 つのチャンネルはすべて同じ値を持っています。pp1[i]
for(int x=0;x<height;x++)
{
for(int y=0;y<width;y++)
{
pp1=pixel1+x*rowstride+y*n_channels;
pp2=pixel2+x*rowstride+y*n_channels;
for(int xx=0;xx<height;xx++)
{
for(int yy=0;yy<width;yy++)
{
real=real+pp1[0]*cos(2*3.14*yy*y/width+2*3.14*xx*x/height);
imag=imag-pp1[0]*sin(2*3.14*yy*y/width+2*3.14*xx*x/height);
}
}
temp=sqrt(real*real+imag*imag);
pp2[0]=(int)temp;
pp2[1]=(int)temp;
pp2[2]=(int)temp;
}
}