コード例 #1
0
        /// <summary>
        /// Detect ellipses in image
        /// </summary>
        /// <param name="image">Binary image with white foreground</param>
        /// <returns>List of ellipses found</returns>
        public DetectedEllipse[] DetectEllipses(Emgu.CV.Image <Emgu.CV.Structure.Gray, byte> image)
        {
            List <DetectedEllipse> ellipses = new List <DetectedEllipse>();

            Emgu.CV.Contour <System.Drawing.Point> c = image.FindContours();

            while (c != null)
            {
                if (c.Count() >= _min_contour_count)
                {
                    Emgu.CV.Structure.Ellipse e = FitByContour(c);
                    double rating = GoodnessOfFit(e, c);
                    ellipses.Add(new DetectedEllipse(c, e, rating));
                }
                c = c.HNext;
            }

            return(ellipses.ToArray());
        }