This algorithm implements the Harris keypoint detection operator that is commonly used to detect keypoints and infer features of an image.
The standard Harris detector algorithm as described in [1] is applied first. After that, a non-max suppression pruning process is applied to the result to remove multiple or spurious keypoints.
Input | Parameters | Output keypoints |
---|---|---|
![]() | \begin{align*} \mathit{gradientSize} &= 5 \\ \mathit{blockSize} &= 5 \\ \mathit{strengthThresh} &= 20 \\ \mathit{sensitivity} &= 0.01 \\ \mathit{minNMSDistance} &= 8 \end{align*} | ![]() |
\begin{align*} \mathit{sobel}_x &= \frac{1}{4} \cdot \begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix} \cdot \begin{bmatrix} -1 & 0 & 1 \end{bmatrix} \\ \mathit{sobel}_y &= (\mathit{sobel}_x)^\intercal \end{align*}
\begin{align*} \mathit{sobel}_x &= \frac{1}{16} \cdot \begin{bmatrix} 1 \\ 4 \\ 6 \\ 4 \\ 1 \end{bmatrix} \cdot \begin{bmatrix} -1 & -2 & 0 & 2 & 1 \end{bmatrix} \\ \mathit{sobel}_y &= (\mathit{sobel}_x)^\intercal \end{align*}
\begin{align*} \mathit{sobel}_x &= \frac{1}{64} \cdot \begin{bmatrix} 1 \\ 6 \\ 15 \\ 20 \\ 15 \\ 6 \\ 1 \end{bmatrix} \cdot \begin{bmatrix} -1 & -4 & -5 & 0 & 5 & 4 & 1 \end{bmatrix} \\ \mathit{sobel}_y &= (\mathit{sobel}_x)^\intercal \end{align*}
Compute a gradient covariance matrix (structure tensor) for each pixel within a block window, as described by:
\[ M = \sum_{p \in B}\begin{bmatrix}I_x^2(p) & I_x(p) I_y(p) \\ I_x(p) I_y(p) & I_y^2(p) \end{bmatrix} \]
where:
Compute a Harris response score using a sensitivity factor
\[ R = \mathit{det}(M) - k \cdot \mathit{trace}^2(M ) \]
where k is the sensitivity factor
Applies a non-max suppression pruning process.
This process splits the input image into a 2D cell grid. It selects a single corner with the highest response score inside the cell. If several corners within the cell have the same response score, it selects the bottom-right corner.
For more details, consult the API reference.
Constraints for specific backends supersede the ones specified for all backends.
For further information on how performance was benchmarked, see Performance Measurement.
size | type | grad. size | block size | CPU | CUDA | PVA |
---|---|---|---|---|---|---|
1920x1080 | u8 | 3 | 3 | 5.7 ms | 0.9917 ms | n/a |
1920x1080 | u8 | 5 | 5 | 8.2 ms | 0.9691 ms | n/a |
1920x1080 | u8 | 7 | 7 | 10.1 ms | 1.2288 ms | n/a |
1920x1080 | s16 | 3 | 3 | 5.83 ms | 1.0400 ms | 8.344 ms |
1920x1080 | s16 | 5 | 5 | 8.2 ms | 1.0010 ms | 8.6946 ms |
1920x1080 | s16 | 7 | 7 | 10.0 ms | 1.2605 ms | 9.094 ms |
size | type | grad. size | block size | CPU | CUDA | PVA |
---|---|---|---|---|---|---|
1920x1080 | u8 | 3 | 3 | 15.9 ms | 5.191 ms | n/a |
1920x1080 | u8 | 5 | 5 | 19.0 ms | 4.25 ms | n/a |
1920x1080 | u8 | 7 | 7 | 24.8 ms | 5.202 ms | n/a |
1920x1080 | s16 | 3 | 3 | 15.12 ms | 5.196 ms | n/a |
1920x1080 | s16 | 5 | 5 | 20.4 ms | 4.67 ms | n/a |
1920x1080 | s16 | 7 | 7 | 25.5 ms | 5.210 ms | n/a |
size | type | grad. size | block size | CPU | CUDA | PVA |
---|---|---|---|---|---|---|
1920x1080 | u8 | 3 | 3 | 29.8 ms | 10.46 ms | n/a |
1920x1080 | u8 | 5 | 5 | 39.2 ms | 10.308 ms | n/a |
1920x1080 | u8 | 7 | 7 | 51.4 ms | 12.036 ms | n/a |
1920x1080 | s16 | 3 | 3 | 30.32 ms | 12.036 ms | n/a |
1920x1080 | s16 | 5 | 5 | 39.8 ms | 10.31 ms | n/a |
1920x1080 | s16 | 7 | 7 | 52.2 ms | 12.035 ms | n/a |