矩形比對 |
尚未結案
|
yplin
一般會員 發表:9 回覆:16 積分:5 註冊:2004-08-07 發送簡訊給我 |
|
1666362
初階會員 發表:66 回覆:124 積分:43 註冊:2004-07-07 發送簡訊給我 |
可以用NCC的方式 下面程式碼 您參考看看
int M, N, K, L; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { bmp1=new Graphics::TBitmap(); bmp2=new Graphics::TBitmap(); bmp2->PixelFormat=pf24bit; bmp2->Assign(Image2->Picture); bmp2->Width=Image2->Width; bmp2->Height=Image2->Height; } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { if (OpenPictureDialog1->Execute()) { Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName); bmp1->Assign(Image1->Picture); bmp1->PixelFormat=pf24bit; bmp1->Width=Image1->Width; bmp1->Height=Image1->Height; } } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { M=Image1->Height; N=Image1->Width; K=Image2->Height; L=Image2->Width; double w=0; static double G[48][48]; byte *ptr; for(int y=0; y發表人 - 1666362 於 2005/02/03 21:55:49 發表人 - 1666362 於 2005/02/03 21:56:32 |
yplin
一般會員 發表:9 回覆:16 積分:5 註冊:2004-08-07 發送簡訊給我 |
|
hopgins
一般會員 發表:4 回覆:3 積分:1 註冊:2006-12-20 發送簡訊給我 |
您好!!我trace過您的程式有些問題,不知道有人能夠幫忙一下嘛??
我的templete的大小是96*96 待測 image是640*480 我所trace的code如下,當成是跑到下面要估算相關度時卻會出現 DOMAIN error。 不知道到底是哪出錯!!我覺得這隻code應該沒問題!!想請有心人幫忙解決 謝謝 void __fastcall TForm1::Button2Click(TObject *Sender) { Graphics::TBitmap *bmp1=new Graphics::TBitmap(); Graphics::TBitmap *bmp2=new Graphics::TBitmap(); bmp2->PixelFormat=pf24bit; bmp2->Assign(Image2->Picture->Bitmap); bmp2->Width=Image2->Width; bmp2->Height=Image2->Height; bmp1->Assign(Image1->Picture->Bitmap); bmp1->PixelFormat=pf24bit; bmp1->Width=Image1->Width; bmp1->Height=Image1->Height; M=Image1->Height; N=Image1->Width; K=Image2->Height; L=Image2->Width; double w=0; static double G[96][96]; Byte *ptr; for(int y=0; y { ptr = (Byte*)bmp2->ScanLine[y]; for(int x=0; x w = (double)(ptr[x] ptr[x 1] ptr[x 2])/3; G[x/3][y] = (double)(ptr[x] ptr[x 1] ptr[x 2])/3; } } w /= ( K*L ); static double F[640][480]; static double C[640-96][480-96]={0}; for(int y=0; y ptr = (Byte*)bmp1->ScanLine[y]; for(int x=0; x } double a=0; double b=0; double c=0; double f=0; double max=0; for(int j=0; j for(int i=0; i f=0; for(int y=j; y<(j K); y ) { for(int x=i; x<(i L); x ) f =F[x][y]; f/=(K*L); } for(int y=-48;y<=48;y ) { for(int x=-48;x<=48;x ) { a = (G[x][y] - w)*(F[x i][y j] - f); b = (G[x][y] - w)*(G[x][y] - w); c = (F[x i][y j] - f)*(F[x i][y j] - f); } } Image1->Canvas->Pen->Color=clRed; Image1->Canvas->Rectangle(i,j,i 96,j 96); } } |
lichart
一般會員 發表:0 回覆:4 積分:5 註冊:2005-09-01 發送簡訊給我 |
|
jenglin
一般會員 發表:45 回覆:32 積分:15 註冊:2006-10-08 發送簡訊給我 |
|
yulong375
一般會員 發表:2 回覆:22 積分:19 註冊:2007-03-15 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |