Sfm-python
Sfm-python copied to clipboard
fig_v2报错
fig_v2显示带颜色的,color参数会报错 traits.trait_errors.TraitError: The 'color' trait of a GlyphFactory instance must be a tuple of the form: (0.0 <= a floating point number <= 1.0, 0.0 <= a floating point number <= 1.0, 0.0 <= a floating point number <= 1.0) or None, but a value of array([ 75., 101., 87.]) <class 'numpy.ndarray'> was specified.
color参数要0-1之间的,点云颜色RGB是0-255, 我试着color/255归一化了,发现并不能解决问题
发现问题了,color/255归一化后应该是可以的,可能是我这边点云比较大,会导致绘制很慢 卡死的状态
先归一化再转元组格式,跑一个小点云5GB内存都没加载出来... `
def fig_v2(structure, colors):
colors = colors / 255
colors = colors.tolist()
for i in range(len(structure)):
rgb = tuple(colors[i])
mlab.points3d(structure[i][0], structure[i][1], structure[i][2], mode = 'point', name = 'dinosaur', color = rgb)
mlab.show()
`