-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Polygon approximation #2002
base: main
Are you sure you want to change the base?
Polygon approximation #2002
Conversation
@@ -18,6 +19,12 @@ def approximate_polygon(coords, tolerance): | |||
Maximum distance from original points of polygon to approximated | |||
polygonal chain. If tolerance is 0, the original coordinate array | |||
is returned. | |||
closed : boolean | |||
If true, the algorithm assumes the given polygon is closed | |||
(the first and last vertices are connected) and approximates using the |
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.
true -> True
Describe "approximating using the first and last point" a bit more clearly.
skimage/measure/_polygon.py
Outdated
@@ -1,8 +1,11 @@ | |||
import numpy as np | |||
from scipy import signal | |||
from scipy.spatial import distance_matrix | |||
from numpy import unravel_index | |||
import pdb |
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.
Unused import here.
This PR looks great. I iterated on stefan's comment. After that, I think it will be ready. There are some test failures due to #2237 |
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.
There is only minor things to fix, then it will be ready for me.
@@ -18,6 +20,13 @@ def approximate_polygon(coords, tolerance): | |||
Maximum distance from original points of polygon to approximated | |||
polygonal chain. If tolerance is 0, the original coordinate array | |||
is returned. | |||
closed : boolean |
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.
boolean, optional
@@ -11,18 +11,30 @@ | |||
|
|||
|
|||
def test_approximate_polygon(): |
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 split this test in several ones, with a name that reflects the idea behind the each test.
Hello @Seth-Park and sorry for the tooooo long feedback 🙏 |
addressing issue #1552
Some of the issues in the previous implementation:
Possible Fix:
In the following examples, the top plots in each figure are the results when setting closed=True while the bottom plots are the results when setting closed=False.
Open to many feedbacks! Thank you :)