r''' Visualizes voxel data. show only first num_shown
(out_file, voxels, num_shown=16, threshold=0.5)
| 123 | ''' |
| 124 | |
| 125 | def 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 | |
| 148 | def visualize_pointcloud(points, normals=None, |
| 149 | out_file=None, show=False, elev=30, azim=225): |
nothing calls this directly
no outgoing calls
no test coverage detected