yishiliuhuasheng / deep_image_homography_estimation

deep image homography estimation
48 stars 15 forks source link

Why do you use inverse H ? #3

Open giovannicaprio opened 4 years ago

giovannicaprio commented 4 years ago

Dear @yishiliuhuasheng ,

I did not understand why you use the inverse H to create the warped_image instead of the H you just calculates. Could you explain to me?

This is the code that intrigues me:

compute H

    H = cv2.getPerspectiveTransform(np.float32(four_points), np.float32(perturbed_four_points))
    H_inverse = inv(H)
    inv_warped_image = cv2.warpPerspective(gray_image, H_inverse, (320, 240))
    warped_image = cv2.warpPerspective(gray_image, H, (320, 240))

    # grab image patches
    original_patch = gray_image[y:y + patch_size, x:x + patch_size]
    warped_patch = inv_warped_image[y:y + patch_size, x:x + patch_size]

Thank you