isl-org / Open3D

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

"TypeError: write_point_cloud(): incompatible function arguments" while running run_system.py tutorial code #6646

Open hexaflexa opened 7 months ago

hexaflexa commented 7 months ago

Checklist

My Question

I just learned about Open3D and am trying to get the tutorial code to work in examples\python\reconstruction_system. I ran:

python run_system.py --make --register --refine --integrate

After waiting a long time and a after lot of output, it ended up with the following error (some personal path stuff is omitted below)

...
Fragment 029 / 029 :: integrate rgbd frame 2996 (97 of 100).
Fragment 029 / 029 :: integrate rgbd frame 2997 (98 of 100).
Fragment 029 / 029 :: integrate rgbd frame 2998 (99 of 100).
Fragment 029 / 029 :: integrate rgbd frame 2999 (100 of 100).

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "[]\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "[]\lib\multiprocessing\pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "Open3D\examples\python\reconstruction_system\make_fragments.py", line 160, in process_single_fragment
    make_pointcloud_for_fragment(config["path_dataset"], color_files,
  File "Open3D\examples\python\reconstruction_system\make_fragments.py", line 142, in make_pointcloud_for_fragment
    o3d.io.write_point_cloud(pcd_name, pcd, False, True)
TypeError: write_point_cloud(): incompatible function arguments. The following argument types are supported:
    1. (filename: str, pointcloud: open3d.cpu.pybind.geometry.PointCloud, format: str = 'auto', write_ascii: bool = False, compressed: bool = False, print_progress: bool = False) -> bool

Invoked with: open3d_data/extract/LoungeRGBDImages\\fragments/fragment_004.ply', PointCloud with 625500 points., False, True
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "Open3D\examples\python\reconstruction_system\run_system.py", line 111, in <module> 
    make_fragments.run(config)
  File "Open3D\examples\python\reconstruction_system\make_fragments.py", line 183, in run  
    pool.starmap(process_single_fragment, args)
  File "[]\lib\multiprocessing\pool.py", line 375, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "[]\lib\multiprocessing\pool.py", line 774, in get
    raise self._value
TypeError: write_point_cloud(): incompatible function arguments. The following argument types are supported:
    1. (filename: str, pointcloud: open3d.cpu.pybind.geometry.PointCloud, format: str = 'auto', write_ascii: bool = False, compressed: bool = False, print_progress: bool = False) -> bool

Invoked with: 'open3d_data/extract/LoungeRGBDImages\\fragments/fragment_004.ply', PointCloud with 625500 points., False, True

As Open3D is very new to me, I'm not sure why the tutorial / example code is throwing a TypeError on write_point_cloud(). Any suggestions?

hexaflexa commented 7 months ago

I think I figured out the problem

The current version (0.18) has this function definition:

open3d.io.write_point_cloud(filename, pointcloud, format='auto', write_ascii=False, compressed=False, print_progress=False)

but an older version (0.17) has a different function definition:

open3d.io.write_point_cloud(filename, pointcloud, write_ascii=False, compressed=False, print_progress=False)

Thus, in examples\python\reconstruction_system\make_fragments.py, the code o3d.io.write_point_cloud(pcd_name, pcd, False, True) throws the TypeError I reported above, since there is no format argument.

I changed the code to o3d.io.write_point_cloud(pcd_name, pcd, format='auto', write_ascii=False, compressed=False, print_progress=True) and now it runs without the TypeError

lkjvzizh commented 1 month ago

thank you ,I have encountered this problem