Geodan / fill-holes-pointcloud

Generate synthetic points to fill holes in point clouds
MIT License
33 stars 8 forks source link

IndexError: index 65670 is out of bounds for axis 0 with size 65668 #3

Open levanpon98 opened 4 years ago

levanpon98 commented 4 years ago

Here is my point cloud

[[-72.290344 110.215118  45.232807]
 [-71.844398 110.23407   46.259731]
 [-71.713478 111.132759  45.583839]
 ...
 [ 56.032158  37.679405  29.674858]
 [ 56.453171  35.20845   28.306606]
 [ 56.071678  42.443367  27.207411]]

The shape is

(32892, 3)

When I execute the code

_points = fill_holes(points)

I got some errors

Traceback (most recent call last):
  File "fill_hole.py", line 466, in <module>
    app.run(main)
  File "/home/levanpon/anaconda3/envs/tf2/lib/python3.7/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/home/levanpon/anaconda3/envs/tf2/lib/python3.7/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "fill_hole.py", line 460, in main
    synthetic_points = fill_holes(points)
  File "fill_hole.py", line 409, in fill_holes
    suppress_qhull_errors=suppress_qhull_errors
  File "fill_hole.py", line 341, in find_holes
    height_clustering, kde_bandwidth)
  File "fill_hole.py", line 268, in triangles_to_holes
    holes = [Polygon(points_indexed[tri_simplices[big_triangles[0]]])]
IndexError: index 65670 is out of bounds for axis 0 with size 65668

How can I fix this?

chrislcs commented 4 years ago

Any chance you could give me a point cloud were this issue occurs? Without any way to reproduce, it is hard for me to debug.

In any case it seems to me like the default parameter settings are not working well with your data, as that line were the bug occurs is run when only 1 big triangle is found. Unless you were expecting very little holes in your data (which would making this tool quite redundant), I think you will need to adjust the max_circumradius and max_ratio_radius_area. These 2 parameters determine when a triangle (which is the result of a triangulation of the point cloud) is considered too big and thus part of a hole in the data.

levanpon98 commented 4 years ago

Hi @chrislcs, Thanks for your reply, You can download my point cloud from this link

ankistr commented 4 years ago

Hi @levanpon98, I have the same issues with the code as you mentioned above, did you fix your problem? and can you tell me how you did this? Many thanks in advance

Bowen577 commented 2 years ago

Hi @chrislcs , I met the same issue as @levanpon98 , no matter how I adjust max_circumradius and max_ratio_radius_area there always raise this error, and only one big triangle can be found. Do you know how to solve this?

marcosdiak commented 2 years ago

Same issue here, @chrislcs, any suggestion? Thanks.


IndexError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_23316\2779657841.py in ----> 1 _points = fill_holes(np.asarray(downpcd.points))

~\AppData\Local\Temp\ipykernel_23316\1142188005.py in fill_holes(points, max_circumradius, max_ratio_radius_area, distance, percentile, normals_z, min_norm_z, bounding_shape, height_clustering, kde_bandwidth, suppress_qhull_errors) 404 height_clustering=height_clustering, 405 kde_bandwidth=kde_bandwidth, --> 406 suppress_qhull_errors=suppress_qhull_errors 407 ) 408

~\AppData\Local\Temp\ipykernel_23316\1142188005.py in find_holes(points, max_circumradius, max_ratio_radius_area, height_clustering, kde_bandwidth, suppress_qhull_errors) 336 if len(big_triangles) != 0: 337 holes = triangles_to_holes(points, tri.simplices, big_triangles, --> 338 height_clustering, kde_bandwidth) 339 340 holes = [holes] if type(holes) == Polygon else list(holes)

~\AppData\Local\Temp\ipykernel_23316\1142188005.py in triangles_to_holes(points, tri_simplices, big_triangles, height_clustering, kde_bandwidth) 260 261 if len(big_triangles) == 1: --> 262 holes = [Polygon(points_indexed[tri_simplices[big_triangles[0]]])] 263 elif not height_clustering: 264 holes = cascaded_union([Polygon(points_indexed[tri_simplices[t]])

IndexError: index 13620 is out of bounds for axis 0 with size 13616