-
Notifications
You must be signed in to change notification settings - Fork 5
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
Index Error #8
Comments
Hi Rahul, Best, |
Yes, I tried it out now, it seems to be working...Thanks a lot... |
I also wanted to know one more thing, instead of the vertices and edges...can the algo directly give the polygon? or do we need to write custom logic for that? |
I currently have no plans for adding such functionality to the code, as there already exist more advanced libraries to handle polygons and/or meshes (e.g. OpenMesh). The extracted data structure is also likely to depend on the specific use case (- point list, half-edge structure, ...). Just a remark about extracting polygons: Depending on the parameters, the SNIC algorithm can produce superpixels that are fully enclosed into others. Simply converting to polygons by tracing the edges may violate this topology, as the enclosing super-pixels may also cover the area of the enclosed ones. This may be problematic if you plan to do some calculations/statistics on them. If you simply want to visualize the superpixels, make sure to draw the graphs in the provided order. Graphs containing the enclosed superpixels are provided last in the returned graph list. If you got some suggestions for adding such functionality in a proper way, I can try to free some time and add it to the repo. |
I just want to visualize...and send the polygon coordinates...will keep in mind the point which you mentioned..will implement and let you know if at all a way exists which will be useful for the community |
Just in case you are again encountering index out of bound errors in the polygonization method - I just revised the code to cover some more edge cases. (Fixed the same error in another sub-method and prevented some edges from being mistakenly discarded). |
Thanks a lot Moritz....just wanted to know...whether you have updated the same in the pip version of pysnic |
Just updated the pip package. 👍 |
Hello Moritz,
Thanks for such a great implementation of Polygon based on SNIC...i am facing one small issue...so In some cases..I am observing that the polygonize code is giving index error with queue[-1]...I was hoping you could help out in finding a way to solve it.
Preview of the Error is below-
Traceback (most recent call last):
File "trial.py", line 33, in
graphs = polygonize(segmentation, seeds, rdp)
File "/home/sirzech/anaconda3/lib/python3.8/site-packages/pysnic/algorithms/polygonize.py", line 522, in polygonize
graphs = trace_isles(vertices, seeds, segmentation)
File "/home/sirzech/anaconda3/lib/python3.8/site-packages/pysnic/algorithms/polygonize.py", line 304, in trace_isles
vertices, edges = trace_edges_unsafe(px, py, direction, segmentation)
File "/home/sirzech/anaconda3/lib/python3.8/site-packages/pysnic/algorithms/polygonize.py", line 348, in trace_edges_unsafe
idx = queue[-1]
IndexError: list index out of range
Thanks,
Rahul Moorthy
The text was updated successfully, but these errors were encountered: