Sfm-python icon indicating copy to clipboard operation
Sfm-python copied to clipboard

fig_v2报错

Open oulton opened this issue 3 years ago • 2 comments

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归一化了,发现并不能解决问题

oulton avatar Oct 09 '21 09:10 oulton

发现问题了,color/255归一化后应该是可以的,可能是我这边点云比较大,会导致绘制很慢 卡死的状态

oulton avatar Oct 10 '21 10:10 oulton

先归一化再转元组格式,跑一个小点云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()

`

pilipala818 avatar Aug 31 '22 11:08 pilipala818