I created a transform matrix using findHomography() and used warpImage() to make the change, so far so good.

But I found a point on the original image. I want to know the equivalent coordinate on the warped image. I thought it would be as simple as multiplying by the inverse transform matrix

[[x2]

[y2] = H**-1 * [[x1][y1][1]]

[1]]

So I get the coords of the contour center in a matrix and then transform:

M = cv2.moments(cB)

coord = [[int(M[“m10”] / M[“m00”])],[int(M[“m01”] / M[“m00”])],[1]]

warpedCoord = np.matmul(np.linalg.inv(h), coord)

warpedCoord = warpedCoord *(1/warpedCoord[2][0]) #EDIT: this line was missing before

cv2.circle(oImg,(int(warpedCoord[0][0]),int(warpedCoord[1][0])), 5, (255,0,0), -1)

However the results are off:

What am I doing wrong?