← all repositories
rmislam/PythonSIFT

SIFT, unwrapped: the classic vision algorithm in plain Python

A readable, from-scratch NumPy implementation of Lowe's feature detector that doubles as a teaching tool.

1k stars Python Computer Vision
PythonSIFT
Velocity · 7d
+0.3
★ / day
Trend
steady
star history

What it does

PythonSIFT reimplements David Lowe’s scale-invariant feature transform entirely in Python and NumPy, returning standard OpenCV KeyPoint objects and 128-element descriptors. You import pysift, call computeKeypointsAndDescriptors(image), and get results you can feed straight into existing OpenCV pipelines. The author is admirably insistent that you not confuse this with the unrelated PySift package on PyPI.

The interesting bit

The project treats clarity as a feature, not a bug. Where OpenCV’s SIFT is a black box of optimized C++, this version exposes every step of Gaussian pyramids, difference-of-Gaussians extrema detection, and orientation histograms in plottable, printable Python. The author even wrote a two-part Medium tutorial walking through each function.

Key highlights

  • Drop-in API compatibility: returns OpenCV-native keypoints and descriptors
  • Ships with a template-matching demo adapted from OpenCV’s own example
  • SIFT patent expired, so the code is unencumbered for commercial use
  • Explicitly “not optimized for speed” — designed for comprehension over throughput
  • Dependencies are minimal: Python 3, NumPy, OpenCV-Python

Caveats

  • “A few minutes to run on most images” — this is strictly for offline learning or small-scale experiments
  • Last tested on Python 3.8.5 / NumPy 1.19.4 / OpenCV 4.3.0; compatibility with newer stacks is unclear

Verdict

Grab this if you’re teaching computer vision, debugging SIFT behavior, or just want to finally understand what detectAndCompute is actually doing under the hood. Skip it if you need real-time feature extraction on a video stream.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.