How to construct stereoParameters with intrinsic and extrinsic matrix?
4 views (last 30 days)
Show older comments
I'm trying to reconstruct a 3D Scene from two images. Suppose camera has no distortions.
I have the images I1, I2 and the coressponding intrinsic_1, extrinsic_1, intrinsic_2, extrinsic_2 matrix. I also has the transaltion and rotation from camera1 to camera 2. How could I use them to construct a stereoParameters object? I found that cameraParameters has private attributes and extrinsic matrixs could not be set.
stereoParams = stereoParameters(cameraParameters1,cameraParameters2,poseCamera2)
[I1Rect, I2Rect, reprojectionMatrix] = rectifyStereoImages(I1,I2,stereoParams);
disparityMap = disparitySGM(I1Rect, I2Rect);
points3D = reconstructScene(disparityMap, reprojectionMatrix);
Or is it possible to figure out the reprojectionMatix directly using some functions with matched points inlierPts1 and inlierPts2?
[t1, t2] = estimateStereoRectification(fNorm8Point,inlierPts1.Location,inlierPts2.Location,size(I2));
reprojectionMatrix = some_function(t1, t2, intrinsic_1, extrinsic_1, intrinsic_2, extrinsic_2, rotations and translations between c1 to c2)
[I1Rect, I2Rect] = rectifyStereoImages(I1,I2,reprojectionMatrix);
Qu Cao on 21 Nov 2022
poseCamera2 essentially transforms camera 2 to camer 1. If you have “the transaltion and rotation from camera1 to camera 2”, (let's call them t and R respectively), then you should be able to construct poseCamera2 as follows:
poseCamera2 = rigidtform3d(R', -R'*t)
I'm assuming that you're using R2022b.
Find more on MATLAB Support Package for USB Webcams in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!