メモリ ストリーム (バイト) で jpeg を提供するソースがあります。
System.Drawing.Image に変換できますが、Emgu Image に変換する
方法がわかりません。
Emgu Image への直接変換は可能でしょうか?
私は VS2010 で C# を使用しています。
ありがとう。
SW
12307 次
4 に答える
2
最初に System.Drawing.Image オブジェクトを Bitmap に変換してから、そのビットマップで Emgu.CV.Image を作成できます。コードは次のとおりです。
System.Drawing.Image image;
Bitmap bmpImage = new Bitmap(image);
Emgu.CV.Image = new Emgu.CV.Image<Bgr, Byte>(bmpImage);
メモリ ストリームがある場合は、メモリ ストリームから直接ビットマップを取得できます。
MemoryStream ms;
Bitmap bmpImage = new Bitmap(ms);
Emgu.CV.Image = new Emgu.CV.Image<Bgr, Byte>(bmpImage);
于 2011-06-24T15:50:34.963 に答える
1
次のようなコードを使用して、配列バイトをEmgu Image <、>に変換できます...
public Image<Bgr, Byte> CreateImageFromBytesArray(byte[] bytes)
{
MemoryStream ms = new MemoryStream(bytes);
Bitmap bmpImage = (Bitmap) Image.FromStream(ms);
return new Image<Bgr, byte>(bmpImage);
}
于 2011-03-29T23:31:06.003 に答える
0
ps2010 ソリューションを使用して、http から画像を取得するためにこれを書きました。
try
{
using (WebClient client = new WebClient())
{
data = client.DownloadData("http://LINK TO PICTURE");
}
}
catch (Exception ex)
{
// error treatment
}
MemoryStream ms = new MemoryStream(data);
Bitmap bmpImage = new Bitmap(Image.FromStream(ms));
Emgu.CV.Image<Bgr, Byte> currentFrame = new Emgu.CV.Image<Bgr, Byte>(bmpImage);
gray = currentFrame.Convert<Gray, Byte>();
于 2012-08-15T05:09:07.510 に答える