meyerls / pc-skeletor

Skeletonization of 3D Point Clouds
MIT License
151 stars 18 forks source link

ValueError: setting an array element with a sequence. #18

Closed midiexiangxxx closed 1 year ago

midiexiangxxx commented 1 year ago

I would very appreciate it if you can help me run code

trunk_pcd_path, branch_pcd_path = downloader.download_semantic_tree_dataset()

pcd_trunk = o3d.io.read_point_cloud(trunk_pcd_path)
pcd_branch = o3d.io.read_point_cloud(branch_pcd_path)
pcd = pcd_trunk + pcd_branch
#  
lbc = LBC(point_cloud=pcd,
          down_sample=0.008)
lbc.extract_skeleton()
lbc.extract_topology()
lbc.visualize()
lbc.show_graph(lbc.skeleton_graph)
lbc.show_graph(lbc.topology_graph)
lbc.save('./output')
lbc.animate(init_rot=np.asarray([[1, 0, 0], [0, 0, 1], [0, 1, 0]]),
            steps=300,
            output='./output')

error: Traceback (most recent call last): File "main.py", line 53, in lbc.extract_topology() File "/home/moyu/.local/lib/python3.8/site-packages/pc_skeletor/laplacian.py", line 287, in extract_topology self.skeleton_graph = self.__extract_skeletal_graph(skeletal_points=skeleton_points) File "/home/moyu/.local/lib/python3.8/site-packages/pc_skeletor/laplacian.py", line 241, in __extract_skeletalgraph , , , _, edgeindex, = extract_mst(points=skeletal_points) File "/home/moyu/.local/lib/python3.8/site-packages/pc_skeletor/laplacian.py", line 237, in extract_mst degree, edge_length, branch_length, branch_shape, edge_index, branch_index = mst.get_stats(include_index=True, k_neighbours=self.graph_k_n) File "/home/moyu/.local/lib/python3.8/site-packages/mistree/mst/get_mst_class.py", line 408, in get_stats return self._get_stats(include_index=include_index, sub_divisions=sub_divisions, File "/home/moyu/.local/lib/python3.8/site-packages/mistree/mst/get_mst_class.py", line 370, in _get_stats self.get_branches(sub_divisions=sub_divisions) File "/home/moyu/.local/lib/python3.8/site-packages/mistree/mst/get_mst_class.py", line 198, in get_branches branch_index, rejected_branch_index = branches.get_branch_index(self.edge_index, self.edge_degree) File "/home/moyu/.local/lib/python3.8/site-packages/mistree/mst/branches.py", line 86, in get_branch_index branch_index.append(np.ndarray.tolist(np.ndarray.flatten(np.array(_twig)))) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (17,) + inhomogeneous part.

meyerls commented 1 year ago

This error is caused by the mistree library. Please refere to the issue #13

midiexiangxxx commented 1 year ago

This error is caused by the mistree library. Please refere to the issue #13

thanks a lot, it does work!Your code really makes sense!