請教這錯誤訊息 |
尚未結案
|
mauricechen
一般會員 發表:22 回覆:8 積分:6 註冊:2005-02-17 發送簡訊給我 |
|
sew
一般會員 發表:2 回覆:54 積分:21 註冊:2003-08-25 發送簡訊給我 |
請參考
http://delphi.ktop.com.tw/topic.php?topic_id=52951
http://delphi.ktop.com.tw/topic.php?topic_id=47038
http://delphi.ktop.com.tw/topic.php?topic_id=46325
等文章
若不能解決您的問題,再po上來討論囉 加油!
------
加油! |
mauricechen
一般會員 發表:22 回覆:8 積分:6 註冊:2005-02-17 發送簡訊給我 |
|
sew
一般會員 發表:2 回覆:54 積分:21 註冊:2003-08-25 發送簡訊給我 |
|
mauricechen
一般會員 發表:22 回覆:8 積分:6 註冊:2005-02-17 發送簡訊給我 |
|
sew
一般會員 發表:2 回覆:54 積分:21 註冊:2003-08-25 發送簡訊給我 |
|
mauricechen
一般會員 發表:22 回覆:8 積分:6 註冊:2005-02-17 發送簡訊給我 |
|
poaivy
中階會員 發表:40 回覆:78 積分:53 註冊:2004-08-09 發送簡訊給我 |
妳好我看了你的程式後做了以下修改
int Threshold; Graphics::TBitmap *TheBitmap,*TempBitmap; Byte *ptr,*tptr; TheBitmap=Image1->Picture->Bitmap; TheBitmap->PixelFormat = pf32bit; // TempBitmap=Form1->OrgBitmap; TempBitmap=new Graphics::TBitmap(); TempBitmap->Width= TheBitmap->Width; TempBitmap->Height= TheBitmap->Height; TempBitmap->PixelFormat = pf32bit; //------------------ Threshold=(int)ScrollBar1->Position; //-------------------執行 Thresholding----------------------------------- for (int y=0; y < TheBitmap->Height; y ) { tptr = (Byte*)TheBitmap->ScanLine[y]; ptr = (Byte*)TempBitmap->ScanLine[y]; for (int x=0; x < TheBitmap->Width; x ) { if (tptr[x*4] < Threshold) ptr[x*4]=ptr[x*4 1]=ptr[x*4 2]=ptr[x*4 3]=0; else ptr[x*4]=ptr[x*4 1]=ptr[x*4 2]=ptr[x*4 3]=255; } } Image2->Picture->Assign(TempBitmap); delete TempBitmap;首先再FORM上放置一個ScrollBar以及兩個image在第一張上面先讀進來一張圖片,可以藉由ScrollBar改變Threshold的值。不知道您是否需要這種功能? 做些許修改即可達到你所需要的結果。 回答不好請多多包含!! |
sew
一般會員 發表:2 回覆:54 積分:21 註冊:2003-08-25 發送簡訊給我 |
|
mauricechen
一般會員 發表:22 回覆:8 積分:6 註冊:2005-02-17 發送簡訊給我 |
|
mauricechen
一般會員 發表:22 回覆:8 積分:6 註冊:2005-02-17 發送簡訊給我 |
|
sew
一般會員 發表:2 回覆:54 積分:21 註冊:2003-08-25 發送簡訊給我 |
TempBitmap->Width= 200
TheBitmap->Width=288;
TempBitmap->Height=200
TheBitmap->Height=352;
因為您的TempBitmap->Width是等於Image1->Width
其中Image1->Width與Image1->Height是在物件中設定的
雖然你沒有寫出來,但是您在設定物件時bcb就會幫您寫進去了 加油! 發表人 - sew 於 2005/04/16 12:44:33
------
加油! |
sew
一般會員 發表:2 回覆:54 積分:21 註冊:2003-08-25 發送簡訊給我 |
參考一下吧
//------------------------------------------------------------------- void __fastcall TThresholdDlg::ScrollBar1Change(TObject *Sender) { int Threshold; Graphics::TBitmap *TheBitmap,*TempBitmap; Byte *ptr,*tptr; ThresholdDlg->Image1->Height=Form1->Image1->Height; ThresholdDlg->Image1->Width=Form1->Image1->Width; TheBitmap=Image1->Picture->Bitmap; TheBitmap->PixelFormat = pf32bit; TempBitmap=Form1->Image1->Picture->Bitmap; TempBitmap->PixelFormat = pf32bit; //------------------ Threshold=(int)ScrollBar1->Position; //-------------------執行 Thresholding----------------------------------- for (int y=0; y < TheBitmap->Height; y ) { ptr = (Byte*)TheBitmap->ScanLine[y]; tptr= (Byte*)TempBitmap->ScanLine[y]; for (int x=0; x < TheBitmap->Width*4; x ) { if (tptr[x] < Threshold) ptr[x]=0; else ptr[x]=255; } } //-------------------顯示圖像--------------------------------------- Repaint(); //--------------------------------------------------------- }加油!
------
加油! |
mauricechen
一般會員 發表:22 回覆:8 積分:6 註冊:2005-02-17 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |