Here we just consider objects made up from a finite number
k of points in
n dimensions. Often, these points are selected on the continuous surface of complex objects, such as a human bone, and in this case they are called
landmark points. The shape of an object can be considered as a member of an
equivalence class formed by removing the
translational,
rotational and
uniform scaling components.
Translation For example, translational components can be removed from an object by translating the object so that the
mean of all the object's points (i.e. its
centroid) lies at the origin. Mathematically: take k points in two dimensions, say :((x_1,y_1),(x_2,y_2),\dots,(x_k,y_k))\,. The mean of these points is (\bar{x},\bar{y}) where :\bar{x} = \frac{x_1+x_2+\cdots+x_k}{k},\quad \bar{y} = \frac{y_1+y_2+\cdots+y_k}{k}. Now translate these points so that their mean is translated to the origin (x,y)\to(x-\bar{x},y-\bar{y}), giving the point (x_1-\bar{x},y_1-\bar{y}),\dots.
Uniform scaling Likewise, the scale component can be removed by scaling the object so that the
root mean square distance (
RMSD) from the points to the translated origin is 1. This RMSD is a statistical measure of the object's
scale or
size: :s= \sqrt{{(x_1-\bar{x})^2+(y_1-\bar{y})^2+\cdots} \over k} The scale becomes 1 when the point coordinates are divided by the object's initial scale: :((x_1-\bar{x})/s,(y_1-\bar{y})/s). Notice that other methods for defining and removing the scale are sometimes used in the literature.
Rotation Removing the rotational component is more complex, as a standard reference orientation is not always available. Consider two objects composed of the same number of points with scale and translation removed. Let the points of these be ((x_1,y_1),\ldots), ((w_1,z_1),\ldots). One of these objects can be used to provide a reference orientation. Fix the reference object and rotate the other around the origin, until you find an optimum angle of rotation \theta\,\! such that the sum of the squared distances (
SSD) between the corresponding points is minimised (an example of
least squares technique). A rotation by angle \theta\,\! gives : (u_1,v_1) = (\cos\theta\,w_1-\sin\theta\,z_1,\,\sin\theta\,w_1+\cos\theta\,z_1)\,\!. where (u,v) are the coordinates of a rotated point. Taking the derivative of (u_1-x_1)^2+(v_1-y_1)^2+\cdots with respect to \theta and solving for \theta when the derivative is zero gives : \theta = \tan^{-1}\left(\frac{\sum_{i=1}^k(w_iy_i-z_ix_i)}{\sum_{i=1}^k(w_ix_i + z_iy_i)}\right). When the object is three-dimensional, the optimum rotation is represented by a 3-by-3
rotation matrix R, rather than a simple angle, and in this case
singular value decomposition can be used to find the optimum value for
R (see the solution for the constrained
orthogonal Procrustes problem, subject to
det(
R) = 1).
Shape comparison The difference between the shape of two objects can be evaluated only after "superimposing" the two objects by translating, scaling and optimally rotating them as explained above. The
square root of the above mentioned SSD between corresponding points can be used as a statistical measure of this difference in shape: : d = \sqrt{(u_1-x_1)^2+(v_1-y_1)^2+\cdots}. This measure is often called
Procrustes distance. Notice that other more complex definitions of Procrustes distance, and other measures of "shape difference" are sometimes used in the literature.
Superimposing a set of shapes We showed how to superimpose two shapes. The same method can be applied to superimpose a set of three or more shapes, as far as the above mentioned reference orientation is used for all of them. However, Generalized Procrustes analysis provides a better method to achieve this goal. == Generalized Procrustes analysis (GPA) ==