PIXELBANKv9.1.0
Menu

Compute Harris Corner Detector Response

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

Test Results

0/0
Run code to see test results.
Compute Harris Corner Detector Response - Medium | PixelBank