v9.1.1
Menu

Compute Harris Corner Detector Response

mediumFREEFeature Detection and MatchingMatrix, Linear FilteringComputer Vision 1

The Harris Corner Detector identifies interest points by analyzing local image structure through the autocorrelation matrix A. The corner response R is calculated using:

R = det(A) - k × (trace(A))²

where:

  • det(A) = Axx × Ayy - Axy²
  • trace(A) = Axx + Ayy

Given pre-computed gradient sums Axx, Ayy, Axy, and sensitivity constant k, calculate the Harris response R.

Constraints:

  • k = 0.04 (default)
  • Axx, Ayy, Axy are non-negative floats
  • 0 ≤ Axx, Ayy ≤ 1000

Examples:

| Input | Output | |-------|--------| | Axx=100, Ayy=100, Axy=0, k=0.04 | 9600.0 | | Axx=500, Ayy=500, Axy=10, k=0.04 | 209600.0 |

Example

Input
Axx=100, Ayy=100, Axy=0, k=0.04
Output
8400.0
Reasoning
  • First, compute the determinant: det⁡(A)=Axx⋅Ayy−Axy2=100⋅100−02=10000 \det(A) = A_{xx} \cdot A_{yy} - A_{xy}^2 = 100 \cdot 100 - 0^2 = 10000
  • Then, compute the trace: trace(A)=Axx+Ayy=100+100=200 \text{trace}(A) = A_{xx} + A_{yy} = 100 + 100 = 200
  • Next, compute the penalty term: k⋅(trace(A))2=0.04⋅2002=0.04⋅40000=1600k \cdot (\text{trace}(A))^2 = 0.04 \cdot 200^2 = 0.04 \cdot 40000 = 1600
  • Finally, compute the Harris response: R=det⁡(A)−k⋅(trace(A))2=10000−1600=8400.0R = \det(A) - k \cdot (\text{trace}(A))^2 = 10000 - 1600 = 8400.0, which matches the sample output.

More from Computer Vision 1

solution.py

Test results

Sign in to run your code against the test cases.