Giter VIP home page Giter VIP logo

differences-between-two-images's Introduction

differences-between-two-images (or multiple images)

Detect and visualize differences between images with OpenCV and the SSIM method. The images are compared with the first provided image.

Versions

The latest version of this project is currently 2.0.1.

Note: to navigate through the different versions, use e.g. git checkout tags/1.0.1.

Dependencies

To manage the dependencies, I recommend using the python package manager poetry. You might have to install it before using brew install poetry (on MacOS).

Then, just install the different dependencies:

poetry update

Note: In case you want to use any other methods, a requirements.txt file is also provided.

Quick-start

Once the virtual environment is set up, you can call the script using different parameters.

On MacOS:

poetry run main -bd $(ls ./dataset/*.jpg)

On Windows PowerShell:

python ./main.py $(dir ./dataset/*.jpg)

You can also add options to display:

  • The input images -dm (display mask)
  • The boxed differences -bd (display outbound boxes)
  • The drawed differences -dd (draw differences i.e. the freckles)
  • The computed ssim model -ds (display ssim)

Notes:

  • The first given file is the reference which will be use for comparison.
  • The results are saved under the results/ folder by default.

Example

python ./main.py image-1.jpg image-2.jpg image-3.jpg

image-2.jpg and image-3.jpg will be compared to image-1.jpg.

Back-end logic explained

Let's take the following images:

and:

The first step to do is to compute the ssim difference after having had converted the images from colorized to gray-scaled:

Then, we isolate the differences by binarizing the image:

Then, we remove the noise by applying a mask and removing the outliers i.e. the freckles for which the surface is inferior to an arbitrary number:

Finally, we compute the bouding box for each surface and superpose it to the image:

Troubleshooting

If you encounter a similar error when applying pylint, e.g.:

E1101: Module 'cv2' has no 'imread' member (no-member)

Then, edit the following line in the .pylintrc for:

generated-members=["cv2.*"]

If you encounter the following, related to the use of click:

E1120: No value for argument 'images' in function call (no-value-for-parameter)

Then, edit the following line in the .pylintrc for:

signature-mutators=click.decorators.option

Inspirations

differences-between-two-images's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

cody0704

differences-between-two-images's Issues

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.