public boolean process ( EllipseRotated_F64 ellipse ) { // see if it's disabled if ( numContourPoints <= 0 ) { score = 0 ; return true ; } double cphi = Math . cos ( ellipse . phi ) ; double sphi = Math . sin ( ellipse . phi ) ; averageInside = 0 ; averageOutside = 0 ; int total = 0 ; for ( int contourIndex = 0 ; contourIndex < numContourPoints ; contourIndex ++ ) { double theta = contourIndex * Math . PI * 2.0 / numContourPoints ; // copied from UtilEllipse_F64.computePoint() reduced number of cos and sin double ct = Math . cos ( theta ) ; double st = Math . sin ( theta ) ; // location on ellipse in world frame double px = ellipse . center . x + ellipse . a * ct * cphi - ellipse . b * st * sphi ; double py = ellipse . center . y + ellipse . a * ct * sphi + ellipse . b * st * cphi ; // find direction of the tangent line // ellipse frame double edx = ellipse . a * ct * ellipse . b * ellipse . b ; double edy = ellipse . b * st * ellipse . a * ellipse . a ; double r = Math . sqrt ( edx * edx + edy * edy ) ; edx /= r ; edy /= r ; // rotate tangent into world frame double dx = edx * cphi - edy * sphi ; double dy = edx * sphi + edy * cphi ; // define the line integral double xin = px - dx * tangentDistance ; double yin = py - dy * tangentDistance ; double xout = px + dx * tangentDistance ; double yout = py + dy * tangentDistance ; if ( integral . isInside ( xin , yin ) && integral . isInside ( xout , yout ) ) { averageInside += integral . compute ( px , py , xin , yin ) ; averageOutside += integral . compute ( px , py , xout , yout ) ; total ++ ; } } score = 0 ; if ( total > 0 ) { score = Math . abs ( averageOutside - averageInside ) / ( total * tangentDistance ) ; } return score >= passThreshold ; }
Processes the edge along the ellipse and determines if the edge intensity is strong enough to pass or not