Getting to camera coordinates from world coordinates. (estimateCameraParameters)
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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??
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur MATLAB Support Package for USB Webcams dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!