diff --git a/Emgu.CV.Platform/Android/MatAndroid.cs b/Emgu.CV.Platform/Android/MatAndroid.cs index aac641e90..09589b7dd 100644 --- a/Emgu.CV.Platform/Android/MatAndroid.cs +++ b/Emgu.CV.Platform/Android/MatAndroid.cs @@ -54,13 +54,23 @@ namespace Emgu.CV /// The mat to copy Bitmap into /// The bitmap to copy into mat public static void ToMat(this Android.Graphics.Bitmap bitmap, Mat mat) + { + ToArray(bitmap, mat); + } + + /// + /// Convert a Bitmap to an image + /// + /// The image to copy Bitmap into + /// The bitmap to copy into image + public static void ToArray(this Android.Graphics.Bitmap bitmap, IOutputArray image) { Android.Graphics.Bitmap.Config config = bitmap.GetConfig(); if (config.Equals(Android.Graphics.Bitmap.Config.Argb8888)) { using (BitmapArgb8888Image bi = new BitmapArgb8888Image(bitmap)) { - CvInvoke.CvtColor(bi, mat, ColorConversion.Rgba2Bgra); + CvInvoke.CvtColor(bi, image, ColorConversion.Rgba2Bgra); } } else if (config.Equals(Android.Graphics.Bitmap.Config.Rgb565)) @@ -71,7 +81,7 @@ namespace Emgu.CV GCHandle handle = GCHandle.Alloc(values, GCHandleType.Pinned); using (Mat bgra = new Mat(size, DepthType.Cv8U, 4, handle.AddrOfPinnedObject(), size.Width * 4)) { - bgra.CopyTo(mat); + bgra.CopyTo(image); } handle.Free(); }