The OpenVX Specification  a73e458
Harris Corners

## Detailed Description

Computes the Harris Corners of an image.

The Harris Corners are computed with several parameters

\begin{eqnarray} I &=& \text{input image} \\ T_c &=& \text{corner strength threshold} \\ r &=& \text{euclidean radius} \\ k &=& \text{sensitivity threshold} \\ w &=& \text{window size} \\ b &=& \text{block size} \\ \end{eqnarray}

The computation to find the corner values or scores can be summarized as [R00060]:

\begin{eqnarray} G_x &=& Sobel_x(w, I) \\ G_y &=& Sobel_y(w, I) \\ A &=& window_{G_{x,y}}(x-b/2,y-b/2,x+b/2,y+b/2) \\ trace(A) &=& \sum^{A}{G_x^{2}} + \sum^{A}{G_y^{2}} \\ det(A) &=& \sum^{A}{G_x^{2}} \sum^{A}{G_y^{2}} - {\left(\sum^{A}{(G_x G_y)}\right)}^{2} \\ M_c(x,y) &=& det(A) - k*trace(A)^{2} \\ V_c(x,y) &=& \begin{cases} M_c(x,y) \text{ if } M_c(x,y) > T_c \\ 0 \text{ otherwise} \\ \end{cases} \end{eqnarray}

$\text{where } V_c \text{ is the thresholded corner value}.$

The normalized Sobel kernels used for the gradient computation shall be as shown below:

• For gradient size 3 [R00061]:

$\mathbf{Sobel}_{x}(Normalized)= \frac{1}{4*255*b}* \begin{vmatrix} -1 & 0 & 1\\ -2 & 0 & 2\\ -1 & 0 & 1 \end{vmatrix}$

$\mathbf{Sobel}_{y}(Normalized)= \frac{1}{4*255*b}*transpose({sobel}_{x})= \frac{1}{4*255*b}* \begin{vmatrix} -1 & -2 & -1\\ 0 & 0 & 0\\ 1 & 2 & 1 \end{vmatrix}$

• For gradient size 5 [R00062]:

$\mathbf{Sobel}_{x}(Normalized)= \frac{1}{16*255*b}* \begin{vmatrix} -1 & -2 & 0 & 2 & 1\\ -4 & -8 & 0 & 8 & 4\\ -6 & -12 & 0 & 12 & 6\\ -4 & -8 & 0 & 8 & 4\\ -1 & -2 & 0 & 2 & 1\\ \end{vmatrix}$

$\mathbf{Sobel}_{y}(Normalized)= \frac{1}{16*255*b}*transpose({sobel}_{x})$

• For gradient size 7 [R00063]:

$\mathbf{Sobel}_{x}(Normalized)= \frac{1}{64*255*b}* \begin{vmatrix} -1 & -4 & -5 & 0 & 5 & 4 & 1\\ -6 & -24 & -30 & 0 & 30 & 24 & 6\\ -15 & -60 & -75 & 0 & 75 & 60 & 15\\ -20 & -80 & -100 & 0 & 100 & 80 & 20\\ -15 & -60 & -75 & 0 & 75 & 60 & 15\\ -6 & -24 & -30 & 0 & 30 & 24 & 6\\ -1 & -4 & -5 & 0 & 5 & 4 & 1\\ \end{vmatrix}$

$\mathbf{Sobel}_{y}(Normalized)= \frac{1}{64*255*b}*transpose({sobel}_{x})$

$$V_c$$ is then non-maximally suppressed, returning the same results as using the following algorithm [R00064]:

• Filter the features using the non-maximum suppression algorithm defined for vxFastCornersNode.
• Create an array of features sorted by $$V_c$$ in descending order: $$V_c(j) > V_c(j+1)$$.
• Initialize an empty feature set $$F = \{\}$$
• For each feature $$j$$ in the sorted array, while $$V_c(j) > T_c$$:
• If there is no feature i in $$F$$ such that the Euclidean distance between pixels i and j is less than $$r$$, add the feature $$j$$ to the feature set $$F$$.

An implementation shall support all values of Euclidean distance $$r$$ that satisfy [R00065]:

 0 <= max_dist <= 30

The feature set $$F$$ is returned as a vx_array of vx_keypoint_t structs.

## Functions

vx_node VX_API_CALL vxHarrisCornersNode (vx_graph graph, vx_image input, vx_scalar strength_thresh, vx_scalar min_distance, vx_scalar sensitivity, vx_int32 gradient_size, vx_int32 block_size, vx_array corners, vx_scalar num_corners)
[Graph] Creates a Harris Corners Node. More...

## ◆ vxHarrisCornersNode()

 vx_node VX_API_CALL vxHarrisCornersNode ( vx_graph graph, vx_image input, vx_scalar strength_thresh, vx_scalar min_distance, vx_scalar sensitivity, vx_int32 gradient_size, vx_int32 block_size, vx_array corners, vx_scalar num_corners )

[Graph] Creates a Harris Corners Node.

Parameters
 [in] graph The reference to the graph [R00357]. [in] input The input VX_DF_IMAGE_U8 image [R00358]. [in] strength_thresh The VX_TYPE_FLOAT32 minimum threshold with which to eliminate Harris Corner scores (computed using the normalized Sobel kernel) [R00359]. [in] min_distance The VX_TYPE_FLOAT32 radial Euclidean distance for non-maximum suppression [R00360]. [in] sensitivity The VX_TYPE_FLOAT32 scalar sensitivity threshold $$k$$ from the Harris-Stephens equation [R00361]. [in] gradient_size The gradient window size to use on the input [R00362]. The implementation must support at least 3, 5, and 7. [in] block_size The block window size used to compute the Harris Corner score [R00363]. The implementation must support at least 3, 5, and 7. [out] corners The array of VX_TYPE_KEYPOINT objects [R00364]. The order of the keypoints in this array is implementation dependent. [out] num_corners The total number of detected corners in image [R00365](optional). Use a VX_TYPE_SIZE scalar [R00366].
Returns
vx_node [R00367].
Return values
 vx_node A node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus