Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
            }
        }