-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[WIP] Hausdorff Distance (new) #4005
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
Conversation
Is this considered a new feature/do I need to provide a gallery example for this? |
Hi, I'm not sure under what existing gallery section should I put the gallery example? |
@clementkng possibly the function should now be moved to the new |
Hello @clementkng! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-08-06 23:51:54 UTC |
@jni Thanks! Just to be clear, I would put the |
coords_b[(x, y)] = True | ||
|
||
# Call the hausdorff function on the coordinates | ||
measure.set_metrics.hausdorff_distance(coords_a, coords_b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change this to
from skimage import metrics
metrics.hausdorff_distance(coords_a, coords_b)
I'm also confused that you have given images as input instead of coordinates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put image
in because for now, the hausdorff_distance
algorithm takes in coordinates. I then use the image
to render a plot of the the points passed in.
|
||
ax.imshow(image, cmap=plt.cm.gray) | ||
ax.axis((0, 600, 600, 0)) | ||
plt.show() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a screenshot of the output as a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean a comment w/i the code (I'm not fully sure how to do that) or w/i the issue i.e. in the PR description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jni I've added the output into the description of the PR for now. Let me know if you meant something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was right, sorry that I didn't respond at the time!
@clementkng there's definitely something wrong with that drawing. The Hausdorff distance is the largest shortest distance between points in either set. The wikipedia page has a clear drawing. In this case, the point at the top of the kite clearly has closer neighbours in the diamond! |
skimage/metrics/set_metrics.py
Outdated
@@ -0,0 +1,70 @@ | |||
from __future__ import print_function, division |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be removed since we don't support Python 2 anymore.
skimage/metrics/set_metrics.py
Outdated
b_points = np.transpose(np.nonzero(b)) | ||
|
||
if a_points.ndim != 2 or b_points.ndim != 2: | ||
raise ValueError('Both input arrays must be two-dimensional') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will never happen, so it can be removed.
@jni Thanks for the feedback! In that case, I suspect there's something wrong w/ the original algorithm or my understanding of it, but thank you for confirming my suspicions. |
Hi @jni, I've fixed up the gallery example and code. Hopefully it's more clear this time around! |
@jni I was also able to clear up the bento issue that was failing the Travis builds. |
Minor changes to the installation guide
* replace _roll_axes with np.roll(..., axis=) requires NumPy >= 1.12 * avoid unnecessary numpy function calls
Migrate to networkx 2.x
Forward port v0.16.x documentation changes
Sync numpy requirement in build.txt
…ance, improved test coverage
…larger point distances getting through to the hausdorff distance
Hi @jni, I was wondering if scikit image was still interested in having this feature? I accidentally messed up this PR due to git issues, but can work to get an updated PR out. |
@clementkng we absolutely are! I have often stopped on this PR to check whether I could update it myself, but other priorities drew me away. If you can submit a clean PR I'll push it to the top of my stack. =) Thank you! |
Description
Supersedes gh-742.
This is my attempt to fix the feedback on @josteinbf 's Hausdorff distance PR and add docs, examples, and extra tests. I've changed the methods to a single
hausdorff_distance
method to be more clear.Existing discussion at gh-738. WIP b/c I still need to add benchmarks and gallery examples.
Pinging the original people that still had feedback open on the original PR: @stefanv @tonysyu @ahojnnes @emmanuelle @jni @alexandrejaguar
Checklist
./doc/examples
(new features only)./benchmarks
, if your changes aren't covered by anexisting benchmark
Gallery Example Output
For reviewers
later.
__init__.py
.doc/release/release_dev.rst
.@meeseeksdev backport to v0.14.x