Skip to main content

Feature Detection and Matching

Learn how to detect and match distinctive features in images, essential for tasks like image stitching, object recognition, and camera calibration.

What are Features?

Features are distinctive points or regions in an image that can be reliably detected across different views. Good features are:
  • Repeatable (can be found in different images of the same scene)
  • Distinctive (can be distinguished from nearby features)
  • Local (not affected by clutter or occlusion)
  • Efficient (fast to compute)

Corner Detection

Harris Corner Detector

Shi-Tomasi Corner Detector (Good Features to Track)

Edge Detection

Canny Edge Detector

For Canny edge detection:
  • Use a 2:1 or 3:1 ratio between upper and lower thresholds
  • Lower threshold: detects weak edges
  • Upper threshold: detects strong edges
  • Edges are connected if they’re above the lower threshold and connected to an edge above the upper threshold

Feature Descriptors

SIFT (Scale-Invariant Feature Transform)

ORB (Oriented FAST and Rotated BRIEF)

ORB is a fast alternative to SIFT and SURF:

AKAZE

Feature Matching

Based on OpenCV’s find_obj.py sample:

Brute-Force Matcher

FLANN-Based Matcher

Faster for large datasets:

Finding Homography

Find the transformation between matched images:

Blob Detection

Feature detector comparison:
  • SIFT: Most robust, patented (free since 2020), slower
  • SURF: Fast, patented, good for real-time
  • ORB: Free, fast, good alternative to SIFT/SURF
  • AKAZE: Free, fast, works well with planar scenes
  • BRISK: Free, very fast, binary descriptor
When matching features, always use the ratio test (Lowe’s ratio test) to filter out ambiguous matches and reduce false positives.

Next Steps