Пример #1
0
        /// <summary>
        /// Draws circle.
        /// </summary>
        /// <param name="image">Input image.</param>
        /// <param name="circle">Circle</param>
        /// <param name="color">Circle color.</param>
        /// <param name="thickness">Contours thickness.</param>
        /// <param name="opacity">Sets alpha channel where 0 is transparent and 255 is full opaque.</param>
        public unsafe static void Draw(this Bgr <byte>[,] image, Circle circle, Bgr <byte> color, int thickness, byte opacity = Byte.MaxValue)
        {
            draw(image, opacity, cvImg =>
            {
                var center = new Point(circle.X, circle.Y);

                CvCoreInvoke.cvCircle(&cvImg, center, circle.Radius, color.ToCvScalar(),
                                      thickness, LineTypes.EightConnected, 0);
            });
        }
Пример #2
0
        /// <summary>
        /// Draws circle.
        /// </summary>
        /// <param name="image">Input image.</param>
        /// <param name="circle">Circle</param>
        /// <param name="color">Circle color.</param>
        /// <param name="thickness">Contours thickness.</param>
        public unsafe static void Draw(this Bgr <byte>[,] image, Circle circle, Bgr <byte> color, int thickness)
        {
            using (var img = image.Lock())
            {
                var iplImage = img.AsCvIplImage();
                var center   = new Point(circle.X, circle.Y);

                CvCoreInvoke.cvCircle(&iplImage, center, circle.Radius, color.ToCvScalar(),
                                      thickness, LineTypes.EightConnected, 0);
            }
        }
Пример #3
0
        /// <summary>
        /// Draws circles.
        /// </summary>
        /// <param name="image">Input image.</param>
        /// <param name="circles">Circles</param>
        /// <param name="color">Circle color.</param>
        /// <param name="thickness">Contours thickness.</param>
        /// <param name="opacity">Sets alpha channel where 0 is transparent and 255 is full opaque.</param>
        public unsafe static void DrawCircles(this Bgr <byte>[,] image, IEnumerable <Circle> circles, Bgr <byte> color, int thickness, byte opacity = Byte.MaxValue)
        {
            Draw(image, opacity, cvImg =>
            {
                foreach (var circle in circles)
                {
                    var center = new Point(circle.X, circle.Y);

                    CvCoreInvoke.cvCircle(&cvImg, center, circle.Radius, color.ToCvScalar(),
                                          thickness, LineTypes.EightConnected, 0);
                }
            });
        }