Minimizing mean square error for a body tracking problem

조회 수: 3 (최근 30일)
K E
K E 2012년 6월 5일
Seeking big-picture suggestions on how to tackle the following problem: I have measurements of the positions of 4 marker locations on a 3D body, and I know how to write the rotation/translation matrix given the body's unknown yaw, pitch, roll, and x,y,z translation. I want to solve for the yaw, pitch, etc. which minimizes the error of [markers' estimated separations] - [known marker separations]. I could loop through the expected range of yaw, pitch, etc., calculate the resulting marker separation, and choose the combination with smallest distance from their known separation. But is there a way to perform the minimization in 1 step? I assume this would be faster, especially since this will be inside a time loop.

채택된 답변

Anton Semechko
Anton Semechko 2012년 6월 5일
No pen and paper necessary. Here is code for the function that I already have:
function [R,t,s]=SymTformParams(Xref,Xsrc)
% Compute rotation (R), translation (t) and scaling (s) parameters, such
% that Xref=s*R*Xsrc+t, where Xref and Xsrc are two point sets, respectively.
%
% - Xref,Xsrc : N-by-3 arrays of corresponding point coordinates.
% - R : 3x3 rotation matrix.
% - t : 1x3 translation vector.
% - s : scaling factor.
%
% AUTHOR: Anton Semechko (a.semechko@gmail.com)
% DATE: Apr.2012
%
% Find the centroids
Cref=mean(Xref,1);
Csrc=mean(Xsrc,1);
% Center the point sets
Xref=bsxfun(@minus,Xref,Cref);
Xsrc=bsxfun(@minus,Xsrc,Csrc);
N=size(Xref,1);
% Compute the covariance matrix
Cmat=(Xref'*Xsrc)/N;
% Find rotation using SVD
[U,~,V] = svd(Cmat);
R=U*diag([1 1 det(U*V')])*V';
% Find the scaling factor
Xref_L2=sum(Xref.^2,2);
Xsrc_L2=sum(Xsrc.^2,2);
s=Xref_L2./Xsrc_L2;
s=mean(sqrt(s));
% Translation
t=Cref-(s*R*Csrc')';

추가 답변 (1개)

Anton Semechko
Anton Semechko 2012년 6월 5일
If point correspondences are known, do the following:
1) solve for translation, by comparing the centroids of the landmark sets before and after the transformation 2) normalize for translation and find rotation matrix using SVD (<http://kwon3d.com/theory/jkinem/rotmat.html>)
If you are interested in finding the Euler angles, you can use the 't2x' which can be downloaded from here: http://www.mathworks.com/matlabcentral/fileexchange/956-3d-rotations.
  댓글 수: 1
K E
K E 2012년 6월 5일
Thanks, Anton. It is paper and pencil time to work through this.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Labeling, Segmentation, and Detection에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by