isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.22k stars 2.28k forks source link

ICP registration crashes in visualization/draw #6887

Open AlexanderRitter02 opened 1 month ago

AlexanderRitter02 commented 1 month ago

Checklist

Describe the issue

Running the visualization/draw example and clicking on ICP registration results in a crash about list index out of range.

Previously in O3D 0.14, there may have been a similar issue, see #4531.

Steps to reproduce the bug

Run the test command as described in the documentation at https://www.open3d.org/docs/latest/getting_started.html#try-it:

open3d example visualization/draw

Then close the windows until you are at the two pointclouds. Then click "ICP registration (one set)" or "ICP registration (two sets)". It will crash.

Error message

(open3d-dev) user@user-pc:~$ open3d example visualization/draw
***************************************************
* Open3D: A Modern Library for 3D Data Processing *
*                                                 *
* Version 0.18.0+c1b55ee                          *
* Docs    https://www.open3d.org/docs             *
* Code    https://github.com/isl-org/Open3D       *
***************************************************
Running example visualization/draw ...
FEngine (64 bits) created at 0x55e4370 (threading is enabled)
FEngine resolved backend: OpenGL
[Open3D INFO] Downloading https://github.com/isl-org/open3d_downloads/releases/download/20220201-data/BunnyMesh.ply
[Open3D INFO] Downloaded to /home/user/open3d_data/download/BunnyMesh/BunnyMesh.ply
[Open3D INFO] Downloading https://github.com/isl-org/open3d_downloads/releases/download/20220301-data/DemoICPPointClouds.zip
[Open3D INFO] Downloaded to /home/user/open3d_data/download/DemoICPPointClouds/DemoICPPointClouds.zip
[Open3D INFO] Created directory /home/user/open3d_data/extract/DemoICPPointClouds.
[Open3D INFO] Extracting /home/user/open3d_data/download/DemoICPPointClouds/DemoICPPointClouds.zip.
[Open3D INFO] Extracted to /home/user/open3d_data/extract/DemoICPPointClouds.
Traceback (most recent call last):
  File "/home/user/miniconda3/envs/open3d-dev/bin/open3d", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/miniconda3/envs/open3d-dev/lib/python3.11/site-packages/open3d/tools/cli.py", line 368, in main
    return args.func(subparsers.choices[args.command], args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/open3d-dev/lib/python3.11/site-packages/open3d/tools/cli.py", line 184, in _example
    runpy.run_path(target, run_name="__main__")
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "/home/user/miniconda3/envs/open3d-dev/lib/python3.11/site-packages/open3d/examples/visualization/draw.py", line 327, in <module>
    main()
  File "/home/user/miniconda3/envs/open3d-dev/lib/python3.11/site-packages/open3d/examples/visualization/draw.py", line 321, in main
    selections()
  File "/home/user/miniconda3/envs/open3d-dev/lib/python3.11/site-packages/open3d/examples/visualization/draw.py", line 179, in selections
    vis.draw([{
  File "/home/user/miniconda3/envs/open3d-dev/lib/python3.11/site-packages/open3d/visualization/draw.py", line 227, in draw
    gui.Application.instance.run()
  File "/home/user/miniconda3/envs/open3d-dev/lib/python3.11/site-packages/open3d/examples/visualization/draw.py", line 149, in do_icp_one_set
    source_picked = sorted(list(sets[0][source_name]),
                                ~~~~^^^
IndexError: list index out of range

Expected behavior

It won't crash and perform the point cloud registration.

Open3D, Python and System information

- Operating system: Linux Mint 21.3 Cinnamon
- Python version: Python 3.11.9
- Open3D version: 0.18.0+c1b55ee
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: conda, latest development wheel

Additional information

No response

rxba commented 2 weeks ago

Hey @AlexanderRitter02 , you need to select point correspondences for an initial rough transformation in this example.

As this is currently not very obvious, I've opened a PR to prevent the IndexError and also warn the user of the need to provide point correspondences.