統計Pixel |
|
gruza
一般會員 發表:1 回覆:0 積分:0 註冊:2006-10-25 發送簡訊給我 |
|
n890377
一般會員 發表:17 回覆:16 積分:21 註冊:2006-07-13 發送簡訊給我 |
計算黑點pixel:
Graphics::TBitmap *TheBitmap, *TempBitmap; TempBitmap = new Graphics::TBitmap(); TempBitmap =Image1->Picture->Bitmap; Byte *ptr_s; int g_s,j,i,line,g_s1,g_s2; int cxy=0,sx=0,sy=0,sum=0; AnsiString ss; TempBitmap->PixelFormat = pf24bit; for (j=0; j { ptr_s = (Byte *)Image1->Picture->Bitmap->ScanLine[j]; for (i=0; i { g_s = ptr_s[i*3 2]; g_s1= ptr_s[i*3 1]; g_s2= ptr_s[i*3]; if(g_s2==0&& g_s1==0&& g_s==0) { sx=sx i; sy=sy j; sum=sum 1; cxy ; i Image1->Picture->Bitmap->Width; //紀錄座標之後讓i大於判斷式跳出迴圈 j Image1->Picture->Bitmap->Height;//紀錄座標之後讓j大於判斷式跳出迴圈 } } } Form1->Edit1->Text=sum;
------
. |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |