-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Converting Image
shimat edited this page Jan 19, 2019
·
6 revisions
Mat mat = new Mat("foobar.jpg", ImreadModes.Color);
Bitmap bitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);
Bitmap bitmap = new Bitmap("foobar.jpg");
Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(bitmap);
Mat mat = new Mat("foobar.jpg", ImreadModes.Color);
byte[] bytes1 = mat.ToBytes(".png");
byte[] bytes2;
Cv2.ImEncode(".jpg", mat, out bytes2);
byte[] imageData = System.IO.File.ReadAllBytes("foobar.jpg");
Mat colorMat = Mat.FromImageData(imageData, ImreadModes.Color);
Mat grayscaleMat = Mat.FromImageData(imageData, ImreadModes.GrayScale);
Mat alt = Cv2.ImDecode(imageData, ImreadModes.GrayScale);