Eigenvectors in image analysis
Eigenvectors appear on more than a dozen days of this course, from principal components on day 1 to camera calibration near the end. This page puts them side by side: what question each method asks of its matrix, which eigenvector it keeps, and when the answer stops meaning anything. Each method is taught in its own unit; follow the links for the full story.
The page is in two layers, like the units: the ideas and pictures first, then one short collapsed callout, The math, for the theorem that ties them together. You can skip it.
The question
A matrix is a recipe for turning one vector into another. Most vectors come out pointing somewhere new. A few special directions come out pointing the same way, only longer or shorter: those are the eigenvectors, and the stretch factor is the eigenvalue.
In image analysis the matrix is almost always symmetric, and then the picture is especially simple: the matrix is an ellipse (or an ellipsoid in more dimensions). The eigenvectors are the ellipse’s axes, at right angles to each other, and the eigenvalues say how long each axis is. So the same question keeps coming back, in many disguises:
Along which directions is this thing most stretched, and least stretched, and by how much?
The “thing” changes from day to day: a cloud of images, the gradients in a small window, the curvature of the grey-level landscape, the pixels of one object, the links of a graph, a set of equations about a camera. The answer is always read the same way.
One picture, four meanings
The four panels come from four different days, and the matrices mean different things:
- PCA (principal component analysis): the spread of a cloud of images. The long axis is the direction in which the images differ most.
- Structure tensor (structure tensor): the spread of the gradients in a window. The long axis is the direction across the dominant edges; the short axis runs along them.
- Moments (region properties): the spread of an object’s pixels. The axes are the object’s orientation and its length and width.
- Hessian (the Hessian): the curvature of the image seen as a landscape. One eigenvector points across a ridge, where it bends sharply; the other along it, where it is flat.
The first three are the same computation on different points: average the products of the coordinates (a covariance or second-moment matrix), then take the ellipse. The Hessian is different: its numbers can be negative, and the sign matters (bright or dark, hill or valley).
Four kinds of matrix
Sorted by where the matrix comes from, the course’s eigenvector methods fall into four groups. The group tells you how to read the eigenvalues.
- The spread of a cloud (covariance, second moments). Eigenvalues are variances: never negative, and big means “a lot happens along this direction”. PCA, the KLT behind transform coding, the structure tensor, region moments, shape models, the ellipses of a Gaussian mixture, the decorrelation stretch of a colour image, and the stain directions in H&E.
- Curvature (second derivatives). Eigenvalues are signed curvatures. The Hessian for blobs, ridges and vessels (vessel networks), and the test that throws away edge-like keypoints.
- An operator that acts on the whole image or graph: a blur, a smoothing step, a graph’s Laplacian. Here the eigenvectors are whole patterns (waves, or a split of the graph), and the eigenvalue says what the operator does to that pattern. A blur’s eigenvectors are the Fourier waves (frequency space, an ill-posed problem); the heat equation, quadratic smoothing and the snake matrix damp each wave by its own factor; and normalized cuts split a graph with one eigenvector.
- A set of equations with no exact solution, where we want the vector that comes closest to solving them all: camera calibration, the homography between two photographs, the fundamental matrix of two views, and the rotation in Procrustes alignment. The answer is the direction the equations stretch least (the smallest singular vector, the same idea for a non-square matrix).
Side by side
| Method (unit) | Matrix, and its size | What it keeps | Assumes | Cost | Fails when |
|---|---|---|---|---|---|
| PCA | covariance of the data, one row and column per pixel (or feature) | the largest: directions of most variance | the cloud is roughly flat (linear); features in comparable units | one eigenproblem per data set, or a few leading vectors only | outliers; mixed units; curved clouds; near-equal eigenvalues |
| KLT vs DCT | covariance of 8 × 8 blocks (64 × 64) | the largest: best energy compaction | the image statistics are the same everywhere | one eigenproblem, and the basis must be stored with the data; codecs use the fixed DCT instead | statistics that change across the image; in practice the DCT is almost as good |
| Structure tensor | averaged products of gradients, 2 × 2 per pixel | both: orientation from the larger, corner strength from the smaller | one orientation per window (window size ρ) | closed form per pixel; a few blurs | two textures in one window; ρ too small (noise) or too large (mixing) |
| Lucas–Kanade | the same 2 × 2 matrix | the smaller eigenvalue as confidence | brightness constancy, one motion per window | closed form per pixel | edges and flat areas (the aperture problem): small eigenvalue |
| Hessian | second derivatives, 2 × 2 per pixel (3 × 3 in 3D) | signs and sizes: blob, ridge or saddle; the ridge direction | structure size matches σ | closed form per pixel; three derivative filters per σ | wrong σ; crossings and junctions; edges beside lines |
| Moments | covariance of an object’s pixel positions, 2 × 2 | both: orientation, length and width of the equivalent ellipse | the object is elongated | three sums per object | round or symmetric shapes (disc, square, star): no orientation |
| Shape models | covariance of aligned landmark vectors (2n × 2n for n landmarks) | the largest: modes of variation | corresponding landmarks; variation roughly linear | one eigenproblem on the training set | few training shapes; bending or non-linear variation |
| Blur, deconvolution | the blur as a circulant matrix (pixels × pixels) | all of them, known in advance: Fourier waves; eigenvalue = transfer function | a shift-invariant blur, periodic border | one FFT | small eigenvalues amplify noise when inverted |
| Heat equation, snakes | the Laplacian or the snake matrix | all of them: waves; eigenvalue = how fast each wave is damped | uniform grid or evenly spaced beads | one FFT, or a banded solve | explicit steps longer than the stability limit (the largest eigenvalue) explode |
| Normalized cuts | graph Laplacian of affinities, one row per node or pixel | the second smallest (Fiedler vector) | groups are linked by weak edges; the affinity scale σ suits the data | an iterative sparse eigensolver; heavy for many pixels | no weak link; wrong σ; the vector must still be thresholded |
| Calibration, homography, F | stacked linear equations, many rows × 12, 9 or 9 | the smallest singular vector | enough points in general position; coordinates normalised | one small SVD | all points on one plane (calibration); unnormalised pixel coordinates; outliers (use RANSAC first) |
Two columns are worth reading down. “What it keeps” shows that “eigenvector” alone does not say much: some methods want the largest, some the smallest, some both, and one the second smallest. “Fails when” shows the two failures that every row shares: two eigenvalues that are nearly equal (the direction is not defined), and a smallest eigenvalue near zero (something cannot be pinned down).
Reading two eigenvalues
Many methods need no eigenvectors at all, only the two eigenvalues, and they read them as a point in a plane:
- Structure tensor: the Harris and Förstner corner scores (structure tensor) are formulas that are large only in the “both large” corner of the left plane, and Lucas–Kanade uses the same corner as “the motion here can be trusted” (Lucas–Kanade). In a small window around the corner of a synthetic square, both eigenvalues are of the same order (0.011 and 0.007); across a straight edge the smaller one is exactly 0.
- Hessian: the vesselness score keeps the “bright line” band of the right plane (the Hessian, vessel networks); the Laplacian of Gaussian is the sum of the two (the trace), and the keypoint edge test rejects points whose two curvatures differ too much.
- Moments: the trace and the gap between the eigenvalues do not change when the object rotates, which makes them moment invariants.
Sums and products of eigenvalues (trace and determinant) can be computed without solving for the eigenvalues at all, which is why so many detectors are written that way.
Largest, smallest, or second smallest
Whether we want the largest or the smallest eigenvalue depends on what the eigenvalue costs.
- In a covariance, the eigenvalue is how much the data vary along a direction. To keep as much of the data as possible with few numbers, keep the largest: that is PCA, and the same choice gives the shape modes and the KLT.
- In a Laplacian or a snake matrix, the eigenvalue is how much a pattern costs: how much it changes across strong links, or how much it wiggles. The cheapest pattern is a constant, which says nothing (eigenvalue 0). The second smallest, the Fiedler vector, is the cheapest pattern that is not constant: it changes where the links are weak, so its sign splits the graph (normalized cuts). On a uniform chain, with no weak link anywhere, the cheap patterns are just slow waves: the same waves that the heat equation damps last and the snake keeps longest (the snake as a linear system).
- In a stack of equations, the eigenvalue of the smallest singular vector is the leftover error. The smallest one is the vector that comes closest to satisfying every equation: the camera matrix, the homography, the fundamental matrix.
Small eigenvalues: what the data cannot pin down
A small eigenvalue is not just “the least interesting direction”. When we have to solve with the matrix, it is the direction in which a little noise in the data becomes a large error in the answer. The course meets this again and again:
- Deconvolution: the blur’s eigenvalues are its transfer function. Frequencies the microscope barely passes have tiny eigenvalues, and dividing by them blows up the noise (an ill-posed problem); regularisation damps exactly those directions (regularisation).
- Unmixing: two dyes with nearly the same spectrum make a matrix with one small eigenvalue, along the difference of the two dyes; their sum is measured well, their difference badly (least-squares unmixing).
- Optical flow: at an edge the smaller eigenvalue of the window’s matrix is near zero, and the motion along the edge cannot be measured at all: the aperture problem (Lucas–Kanade).
- Moments: monomial moments of high order are nearly parallel, which makes their matrix badly conditioned; orthogonal bases fix it (Legendre moments).
- Structure from motion: a whole reconstruction can be moved, turned and scaled without changing the images, so several eigenvalues are exactly zero until we fix that freedom (bundle adjustment).
The ratio of the largest to the smallest eigenvalue, the condition number, is the one number that summarises all of these: roughly, it is the factor by which relative noise can grow.
Fixed bases and learned bases

Some eigenvectors are learned from data; others are known before we see a single image.
- Learned: PCA, shape modes, the KLT. They are the best possible basis for this data, and they must be computed (and, for compression, sent along).
- Known in advance: every operator that treats every position the same way (a blur, a smoothing step, the heat equation, a ring-shaped snake) has the Fourier waves as its eigenvectors (frequency space). This is why filtering is a multiplication in the frequency domain, why the snake smooths its wiggles first, and why heat flow is a low-pass filter.
The figure shows where the two meet. For images whose statistics are the same everywhere (neighbouring pixels correlate in the same way all over the image), the learned PCA basis of small patches comes out close to a fixed cosine basis. That is why compression can use the fixed DCT instead of the image’s own KLT and lose almost nothing (transform coding). Where the data are not like that (hand shapes, faces, a few cell types), the learned basis wins, and a non-linear autoencoder goes further still: a linear autoencoder can do no better than PCA.
When eigenvectors mislead
- Nearly equal eigenvalues: a round cloud, a disc-shaped object, a flat or isotropic texture, a structure tensor at a junction. The ellipse is a circle, and its “axes” are decided by the noise. Report the subspace (or the eigenvalues alone), not the individual directions. A disc, a square and a five-pointed star all have equal moment eigenvalues (shape features).
- The sign is arbitrary. An eigenvector and its negative are equally correct. Shape modes, the Fiedler vector and principal components may flip sign between two runs or two data sets; compare them only after fixing a sign.
- Outliers and units. A covariance is a sum of squares: one bad image, or one feature in larger units, can turn the first component (PCA).
- Curved data. Eigenvectors describe flat (linear) structure. Images of a moving spot lie on a curve, and no single principal component follows it (autoencoder).
- Scale. The structure tensor and the Hessian depend on the scales σ and ρ: the eigenvalues answer the question at the scale you asked it (scale space).
- Variance is not meaning. The largest component may be lighting, focus or a batch effect, not the biology you care about.
Try it
Two demos from the course, at the two ends of the table: the largest eigenvector of a covariance, and the second smallest of a graph Laplacian.
Principal components of two-pixel images (from PCA). Each dot is a two-pixel image; drag the blue direction and watch the variance (blue curve) and the reconstruction error (red curve) trade places: the best direction for one is the best for the other. Try the presets round cloud and one outlier.
The Fiedler vector (from normalized cuts). Points coloured by the second eigenvector of the graph Laplacian (blue negative, orange positive). Try blobs + outlier with and without “normalized”, and raise σ on two rings until the split changes.
More eigenvector demos: the structure tensor, the Hessian per pixel, the modes of a snake, a point distribution model, moments of a shape, PCA of the colour cloud, one block in three bases and Gaussians, ellipses and mixtures.
The math
Spectral theorem. A real symmetric n \times n matrix M has n real eigenvalues \lambda_1 \ge \dots \ge \lambda_n and orthonormal eigenvectors \mathbf u_1, \dots, \mathbf u_n: M = U\Lambda U^\top. In the eigenvector coordinates M only stretches, axis by axis.
Rayleigh quotient. For a unit vector \mathbf u, \mathbf u^\top M\mathbf u = \sum_k \lambda_k (\mathbf u_k^\top\mathbf u)^2, \qquad \lambda_n \le \mathbf u^\top M\mathbf u \le \lambda_1 , with the maximum at \mathbf u_1 and the minimum at \mathbf u_n. Restricted to vectors orthogonal to \mathbf u_n, the minimum is \lambda_{n-1} at \mathbf u_{n-1}, and so on. Every row of the table is one of these extremal problems:
- PCA, KLT, shape modes: M = S, the covariance; \mathbf u^\top S\mathbf u is the variance of the scores along \mathbf u. Maximise it.
- Structure tensor: M = J = \overline{\nabla I\,\nabla I^\top}; \mathbf u^\top J\mathbf u is the mean squared derivative in direction \mathbf u. Max: across the edges; min: along them.
- Hessian: \mathbf u^\top H\mathbf u is the second derivative (curvature) in direction \mathbf u; the eigenvalues are the extreme curvatures.
- Graph Laplacian: \mathbf x^\top L\mathbf x = \sum_{p \sim q} w_{pq}(x_p - x_q)^2, the cost of a pattern \mathbf x. Minimise it with \mathbf x \perp \mathbf 1 (not constant): the Fiedler vector. Normalized cuts use \mathbf x^\top L\mathbf x / \mathbf x^\top D\mathbf x, a generalized eigenproblem L\mathbf x = \mu D\mathbf x.
- Homogeneous equations A\mathbf p \approx \mathbf 0: minimise \lVert A\mathbf p\rVert^2 = \mathbf p^\top (A^\top A)\mathbf p with \lVert\mathbf p\rVert = 1: the eigenvector of A^\top A with the smallest eigenvalue, i.e. the right singular vector of A with the smallest singular value.
Shift-invariant operators. A circulant matrix C (a circular convolution) satisfies C\mathbf w_k = H(k)\,\mathbf w_k for every Fourier wave \mathbf w_k = (e^{2\pi i kj/n})_j, with H the DFT of the kernel. So all blurs, the 1D Laplacian (H(k) = 2 - 2\cos(2\pi k/n) on a ring) and the snake matrix share one set of eigenvectors, and the DFT diagonalises them all.
Conditioning. Solving M\mathbf x = \mathbf b with M = U\Lambda U^\top gives \mathbf x = \sum_k (\mathbf u_k^\top\mathbf b/\lambda_k)\,\mathbf u_k: noise along \mathbf u_k is multiplied by 1/\lambda_k. The condition number \kappa = \lambda_1/\lambda_n bounds the growth of relative error.
Where to read more
In course order, the units where eigenvectors do the work:
- Day 1: principal component analysis (exercise), images in frequency space (waves as eigenvectors of convolution)
- Day 2: the Hessian, the structure tensor
- Day 4: running the model backwards (blur eigenvalues and conditioning); day 5: regularisation
- Day 8: transform coding, the DCT and the KLT
- Day 10: the heat equation (stability from the largest eigenvalue)
- Day 14: region properties and moments, shape features
- Day 18: moment invariants, Legendre moments
- Day 24: keypoints, from matches to a transform
- Day 25: Lucas–Kanade
- Day 27: normalized cuts; day 28: quadratic smoothing
- Day 30: the snake as a linear system, shape models, active shape models
- Day 35: the multivariate Gaussian and mixtures; day 39: from PCA to autoencoders
- Day 46: colour for display (decorrelation stretch); day 47: least-squares unmixing, endmembers, stain separation
- Day 53: camera calibration, two views, structure from motion
See also the other topic pages.