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 contrast weighted option and fix resample for constrast #5

Closed
wants to merge 5 commits into from

Conversation

alexprand
Copy link
Contributor

This pull request includes two changes:

  1. It add a new smoothing algorithm "contrast weighted". This is just Lloyd smoothing using the image gradient as a weight function. However, because we need to iterate over the pixels of the image, this new method is slower than the others. But it gives really nice results if your goal is to capture edges in the image as part of the triangulation. Also, it gives interesting pictures in "Circles" mode where the dots get lined up along the edges.

  2. I reworked the "resample by contrast" slider since it had a bug and wasn't really doing what I expected previously. Now the resampling slider works on a scale from 1-100%, is a lot faster and can cause a little more density in near the edges that we saw previously.

There still seems to be some kind of bug where the Delaunay triangulation fails. I think this is a known robustness issue in the d3 code (see here), but unfortunately, it seems to be more common using contrast weighted smoothing and a large number of points, presumably since in that setting we get some lower quality cells and lots points sort of in a line. But I don't know of a good solution beyond getting deep into the d3 code or writing a new triangulator.

@alexprand
Copy link
Contributor Author

I am going to close this and put up a new pull request once the react branch merges (and I get a chance to update this code to that structure).

@alexprand alexprand closed this Dec 1, 2017
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