# Get points coordinates in correspondance to ellipse axes

I have a couple of objects that have points inside of them. I fitted an ellipse around them and want to get the coordinates of the points in a normalized way since the ellipses have different shapes and rotations

The original images are as such:

I got to this point but don’t know how to make the axes of the ellipse as my axes:

I first fitted the ellipse:

``````# find largest contour

ret, thresh = cv2.threshold(mask_gray, 0, 255, cv2.THRESH_BINARY)

contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE,
cv2.CHAIN_APPROX_SIMPLE)
cnt=[item for sublist in contours for item in sublist]
cnt=np.asarray(cnt)
ellipse = cv2.fitEllipse(cnt)

(xc,yc),(d1,d2),angle = ellipse
``````

I then detected the points and drew them with the cv2.circle function then drew the ellipse
I also drew the axis this way:

``````rmajor = max(d1,d2)/2
if angle > 90:
angle = angle - 90
else:
angle = angle + 90
cv2.line(result, (int(xtop),int(ytop)), (int(xbot),int(ybot)), (0, 0, 255), 1)
``````

I then rotated the image with:

``````result = ndimage.rotate(result,angle)
``````

with the angle being the angle of the ellipse so that the axes are kind of the same for all ellipses since I want the coordinates to be normalized for all images