Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A clean and concise Python implementation of SIFT (Scale-Invariant Feature Transform)

License

NotificationsYou must be signed in to change notification settings

rmislam/PythonSIFT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is an implementation of SIFT (David G. Lowe's scale-invariant feature transform) done entirely in Python with the help of NumPy. This implementation is based on OpenCV's implementation and returns OpenCVKeyPoint objects and descriptors, and so can be used as a drop-in replacement for OpenCV SIFT. This repository is intended to help computer vision enthusiasts learn about the details behind SIFT.

Update 2/11/2020

PythonSIFT has been reimplemented (and greatly improved!) in Python 3. You can find the original Python 2 version in thelegacy branch. However, I strongly recommend you usemaster (the new Python 3 implementation). It's much better.

Dependencies

Python 3

NumPy

OpenCV-Python

Last tested successfully usingPython 3.8.5,Numpy 1.19.4 andOpenCV-Python 4.3.0.

Usage

importcv2importpysiftimage=cv2.imread('your_image.png',0)keypoints,descriptors=pysift.computeKeypointsAndDescriptors(image)

It's as simple as that. Just like OpenCV.

The returnedkeypoints are a list of OpenCVKeyPoint objects, and the correspondingdescriptors are a list of128 element NumPy vectors. They can be used just like the objects returned by OpenCV-Python's SIFTdetectAndCompute member function. Note that this code is not optimized for speed, but rather designed for clarity and ease of understanding, so it will take a few minutes to run on most images.

Tutorial

You can find a step-by-step, detailed explanation of the code in this repo in my two-part tutorial:

Implementing SIFT in Python: A Complete Guide (Part 1)

Implementing SIFT in Python: A Complete Guide (Part 2)

I'll walk you through each function, printing and plotting things along the way to develop a solid understanding of SIFT and its implementation details.

Template Matching Demo

I've adapted OpenCV's SIFT template matching demo to use PythonSIFT instead. The OpenCV images used in the demo are included in this repo for your convenience.

pythontemplate_matching_demo.py

Questions, Concerns, Bugs

Anyone is welcome to report and/or fix any bugs. I will resolve any opened issues as soon as possible.

Any questions about the implementation, no matter how simple, are welcome. I will patiently explain my code to you.

Original Paper

"Distinctive Image Features from Scale-Invariant Keypoints", David G. Lowe

Definitely worth a read!

Legal Notice

SIFTwas patented, but it has expired.This repo is primarily meant for educational purposes, but feel free to use my code any way you want, commercial or otherwise. All I ask is that you cite or share this repo.

You can find the original (now expired) patenthere (Inventor: David G. Lowe. Assignee: University of British Columbia.).

About

A clean and concise Python implementation of SIFT (Scale-Invariant Feature Transform)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp