Affine shape adaptation is a methodology for iteratively adapting the shape of the smoothing kernels in an affine group of smoothing kernels to the local image structure in neighbourhood region of a specific image point. Equivalently, affine shape adaptation can be accomplished by iteratively warping a local image patch with affine transformations while applying a rotationally symmetric filter to the warped image patches. Provided that this iterative process converges, the resulting fixed point will be affine invariant. In the area of computer vision, this idea has been used for defining affine invariant interest point operators as well as affine invariant texture analysis methods.

The interest points obtained from the scale-adapted Laplacian blob detector or the multi-scale Harris corner detector with automatic scale selection are invariant to translations, rotations and uniform rescalings in the spatial domain. The images that constitute the input to a computer vision system are, however, also subject to perspective distortions. To obtain interest points that are more robust to perspective transformations, a natural approach is to devise a feature detector that is invariant to affine transformations.

Interestingly, affine invariance can be accomplished from measurements of the same multi-scale windowed second moment matrix ${\displaystyle \mu }$ as is used in the multi-scale Harris operator provided that we extend the regular scale space concept obtained by convolution with rotationally symmetric Gaussian kernels to an affine Gaussian scale-space obtained by shape-adapted Gaussian kernels (Lindeberg 1994 section 15.3; Lindeberg and Garding 1997). For a two-dimensional image ${\displaystyle I}$, let ${\displaystyle {\bar {x}}=(x,y)^{T}}$ and let ${\displaystyle \Sigma _{t}}$ be a positive definite 2×2 matrix. Then, a non-uniform Gaussian kernel can be defined as

${\displaystyle g({\bar {x}};\Sigma )={\frac {1}{2\pi {\sqrt {\operatorname {det} \Sigma _{t}}}}}e^{-{\bar {x}}\Sigma _{t}^{-1}{\bar {x}}/2}}$

and given any input image ${\displaystyle I_{L}}$ the affine Gaussian scale-space is the three-parameter scale-space defined as

${\displaystyle L({\bar {x}};\Sigma _{t})=\int _{\bar {xi}}I_{L}(x-\xi )\,g({\bar {\xi }};\Sigma _{t})\,d{\bar {\xi }}.}$

Next, introduce an affine transformation ${\displaystyle \eta =B\xi }$ where ${\displaystyle B}$ is a 2×2-matrix, and define a transformed image ${\displaystyle I_{R}}$ as

${\displaystyle I_{L}({\bar {\xi }})=I_{R}({\bar {\eta }})}$.

Then, the affine scale-space representations ${\displaystyle L}$ and ${\displaystyle R}$ of ${\displaystyle I_{L}}$ and ${\displaystyle I_{R}}$, respectively, are related according to

${\displaystyle L({\bar {\xi }},\Sigma _{L})=R({\bar {\eta }},\Sigma _{R})}$

provided that the affine shape matrices ${\displaystyle \Sigma _{L}}$ and ${\displaystyle \Sigma _{R}}$ are related according to

${\displaystyle \Sigma _{R}=B\Sigma _{L}B^{T}}$.

Disregarding mathematical details, which unfortunately become somewhat technical if one aims at a precise description of what is going on, the important message is that the affine Gaussian scale-space is closed under affine transformations.

If we, given the notation ${\displaystyle \nabla L=(L_{x},L_{y})^{T}}$ as well as local shape matrix ${\displaystyle \Sigma _{t}}$ and an integration shape matrix ${\displaystyle \Sigma _{s}}$, introduce an affine-adapted multi-scale second-moment matrix according to

${\displaystyle \mu _{L}({\bar {x}};\Sigma _{t},\Sigma _{s})=g({\bar {x}}-{\bar {\xi }};\Sigma _{s})\,\left(\nabla _{L}({\bar {\xi }};\Sigma _{t})\nabla _{L}^{T}({\bar {\xi }};\Sigma _{t})\right)}$

it can be shown that under any affine transformation ${\displaystyle {\bar {q}}=B{\bar {p}}}$ the affine-adapted multi-scale second-moment matrix transforms according to

${\displaystyle \mu _{L}({\bar {p}};\Sigma _{t},\Sigma _{s})=B^{T}\mu _{R}(q;B\Sigma _{t}B^{T},B\Sigma _{s}B^{T})B}$.

Again, disregarding somewhat messy technical details, the important message here is that given a correspondence between the image points ${\displaystyle {\bar {p}}}$ and ${\displaystyle {\bar {q}}}$, the affine transformation ${\displaystyle B}$ can be estimated from measurements of the multi-scale second-moment matrices ${\displaystyle \mu _{L}}$ and ${\displaystyle \mu _{R}}$ in the two domains.

An important consequence of this study is that if we can find an affine transformation ${\displaystyle B}$ such that ${\displaystyle \mu _{R}}$ is a constant times the unit matrix, then we obtain a fixed-point that is invariant to affine transformations (Lindeberg 1994 section 15.4; Lindeberg and Garding 1997). For the purpose of practical implementation, this property can often be reached by in either of two main ways. The first approach is based on transformations of the smoothing filters and consists of:

• estimating the second-moment matrix ${\displaystyle \mu }$ in the image domain,
• determining a new adapted smoothing kernel with covariance matrix proportional to ${\displaystyle \mu ^{-1}}$,
• smoothing the original image by the shape-adapted smoothing kernel, and
• repeating this operation until the difference between two successive second-moment matrices is sufficiently small.

The second approach is based on warpings in the image domain and implies:

• estimating ${\displaystyle \mu }$ in the image domain,
• estimating a local affine transformation proportional to ${\displaystyle {\hat {B}}=\mu ^{1/2}}$ where ${\displaystyle \mu ^{1/2}}$ denotes the square root matrix of ${\displaystyle \mu }$,
• warping the input image by the affine transformation ${\displaystyle {\hat {B}}^{-1}}$ and
• repeating this operation until ${\displaystyle \mu }$ is sufficiently close to a constant times the unit matrix.

This overall process is referred to as affine shape adaptation (Lindeberg and Garding 1997; Baumberg 2000; Mikolajczyk and Schmid 2004; Tuytelaars and van Gool 2004; Lindeberg 2008). In the ideal continuous case, the two approaches are mathematically equivalent. In practical implementations, however, the first filter-based approach is usually more accurate in the presence of noise while the second warping-based approach is usually faster.

In practice, the affine shape adaptation process described here is often combined with interest point detection automatic scale selection as described in the articles on blob detection and corner detection, to obtain interest points that are invariant to the full affine group, including scale changes. Besides the commonly used multi-scale Harris operator, this affine shape adaptation can also be applied to other types of interest point operators such as the Laplacian/Difference of Gaussian blob operator and the determinant of the Hessian (Lindeberg 2008). Affine shape adaptation can also be used for affine invariant texture recognition and affine invariant texture segmentation.