Computer Vision · Beginner level

Beginner level · Module 5: Feature Extraction · Lesson 3 of 3

Keypoints and Matching with ORB

Learners detect keypoints with ORB, match them between two photographs of the same object or scene, and see how keypoints support panoramas, mapping and later SLAM.

In this lesson you will

  • Detect and describe keypoints with ORB
  • Match keypoints between images

Key concepts

keypointdescriptorcv2.ORB_createBFMatcher with Hamming distanceratio test

The lesson

Keypoints are distinctive points, such as corners, that can be found again in another image of the same scene. A descriptor is a short code describing the patch around each keypoint. ORB (cv2.ORB_create()) is fast, free to use and works on a CPU.

Matching compares descriptors between two images. ORB descriptors are binary, so use cv2.BFMatcher(cv2.NORM_HAMMING). The ratio test (keep a match only if it is clearly better than the second-best) removes many wrong matches.

Keypoint matching underlies image stitching, recognising the same building from different angles and estimating camera motion, which you will use in the Advanced level's SLAM module.

Step by step

  1. Take two photos of the same building from slightly different positions.
  2. Detect ORB keypoints in both and draw them.
  3. Match descriptors and apply the ratio test.
  4. Draw the best 30 matches and count wrong ones.

Practice activity

Match keypoints between photo pairs of three local landmarks or buildings and report match quality.

Expected result: Match visualisations and an estimate of the share of correct matches.

Check your understanding

  1. What is a descriptor?

    Show answer

    A compact code describing the image patch around a keypoint.

  2. Which distance is used to match ORB descriptors?

    Show answer

    Hamming distance.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.