@@ -310,11 +310,11 @@ float EllipseDetectorImpl::getMedianSlope(std::vector<Point2f> &med, Point2f &ce
310310 // centers : centroid of the points in med
311311 // slopes : vector of the slopes
312312
313- unsigned pointCount = med.size ();
313+ size_t pointCount = med.size ();
314314 // CV_Assert(pointCount >= 2);
315315
316- unsigned halfSize = pointCount >> 1 ;
317- unsigned quarterSize = halfSize >> 1 ;
316+ size_t halfSize = pointCount >> 1 ;
317+ size_t quarterSize = halfSize >> 1 ;
318318
319319 std::vector<float > xx, yy;
320320 slopes.reserve (halfSize);
@@ -333,7 +333,7 @@ float EllipseDetectorImpl::getMedianSlope(std::vector<Point2f> &med, Point2f &ce
333333 float den = (p2.x - p1.x );
334334 float num = (p2.y - p1.y );
335335
336- if ( den == 0 ) den = 0 .00001f ;
336+ den = ( std::fabs ( den) >= 1e-5 ) ? den : 0 .00001f ; // FIXIT: algorithm is not reliable
337337
338338 slopes.push_back (num / den);
339339 }
@@ -1341,7 +1341,7 @@ void EllipseDetectorImpl::preProcessing(Mat1b &image, Mat1b &dp, Mat1b &dn) {
13411341 }
13421342
13431343 const int CANNY_SHIFT = 15 ;
1344- const float TAN22_5 = 0.4142135623730950488016887242097 ; // tan(22.5) = sqrt(2) - 1
1344+ const float TAN22_5 = 0 .4142135623730950488016887242097f ; // tan(22.5) = sqrt(2) - 1
13451345 const int TG22 = (int ) (TAN22_5 * (1 << CANNY_SHIFT) + 0.5 );
13461346
13471347 // #define CANNY_PUSH(d) *(d) = (uchar)2, *stack_top++ = (d)
@@ -1723,8 +1723,8 @@ void EllipseDetectorImpl::findEllipses(Point2f ¢er, VP &edge_i, VP &edge_j,
17231723 }
17241724
17251725 // find peak in N and K accumulator
1726- int iN = std::distance (accN, std::max_element (accN, accN + ACC_N_SIZE));
1727- int iK = std::distance (accR, std::max_element (accR, accR + ACC_R_SIZE)) + 90 ;
1726+ int iN = ( int ) std::distance (accN, std::max_element (accN, accN + ACC_N_SIZE));
1727+ int iK = ( int ) std::distance (accR, std::max_element (accR, accR + ACC_R_SIZE)) + 90 ;
17281728
17291729 // recover real values
17301730 auto fK = float (iK);
@@ -1767,7 +1767,7 @@ void EllipseDetectorImpl::findEllipses(Point2f ¢er, VP &edge_i, VP &edge_j,
17671767 }
17681768
17691769 // find peak in A accumulator
1770- int A = std::distance (accA, std::max_element (accA, accA + ACC_A_SIZE));
1770+ int A = ( int ) std::distance (accA, std::max_element (accA, accA + ACC_A_SIZE));
17711771 auto fA = float (A);
17721772
17731773 // find B value. See Eq [23] in the paper
0 commit comments