Why do we need to switch x, y order?
neon5d opened this issue · comments
Hello,
I am very confused about why we need to switch x, y order before warp_keypoints function call?
Can you explain a little bit about the background of this?
Thank you,
# Keypoint vector, consisting of (x,y,probability).
keypoints = np.stack([keypoints[0], keypoints[1]], axis=-1)
warp_keypoints(keypoints[:, [1, 0]], H)
def keep_true_keypoints(points, descriptors, H, shape):
""" Keep only the points whose warped coordinates by H are still inside shape. """
warped_points = warp_keypoints(_points[:, [1, 0]], H)
warped_points[:, [0, 1]] = warped_points[:, [1, 0]]
mask = (warped_points[:, 0] >= 0) & (warped_points[:, 0] < shape[0]) &\
(warped_points[:, 1] >= 0) & (warped_points[:, 1] < shape[1])
return points[mask, :], descriptors[mask, :]
Hey - thanks for the question. We kept much of the evaluation similar to other methods for consistency. I'm pretty sure we should be able to do this in a cleaner way. I'll check in more detail and get back to you in a few days.
Hey - thanks for the question. We kept much of the evaluation similar to other methods for consistency. I'm pretty sure we should be able to do this in a cleaner way. I'll check in more detail and get back to you in a few days.
I am confused too. It seems that x,y should not swap...
In the normal scene,conside map to :
the final result is:
But in code ,its seem that:
the final result is:
then we swap final x,y after warp_keypoints
finished,but result is not right,is obviouse that:
Maybe should not swap x,y?
Thanks! I've also been looking into this and cleaning up the code. The calculation is correct, but we swap and then swap back in a couple of places which is unnecessary. I'll PR the cleanup fix later today (and I've also updated the repo to pytorch 1.6).
We just merged a PR with the cleanup - hopefully it makes more sense now!