Skip to content

WIP: Proposed Fix to Ellipse COCO Annotations calculation

mlubega requested to merge mlubega/via:ellipse_fix into via-2.x.y

This a solution to the issue I raised in #215 (closed). In the via_region_shape_to_coco_annotation function, I separated the logic for circle and ellipse. Different parametric equations are needed calculate the correct (x,y) coordinates for a rotated ellipse as seen in this video. Essentially I changed the equations from

x = r_x + a cos(\theta) \\
y = r_y + b sin(\theta)

to

x = r_x + a cos(\theta) cos(\beta) - b sin(\theta) sin(\beta) \\
y = r_y + b cos(\theta) sin(\beta) + b sin(\theta) cos(\beta) \\

where \beta is the angle of rotation of the ellipse.

I have tested my changes and now the ellipses are oriented correctly:

image

This is my first Merge Request so while I have done my best to follow to the contribution rules, I apologize if I have not followed protocol properly. I only changed one file (via.js) and am unclear why several additional commits and changes not by me have appeared. How can I fix this?

Merge request reports