Ask Your Question

Revision history [back]

check whether point correspondence in front of both images

Anyone could explane the code below to check whether point correspondence in front of both images?

def _in_front_of_both_cameras(self, first_points, second_points, rot, trans): """Determines whether point correspondences are in front of both images""" rot_inv = rot for first, second in zip(first_points, second_points): first_z = np.dot(rot[0, :] - second[0]rot[2, :], trans) / np.dot(rot[0, :] - second[0]rot[2, :], second) first_3d_point = np.array([first[0] * first_z, second[0] * first_z, first_z]) second_3d_point = np.dot(rot.T, first_3d_point) - np.dot(rot.T, trans)

        if first_3d_point[2] < 0 or second_3d_point[2] < 0:
            return False

    return True