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

Add basic erosion morphological operation #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

coreh
Copy link

@coreh coreh commented Jul 26, 2019

Hey there πŸ‘‹

While comparing images produced by two different computers via WebGL, we noticed that sometimes the images would include 1px-2px thick spurious diff regions, likely caused by differences in rasterization and floating point precision between GPU models.

pixelmatch already includes antialias detection which helps alleviate some of these false-positives, but in some cases they were still showing up in our image diffs.

This PR introduces logic to optionally apply an erosion morphological operation after calculating the diff β€” which eliminates 1-2px wide structures from the image diff β€” and to return the total of non-eroded pixels.

Erosion is implemented as a separate pass, so it requires the output image to be present. By default eroded pixels are marked with an orange color.

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.

None yet

1 participant