首页 > 编程知识 正文

点云数据怎么转成模型,螺旋桨三维坐标转换

时间:2023-05-05 05:53:57 阅读:174170 作者:1623

重要步骤:

1 .首先,读入. txt文本数据,进行一系列字符串处理,由此提取显示所需的相关数据矩阵

2 .然后利用python的matplotlib库进行动态的三维显示

备注: matplotlib在显示二维数据可视化方面具有绝对优势,但在三维点云显示方面存在很多问题。 首先一个是显示几千几万个以上或者更多的三维点的时候,电脑的CPU明显跟不上,电脑的显示明显是纸箱化的,需要显示更多的点的时候,用python的另一个GPU渲染的演唱会

导入编号为NP

导入匹配

import matplotlib.pyplot as plt

from mpl _ toolkits.MP lot3dimportaxes 3d

frommatplotlib.animationimportfuncanimation

f=open(data.txt,) r ) )

point=f.read ()

f.close () )

L1=point.replace('n ',',')

l2=l1.replace (',',') )。

l3=l2.split (,) )

#print(L3 )

m1=NP.Array(L3 ) ) )

m2=m1.reshape (2664,6 ) ) ) ) ) ) ) ) m2 ) ) ) ) m2 ) ) ) m1.reshape (2664,6 )。

m3=[]

for each in m2:

each _ line=list (map (lambdax : float (x ),each ) )

m3.append(each_line ) )。

m4=NP.Array(m3 ) )。

打印(M4 )。

yaw=[i[0] for i in m4]

pitch=[i[1] for i in m4]

radius=[i[2] for i in m4]

c1=[i[3:6] for i in m4]

C2=NP.Array(C1 )

C3=C2.reshape (2664,3 ) ) ) ) ) ) ) ) ) ) C3=C2.reshape (2664,3 ) ) ) ) ) ) ) ) ) ) C3 ) ) ) ) ) C3 ) ) ) ) C4 ) C4 ) C4 ) C4 ) C4 )

是打印(C3 )

x=[]

y=[]

z=[]

forIinrange(Len ) m4 ) ) :

x.append (radius [ I ] * math.sin (0.0174532924 * pitch [ I ] ) () ) ) )。

y.append(radius[I]*math.cos ) 0.0174532924*pitch[I] )

z.append (radius [ I ] * math.sin (0.0174532924 * pitch [ I ] ) () ) ) )。

#我是#print(x )

#我是#print(y )

#我是#print(z )

自订动画(: )

返回点

定义(:

返回点

fig=PLT.figure (fig size=(16,9 ),dpi=120 ) ) ) ) ) )。

ax=fig.add_subplot(111,projection='3d ' )

PLT.title('point ' ) )。

ax.set_xlabel('xlabel ' ) ) ) ) ) ) ) ) ) ) )。

ax.set_ylabel(zlabel ) )。

ax.set_zlabel(ylabel ) )。

anim=funcanimation(fig,animate,frames=NP.arange(100 ),init_func=init,

interval=100,blit=True )

forIinrange(2664 ) :

point=ax.Scatter(z[I],x[i],y[i],c=(C3[I]/255 ),marker='.',s=10,linewidth=1,alpha=1

plt.ion () )

PLT.Pause(0.01 ) )。

plt.close

plt.show () )

如果数据点未着色,则为:

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。