[影像處理]程式問題?? |
|
parano
一般會員 發表:14 回覆:6 積分:4 註冊:2007-02-02 發送簡訊給我 |
<textarea class="cpp" rows="10" cols="60" name="code">
Image1->Picture->Bitmap->PixelFormat=pf24bit;
float gray_level[256]; //宣告要排放gray等級個數的陣列
Graphics::TBitmap *BMP = new Graphics::TBitmap();
Byte *ptr=NULL; //??為何要令為NULL.....第一個問題
BMP->Assign(Image1->Picture->Bitmap);
for(int j=0;j<256;j )
gray_level[j]=0;
for(int y=0;yHeight;y ) //把值放入gray_level[]內
{
ptr = (Byte *)BMP->ScanLine[y];
for(int x=0;xWidth;x )
{
int gray=0.3*ptr[x*3] 0.3*ptr[x*3 1] 0.4*ptr[x*3 2];
gray_level[gray]=gray_level[gray] 1;
}
}
for(int i=0;i<256;i )
{gray_level[i]=gray_level[i]/((Image1->Picture->Width)*(Image1->Picture->Height)); //??此段的意思是?...第二個問題
}
for(int i=1;i<256;i )
{
gray_level[i]=gray_level[i] gray_level[i-1]; //??此段的意思是?...第三個問題
}
for(int i=0;i<256;i )
{
gray_level[i]=gray_level[i]*255; //??此段的意思是...第四個問題
}
for(int y=0;y
|
parano
一般會員 發表:14 回覆:6 積分:4 註冊:2007-02-02 發送簡訊給我 |
<textarea class="cpp" rows="10" cols="60" name="code">
void __fastcall TForm1::Button4Click(TObject *Sender)
{
Graphics::TBitmap *TheBitmap;
Graphics::TBitmap *Bmp = new Graphics::TBitmap();
Byte *ptr,*mptr,*u1ptr,*u2ptr,*d1ptr,*d2ptr;
int up1,up2,down1,down2,left1,left2,right1,right2;
float Gou;
Bmp->PixelFormat=pf24bit;
Bmp->Assign(Image1->Picture->Bitmap);
for(int y=0;y
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
|
六尾犬
一般會員 發表:0 回覆:9 積分:11 註冊:2006-09-12 發送簡訊給我 |
試問...
如果你的圖大小為320*240 y剛好等於239 down2的值為何? ===================引 用 文 章=================== <textarea class="cpp" rows="10" cols="60" name="code">void __fastcall TForm1::Button4Click(TObject *Sender) { Graphics::TBitmap *TheBitmap; Graphics::TBitmap *Bmp = new Graphics::TBitmap(); Byte *ptr,*mptr,*u1ptr,*u2ptr,*d1ptr,*d2ptr; int up1,up2,down1,down2,left1,left2,right1,right2; float Gou; Bmp->PixelFormat=pf24bit; Bmp->Assign(Image1->Picture->Bitmap); for(int y=0;y |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |