[問題] 物件型別與引數型別不同 請問要怎麼宣告?

看板C_and_CPP (C/C++)作者 (蠢蛋必有傻福)時間12年前 (2013/07/04 20:07), 編輯推噓1(101)
留言2則, 1人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) CV++ 問題(Question): 這是原本我寫的一個程式,專題老師要求要把他變成windows form裡的一個功能。 點選後,將讀入的影像作影像處理的動作。 不過最後一步驟中picturebox2的物件型別為System::Windows::Forms::PictureBox ^ 而我一開始宣告的是 unsigned char * 想請教該如何做呢? 謝謝 程式碼(Code):(請善用置底文網頁, 記得排版) { unsigned char *image1; int width,height; width=pictureBox1->Size.Width; height=pictureBox1->Size.Height; image1=new unsigned char[width*height]; int x=150,y=150; //seed的x,y值 int thr=30; //門檻值 int seed,seed_value; int top=-1; int pos; stack<int> region; seed=x*width+y; seed_value=image1[seed]; region.push(seed); image1[seed]=255; while (!region.empty()) { pos=region.top(); image1[pos]=255; region.pop(); //左 if (abs(image1[pos-1]-seed_value)<thr && image1[pos-1]!=255) region.push(pos-1); //右 if (abs(image1[pos+1]-seed_value)<thr && image1[pos+1]!=255) region.push(pos+1); //下 if (abs(image1[pos-width]-seed_value)<thr && image1[pos-width]!=255) region.push(pos-width); //上 if (abs(image1[pos+width]-seed_value)<thr && image1[pos+width]!=255) region.push(pos+width); } pictureBox2->Image=image1; } 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.33.229.195 ※ 編輯: bachikevin 來自: 114.33.229.195 (07/04 20:07) ※ 編輯: bachikevin 來自: 114.33.229.195 (07/04 20:10)

07/04 20:26, , 2F
bitmap.aspx
07/04 20:26, 2F
文章代碼(AID): #1HrMLs9K (C_and_CPP)
文章代碼(AID): #1HrMLs9K (C_and_CPP)