MCPcopy Create free account
hub / github.com/Zhiyuan-R/Tiger-Diffusion / visualize_pointcloud

Function visualize_pointcloud

utils/visualize.py:148–178  ·  view source on GitHub ↗

r''' Visualizes point cloud data. Args: points (tensor): point data normals (tensor): normal data (if existing) out_file (string): output file show (bool): whether the plot should be shown

(points, normals=None,
                         out_file=None, show=False, elev=30, azim=225)

Source from the content-addressed store, hash-verified

146 plt.close()
147
148def visualize_pointcloud(points, normals=None,
149 out_file=None, show=False, elev=30, azim=225):
150 r''' Visualizes point cloud data.
151 Args:
152 points (tensor): point data
153 normals (tensor): normal data (if existing)
154 out_file (string): output file
155 show (bool): whether the plot should be shown
156 '''
157 # Create plot
158 fig = plt.figure()
159 ax = fig.gca(projection=Axes3D.name)
160 ax.scatter(points[:, 2], points[:, 0], points[:, 1])
161 if normals is not None:
162 ax.quiver(
163 points[:, 2], points[:, 0], points[:, 1],
164 normals[:, 2], normals[:, 0], normals[:, 1],
165 length=0.1, color='k'
166 )
167 ax.set_xlabel('Z')
168 ax.set_ylabel('X')
169 ax.set_zlabel('Y')
170 # ax.set_xlim(-0.5, 0.5)
171 # ax.set_ylim(-0.5, 0.5)
172 # ax.set_zlim(-0.5, 0.5)
173 ax.view_init(elev=elev, azim=azim)
174 if out_file is not None:
175 plt.savefig(out_file)
176 if show:
177 plt.show()
178 plt.close(fig)
179
180
181def visualize_pointcloud_batch(path, pointclouds, pred_labels, labels, categories, vis_label=False, target=None, elev=30, azim=225):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected