Can one predict the location of the unseen point?

55 Views Asked by At

My question is quite simple. I have two images, on the first one I know the location of points P1, P2, P3, and P4. In the second image, I know the location of P2', P3', P4', and point Q'. Is there any way I could find the exact location of point Q on the first image?

Image 1 Image 2

I've tried to do th following as replied here

def find_point_Q(P1, P2, P3, P4, P2_prime, P3_prime, P4_prime, Q_prime):
    # Calculate the basis vectors in the second image
    v1 = P2 - P1
    v2 = P4 - P1

    # Solve for the coefficients x and y
    A = np.array([[v1[0], v2[0]], [v1[1], v2[1]]])
    b = Q_prime - P1
    x, y = np.linalg.solve(A, b)

    # Calculate the location of point Q in the first image
    Q = P1 + x * (P2_prime - P1) + y * (P4_prime - P1)

    return Q

But I'm afraid this logic assumes an affine transform and I might be looking for a prespective transform (?) I have created a gist to reproduce it quickly GIST

0

There are 0 best solutions below