How to construct stereoParameters with intrinsic and extrinsic matrix?

3 次查看(过去 30 天)
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);

回答(1 个)

Qu Cao
Qu Cao 2022-11-21
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.

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for USB Webcams 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by