私が必要とするものはEmgu.Cv.Mat
です。私はBitmap
を持っているので、彼の情報をこのMatインスタンスに渡したいと思います。EmguCVを使ってMatを構築中にSystem.AccessViolationExceptionが発生する
//the real file is not stored on the harddrive. this is for demonstration only.
Bitmap fileBmp = new Bitmap(@"C:\Users\my\Desktop\file1.PNG");
:
は、ここに私のコードです。
//generating an Image from it works pretty fine as well. Even displaying it works great.
Image<Bgr, Byte> image = new Image<Bgr, Byte>(fileBmp);
。
//But I'm not able to generate a Mat with it. Not using the Bitmap
Mat mat1 = new Mat(new int[] { fileBmp.Width, fileBmp.Height }, DepthType.Cv8S, fileBmp.GetHbitmap());
//... and not using the Image
Mat mat2 = new Mat(new int[] { fileBmp.Width, fileBmp.Height }, DepthType.Cv8S, image.Bitmap.GetHbitmap());
私はmat1.Bitmap
プロパティまたはmat2.Bitmap
財産(ファイン探して他のすべてのプロパティ)のいずれかを読めば
System.AccessViolationException
EmguCv
を使用してMat
に「グラフィック情報」を渡す方法を教えてください。
もう一度:ビットマップがハードドライブに格納されていないため、new Mat(@"C:\Users\my\Desktop\file1.PNG")
を使用することはできません。