Absolute Orientation - Horn's method

版本 1.5.0.0 (18.5 KB) 作者: Matt J
Solves weighted absolute orientation problem using Horn's quaternion-based method.
9.3K 次下载
更新时间 2022/5/25

查看许可证

ABSOR is a tool for least squares estimation of the rotation -- and optionally also the
scaling and translation -- that maps one collection of point coordinates to
another. It is based on Horn's quaternion-based algorithm. The function works for both 2D and 3D coordinates, and also gives the option of weighting the coordinates non-uniformly. The code avoids for-loops so as to maximize speed.
DESCRIPTION:
As input data, one has
A: a 2xN or 3xN matrix whos columns are the coordinates of N source points.
B: a 2xN or 3xN matrix whos columns are the coordinates of N target points.
The basic syntax
[regParams,Bfit,ErrorStats]=absor(A,B)
solves the unweighted/unscaled registration problem
min. sum_i ||R*A(:,i) + t - B(:,i)||^2
for unknown rotation matrix R and unknown translation vector t.
ABSOR can also solve the more general problem
min. sum_i w(i)*||s*R*A(:,i) + t - B(:,i)||^2
where s>=0 is an unknown global scale factor to be estimated, along with R and t,
and w is a user-supplied N-vector of weights. One can include/exclude any
combination of s, w, and translation t in the problem formulation. Which
parameters participate is controlled using the syntax,
[regParams,Bfit,ErrorStats]=absor(A,B,'param1',value1,'param2',value2,...)
with parameter/value pair options,
'doScale' - Boolean flag. If TRUE, the global scale factor, s, is included.
Otherwise, it is assumed that s=1. Default=FALSE.
'doTrans' - Boolean flag. If TRUE, the translation, t, is included. Otherwise,
zero translation is assumed. Default=TRUE.
'weights' - The length N-vector of weights, w. Default, no weighting.
OUTPUTS:
regParams: structure output with estimated registration parameters,
regParams.R: The estimated rotation matrix, R
regParams.t: The estimated translation vector, t
regParams.s: The estimated scale factor.
regParams.M: Homogenous coordinate transform matrix [s*R,t;[0 0 ... 1]].
For 3D problems, the structure includes
regParams.q: A unit quaternion [q0 qx qy qz] corresponding to R and
signed to satisfy max(q)=max(abs(q))>0
For 2D problems, it includes
regParams.theta: the counter-clockwise rotation angle about the
2D origin
Bfit: The rotation, translation, and scaling (as applicable) of A that
best matches B.
ErrorStats: structure output with error statistics. In particular,
defining err(i)=sqrt(w(i))*norm( Bfit(:,i)-B(:,i) ),
it contains
ErrorStats.errlsq = norm(err)
ErrorStats.errmax = max(err)

引用格式

Matt J (2024). Absolute Orientation - Horn's method (https://www.mathworks.com/matlabcentral/fileexchange/26186-absolute-orientation-horn-s-method), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2009b
兼容任何版本
平台兼容性
Windows macOS Linux
致谢

参考作品: Absolute Orientation

启发作品: microwae engineering

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.5.0.0

Updated to take advantage of implicit expansion.

1.4.0.0

*The many previous files in the distribution have been consolidated into a single file absor.m.

*New capability:weighted least squares registration.

*Fixed minor bug in the 2D registration routines, occurring when rotation angle was 0.
Added the option of constraining translation to zero (see the 'doTrans' parameter).
Small edits to the file description.

1.3.0.0

Added tools for purely 2D registration

1.2.0.0

Added absorientParams. See README.txt for details

1.1.0.0

1. Important typo fix in help doc. Model is s*R*A+t not s*R*A-t
2. Added version for earlier MATLAB versions lacking bsxfun

1.0.0.0