Skip to content

dderooy/image_comparison

Repository files navigation

Python Image Comparison using OpenCV

The pictures have 0.13698 similarity: alt text

This program consumes a csv file of image pairs and conducts a comparison using OpenCV. Similarity ranges from 0 - 1 with 0 being the same image.

Code Workspace Setup (using a mac):

(using python 2.7.14)

After cloning the repository and opening the directory in a terminal, run the below commands

Pipenv: is used to control the project dependencies and python environments

sudo pip install pipenv

Check to see if pipenv is installed correctly

pipenv

Install project dependencies using python 2

pipenv install --two

Run the python environment

pipenv shell

Unit Tests

Run the project unittests. The first time they will fail since the test data is being created with image paths specific to your system. Running this command a second time will allow all tests to pass.

python -m unittest discover

Operation (using a mac):

Run the command and follow the instructions:

python CompareImages.py

The program will ask for the path of an input and output file and build a results file. The resutls file contains the similarity of each image pair, as well as the elapsed computation time in seconds for each image.

Creating executable files for Mac and Windows

Install pyinstaller

sudo pip install pyinstaller

This will create an executable file depending on the OS being used. (since I don't have a windows machine I can only create mac executable files)

pyinstaller CompareImages.spec

The executable file will be located in the 'dist/image_comparison/' folder.

Improvements

The quality of the comparison is dependent on many factors. Image size and resolution is very important since high res photos will have better feature detection.

The programs uses the open source ORB algorithm for feature detection, however there are other non-free algorithms that exist such as SIFT and SURF. Other alternatives can always be explored.

Finally it would be nice to add a littel GUI for importing csv files into and out of the program.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages