Code Monkey home page Code Monkey logo

siftimagesimilarity's Introduction

SIFTImageSimilarity

This repo provides a working interactive code to use SIFT algorithm for image similarity. I have also presented some of the results. Check them out and let me know if you need something more.

Requirements:

  • Python 3.6.5
  • iPython 7
  • jupyter notebook 6.0.3
  • opencv2
  • pickle

Results

Image 1 vs Image 2 Match (%) Similar
drawing 9.75 Yes
drawing 60.86 Yes
drawing 48.14 Yes
drawing 0.94 No
drawing 0.0 No
drawing 31.26 Yes
drawingdrawing 0.18 No

The codes available in this repo are tuned such that any score greater than 1.0 means they are a possible match. It works well with rotation and for images captured from different angles as well. However, if it is a 3D object (something with holes/gaps in between) and the view changes completely, it might not be possible for the algorithm to detect stuff. Depending on the use case and how strict you want the comparison, you can tune some parameters and also the cut-off.
I really wished Robert and Tom to match though (cries in the corner) #3000

If you want the codes for identifying similar objects like Taj1 vs Taj2 or Eiffel1 vs Eiffel2 (3D objects), feel free to reach out to me. I am working on it parallely.

This algorithm works great when you have descriptors pre-generated for thousands of images and all you want to do is find the images similar a new image.
You can also use the opencv's FlannBasedMatcher which is faster in terms of keypoint matching time but a little less accurate.

Thanks to rmislam for providing an open-source implementation of the SIFT (David G. Lowe's scale-invariant feature transform) done entirely in Python. I have added it as a commented code, you can use it incase you want to avoid using opencv's implementation. The only drawback right now is, it is very slow compared to opencv's efficient implementation.

Questions, Concerns, Bugs

Anyone is welcome to report and/or fix any bugs. I will resolve any open 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

SIFT was patented, but it has expired. This repo is primarily meant for beginners, 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) patent here (Inventor: David G. Lowe. Assignee: University of British Columbia.).

Understanding the SIFT algorithm:

For those, looking for resources to help understand the SIFT algorithm, here is an amazing 5 minute video:

SIFT - 5 Minutes with Cyrill

siftimagesimilarity's People

Contributors

adumrewal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.