what's the corresponding theory formula about the function of estimateMo​noCameraPa​rameters

1 visualizzazione (ultimi 30 giorni)
Hi, when i reading the source code of the function of estimateMonoCameraParameters as follows, i cann't understand the process of implementation.
If someone knows the corresponding theory formula, please give me a hint. I will appreciate it!
[rotationMatrix, translationVector] = extrinsics(imagePoints, worldPoints, intrinsics);
% Compute camera pose in the world coordinate system defined by the board.
orientation = rotationMatrix';
location = -translationVector * rotationMatrix';
isPatternHorizontal = strcmpi(patternOrientation, 'horizontal');
% Rotate the world coordinate sytem attached to the board so that X-axis
% points to the right side of the vehicle.
R = getXAxisRotationMatrix(pattternPosition, isPatternHorizontal);
% Adjust camera position in the new world coordinate sytem.
location = R * location(:);
orientation = orientation * R';
% Rotate the world coordinate sytem attached to the board so that Z-axis
% points up.
R = getZAxisRotationMatrix(isPatternHorizontal);
% Adjust camera position in the new world coordinate sytem.
location = R * location(:);
orientation = orientation * R';
% Rotate 90 degrees around z.
R = [0 1 0; -1 0 0; 0 0 1];
orientation = orientation * R';
% Decompose the rotation matrix into Euler angles.
% This is the inverse operation of the transformation defined in
% monoCamera.rotationMatrix()
R = [0 -1 0; -1 0 0; 0 0 -1] * orientation';
%==========================================================================
function R = getZAxisRotationMatrix(isPatternHorizontal)
if isPatternHorizontal
% Flip Y and Z axis.
R = [1 0 0; 0 -1 0; 0 0 -1];
else
% Rotate -90 degrees around x.
R = [1 0 0; 0 0 1; 0 -1 0];
end
%==========================================================================
function R = getXAxisRotationMatrix(pattternPosition, isPatternHorizontal)
if strcmpi(pattternPosition, 'front')
R = [1 0 0; 0 1 0; 0 0 1];
elseif strcmpi(pattternPosition, 'back')
if isPatternHorizontal
R = [-1 0 0; 0 -1 0; 0 0 1];
else
R = [-1 0 0; 0 1 0; 0 0 -1];
end
elseif strcmpi(pattternPosition, 'left')
if isPatternHorizontal
R = [0 1 0; -1 0 0; 0 0 1];
else
R = [0 0 -1; 0 1 0; 1 0 0];
end
elseif strcmpi(pattternPosition, 'right')
if isPatternHorizontal
R = [0 -1 0; 1 0 0; 0 0 1];
else
R = [0 0 1; 0 1 0; -1 0 0];
end
end

Risposte (0)

Categorie

Scopri di più su 3-D Scene Control in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by