2011-08-23 43 views
0

可能重複:
Image conversion in OpenCV C#無法識別的或不支持的陣列型例外

WeightedImg.Bitmap.SetPixel(x, y,Color.FromArgb((int)Math.Ceiling(color * R), (int)Math.Ceiling(color * G),(int)Math.Ceiling(color * B)));

這行代碼產生上述例外..任何人知道的溶液? 和這個例外是什麼意思? 非常感謝

+1

您能否請您發佈例外情況? – gyurisc

+1

你的問題可能出現在你沒有包含在你的問題中,你將表達式的結果賦值給一個變量。嘗試檢查[這個問題](http://stackoverflow.com/questions/3579332/an-exception-on-opencv-matrix功能) –

+1

嘗試將該行分成更多的行使用更多的變量和調試,看看是否有奇怪的東西出現在那裏 – mtijn

回答

0

您需要設置alpha通道,如* 一個 * RGB 設置的alpha通道的顏色

+0

不,這不是問題.. :) –

0

你真的需要給我們更多的去努力的透明度。那些變量是如何定義的?什麼是異常和堆棧跟蹤打印?這相當於您發佈的內容,例如,作爲我機器上的一個魅力

 Bitmap b = new Bitmap("somefile.bmp"); 
     double color = 1, R = 2, G = 3, B = 4; 
     int x = 1, y = 1; 
     b.SetPixel(x, y, Color.FromArgb((int)Math.Ceiling(color * R), (int)Math.Ceiling(color * G), (int)Math.Ceiling(color * B))); 
相關問題