/// <summary> /// Saves the specified image. /// </summary> /// <typeparam name="TColor">Image color.</typeparam> /// <param name="image">Image to save.</param> /// <param name="fileName">Image filename.</param> private unsafe static void Save <TColor>(this Image <TColor> image, string fileName) where TColor : unmanaged, IColor { var iplImage = image.AsCvIplImage(); CvInvoke.cvSaveImage(fileName, &iplImage, IntPtr.Zero); }
internal unsafe static void Draw(Image <Bgr <byte> > image, byte opacity, Action <IplImage> drawingAction) { var cvImg = image.AsCvIplImage(); var cvOverlayImPtr = CvCoreInvoke.cvCloneImage(&cvImg); drawingAction(*cvOverlayImPtr); CvCoreInvoke.cvAddWeighted(cvOverlayImPtr, (float)opacity / Byte.MaxValue, &cvImg, 1 - (float)opacity / Byte.MaxValue, 0, &cvImg); CvCoreInvoke.cvReleaseImage(&cvOverlayImPtr); }