Esempio n. 1
0
 def test_fit_int_version_1(self):
     output = fit_improved_B2AC_int(self.points.copy())
     ellipse_data = c2gconv.conic_to_general_int(output, return_float=True, verbose=True)
     e_fitted = B2ACEllipse(*ellipse_data)
     assert np.linalg.norm(self.e.center_point - e_fitted.center_point) < 1
     assert np.linalg.norm(max(self.e.radii) - max(e_fitted.radii)) < 1
     assert np.linalg.norm(min(self.e.radii) - min(e_fitted.radii)) < 1
     assert overlap(self.e, e_fitted) > 0.95
     assert overlap(e_fitted, self.e) > 0.95
Esempio n. 2
0
 def test_py_and_ext_similarity(self):
     output = fitext.fit_ellipse_int(self.points.copy())
     e_ext = B2ACEllipse(*output)
     points, x_mean, y_mean = remove_mean_values(self.points.copy())
     output = fit_improved_B2AC_int(points)
     ellipse_data = c2gconv.conic_to_general_int(output, return_float=True, verbose=True)
     e_py = B2ACEllipse(*ellipse_data)
     e_py.center_point += (x_mean, y_mean)
     assert overlap(e_ext, e_py) > 0.99
     assert overlap(e_py, e_ext) > 0.99
Esempio n. 3
0
 def test_fit_int_version_2(self):
     points, x_mean, y_mean = remove_mean_values(self.points.copy())
     output = fit_improved_B2AC_int(points)
     ellipse_data = c2gconv.conic_to_general_int(output, return_float=True, verbose=True)
     e_fitted = B2ACEllipse(*ellipse_data)
     e_fitted.center_point += (x_mean, y_mean)
     print(e_fitted)
     assert np.linalg.norm(self.e.center_point - e_fitted.center_point) < 1.0
     assert np.linalg.norm(max(self.e.radii) - max(e_fitted.radii)) < 0.1
     assert np.linalg.norm(min(self.e.radii) - min(e_fitted.radii)) < 0.1
     assert overlap(self.e, e_fitted) > 0.98
     assert overlap(e_fitted, self.e) > 0.98