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} &= 250 \\ \mathit{sensitivity} &= 0.24 \\ \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.
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 | 1.0003 ms | n/a |
1920x1080 | u8 | 5 | 5 | 8.2 ms | 0.9735 ms | n/a |
1920x1080 | u8 | 7 | 7 | 10.2 ms | 1.2313 ms | n/a |
1920x1080 | s16 | 3 | 3 | 6.0 ms | 1.0437 ms | 8.346 ms |
1920x1080 | s16 | 5 | 5 | 8.57 ms | 1.0011 ms | 8.680 ms |
1920x1080 | s16 | 7 | 7 | 10.2 ms | 1.2646 ms | 9.054 ms |
size | type | grad. size | block size | CPU | CUDA | PVA |
---|---|---|---|---|---|---|
1920x1080 | u8 | 3 | 3 | 15.7 ms | 5.226 ms | n/a |
1920x1080 | u8 | 5 | 5 | 18.4 ms | 4.61 ms | n/a |
1920x1080 | u8 | 7 | 7 | 24.3 ms | 5.246 ms | n/a |
1920x1080 | s16 | 3 | 3 | 15.3 ms | 5.229 ms | n/a |
1920x1080 | s16 | 5 | 5 | 19.2 ms | 4.70 ms | n/a |
1920x1080 | s16 | 7 | 7 | 25.0 ms | 5.25 ms | n/a |
size | type | grad. size | block size | CPU | CUDA | PVA |
---|---|---|---|---|---|---|
1920x1080 | u8 | 3 | 3 | 29.69 ms | 10.7 ms | n/a |
1920x1080 | u8 | 5 | 5 | 39.2 ms | 10.311 ms | n/a |
1920x1080 | u8 | 7 | 7 | 50.89 ms | 12.041 ms | n/a |
1920x1080 | s16 | 3 | 3 | 30.29 ms | 11.99 ms | n/a |
1920x1080 | s16 | 5 | 5 | 39.8 ms | 10.309 ms | n/a |
1920x1080 | s16 | 7 | 7 | 51.77 ms | 12.052 ms | n/a |