SIFT Algorithm for Image Comparison

Images for Test
import cv2
img1 = cv2.imread("Path to image 1",0)
img2 = cv2.imread("Path to image 2",0)
# check for similaritiessift = cv2.xfeatures2d.SIFT_create()# check keypoints and descriptions of imageskp_1,desc_1 = sift.detectAndCompute(img1,None)
kp_2,desc_2 = sift.detectAndCompute(img2,None)
index_params = dict(algorithm=0, trees=5)
search_params = dict()
flann = cv2.FlannBasedMatcher(index_params, search_params)
matches = flann.knnMatch(desc_1, desc_2, k=2)
result = cv2.drawMatchesKnn(img1,kp1,img2,kp2,matches,None)
cv2.imshow("Correlation", result)
cv2.imshow("Image 1", img1)
cv2.imshow("Image 2", img2)
Correlated Images
  1. Rotation
  2. Scaling
  3. Image Brightness

--

--

--

Full-Stack Data Scientist

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Making fun visuals, history maps and other tool improvements

Make your Kafka cluster production-ready with Irori Streaming Data Platform (ISDP)!

Installing Postman on Kali Linux [2020]

Part 3: Feature implementation, a clean and swift way of doing it.

Top 7 Web Development Frameworks In 2020

Git IS a Version Control System | But What Does This Mean?

How to team: lessons in mountaineering and software engineering

Basics of error handling in Go

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adnan Karol

Adnan Karol

Full-Stack Data Scientist

More from Medium

Custom Object Detection for Road Damage Detection using Yolov4

AI Tennis Ball Bounce Detection

Image Segmentation on Indian traffic dataset

Colorful Image Colorization