Exemple #1
0
        /// <summary>
        /// Find the nearest ellipse-center to a query point in image space.
        /// </summary>
        /// <param name="finals">List of ellipses to test</param>
        /// <param name="ex">Query point</param>
        /// <returns>Nearest result</returns>
        private NearestEllipseResult NearestEllipseCenter(List <DetectedEllipse> finals, System.Drawing.PointF ex)
        {
            NearestEllipseResult ner = new NearestEllipseResult();

            ner.dist2 = Double.MaxValue;
            foreach (DetectedEllipse de in finals)
            {
                System.Drawing.PointF p = de.Ellipse.MCvBox2D.center;
                double cur_dist2        = (ex.X - p.X) * (ex.X - p.X) + (ex.Y - p.Y) * (ex.Y - p.Y);
                if (cur_dist2 < ner.dist2)
                {
                    ner.dist2  = cur_dist2;
                    ner.center = p;
                }
            }
            return(ner);
        }
 /// <summary>
 /// Find the nearest ellipse-center to a query point in image space.
 /// </summary>
 /// <param name="finals">List of ellipses to test</param>
 /// <param name="ex">Query point</param>
 /// <returns>Nearest result</returns>
 private NearestEllipseResult NearestEllipseCenter(List<DetectedEllipse> finals, System.Drawing.PointF ex) {
   NearestEllipseResult ner = new NearestEllipseResult();
   ner.dist2 = Double.MaxValue;
   foreach (DetectedEllipse de in finals) {
     System.Drawing.PointF p = de.Ellipse.MCvBox2D.center;
     double cur_dist2 = (ex.X - p.X) * (ex.X - p.X) + (ex.Y - p.Y) * (ex.Y - p.Y);
     if (cur_dist2 < ner.dist2) {
       ner.dist2 = cur_dist2;
       ner.center = p;
     }
   }
   return ner;
 }