deepof.arena_utils.fit_ellipse_to_polygon

deepof.arena_utils.fit_ellipse_to_polygon(polygon: list, return_ellipse=True)

Fit an ellipse to the provided polygon.

Parameters:

polygon (list) – List of (x,y) coordinates of the corners of the polygon.

If return_ellipse:
Returns:

center_coordinates (tuple): (x,y) coordinates of the center of the ellipse. axes_length (tuple): (a,b) semi-major and semi-minor axes of the ellipse. ellipse_angle (float): Angle of the ellipse.

else:
Returns:

vertices-coordinates (np.array): array of (x,y) points on the ellipse edge