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
- 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.
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
.
- Added publishing to JCenter
- fixed bug #11(finally!!)
- fixed bug #43
- fixed bug #21
- use as a library
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.
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
<dependency>
<groupId>com.github.romankh3</groupId>
<artifactId>image-comparison</artifactId>
<version>2.1.0</version>
</dependency>
compile 'com.github.romankh3:image-comparison:2.1.0'
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();
}
}
Run the ./run.sh
script to run the demo.
You will get the result of comparing two images. The images, which are using:
This project is unlicense - see the LICENSE file for details
Thanks @dee-y for designing this logo
- Raspberry home ecosystem - home ecosystem based on raspberry pi.
- Movie Tracking Simple API for tracking movies with favorite actors for the specific time.
- Tic Tac Toe NxM- Own implementation. For any rectangle and any winner line count.