Giter Club home page Giter Club logo

image-comparison's Introduction

logo-trans Download Codacy Badge Build Status Coverage Status BCH compliance PRs Welcome

About

The program in Java that compares any 2 images and shows the differences visually by drawing rectangles. The Usages of the image-comparison can be found here Usage Image Comparison

Requirements

  • Implementation is using only standard core language and platform features, no 3rd party libraries and plagiarized code is permitted.
  • Pixels (with the same coordinates in two images) can be visually similar, but have different values of RGB. 2 pixels are considered to be "different" if they differ more than 10% from each other.
  • The output of the comparison is a copy of one of the images. The differences are outlined with red rectangles as shown below.
  • No third party libraries or borrowed code are in usage.

Building

To clone and build this project, run the following commands:

git clone https://github.com/romankh3/image-comparison
cd image-comparison
./gradlew check jar

This will compile, run the tests, and create a runnable jar at ${projectDir}/build/libs.

Release Notes

2.1.0

  • Added publishing to JCenter

2.0.2

  • fixed bug #11(finally!!)
  • fixed bug #43

2.0.1

  • fixed bug #21

2.0

  • use as a library

1.0

The program in Java that compares any 2 images and shows the differences visually by drawing rectangles.

  • Implementation is using only standard core language and platform features, no 3rd party libraries and plagiarized code is permitted.
  • Pixels (with the same coordinates in two images) can be visually similar, but have different values of RGB. We are only consider 2 pixels to be "different" if the difference between them is more than 10%.
  • The output of the comparison is a copy of one of the images image with differences outlined with red rectangles as shown below.
  • No third party libraries and borrowed code are not using.

Usage

Using the command-line

This library can be used as a command-line utility to compare two images.

After building with ./gradlew jar, you will find the runnable jar at ${projectDir}/build/libs.

To compare two images in files a.png and b.png, for example, run:

java -jar image-comparison.jar a.png b.png

To save the result image in a third file, say comparison.png, just give that file as a third argument:

java -jar image-comparison.jar a.png b.png comparison.png

To show more usage details, run:

java -jar image-comparison.jar -h

Using as a Java library

Dependency

Maven
<dependency>
    <groupId>com.github.romankh3</groupId>
    <artifactId>image-comparison</artifactId>
    <version>2.1.0</version>
</dependency>
Gradle
compile 'com.github.romankh3:image-comparison:2.1.0'

To compare two images programmatically

class Example {
    public static void main( String[] args ) {
        // load the images to be compared
        BufferedImage bufferedImage1 = ImageComparisonTools.readImageFromResources("image1.png");
        BufferedImage bufferedImage2 = ImageComparisonTools.readImageFromResources("image2.png");
        
        // where to save the result (leave null if you want to see the result in the UI)
        File result = new File( "result.png" );
        
        // compare them
        BufferedImage drawnDifferences = new ImageComparison( image1, image2, result ).compareImages();
    }
}

Demo

Run the ./run.sh script to run the demo.

You will get the result of comparing two images. The images, which are using:

Image 1

image1

Image 2

image2

Result

result

License

This project is unlicense - see the LICENSE file for details

Thanks @dee-y for designing this logo

Also if you're interesting - see my other repositories

image-comparison's People

Stargazers

 avatar

Watchers

 avatar

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.