Skip to content

Hessian-based filter

Fact Value
Also called Hybrid Hessian filter, Wrinkle filter
Status Implemented and tested
Family Texture, corners, blobs and features
Engine Science engine
Type Nonlinear, spatial, hybrid Hessian ridge measure
Output Image
Operator shown as algorithm (exact)
Support radius global
Code engine/src/pixelnexus_engine/filters/ridges.py, hessian_filter
Operator code engine/src/pixelnexus_engine/filters/ridges.py, ridge_representation
Packages scikit-image
Channels Brightness only, RGB

Overview

Ng and coworkers made the hybrid Hessian filter to find wrinkles and fine lines. It is the Frangi vesselness with a fixed structure constant gamma, so the strength of a response does not depend on the rest of the image. Then scikit-image sets every pixel whose response is exactly 0 to 1. The filter runs in the PixelNexus engine on your computer.

Four panels: four dark waves of growing width and a dark disk on a light ground with fine noise, and three hybrid Hessian results. In all three, white speckles fill the noisy ground, where the curvature has the wrong sign for a ridge and the response is set to 1. The waves show as lines among the speckles. Four panels: four dark waves of growing width and a dark disk on a light ground with fine noise, and three hybrid Hessian results. In all three, white speckles fill the noisy ground, where the curvature has the wrong sign for a ridge and the response is set to 1. The waves show as lines among the speckles.
Four dark waves 1, 2, 4 and 8 pixels wide and a dark disk, with noise. Then the filter with the defaults, with the scales 1 to 3 only, and with bright ridges.

How it works

  1. Blur the image with a Gaussian at each scale, and find the second derivatives.
  2. At each pixel, find the eigenvalues of the Hessian, the curvatures along and across.
  3. Turn them into the line measure of this filter.
  4. Keep the largest measure over the scales.
  5. Stretch the result so the strongest response is white.

Mathematical foundation

\[ V_\sigma = \begin{cases} \exp\!\left(-\frac{R_B^2}{2\beta^2}\right)\left(1 - \exp\!\left(-\frac{S^2}{2\gamma^2}\right)\right) & \text{if this is above } 0 \\ 1 & \text{otherwise} \end{cases}, \qquad \beta = 0.5,\ \gamma = 15 \]

The formula shows the default parameter values.

where

  • \(\lambda_1, \lambda_2\): The Hessian eigenvalues, |lambda_1| <= |lambda_2|
  • \(R_B\): The blob ratio
  • \(S\): The structure, the norm of the Hessian
  • \(\beta, \gamma\): The blob and structure constants

The hybrid Hessian filter of Ng and coworkers uses Frangi's vesselness with a fixed gamma. R_B = |lambda_1| / lambda_2 is the blob ratio and S the norm of the Hessian, as on the Frangi page. Where the curvature has the wrong sign for a ridge, scikit-image clips lambda_2, and the response becomes exactly 0. Then scikit-image sets every such pixel to 1, the largest value the measure can have. On the Disks image with dark ridges, this makes the inside of the disks white, while the dark background stays near 0. The result is stretched so the strongest response is white.

The measure is Frangi's vesselness. R_B = |lambda_1| / lambda_2 compares the two Hessian eigenvalues and removes round blobs. S, the size of the Hessian, removes flat noise. Here gamma is a fixed number in pixel levels per pixel squared, 15 by default, as in scikit-image.

Where the curvature has the wrong sign for the chosen ridge color, scikit-image clips lambda_2 to 1e-10, and the measure becomes exactly 0. The hybrid Hessian filter of scikit-image then sets every such pixel to 1, the largest value the measure can have. Read white areas with care: they are either strong ridges or pixels with the wrong curvature. On the Disks image with dark ridges, the inside of each disk is white, while the dark background stays near 0.

Kernel or operator

The Inspector asks the engine for the stages with the current settings. They are the Hessian with the list of scales, the eigenvalues, the line measure with its constants, and the maximum over the scales.

Algorithm

  1. Compute the Frangi vesselness with the fixed gamma at each scale.
  2. Keep the largest response over the scales.
  3. Set every pixel with no response to 1.
  4. Stretch the result to the full range.

Parameters

Parameter Default Values Meaning
Ridges ridges Dark ridges Dark ridges, Bright ridges Whether the lines to find are darker or brighter than their surroundings. Vessels in retinal photos are dark.
Smallest scale sigmaMin 1 0.5 to 20 px The smallest Gaussian sigma. A line of width w responds most near sigma = w / 2 or a little less.
Largest scale sigmaMax 9 0.5 to 20 px The largest Gaussian sigma. If it is below the smallest scale, only the smallest is used.
Scale step sigmaStep 2 0.5 to 10 px The step between the scales. The defaults give 1, 3, 5, 7 and 9, the scikit-image defaults.
Beta beta 0.5 0.1 to 2 How strongly round blobs are suppressed, through R_B =
Gamma gamma 15 1 to 200 The structure scale, in pixel levels per pixel squared. Responses with S well below gamma are suppressed. scikit-image uses 15.
Border mode border Reflect Reflect 101 (default), Reflect, Replicate, Constant (zero), Wrap How pixels outside the image are filled when the window reaches past the edge.
Channels channelScope Brightness only RGB, Brightness only Which part of the color image the filter changes.

Implementation

hessian_filter in engine/src/pixelnexus_engine/filters/ridges.py calls skimage.filters.hessian on each plane the scope names, in pixel levels from 0 to 255. Then it stretches the result so the strongest response is 255. The Hessian comes from two passes of a Gaussian derivative of sigma / sqrt(2), so the image is blurred by sigma in all. There is no live preview. The result arrives when you click Apply.

Worked example

Scales Width 1 Width 2 Width 4 Width 8 Disk
Defaults (1 to 9) 214 245 225 21 3
Scales 1 to 3 214 245 225 32 3
Scales 5 to 9 0 0 1 3 0

The image of the figure: four dark waves on a ground of 200, at 70 before a blur of sigma 0.6 and noise of sigma 4, and a dark disk of radius 6. The numbers are the result of the Hybrid Hessian filter from 0 to 255, as the median along the middle of each wave and the value at the middle of the disk. Each result is stretched so its strongest response is 255.

Complexity

  • Time: \(O(K N sigma)\)
  • Memory: \(O(N)\)

N is the number of pixels, K the number of scales and sigma the largest scale. The Gaussian derivatives are separable, and their windows reach 8 sigma.

Artifacts and limitations

Limitations

  • Pixels with the wrong curvature come out white, the same as the strongest lines, because scikit-image sets responses of exactly 0 to 1. Read the result together with the Frangi filter.
  • Gamma is in pixel levels, so the response depends on the contrast of the image.
  • As with Frangi, wide lines respond far more weakly than thin ones when small scales are included.
  • On noisy images, many pixels of the background have the wrong curvature, so the result is full of white speckles.

Artifacts

  • White patches on the wrong side of edges, such as the inside of bright shapes when looking for dark ridges.
  • White speckles over noisy flat areas.

Tests

The filter must equal skimage.filters.hessian, stretched and rounded. Inside a bright disk, looking for dark ridges, the response must be 1 where the Frangi measure is 0, and near 0 on the dark ground. A flat image must come out white. The strongest response must be in the middle of a line. The engine API tests run a job and check the stages of the representation.

References

  • Ng, C. C., Yap, M. H., Costen, N., and Li, B. Automatic wrinkle detection using hybrid Hessian filter. Computer Vision, ACCV 2014, Lecture Notes in Computer Science 9005, 609 to 622, 2015. DOI 10.1007/978-3-319-16811-1_40.
  • scikit-image documentation, skimage.filters.hessian.