Harris Corner Detection
Detects corners in images using intensity gradients. Finds points with large intensity changes in multiple directions. Key feature detection algorithm.
Visualization
Interactive visualization for Harris Corner Detection
Harris Corner:
- • Corner detection
Interactive visualization with step-by-step execution
Implementation
1function harrisCorner(image: number[][], k: number = 0.04, threshold: number = 0.01): Array<{x: number, y: number}> {
2 const { Ix, Iy } = computeGradients(image);
3 const corners: Array<{x: number, y: number}> = [];
4
5 for (let i = 1; i < image.length - 1; i++) {
6 for (let j = 1; j < image[0].length - 1; j++) {
7 const Ixx = Ix[i][j] * Ix[i][j];
8 const Iyy = Iy[i][j] * Iy[i][j];
9 const Ixy = Ix[i][j] * Iy[i][j];
10
11 const det = Ixx * Iyy - Ixy * Ixy;
12 const trace = Ixx + Iyy;
13 const R = det - k * trace * trace;
14
15 if (R > threshold) {
16 corners.push({ x: j, y: i });
17 }
18 }
19 }
20
21 return nonMaxSuppression(corners, image);
22}Deep Dive
Theoretical Foundation
Computes structure tensor M from gradients Ix, Iy. Response R = det(M) - k×trace(M)². Corners: large R. Edges: R near zero. Flat: R negative. Typical k=0.04-0.06.
Complexity
Time
O(w×h)
O(w×h)
O(w×h)
Space
O(w×h)
Applications
Industry Use
Feature matching in stereo vision
Object tracking and recognition
Image registration and stitching
3D reconstruction from multiple views
Augmented reality marker detection
Camera calibration
Motion estimation and optical flow
Use Cases
Related Algorithms
A* Search Algorithm
Informed search algorithm combining best-first search with Dijkstra's algorithm using heuristics. Widely used in pathfinding and graph traversal, A* is optimal and complete when using admissible heuristic. Used in games, GPS navigation, and robotics. Invented by Peter Hart, Nils Nilsson, and Bertram Raphael in 1968.
Convex Hull (Graham Scan)
Find smallest convex polygon containing all points. Graham Scan invented by Ronald Graham in 1972, runs in O(n log n). Essential in computational geometry, computer graphics, and pattern recognition.
Line Segment Intersection
Determine if two line segments intersect. Fundamental geometric primitive used in graphics, CAD, GIS. Uses orientation and collinearity tests.
Caesar Cipher
The Caesar Cipher is one of the oldest and simplest encryption techniques, named after Julius Caesar who used it to protect military messages around 100 BC. It works by shifting each letter in the plaintext by a fixed number of positions down the alphabet. For example, with a shift of 3, A becomes D, B becomes E, and so on. Despite being used for over 2000 years, it's extremely weak by modern standards with only 25 possible keys, making it trivially breakable by brute force or frequency analysis.