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

Function visualize_voxels

utils/visualize.py:125–146  ·  view source on GitHub ↗

r''' Visualizes voxel data. show only first num_shown

(out_file, voxels, num_shown=16, threshold=0.5)

Source from the content-addressed store, hash-verified

123'''
124
125def visualize_voxels(out_file, voxels, num_shown=16, threshold=0.5):
126 r''' Visualizes voxel data.
127 show only first num_shown
128 '''
129 batch_size =voxels.shape[0]
130 voxels = voxels.squeeze(1) > threshold
131
132 num_shown = min(num_shown, batch_size)
133
134 n = int(np.sqrt(num_shown))
135 fig = plt.figure(figsize=(20,20))
136
137 for idx, pc in enumerate(voxels[:num_shown]):
138 if idx >= n*n:
139 break
140 pc = voxels[idx]
141 ax = fig.add_subplot(n, n, idx + 1, projection='3d')
142 ax.voxels(pc, edgecolor='k', facecolors='green', linewidth=0.1, alpha=0.5)
143 ax.view_init()
144 ax.axis('off')
145 plt.savefig(out_file, bbox_inches='tight')
146 plt.close()
147
148def visualize_pointcloud(points, normals=None,
149 out_file=None, show=False, elev=30, azim=225):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected