This PR reduces the execution times of an image comparison #245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Details
When comparing two images with multiple different raw regions (regionCount), the matrix (array of length image.getHeight() x image.getWitdth()) was being iterated regionCount - 2 times.
I had a case where there where over 900 iterations over a not-so-small image, which made it quite slow.
With this PR, the image is only being checked once to
createRectangles
.Description
I had two screenshots with text where the text size was slightly different. This resulted in a large amount of different pixels, which often were not next to each other.
The time for a comparison of those images was at around 20s.
With the first commit 4ebdad4 i could bring this down to around 3-4s, with the second commit it needs about another second less time.
Related Issue
Might be related to #174 or #153
Motivation and Context
This PR reduces the execution times of an image comparison.
How Has This Been Tested
The unit tests are running without errors, no changes were needed.
To reproduce this scenario, the following test can be used, I did not add this to the tests as of now, because the times will be highly dependent on the hardware and I don't see any other way to test this. Please let me know if I should add this to the tests.
For me, the comparison before my changes took 62s, after the first commit 3.8s and after the second commit 2.7s. 1741 regions are being found.
Types of changes
Checklist