Skip to content

This project provides a tool to compare two images using various similarity metrics, including histograms, structural similarity index (SSIM), mean squared error (MSE), mean absolute error (MAE), feature matching, and image hashing.

Notifications You must be signed in to change notification settings

e43b/Image-Comparison

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Image Comparison Views

This project provides a tool to compare two images using various similarity metrics, including histograms, structural similarity index (SSIM), mean squared error (MSE), mean absolute error (MAE), feature matching, and image hashing.

Donate Discord

GitHub Project: DC Server Link Check
Author: e43b

Features

  • Histogram Comparison: Compares the color distribution of the images.
  • SSIM: Measures the structural similarity between the images.
  • MSE: Calculates the mean squared error between the images.
  • MAE: Calculates the mean absolute error between the images.
  • Feature Matching: Compares the features of the images.
  • Image Hashing: Compares the hash values of the images.

How to Use

  1. Make sure you have Python installed on your system.

  2. Clone this repository:

    git clone https://github.com/e43b/Image-Comparison/
  3. Navigate to the project directory:

    cd Image-Comparison

Requirements

The following Python libraries are required to run the tool:

  • OpenCV (cv2)
  • NumPy (numpy)
  • scikit-image (scikit-image)
  • imagehash (imagehash)
  • Pillow (PIL)

Install the required libraries using the command:

pip install -r requirements.txt

Usage

To compare two images, use the following command:

python main.py <image1> <image2>

For example:

python main.py 1.png 2.png

Example Output

The output will display the similarity metrics for the given images and provide an overall assessment of their similarity.

Sample Input

foxs

Sample Output

Histogram similarity: 0.5765597414419016
Explanation: Values close to 1 indicate high similarity in the color distributions of the images.
---------------------------------------------------------
SSIM similarity: 0.8644391986221096
Explanation: Values range from -1 to 1, where 1 indicates a perfect match. Higher values indicate higher structural similarity.
---------------------------------------------------------
MSE: 106.44129259259259
Explanation: Lower values indicate higher similarity. It's a measure of the average squared difference between the pixels of the images.
---------------------------------------------------------
MAE: 140.07771064814816
Explanation: Lower values indicate higher similarity. It's a measure of the average absolute difference between the pixels of the images.
---------------------------------------------------------
Feature matching similarity: 0.945
Explanation: Higher values indicate higher similarity in feature matching between the images.
---------------------------------------------------------
Image hashing similarity: 0.876
Explanation: Values close to 1 indicate higher similarity. Compares hashes representing the images.
---------------------------------------------------------

Overall assessment:
The images are structurally similar, but differ in color.

Explanation of Metrics

  • Histogram Similarity: Values close to 1 indicate high similarity in color distributions.
  • SSIM Similarity: Values range from -1 to 1, where 1 indicates a perfect match. Higher values indicate higher structural similarity.
  • MSE: Lower values indicate higher similarity. It's a measure of the average squared difference between the pixels of the images.
  • MAE: Lower values indicate higher similarity. It's a measure of the average absolute difference between the pixels of the images.
  • Feature Matching Similarity: Higher values indicate higher similarity in feature matching between the images.
  • Image Hashing Similarity: Values close to 1 indicate higher similarity. Compares hashes representing the images.

Overview

Based on the comparison metrics, the tool will provide an overall assessment of the similarity between the images.

About

This project provides a tool to compare two images using various similarity metrics, including histograms, structural similarity index (SSIM), mean squared error (MSE), mean absolute error (MAE), feature matching, and image hashing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages