pixelmatch icon indicating copy to clipboard operation
pixelmatch copied to clipboard

Improve anti-aliasing algorithm

Open josieoharrow opened this issue 3 years ago • 6 comments

this fixes the issue w false positives and also a bug for returning true when false should have been returned. In addition, I added conditional handling for the "edge" cases where you variably can accept one or two zeros depending on the line they are on.

josieoharrow avatar Jul 22 '22 19:07 josieoharrow

@josieoharrow Thank you so much for the PR! I'm really intrigued by the new anti-aliasing logic — this might address #74. Can you share some example images/diffs with before/after the PR? Also, would you mind fixing the linting errors?

mourner avatar Jul 26 '22 13:07 mourner

Hey @josieoharrow, any updates on this?

mourner avatar Aug 25 '22 14:08 mourner

Hi, @mourner thanks for the reminder! I will attach the output from before and after below:

I did notice the test script is running slower with my change. The algorithm shouldn't be slower, and maybe it has to do with the errors being thrown since the expected is a bit different, but that is worth looking into.

**AFTER (with my change) **

1diff 2diff 3diff 4diff 5diff 6diff 7diff

**BEFORE (as it was) **

1diff 2diff 3diff 4diff 5diff 6diff 7diff

josieoharrow avatar Aug 25 '22 19:08 josieoharrow

@josieoharrow great work! Would you be able to continue this PR, as I am eager to test it in use

paazmaya avatar Jul 13 '23 12:07 paazmaya

@paazmaya I am not sure how to continue this PR. I think the modified js file is the only one which should be changed. I tried un-adding some files which I accidentally included in this PR, but I think the build is failing now because the test cases are inconsistent with the change I made and fixing that involves re-writing the test cases... I don't think that should be done until another person verifies those changes. It has been a while since I looked at this code closely, but I recall seeing definite errors in the logic/math which this PR is aiming to address.

In the interim, I think you can use the code included in this PR on your own fork/locally depending on what you need and it should work well.

josieoharrow avatar Aug 01 '23 22:08 josieoharrow