2014-03-02 121 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