/// <summary> /// Initializes a new instance of the <see cref="Emgu.CV.Mat"/> class from NSImage /// </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="nsImage">The NSImage.</param> public static UMat ToUMat(this NSImage nsImage, ImreadModes mode = ImreadModes.AnyColor) { using (CGImage cgImage = nsImage.CGImage) { return(cgImage.ToUMat()); } }
/// <summary> /// Initializes a new instance of the <see cref="Emgu.CV.UMat"/> 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> public static UMat ToUMat(this UIImage uiImage, ImreadModes mode = ImreadModes.AnyColor) { //UMat umat = new UMat (); using (CGImage cgImage = uiImage.CGImage) { //ConvertCGImageToArray (cgImage, this, mode); return(cgImage.ToUMat(mode)); } }