[問題] 二維影像的DFT
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
BCB
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
請問一下為何我做完DFT所得到的圖片跟原始影像一模一樣?
餵入的資料(Input):
64*64的bmp影像
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
void __fastcall TForm1::Button11Click(TObject *Sender)
{
Graphics::TBitmap *TheBitmap, *TempBitmap;
int Width,Height,x,y,u,v,real_max=0;
double real_min=1000000;
float a;
Byte *ptr1,*ptrt;
std::complex<double> B;
TempBitmap= new Graphics::TBitmap();
TheBitmap=Image1->Picture ->Bitmap;
TheBitmap->PixelFormat=pf8bit;
TempBitmap->Assign(TheBitmap);
TempBitmap->PixelFormat=pf8bit;
Width=TheBitmap->Width;
Height= TheBitmap->Height;
int aaa[64][64]={0};
for(v=0;v<(Height);v++)
{
ptr1=(Byte*) TheBitmap->ScanLine[v];
ptrt=(Byte*) TempBitmap->ScanLine[v];
for(u=0;u<(Width);u++)
{
B._M_re=0;
B._M_im=0;
for(x=0;x<(Width);x++)
{
for(y=0;y<(Height);y++)
{
a=2*M_PI*(((u*x)/Width)+((v*y)/Height));
B._M_re+=(ptr1[u]*cos(a)/(Width*Height));
B._M_im+=(-1)*(ptr1[u]*sin(a)/(Width*Height));
}
}
ptrt[u]=(int)B._M_re;
}
}
TheBitmap->Assign(TempBitmap);
Image1->Refresh();
delete TempBitmap;
}
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.118.141.34
※ 編輯: sd016808 來自: 140.118.141.34 (10/04 20:20)
→
10/04 23:22, , 1F
10/04 23:22, 1F
→
10/04 23:49, , 2F
10/04 23:49, 2F
→
10/05 13:33, , 3F
10/05 13:33, 3F
→
10/05 21:29, , 4F
10/05 21:29, 4F
→
10/07 01:08, , 5F
10/07 01:08, 5F
→
10/07 01:08, , 6F
10/07 01:08, 6F
→
10/07 01:09, , 7F
10/07 01:09, 7F
→
10/07 01:09, , 8F
10/07 01:09, 8F
→
10/07 15:54, , 9F
10/07 15:54, 9F
→
10/07 15:54, , 10F
10/07 15:54, 10F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章