Getting to camera coordinates from world coordinates. (estimateC​ameraParam​eters)

4 Ansichten (letzte 30 Tage)
I did a camera calibration, which gives me the cameraParams . I then assumed that I could do
A = cameraParams.PatternExtrinsics(2).A; % I'm interested in the second image
A(:,4) = A(:,4)/1000; % If I dont do in meters, things look terrible.
K = cameraParams.K
WorldPoints = cameraParams.WorldPoints'/1000;
WorldPoints(3,:) = 0; % need a z coordinate for the world points
WorldPoints(4,:) = 1; % need a 4th row, with a one, as according to the 'algorithms' section here: https://nl.mathworks.com/help/vision/ref/estimatecameraparameters.html, what we want to do is impoints=KA[X Y Z 1]'
tmp1 = A*WorldPoints; % need to do this step first, otherwise cannot multiply with camera params
imagePoints = K*tmp1(1:3,:);
imagePoints = imagePoints(1:2,:);%this should be equal to the image coordinates?
realimagePoints = cameraParams.ReprojectedPoints(:,:,2)';% but it's not equal to this
However, the thus obtained imagePoints does not equal realimagePoints(which does agree with the image that I have of the checkerboard that I used). Why is that? And how would I be able to get from the WorldPoints to imagePoints? As far as I understand, this should be possible given the info in cameraParams??

Antworten (1)

Sjoerd
Sjoerd am 7 Mai 2024
Got it. All I needed to do was;
imagePoints(1,:) =imagePoints(1,:)./imagePoints(3,:);
imagePoints(2,:) =imagePoints(2,:)./imagePoints(3,:);

Kategorien

Mehr zu MATLAB Support Package for USB Webcams finden Sie in Help Center und File Exchange

Produkte


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by