Can I use the outputs of estimateWorldCameraPose to construct a cameraMatrix?

3 views (last 30 days)
I am doing visual odometry and I use a stereo camera setup to triangulate world points.
I match these points with points in a subsequent image, and then I want to use estimateWorldCameraPose to estimate the camera pose in a world coordinate system.
This function returns the parameters worldOrientation and worldLocation, which I want to use to construct the cameraMatrix for my next triangulation to get the world coordinates of the points.
My question is: Can I use these parameters directly for the cameraMatrix-function?
This would be the code:
[worldOrientation, worldLocation] = estimateWorldCameraPose(imagePoints, worldPoints, intrinsics);
camMatrix1 = cameraMatrix(intrinsics, worldOrientation, worldLocation);
camMatrix2 = cameraMatrix(intrinsics, worldOrientation, worldLocation + [baseline, 0, 0]);
worldPoints = triangulate(matchedPointsLeft, matchedPointsRight, camMatrix1, camMatrix2);
Thank you!

Answers (1)

Matt J
Matt J on 4 Sep 2020
Yes, you can.
  1 Comment
Robin Pape
Robin Pape on 4 Sep 2020
Edited: Robin Pape on 4 Sep 2020
Thank you.
I thought so, too, but the results I am getting are not plausible.
However, if I do it this way:
orientation = worldOrientation';
translation = -worldLocation * worldOrientation';
camMatrix1 = cameraMatrix(intrinsics, orientation, translation);
camMatrix2 = cameraMatrix(intrinsics, orientation, translation + [baseline, 0, 0] * worldOrientation');
The results are completely plausible. I tried this, because the documentation of cameraMatrix suggested something like this, with relative location and orientation though. Multiplying the translation with the rotation matrix kind of makes sense, as this probably makes sure the coordinates of the new points are still correct after a rotation of the camera...?
Could you maybe explain further to me what is happening here?

Sign in to comment.

Categories

Find more on MATLAB Support Package for USB Webcams in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!