Eliminate translation before fitting orientation
A microscope images the same markers twice. Marker \(i\) has coordinates \(p_i\) in the first image and \(q_i\) in the second. Seek a proper planar rotation \(R\) and translation \(t\) minimising \(\sum_i\|q_i-Rp_i-t\|^2\). Differentiating with respect to \(t\) gives
Substituting this expression centres both sets. Write \(P_i=p_i-\bar p\) and \(Q_i=q_i-\bar q\). Orthogonality of \(R\) makes \(\sum\|P_i\|^2+\|Q_i\|^2\) independent of the angle. Minimising distance is therefore equivalent to maximising \(\sum Q_i^TRP_i\).
Recover the angle and its conditioning
Insert the rotation matrix with first column \((\cos\theta,\sin\theta)\). Collect the cosine and sine terms to obtain \(C\cos\theta+S\sin\theta\), with \(C=\sum P_i\cdot Q_i\) and \(S=\sum(P_{ix}Q_{iy}-P_{iy}Q_{ix})\). The maximum occurs at \(\operatorname{atan2}(S,C)\). Unlike an ordinary arctangent, this keeps the quadrant and handles \(C=0\). The objective curvature at the maximum is \(-\sqrt{C^2+S^2}\). Small curvature signals that very different angles fit almost equally well.
Two fits with identical measurement precision
For centred markers \((-1,0),(1,0)\) and observations \((0,-1),(0,1)\), \(C=0,S=2\). The result is 90 degrees. Adding the displacement \((3,2)\) to every observation leaves the fitted angle unchanged and recovers precisely that translation. If both markers coincide then all centred \(P_i\) vanish and no angle can be identified.
Now separate the original markers by \(2a\) and shift one observed marker by a transverse measurement error \(\epsilon\). At zero true rotation the connecting segment tilts by \(\arctan(\epsilon/(2a))\). The same 0.1 mm error means about 2.86° for \(a=1\) mm but only 0.29° for \(a=10\) mm. A low spatial residual alone is an incomplete calibration certificate.
Vary the calibration baseline
The true angle is fixed at 20 degrees. A vertical error is added to the positive marker in the second image. The plotted squared distance is computed after centring. Locate its minimum and examine how broad it is for a short or long baseline.
Tutorial on what the fit measures
If an unconstrained matrix maps a chiral triangle to its mirror with zero error, can a proper planar rotation do the same?
Worked solution
A rotation has determinant +1 and preserves signed area. A reflection reverses signed area. A non-collinear labelled triangle cannot match its mirror exactly under a proper rotation and translation.
Why can one ignore weights for equally precise markers but not for a blurred outlier?
Worked solution
Independent isotropic errors with equal variance give a common quadratic weight. Different variances require weighted centroids and weighted \(C,S\) sums. A very noisy marker should contribute less to the fitted orientation.