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

[BUG] bug_issue_title #71

Open
youxiao888 opened this issue Oct 27, 2024 · 1 comment
Open

[BUG] bug_issue_title #71

youxiao888 opened this issue Oct 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@youxiao888
Copy link

youxiao888 commented Oct 27, 2024

Hello, when there are two or more capture points in the current image, how can this code ensure that the points on one image correspond one-to-one with the points on another image to solve the fundamental matrix between the two cameras

@socketio.on("calculate-camera-pose")
def calculate_camera_pose(data):
    cameras = Cameras.instance()
    image_points = np.array(data["cameraPoints"])
    image_points_t = image_points.transpose((1, 0, 2))
    camera_poses = [{
        "R": np.eye(3),
        "t": np.array([[0],[0],[0]], dtype=np.float32)
    }]
    for camera_i in range(0, cameras.num_cameras-1):
        camera1_image_points = image_points_t[camera_i]
        camera2_image_points = image_points_t[camera_i+1]
        not_none_indicies = np.where(np.all(camera1_image_points != None, axis=1) & np.all(camera2_image_points != None, axis=1))[0]
        camera1_image_points = np.take(camera1_image_points, not_none_indicies, axis=0).astype(np.float32)
        camera2_image_points = np.take(camera2_image_points, not_none_indicies, axis=0).astype(np.float32)

        F, _ = cv.findFundamentalMat(camera1_image_points, camera2_image_points, cv.FM_RANSAC, 1, 0.99999)
        E = cv.sfm.essentialFromFundamental(F, cameras.get_camera_params(0)["intrinsic_matrix"], cameras.get_camera_params(1)["intrinsic_matrix"])
@youxiao888 youxiao888 added the bug Something isn't working label Oct 27, 2024
@jyjblrd
Copy link
Owner

jyjblrd commented Oct 27, 2024

When collecting data for the camera pose calibration, you must only have one point in the room. If there is only one point seen by each camera, the point association is trivial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants