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
コード例 #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);
                        }
                    }
                }
            }
        }