Skip to content

Determinant of Hessian

Fact Value
Also called DoH blob detection, Hessian determinant blobs
Status Implemented and tested
Family Texture, corners, blobs and features
Engine Science engine
Type Nonlinear, spatial, Hessian determinant extrema
Output Features
Operator shown as algorithm (exact)
Support radius global
Code engine/src/pixelnexus_engine/filters/blobs.py, blob_doh_filter
Operator code engine/src/pixelnexus_engine/filters/blobs.py, blob_representation
Packages scikit-image

Overview

Determinant of Hessian blob detection finds spots where the brightness curves the same way in every direction. It uses box filters on the integral image, as the Fast-Hessian detector of SURF does, so each scale costs the same, whatever its size. It finds bright and dark blobs in one run. The image does not change. The blobs go to the Features panel and are drawn on the canvas. The filter runs in the PixelNexus engine, with scikit-image.

Four panels of the Disks test image. With the defaults, rings mark the smaller disks and the single bright pixels, and the large disks get rings of the largest radius, off their centers. A false ring sits in the top left corner. With the smallest sigma at 3, the single pixels lose their rings. On a noisy copy, the rings are much the same. Four panels of the Disks test image. With the defaults, rings mark the smaller disks and the single bright pixels, and the large disks get rings of the largest radius, off their centers. A false ring sits in the top left corner. With the smallest sigma at 3, the single pixels lose their rings. On a noisy copy, the rings are much the same.
The Disks test image, and the blobs found with the defaults, with the smallest sigma at 3, and on a noisy copy. Each blob is drawn as a ring of its radius.

How it works

  1. Take the luma from 0 to 1 and its integral image.
  2. At each scale, find the box-filter second derivatives and the determinant.
  3. Keep the points that beat their 26 neighbors in position and scale and reach the threshold.
  4. Remove the smaller of two blobs that overlap too much, and report the rest.

Mathematical foundation

\[ R_\sigma(x) = D_{xx}(x)\, D_{yy}(x) - 0.81\, D_{xy}(x)^2, \qquad (x, \sigma) \text{ is a blob if } R_\sigma(x) = \max_{3 \times 3 \times 3} R \ge T, \qquad r \approx \sigma,\quad T = 0.01 \]

The formula shows the default parameter values.

where

  • \(D_{xx}, D_{yy}, D_{xy}\): Box-filter second derivatives at scale sigma
  • \(r\): The radius of the blob
  • \(T\): The threshold

The Hessian is the matrix of second derivatives. At the middle of a blob, both curvatures have the same sign, so its determinant is large and positive. Bay and coworkers replaced the Gaussian second derivatives by box filters that the integral image sums in constant time, so every scale costs the same. Here scikit-image uses boxes that span floor(3 sigma) pixels and divides each sum by the square of that size. It weights the mixed term by 0.81 = 0.9^2, as SURF does. For true second derivatives, a negated image has the same determinant, so bright and dark blobs are both found. The boxes of scikit-image only sum to zero when floor(3 sigma) is a multiple of 3, so the brightness level itself also adds a little to the response. On the negated Disks image, the same blobs come out with slightly different sizes and scores, and one more appears in a corner. Peaks over position and scale above the threshold are blobs, and overlapping blobs are pruned. The radius is about sigma. The score is R at the peak.

The Hessian is the matrix of second derivatives. In the middle of a blob, the brightness curves the same way in all directions, so both eigenvalues have the same sign and the determinant is large and positive. At an edge, one curvature is small, so the determinant is small.

Bay and coworkers replaced the Gaussian second derivatives by box filters. With the integral image, any box sum takes four lookups, so the cost does not depend on the scale. Here scikit-image uses boxes that span floor(3 sigma) pixels and divides each sum by the square of that size. It weights the mixed term by 0.81 = 0.9^2, as SURF does. For true second derivatives, a negated image has the same determinant, so bright and dark blobs are both found. The boxes of scikit-image only sum to zero when floor(3 sigma) is a multiple of 3, though. So the brightness level itself adds a little to the response, and even a flat gray image can give a false blob.

Peaks over position and scale above the threshold are blobs, and overlapping blobs are pruned. The radius is about sigma. A disk larger than the largest sigma has no matching scale, so it is found in the wrong place.

Kernel or operator

The Inspector asks the engine for the stages with the current settings. They are the input luma, the response with the list of scales, the peak rule with the threshold, and the pruning rule with the overlap.

Parameters

Parameter Default Values Meaning
Smallest sigma minSigma 1 0.5 to 50 px The smallest scale. Blobs smaller than the matching radius are missed.
Largest sigma maxSigma 30 1 to 100 px The largest scale. scikit-image uses 30. If it is below the smallest sigma, only the smallest is used.
Number of scales numSigma 10 2 to 50 How many scales are tried between the smallest and the largest sigma.
Logarithmic scales logScale off On or off Space the scales evenly in log sigma instead of in sigma, so small scales are tried more closely.
Threshold threshold 0.01 0 to 0.2 The smallest determinant a blob needs, for an image from 0 to 1. scikit-image uses 0.01.
Overlap overlap 0.5 0 to 1 Of two blobs whose areas overlap by more than this share, the smaller goes. 1 keeps all.

Implementation

blob_doh_filter in engine/src/pixelnexus_engine/filters/blobs.py takes the luma from 0 to 1 and calls skimage.feature.blob_doh. The score is the box-filter determinant at the peak, from the same scikit-image function that blob_doh uses. There is no setting for bright or dark blobs, since it finds both.

The result is a table, not an image. It has one row per blob, with x and y, the radius, sigma and the score. The x and y columns give the column and row of the center pixel, counted from 0 at the top left. The Features panel shows the table, exports it as CSV, and switches the drawing on the canvas. With a selection, the detector still looks at the whole image, and only the blobs whose center lies in the selection are kept. The Feature viewer in the Learn panel runs the detector on the patch around the probe.

Worked example

Disk radius (px) Found radius (px) Center off by (px) Score
48 not found
24 30.0 1.4 0.0413
12 13.9 2.2 0.0358
6 7.4 2.2 0.0347
72 not found
36 30.0 7.1 0.0224

The six disks of the Disks test image at 512 x 512, and the nearest blob that Determinant of Hessian finds with the defaults. A disk counts as not found when no blob lies within half its radius. With the defaults it finds 9 blobs in all, and 5 of them are not at a disk: the four single bright pixels, or false blobs. On a copy with Gaussian noise of sigma 12 it finds 9.

Complexity

  • Time: \(O(S N)\)
  • Memory: \(O(S N)\)

N is the number of pixels and S the number of scales. Each scale costs the same, whatever its size.

Artifacts and limitations

Limitations

  • scikit-image notes that the box filters are not accurate below sigma 3.
  • On the Disks image, the centers come out one or two pixels up and to the left of the true ones.
  • Blobs larger than the largest sigma are found in the wrong place. With the defaults, the disk of radius 48 on the Disks image is found 27 pixels from its center.
  • The boxes do not always sum to zero, and they are clipped at the image edge. So even a flat gray image can give a false blob at a large scale.
  • It cannot tell bright blobs from dark ones.

Artifacts

  • Square-looking responses, from the box filters.

Tests

The detector must return what skimage.feature.blob_doh returns. On the Disks image and on its negative, it must find the three middle-sized disks within 3 pixels. On a flat gray image it must find the one false blob that the limits name. The engine API tests check that the table arrives as JSON, and the stages of the representation.

References

  • Bay, H., Ess, A., Tuytelaars, T., and Van Gool, L. Speeded-up robust features (SURF). Computer Vision and Image Understanding 110(3), 346 to 359, 2008. DOI 10.1016/j.cviu.2007.09.014.
  • scikit-image documentation, skimage.feature.blob_doh.