Example #1
0
        /// <summary>
        /// Draw the detected object on the image
        /// </summary>
        /// <param name="image">The image to draw on</param>
        /// <param name="color">The color to draw the rectangle around the detected object</param>
        /// <param name="freetype2">Optional freetype2 object, if provided, it will be used to draw the label. If null, will use CvInvoke.PutText instead.</param>
        public virtual void Render(IInputOutputArray image, MCvScalar color, Freetype2 freetype2 = null)
        {
            CvInvoke.Rectangle(image, this.Region, color, 2);
            String label = String.Format("{0}: {1}", this.Label == null ? this.ClassId.ToString() : this.Label,
                                         this.Confident);

            if (freetype2 == null)
            {
                CvInvoke.PutText(
                    image,
                    label,
                    this.Region.Location,
                    FontFace.HersheyDuplex,
                    1.0,
                    color,
                    1);
            }
            else
            {
                freetype2.PutText(
                    image,
                    label,
                    this.Region.Location,
                    16,
                    color,
                    1,
                    LineType.EightConnected,
                    false
                    );
            }
        }
Example #2
0
 /// <summary>
 /// Draw the detected object on the image
 /// </summary>
 /// <param name="image">The image to draw on</param>
 /// <param name="color">The color used for drawing the region</param>
 /// <param name="maskColor">The color used for drawing the mask</param>
 /// <param name="freetype2">Optional freetype2 object, if provided, it will be used to draw the label. If null, will use CvInvoke.PutText instead.</param>
 public virtual void Render(IInputOutputArray image, MCvScalar color, MCvScalar maskColor, Freetype2 freetype2 = null)
 {
     base.Render(image, color, freetype2);
     DrawMask(image, _mask, Region, maskColor);
 }