将输出的h5文件中的车辆模型显示出来基于mayavi

链接:车辆的h5文件

结果是Im2Avatar里生成的shape文件,还没有进行color训练。

import numpy as np
from mayavi.mlab import quiver3d, draw
from mayavi import mlab
import h5py
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string('img', '', '''''')
tf.app.flags.DEFINE_string('mode', 'cube', '''''')
tf.app.flags.DEFINE_float('thresh', '0.6', '''''')
path_shape = 'F:/output_shape/02958343/9aec898631a69b6b5da1f915cad9a74/1.047.h5'
with h5py.File(path_shape, 'r') as f:
	voxel = f['data'][:].reshape(64, 64, 64)
for i in range(64):
	for j in range(64):
		for k in range(64):
			if voxel[i, j, k] >= FLAGS.thresh:
				voxel[i, j, k] = 1
			else:
				voxel[i, j, k] = 0
x, y, z = np.where(voxel == 1)
xx = np.ones(len(x))
yy = np.zeros(len(x))
zz = np.zeros(len(x))
scalars = np.arange(len(x)) 
pts = quiver3d(x, y, z, xx, yy, zz, scalars=scalars, mode=FLAGS.mode)
mlab.show()

猜你喜欢

转载自blog.csdn.net/baidu_36669549/article/details/81001961