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); }
private unsafe static void draw(Bgr <byte>[,] image, byte opacity, Action <IplImage> drawingAction) { using (var uImg = image.Lock()) { var cvImg = uImg.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); } }