-1
我需要将字节数组(byte[]
)(从java BufferedImage
)转换为EmguCV图像,而无需知道宽度和高度。将字节[]转换为不知道宽度和高度的图像EmguCV
byte[] bytes = [data];
Image<Gray, byte> image = new Image<Gray, byte>();
image.Bytes = bytes;
你能帮帮我吗?
我需要将字节数组(byte[]
)(从java BufferedImage
)转换为EmguCV图像,而无需知道宽度和高度。将字节[]转换为不知道宽度和高度的图像EmguCV
byte[] bytes = [data];
Image<Gray, byte> image = new Image<Gray, byte>();
image.Bytes = bytes;
你能帮帮我吗?
我发现这个 [http://www.emgu.com/forum/viewtopic.php?t=1057]
public Image<Bgr, Byte> byteArrayToImage(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Bitmap returnImage = Image.FromStream(ms);
return new Image<Bgr, byte>(returnImage);
// you probably need to clean up stuff like the bitmap and the stream...
}
在emgu论坛,并重新输入它来删除一个变量名错字。假设你的字节数组是一个标准的图像,看起来像你可以加载到一个标准的图像变量,会自动找出大小。从那里你可以将该图像传递给你的emgu图像的构造函数。
Works fine !!!但是,必须添加从图像到位图的投射: 位图returnImage =(位图)Image.FromStream(ms); – asegurpe