A tool to compare similar images
Project description
imgsimilarity
imgsimilarity tool automates the process of comparing image pairs to check if they are similar or not and produces a score that quantifies the comparison by providing a score between 0 to 1, 0 being exactly identical.
How to use the tool
The tool is published in the pypi repository and the latest version can be installed with just a single line of command.
Prerequisites
- Python should be installed version 3 and above.
- Python package manager "pip" should be installed.
Installation
Open a terminal and paste:
pip install imgsimilarity
This will download the tool and set it up by installing all its dependencies
Execution
The module imgsimilarity takes a command line argument, i.e the path to the location of the csv file which needs to be provided when running it like in the example below
python -m imgsimilarity.diff C://pathtocsvfile
The tool will execute and a comparison_results.csv file will be generated in the directory the command was run.
How does the tool work?
The tool uses dhash algorithm to find a hashcode for each image and then find how many bits differ between the hashcodes to find the score for similarity. Identical images have difference as 0.
The dhash pypi module is being used here, its an out of the box python module to compute hashes and determine the difference for images. The hash for an image is stored in a dictionary to avoid repeated execution of dhash function and this reduces the cost of similarity detection. The execution time for each pair is calculated by taking the difference of process time at the start of the iteration and the process time at the end of the iteration.
Below is a flowchart that briefly illustrates how the tool functions.
How does the tool achieve hassle free installation and usage?
It is by using the Python Package Index repository!
Once the latest code is pushed and tagged, the gitlab ci is configured to run pytests to make sure the code works and the once the tests succeed it creates the build and a distributable with the help of setup.py file and twindle. and its uploaded to the PyPi Repository automatically.
The user can install the latest version using pip install or upgrade command. Thanks to the setup.py file all the dependencies are installed automatically
Reference:
PyPi repo: https://pypi.org/project/imgsimilarity/ dhash : https://pypi.org/project/dhash/
note
The source code is well documented and pydoc can be genrated.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file imgsimilarity-1.tar.gz
.
File metadata
- Download URL: imgsimilarity-1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9666770d2254b641a144bec0d5da145645e91bc1403dd0b87a37c1e3209f943a |
|
MD5 | 5fa7f6273a26143adc93342f84bb7a4a |
|
BLAKE2b-256 | fe760d6de3fd0a288335efdca764526a0ca1893c39eff1cef90faf2d2820fa2a |
File details
Details for the file imgsimilarity-1-py3-none-any.whl
.
File metadata
- Download URL: imgsimilarity-1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d0be4f4b090bd94be4283f8e1e06eb086dfade4598bc0bc927cc2fb6d31fb9e |
|
MD5 | 5bcc7f475b67ad20477dea92f4b5e423 |
|
BLAKE2b-256 | 970139842464ca3cd7133f7e4bfc4e05e118003178ae315b4eb20d2e4ed31f42 |