/// <summary> /// Initializes a new instance of the <see cref="Emgu.CV.Mat"/> class from CGImage /// </summary> /// <param name="mode">The color conversion mode. By default, it convert the UIImage to BGRA color type to preserve all the image channels.</param> /// <param name="cgImage">The CGImage.</param> public static UMat ToUMat(this CGImage cgImage, ImreadModes mode = ImreadModes.AnyColor) { UMat umat = new UMat(); cgImage.ToArray(umat, mode); return(umat); }
/// <summary> /// Convert a NSImage to a IOutputArray /// </summary> /// <param name="nsImage">The source NSImage</param> /// <param name="mat">The destination array</param> /// <param name="modes">The color format for the destination array</param> /// <exception cref="NotImplementedException">Exception will be thrown if the ImreadModes is not supported.</exception> public static void ToArray(this NSImage nsImage, IOutputArray mat, ImreadModes modes = ImreadModes.AnyColor) { using (CGImage cgImage = nsImage.CGImage) { cgImage.ToArray(mat, modes); } }
/// <summary> /// Initializes a new instance of the <see cref="Emgu.CV.Mat"/> class from CGImage /// </summary> /// <param name="mode">The color conversion mode. By default, it convert the UIImage to BGRA color type to preserve all the image channels.</param> /// <param name="cgImage">The CGImage.</param> public static Mat ToMat(this CGImage cgImage, ImreadModes mode = ImreadModes.AnyColor) { Mat m = new Mat(); cgImage.ToArray(m, mode); return(m); }
/// <summary> /// Initializes a new instance of the <see cref="Emgu.CV.Mat"/> class from UIImage /// </summary> /// <param name="mode">The color conversion mode. By default, it convert the UIImage to BGRA color type to preserve all the image channels.</param> /// <param name="uiImage">The UIImage.</param> /// <param name="outputArray">The output array</param> public static void ToArray(this UIImage uiImage, IOutputArray outputArray, ImreadModes mode = ImreadModes.AnyColor) { using (CGImage cgImage = uiImage.CGImage) { cgImage.ToArray(outputArray, mode); } }