Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image is undistorted/warped twice in detect_points_in_stereo_canonical_space if using dot detector #33

Open
tdowrick opened this issue Jan 25, 2021 · 1 comment
Assignees

Comments

@tdowrick
Copy link
Collaborator

tdowrick commented Jan 25, 2021

Iterative calibration calls detect_points_in_stereo_canonical_space(), which has this bit of code:

    for j, _ in enumerate(left_images):
        left_undistorted = cv2.undistort(
            left_images[j],
            left_camera_matrix,
            left_distortion_coeffs,
            left_camera_matrix
        )
        left_ids, left_obj_pts, left_img_pts = \
            left_point_detector.get_points(left_undistorted)

        if left_ids is not None \
                and left_ids.shape[0] >= minimum_points_per_frame \
                and right_ids is not None \
                and right_ids.shape[0] >= minimum_points_per_frame:

            left_common_points = match_points_by_id(left_ids,
                                                    left_img_pts,
                                                    reference_ids,
                                                    reference_image_points)
            left_homography, _ = \
                cv2.findHomography(left_common_points[0:, 0:2],
                                   left_common_points[0:, 2:4])
            left_warped = cv2.warpPerspective(left_undistorted,
                                              left_homography,
                                              reference_image_size,)

            left_ids, left_obj_pts, left_img_pts = \
                left_point_detector.get_points(left_warped)

The image is undistorted and warped. However, the get_points() function for dotty_grid_point_detector also undistorts and warps the image, so we end up with something like this, which messes up the rest of the processing:

image

Other point detectors (charuco etc) are unaffected as they don't undistort or warp the input image.

@tdowrick tdowrick self-assigned this Jan 25, 2021
@MattClarkson
Copy link
Collaborator

Hold on ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants