如何通过SVD求解旋转矩阵?U、V含义及公式原理答疑
Great question—let’s unpack this clearly, since SVD-based rigid registration can feel abstract until you connect the pieces.
First, let’s set the stage properly:
We’re working with two sets of corresponding points (e.g., 3D points from a scan and a model):
- Let
Abe the source point set (n points, each a 3D vector) - Let
Bbe the target point set (n corresponding points)
Before applying SVD, we must center both point sets by subtracting their respective centroids:
A' = A - mean(A)(each point inAminus the average of all points inA)B' = B - mean(B)
This step is critical because rotation acts around a center point; centering removes translation, so we can focus solely on rotation.
Step 1: The Covariance Matrix H
First, we construct a 3x3 covariance matrix H that captures the relationship between the centered point sets:
H = B' * A'^T
Here, A'^T is the transpose of A'. Intuitively, H measures how the points in A' relate to the points in B'—it encodes the "directional overlap" between the two sets.
Step 2: What Are U and V in SVD?
We perform Singular Value Decomposition (SVD) on H, which gives us:
H = U * Σ * V^T
Let’s break down each component:
U: A 3x3 orthogonal matrix (its columns are mutually perpendicular, andU^T = U^{-1}). The columns ofUare the principal component directions of the centered target setB'. In other words,Ucaptures the main axes along whichB'is distributed.V: Another 3x3 orthogonal matrix. The columns ofVare the principal component directions of the centered source setA'. It captures the main axes ofA''s distribution.Σ: A diagonal matrix with non-negative "singular values" on its diagonal, ordered from largest to smallest. These values measure the strength of the correlation between the corresponding principal components ofA'andB'.
Think of U and V as coordinate systems that align with the "shape" of each point set. SVD essentially decomposes the relationship between A' and B' into these two coordinate systems plus a scaling factor (Σ).
Step 3: Why R = U^T * V Gives the Rotation Matrix?
Our goal is to find an orthogonal matrix R (rotation matrices are orthogonal with determinant = 1) such that B' ≈ R * A'—meaning we want to rotate A' to best match B' in a least-squares sense.
Here’s why U^T * V works:
- Orthogonality Preservation: Since
UandVare orthogonal matrices, their transposes and products are also orthogonal.U^Tis orthogonal, soU^T * Vis orthogonal (the product of two orthogonal matrices is orthogonal). This guaranteesRhas the right structure for a rotation/reflection. - Aligning Principal Components:
V^Trotates the source setA'so its principal components align with the standard coordinate axes.Urotates the standard coordinate axes to align with the target setB''s principal components.- Combining these,
U^T * Vdirectly maps the principal components ofA'to those ofB'—exactly the rotation needed to align the two point sets.
One Edge Case to Watch For
Occasionally, det(U^T * V) might equal -1 instead of 1. This means the matrix represents a reflection (a flip plus rotation) rather than a pure rotation. To fix this, multiply the last column of V by -1 before computing R:
if det(U^T * V) == -1: V[:, 2] *= -1 R = U^T * V
This ensures det(R) = 1, giving us a valid pure rotation matrix.
Quick Example to Solidify
Suppose we have a 2D source set A' = [(1, 0), (2, 0)] (aligned along the x-axis) and target set B' = [(0, 1), (0, 2)] (aligned along the y-axis). The covariance matrix H = B' * A'^T is:
H = [[0*1 + 0*2, 0*0 + 0*0], [1*1 + 2*2, 1*0 + 2*0]] = [[0, 0], [5, 0]]
SVD of H gives U = [[0, 1], [1, 0]], Σ = [[5, 0], [0, 0]], V = [[1, 0], [0, 1]]. Then R = U^T * V = [[0, 1], [1, 0]]^T * [[1,0],[0,1]] = [[0, 1], [1, 0]]—which is exactly the 90-degree rotation matrix needed to turn A' into B'.
内容的提问来源于stack exchange,提问作者vignesh viki

