Open PeerHalvorsen opened 2 years ago
I ran into the same issue when writing my own project: getDifferencePercent was returning an incorrect percentage. It seems that it was calculating the total number of different pixels incorrectly - instead of increasing an overall counter for each different pixel it was summing a long of differences from getRGB method.
Created a new pull request to fix this.
I'm trying to understand why
getDifferencePercent(BufferedImage img1, BufferedImage img2)
on line 138 of the ImageComparisonUtil class is returning a different result than the percent calculated in line 313 of the ImageComparison class.The algorithm used to acquire the count of different pixels in
populateTheMatrixOfTheDifferences()
on line 234 seems to be similar to what's being done ingetDifferencePercent(BufferedImage img1, BufferedImage img2)
but the end result isn't the same.It seems like if I'm trying to set an allowed percentage difference using
setAllowingPercentOfDifferentPixels()
I can't use the output of getDifferencePercent as a gauge since that value doesn't match what's calculated during the image comparison insideisAllowedPercentOfDifferentPixels(long countOfDifferentPixels)