2014-03-02 69 views
-1

這是我的代碼如何從二進制圖像

Image<Gray, Byte> image = new Image<Gray, byte>(Openfile.FileName); 
pictureBox1.Image = image.ToBitmap(); 
image1 = image1.ThresholdBinary(new Gray(50), new Gray(255)); 

我從我的桌面打開圖像並將其轉換爲灰度,然後二進制值獲得1或0。 我想從二值圖像中獲取值1或0以存儲在矩陣中。 我該怎麼做?我正在使用emgucv。

回答

0

你可以這樣做:

Gray byCurrent = image1[x, y]; 

或者這樣:

Byte byCurrent = image1.Data[x, y, 0]; 

但是,你將有0或255的值改爲0和1