OpenCvSharp.Cv2.Polylines C# (CSharp) Method

Polylines() public static method

draws one or more polygonal curves
public static Polylines ( InputOutputArray img, InputArray pts, bool isClosed, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift ) : void
img InputOutputArray
pts InputArray
isClosed bool
color Scalar
thickness int
lineType LineTypes
shift int
return void
        public static void Polylines(
            InputOutputArray img, InputArray pts, bool isClosed, Scalar color,
            int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            if (pts == null)
                throw new ArgumentNullException(nameof(pts));
            img.ThrowIfDisposed();
            pts.ThrowIfDisposed();

            NativeMethods.imgproc_polylines_InputOutputArray(
                img.CvPtr, pts.CvPtr, isClosed ? 1 : 0, color, thickness, (int)lineType, shift);

            img.Fix();
            GC.KeepAlive(pts);
        }

Same methods

Cv2::Polylines ( Mat img, IEnumerable pts, bool isClosed, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift ) : void

Usage Example

コード例 #1
0
        /// <summary>
        /// Marks detected objects on the texture
        /// </summary>
        public void MarkDetected(bool drawSubItems = true)
        {
            // mark each found eye
            foreach (OpenCvSharp.Demo.DetectedFace face in Faces)
            {
                // face rect
                Cv2.Rectangle((InputOutputArray)Image, face.Region, Scalar.FromRgb(255, 0, 0), 2);

                // convex hull
                //Cv2.Polylines(Image, new IEnumerable<Point>[] { face.Info.ConvexHull }, true, Scalar.FromRgb(255, 0, 0), 2);

                // render face triangulation (should we have one)
                if (face.Info != null)
                {
                    foreach (OpenCvSharp.Demo.DetectedFace.Triangle tr in face.Info.DelaunayTriangles)
                    {
                        Cv2.Polylines(Image, new IEnumerable <Point>[] { tr.ToArray() }, true, Scalar.FromRgb(0, 0, 255),
                                      1);
                    }
                }

                // Sub-items
                if (drawSubItems)
                {
                    List <string> closedItems = new List <string>(new string[] { "Nose", "Eye", "Lip" });
                    foreach (OpenCvSharp.Demo.DetectedObject sub in face.Elements)
                    {
                        if (sub.Marks != null)
                        {
                            Cv2.Polylines(Image, new IEnumerable <Point>[] { sub.Marks }, closedItems.Contains(sub.Name),
                                          Scalar.FromRgb(0, 255, 0), 1);
                        }
                    }
                }
            }
        }
Cv2