動態邊緣化 |
|
poaivy
中階會員 發表:40 回覆:78 積分:53 註冊:2004-08-09 發送簡訊給我 |
參考了版上多位大大的發表寫出來的^^
使用TVideoCapture元件所寫
第一次發表請多多指教
附加檔案:74102_-動態邊緣化.rar
|
fusung
中階會員 發表:26 回覆:169 積分:99 註冊:2003-11-25 發送簡訊給我 |
做了些修改,各位可以參考看看。
int __fastcall TForm1::Gx(int i,int j) { //sobel-x int p[10]; //考慮邊界 if (i==0) i=1; if (i== Image1->Height) i = Image1->Height - 1; if (j==0) j=1; if (j== Image1->Width) j = Image1->Width - 1; p[1]=p1[i-1][j-1]; p[2]=p1[i][j-1]; p[3]=p1[i+1][j-1]; p[4]=p1[i-1][j]; p[5]=p1[i][j]; p[6]=p1[i+1][j]; p[7]=p1[i-1][j+1]; p[8]=p1[i][j+1]; p[9]=p1[i+1][j+1]; int GX=((p[7]+(p[8]*2)+p[9])-(p[1]+(p[2]*2)+p[3])); if (GX>255) return 255; else return (abs(GX)); } //--------------------------------------------------------------------------- int __fastcall TForm1::Gy(int i,int j) { //sobel-y int p[10]; //考慮邊界 if (i==0) i=1; if (i== Image1->Height) i = Image1->Height - 1; if (j==0) j=1; if (j== Image1->Width) j = Image1->Width - 1; p[1]=p1[i-1][j-1]; p[2]=p1[i][j-1]; p[3]=p1[i+1][j-1]; p[4]=p1[i-1][j]; p[5]=p1[i][j]; p[6]=p1[i+1][j]; p[7]=p1[i-1][j+1]; p[8]=p1[i][j+1]; p[9]=p1[i+1][j+1]; int GY=((p[3]+(p[6]*2)+p[9])-(p[1]+(p[4]*2)+p[7])); if (GY>255) return 255; else return (abs(GY)); } //--------------------------------------------------------------------------- void __fastcall TForm1::capBitmapGrabbed(TCapturedBitmap *CapturedImage) { switch (RadioGroup1->ItemIndex) { case 0: Byte *ptr; for (int i=0;i/*
------
The first step toward proving things for yourself is to understand how others have done it before! |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |