Skip to content

AKAZE

Fact Value
Also called Accelerated KAZE
Status Implemented and tested
Family Texture, corners, blobs and features
Engine Science engine
Type Nonlinear, spatial, Hessian determinant in a nonlinear scale space
Output Features
Operator shown as algorithm (simplified)
Support radius global
Code engine/src/pixelnexus_engine/filters/keypoints.py, akaze
Operator code engine/src/pixelnexus_engine/filters/keypoints.py, keypoint_representation
Packages OpenCV

Overview

AKAZE finds keypoints in a nonlinear scale space. Unlike a Gaussian blur, nonlinear diffusion smooths flat areas but keeps edges, so keypoints sit well on object boundaries. Keypoints are maxima of the Hessian determinant, each with a size and an orientation. The keypoints go to the Features panel and are drawn on the canvas. Only the detector runs, not the descriptor. The filter runs in the PixelNexus engine, with OpenCV.

Four panels: a Siemens star and AKAZE keypoints as small rings. On the star, small rings form a circle halfway out and line the rim, with none near the center. The turned star looks the same. On the Disks image, small rings line the edges of the disks. Four panels: a Siemens star and AKAZE keypoints as small rings. On the star, small rings form a circle halfway out and line the rim, with none near the center. The turned star looks the same. On the Disks image, small rings line the edges of the disks.
The keypoints with the defaults on the Siemens star, on the star turned a quarter counterclockwise, and on the Disks image. Each keypoint is a ring of its radius with a line along its angle.

How it works

  1. Build a nonlinear scale space with fast explicit diffusion.
  2. Find maxima of the Hessian determinant in position and scale.
  3. Drop weak ones below the threshold.
  4. Give each one the dominant direction of its derivatives.

Mathematical foundation

\[ \frac{\partial L}{\partial t} = \operatorname{div}\big(g(\lvert \nabla L_\sigma \rvert)\, \nabla L\big), \qquad g = \frac{1}{1 + \lvert \nabla L_\sigma \rvert^2 / k^2} \text{ (Perona-Malik g2)}, \qquad R = L_{xx} L_{yy} - L_{xy}^2 \]

The formula shows the default parameter values.

where

  • \(L\): The image as it diffuses over time t
  • \(g\): The conductance, small at strong edges
  • \(k\): The contrast factor
  • \(R\): The determinant of the Hessian
  • \(x, y\): The keypoint position, with the center of the top-left pixel at 0, 0
  • \(\theta\): The orientation, counterclockwise from the x axis

A Gaussian scale space blurs edges as much as flat areas. AKAZE instead lets the image diffuse with a conductance g that falls where the gradient is large, so edges stay sharp. The contrast factor k comes from the gradients of the image. Fast explicit diffusion solves the equation in steps of varying length, which is much faster than the implicit scheme of KAZE. Keypoints are maxima of the determinant of the Hessian, with derivatives scaled to each level, above the threshold. The orientation is the dominant direction of the first derivatives in a circle around the keypoint, found with a sliding window of 60 degrees. The Inspector shows the formula of the chosen diffusivity.

Linear scale space is the heat equation: the image diffuses the same way everywhere, so edges blur as much as flat areas. Nonlinear diffusion multiplies the flow by a conductance g that falls where the gradient of the slightly blurred image L_sigma is large. Flat areas then smooth fast, and strong edges hardly move. The contrast factor k sets which gradients count as strong. AKAZE takes it from the gradients of the image.

KAZE solved the diffusion with implicit steps, which are slow. AKAZE uses fast explicit diffusion, explicit steps of varying length that stay stable over a whole cycle, so it is much faster. In the resulting scale space, keypoints are maxima of the Hessian determinant above the threshold, with derivatives scaled to each level. The orientation is the dominant direction of the first derivatives in a circle around the keypoint, found with a window of 60 degrees that slides around the circle.

Kernel or operator

The Inspector asks the engine for the stages with the current settings. They start with the 8-bit luma and follow the detector step by step. They summarize what OpenCV does, so the label is Simplified.

Parameters

Parameter Default Values Meaning
Threshold threshold 0.001 0.0001 to 0.05 The smallest Hessian response a keypoint needs, for an image from 0 to 1. OpenCV uses 0.001.
Octaves octaves 4 1 to 8 The number of octaves. OpenCV uses 4.
Layers per octave octaveLayers 4 1 to 8 The number of layers in each octave. OpenCV uses 4.
Diffusivity diffusivity Perona-Malik g2 Perona-Malik g1, Perona-Malik g2, Weickert, Charbonnier How strongly edges stop the smoothing. OpenCV uses Perona-Malik g2.

Implementation

akaze in engine/src/pixelnexus_engine/filters/keypoints.py calls cv2.xfeatures2d.AKAZE_create with the threshold, octaves, layers and diffusivity, and detect on the 8-bit luma. OpenCV 5 keeps AKAZE in cv2.xfeatures2d. The table has x, y, the radius, the angle, the score and the octave.

OpenCV puts the center of the top-left pixel at 0, 0, as the feature tables do, so positions keep their fraction. OpenCV measures angles clockwise in image coordinates, where y points down. The table turns them to count counterclockwise from the x axis, as (360 - angle) mod 360. The rows are sorted by score. With a selection, the detector still looks at the whole image, and only the keypoints on selected pixels are kept.

Worked example

Image Keypoints Radius (px) Found after a quarter turn (%)
Siemens star 246 2.4 to 8.1 87
Disks 217 2.4 to 11.4 80

AKAZE with the defaults on the 512 x 512 test images. The last column is the share of keypoints found again after the image is turned a quarter counterclockwise: within 1 pixel of the turned place, with a radius within 10 percent, and with an angle 90 degrees larger, within 5 degrees. A quarter turn moves pixels exactly onto pixels, so any loss comes from the detector itself.

Complexity

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

N is the number of pixels. Each diffusion step costs O(N), and the number of steps depends on the scales.

Artifacts and limitations

Limitations

  • The contrast factor depends on the image, so the same scene at another contrast gives other keypoints.
  • Only the detector runs. The binary descriptors are not computed.

Artifacts

  • On the Siemens star, no keypoint lies within 39 pixels of the center, where the spokes are fine. 104 of the 246 lie on the rim, where the spokes meet the gray ground.

Tests

The table must hold what OpenCV's AKAZE finds, with the angle turned to count counterclockwise, sorted by score. The defaults must reach OpenCV, including the Perona-Malik g2 diffusivity. A flat image must give no keypoints, and runs must repeat exactly. The engine API tests check the JSON and the stages.

References

  • Alcantarilla, P. F., Nuevo, J., and Bartoli, A. Fast explicit diffusion for accelerated features in nonlinear scale spaces. British Machine Vision Conference, 13.1 to 13.11, 2013. DOI 10.5244/C.27.13.
  • OpenCV documentation, cv2.xfeatures2d.AKAZE_create and detect.