Skip to content
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

Implement BMP version compareImages_BMP() method for issue#153 #221

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

C0deAlchem1st
Copy link

@C0deAlchem1st C0deAlchem1st commented Apr 24, 2022

PR Details

  • Provide an alternative image-comparison method, which is based on image format conversion.

Description

  • Implement a public method called compareImages_BMP(), which works for the same goal as compareImages().
  • Add a series of private methods to support compareImages_BMP().
  • Create 2 test cases to compare the performance between compareImages_BMP() and compareImages().

Related Issue

Motivation and Context

This work is aim to improve the performance of image-comparison, by getting RGB as bytes and removing binary operations in isDifferentPixels method.

How Has This Been Tested

Add a new test file called BMPTest.java, in which I designed some test to test feasibility and speed differernces.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Owner

@romankh3 romankh3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a lot to review, I will do it later.
Please, fix the comments which I created.

public ImageComparisonResult compareImages_BMP() {

// check that the images have the same size
if (isImageSizesNotEqual(expected, actual)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic have code duplicate. Please. provide solution for using it from one place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding a param to compareImages() method to indicate whether using the BMP version could help...
I mean I just tried to avoid "breaking change" at first.
Thanks for comments, I will check and fix the code for the near term.

*
* @return the result of the drawing.
*/
public ImageComparisonResult compareImages_BMP() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, rename method to be more java friendly.
For example compareImagesBMP or similar.

* [work for issue #153]
* a class to store 3 bytes RGB values in a pixel
*/
private class RGB_tuple{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, rename it to RgbTuple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants