The OpenVX Specification  r31169
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:

\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:

$\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:

$\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:

$\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 using the following algorithm:

• 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:

 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...

vx_status VX_API_CALL vxuHarrisCorners (vx_context context, 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)
[Immediate] Computes the Harris Corners over an image and produces the array of scored points. More...

## Function Documentation

 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. [in] input The input VX_DF_IMAGE_U8 image. [in] strength_thresh The VX_TYPE_FLOAT32 minimum threshold with which to eliminate Harris Corner scores (computed using the normalized Sobel kernel). [in] min_distance The VX_TYPE_FLOAT32 radial Euclidean distance for non-maximum suppression. [in] sensitivity The VX_TYPE_FLOAT32 scalar sensitivity threshold $$k$$ from the Harris-Stephens equation. [in] gradient_size The gradient window size to use on the input. The implementation must support at least 3, 5, and 7. [in] block_size The block window size used to compute the Harris Corner score. The implementation must support at least 3, 5, and 7. [out] corners The array of VX_TYPE_KEYPOINT objects. [out] num_corners The total number of detected corners in image (optional). Use a VX_TYPE_SIZE scalar.
Returns
vx_node.
Return values
 vx_node A node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus
 vx_status VX_API_CALL vxuHarrisCorners ( vx_context context, 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 )

[Immediate] Computes the Harris Corners over an image and produces the array of scored points.

Parameters
 [in] context The reference to the overall context. [in] input The input VX_DF_IMAGE_U8 image. [in] strength_thresh The VX_TYPE_FLOAT32 minimum threshold which to eliminate Harris Corner scores (computed using the normalized Sobel kernel). [in] min_distance The VX_TYPE_FLOAT32 radial Euclidean distance for non-maximum suppression. [in] sensitivity The VX_TYPE_FLOAT32 scalar sensitivity threshold $$k$$ from the Harris-Stephens equation. [in] gradient_size The gradient window size to use on the input. The implementation must support at least 3, 5, and 7. [in] block_size The block window size used to compute the harris corner score. The implementation must support at least 3, 5, and 7. [out] corners The array of VX_TYPE_KEYPOINT structs. [out] num_corners The total number of detected corners in image (optional). Use a VX_TYPE_SIZE scalar
Returns
A vx_status_e enumeration.
Return values
 VX_SUCCESS Success * An error occurred. See vx_status_e.