Skip to content

LMamon/cv-feature-matching

Repository files navigation

Feature Matching and Stitching Images

This repository contains four Python scripts demonstrating key computer vision techniques using OpenCV:

  • SIFTDemo.py: Detects and matches SIFT features between two images.
  • BFMDemo.py: Detects and matches ORB features using a brute-force matcher.
  • FM+Homography.py: Performs feature matching with SIFT and estimates a homography to align images.
  • Stitcher.py: Uses OpenCV’s Stitcher API to stitch multiple images into a panorama.

Table of Contents

  1. Requirements
  2. Installation
  3. Usage
  4. Notes

Requirements


Installation

Install the dependencies via pip:

pip install opencv-python numpy matplotlib

Usage

SIFTDemo.py

SIFT feature detection and matching using a K-Nearest Neighbors matcher and ratio test.

python SIFTDemo.py

BFMDemo.py

ORB feature detection and brute-force matching.

python BFMDemo.py

FM+Homography.py

Matches SIFT features, applies ratio test, computes a homography with RANSAC, and shows only inlier matches.

python FM+Homography.py

Stitcher.py

Stitches multiple images into a panorama using OpenCV’s high-level Stitcher API.

python Stitcher.py --images img1.jpg img2.jpg [img3.jpg ...] --output panorama.jpg

Options:

  • --images: List of input image file paths (space-separated).
  • --output: Path to save the stitched panorama.
  • Use -h or --help for full usage details.

Notes

  • Ensure images have sufficient overlap for reliable feature matching and stitching.
  • Adjust MIN_MATCH_COUNT in FM+Homography.py based on image content.
  • Stitcher.py prints an error code if stitching fails; refer to OpenCV docs for details. Feel free to tweak parameters for better results.

About

SIFT, ORB, and image stitching demos using OpenCV in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages