-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added image difference #18
Conversation
My bad, I'm still new to Gradle and the Git CLI. I've removed the unnecessary compiled files from the commit. |
//System.out.println("%"); // Format don't like that syntax! | ||
|
||
// Write the image as png, with the filename based on the path provided | ||
FileUtil.writeImage(output,imgExtension,new File(pathFileName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add condition to only write image if images are not equal. No need to save additional image if they are same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @PeterD23 ,
Thank you. Could you please consider mentioned comments.
int colourSpaceBytes = 3; // RGB is 24 bit, or 3 bytes | ||
double totalPixels = width1 * height1 * colourSpaceBytes; | ||
double pixelError = diff / totalPixels / 255.0; | ||
//System.out.format("Pixel error: "+"%.5f",pixelError*100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented sysout
* @param deviation The upper limit of the pixel deviation for the test | ||
* @return If the test passes | ||
*/ | ||
public static boolean imagesAreEquals(BufferedImage image1, BufferedImage image2, String pathFileName, String imgExtension, double deviation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to pass imgExtension as a parameter. We are only using png, since any other format will cause conversion discrepancies.
* @param deviation The upper limit of the pixel deviation for the test | ||
* @return If the test passes | ||
*/ | ||
public static boolean imagesAreEquals(BufferedImage image1, BufferedImage image2, String pathFileName, String imgExtension, double deviation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename method to imagesAreEqualsWithDiff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will rename it, but I figured that overloading the method would be better since it performs the same function but with added functionality.
For the final comment about showing only the moved position, I am unable to figure out how that can be done, since there is no way I can think of to ignore the original positions. |
Hi @PeterD23 , Thanks for update. Yes you are right about skipping formatting the original position. Lets leave it as it is for now. |
Overloaded existing imagesAreEquals method to include an output file and pixel manipulation to mark areas of deviation when comparing images.