plotCamera: estimateExtrinsics and extrinsics give different poses. Why?
Show older comments
Hello! I am trying to visualize the positions of two cameras with respect to a calibration target. I can use two different codes, one is correct, and the other is wrong. I wonder why this is the case. Can anyone help me with this? Thank you!
I guess the answer lies in the fact that
R1 == camExtrinsics1.Rotation
camExtrinsics1.Rotation ~= camExtrinsics1.R
But I wonder what the difference is between camExtrinsics1.Rotation and camExtrinsics1.R ...
%% Calculate the camera poses via "extrinsics" --> wrong results for the absPoses
[R1, t1] = extrinsics(imagePoints1, worldPoints1, camera_1_parameters);
[R2, t2] = extrinsics(imagePoints2, worldPoints2, camera_2_parameters);
absPose1wrong = extr2pose(rigidtform3d(R1,t1));
absPose2wrong = extr2pose(rigidtform3d(R2,t2));
%% Calculate the camera poses via "estimateExtrinsics" --> correct results for the absPoses
camExtrinsics1 = estimateExtrinsics(imagePoints1,worldPoints1,camera_1_parameters.Intrinsics);
camExtrinsics2 = estimateExtrinsics(imagePoints2,worldPoints2,camera_2_parameters.Intrinsics);
absPose1correct = extr2pose(camExtrinsics1);
absPose2correct = extr2pose(camExtrinsics2);
% R1 == camExtrinsics1.Rotation
% camExtrinsics1.Rotation ~= camExtrinsics1.R
%% =========================================================
% 3D VIEW: TWO CAMERAS + CHARUCO TARGET
% ==========================================================
figure;
plot3(worldPoints1(:,1),worldPoints1(:,2),zeros(size(worldPoints1, 1),1),"*");
hold on
plot3(0,0,0,"g*");
plotcam1wrong = plotCamera(AbsolutePose=absPose1wrong,Size=100,Color="magenta",AxesVisible=true,Label="wrongCam1");
plotcam2wrong = plotCamera(AbsolutePose=absPose2wrong,Size=100,Color="green",AxesVisible=true,Label="wrongCam2");
plotcam1correct = plotCamera(AbsolutePose=absPose1correct,Size=100,Color="blue",AxesVisible=true,Label="correctCam1");
plotcam2correct = plotCamera(AbsolutePose=absPose2correct,Size=100,Color="red",AxesVisible=true,Label="correctCam2");
axis equal
grid on
cameratoolbar('SetMode','orbit');
xlabel("X (mm)");
ylabel("Y (mm)");
zlabel("Z (mm)");
Accepted Answer
More Answers (0)
Categories
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!

