Skip to content

Commit

Permalink
#33: added pom.xml file.
Browse files Browse the repository at this point in the history
  • Loading branch information
romankh3 committed Apr 12, 2019
1 parent 4d0d98c commit 7a1dd24
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -66,7 +66,7 @@ configure(install.repositories.mavenInstaller) {
packaging 'jar'
description project.description

url 'https://github.com/romankh3/image-comparison'
url 'https://romankh3.github.io/image-comparison/'

scm {
connection 'git@github.com:romankh3/image-comparison.git'
Expand Down
35 changes: 35 additions & 0 deletions pom.xml
@@ -0,0 +1,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.romankh3</groupId>
<artifactId>image-comparison</artifactId>
<version>2.0.2</version>
<packaging>jar</packaging>

<name>Image Comparison</name>

<url>https://romankh3.github.io/image-comparison/</url>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.26.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
6 changes: 5 additions & 1 deletion src/main/java/ua/comparison/image/ImageComparison.java
Expand Up @@ -58,7 +58,7 @@ public class ImageComparison {
private int regionCount = counter;
private int[][] matrix;

ImageComparison(String image1, String image2) throws IOException, URISyntaxException {
public ImageComparison(String image1, String image2) throws IOException, URISyntaxException {
this(readImageFromResources(image1), readImageFromResources(image2), null);
}

Expand All @@ -75,6 +75,10 @@ public ImageComparison(BufferedImage image1, BufferedImage image2, File destinat
this.destination = destination;
}

public ImageComparison(BufferedImage image1, BufferedImage image2) {
this(image1, image2, null);
}

public static void main(String[] args) throws IOException, URISyntaxException {
ImageComparison imgCmp = create(args);
BufferedImage result = imgCmp.compareImages();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ua/comparison/image/ImageComparisonTools.java
Expand Up @@ -71,7 +71,7 @@ public static void checkCorrectImageSize(BufferedImage image1, BufferedImage ima
* @param rgb2 the RGB value of the Pixel of the Image2.
* @return {@code true} if they' are difference, {@code false} otherwise.
*/
public static boolean isDifferent(int rgb1, int rgb2) {
public static boolean isDifferentPixels(int rgb1, int rgb2) {
int red1 = (rgb1 >> 16) & 0xff;
int green1 = (rgb1 >> 8) & 0xff;
int blue1 = (rgb1) & 0xff;
Expand All @@ -97,7 +97,7 @@ static int[][] populateTheMatrixOfTheDifferences(BufferedImage image1, BufferedI
int[][] matrix = new int[image1.getWidth()][image1.getHeight()];
for (int y = 0; y < image1.getHeight(); y++) {
for (int x = 0; x < image1.getWidth(); x++) {
matrix[x][y] = isDifferent(image1.getRGB(x, y), image2.getRGB(x, y)) ? 1 : 0;
matrix[x][y] = isDifferentPixels(image1.getRGB(x, y), image2.getRGB(x, y)) ? 1 : 0;
}
}
return matrix;
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 7a1dd24

Please sign in to comment.