3D点云数据显示

3D点云数据显示

效果: 卡顿现象严重,初步显示还行,后期需要寻找其他显示方法
3D点云数据显示_第1张图片

代码:

  import numpy as np 
import matplotlib.pyplot as plt 
from mpl_toolkits.mplot3d import Axes3D
#f=open('point cloud.txt','r')
f=open('11D-zhongxin1-1_RawXYZ_ds_part2.xyz','r')
point=f.read()
f.close()
l1=point.replace('\n',',')
l2=l1.split(',')
#l2.pop()
#print(l2)
m1=np.array(l2[0:332199])
print(len(m1))
#m2=m1.reshape(265565,4)
m2=m1.reshape(110733,3)
print(m2)
m3=[]
for each in m2:
    each_line=list(map(lambda x:float(x),each))
    m3.append(each_line)
m4=np.array(m3)

x=[k[0] for k in m4]
y=[k[1] for k in m4]
z=[k[2] for k in m4]

fig=plt.figure(dpi=120)
ax=fig.add_subplot(111,projection='3d')
plt.title('point cloud')
ax.scatter(x,y,z,c='b',marker='.',s=2,linewidth=0,alpha=1,cmap='spectral')

#ax.set_facecolor((0,0,0))
ax.axis('scaled')          
# ax.xaxis.set_visible(False) 
# ax.yaxis.set_visible(False) 
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
plt.show()

点云数据:

0.71651727,5.81041193,1.157984872
0.712994099,5.765273571,1.361158152
0.71873486,5.803377628,1.586890478
0.729124129,5.771611691,0.941398997
0.731586754,5.774893284,1.151497383
0.732845306,5.768677235,1.362507839
0.737975597,5.800961971,1.586890478
0.747097671,5.78394556,0.325641979
0.748235166,5.753229618,0.938896019
0.753261685,5.783985615,1.153787036
0.754743636,5.779610157,1.365657229
0.753474653,5.762059689,-0.081433389
0.75873059,5.794387341,1.585855265
0.76496172,5.771536827,0.32511862
0.766681135,5.769048214,0.529163857
0.770667493,5.768204689,0.941711862
0.775008976,5.792996407,1.156076808
0.774654567,5.775008678,1.365207334
0.774115801,5.763358116,-0.081503193
0.775369585,5.772693157,1.58067884
0.781552017,5.750246048,0.121293765
0.786450148,5.778726578,0.325641979
0.78735292,5.77028513,0.529512484
0.792139709,5.775264263,0.943276186
0.79327637,5.783551216,-0.490732651
0.791485846,5.763025761,1.150734086
0.795074224,5.774199963,1.365657229
0.796306908,5.775692463,1.582231779
0.801895559,5.749463558,0.121328671
0.807624936,5.775804996,0.325641979
0.808595181,5.775393963,0.530209739
0.80957377,5.767720699,0.735129316
0.809637308,5.760869026,0.941398997
0.8129673,5.769948006,1.15264215
0.815497637,5.773319244,1.366107125
0.816012621,5.769693375,-0.081712622
0.817470491,5.772735119,1.582231779
0.823092639,5.754547596,0.121468287
0.826490641,5.771118164,0.325537313
0.827900767,5.766619682,0.529686768
0.831115901,5.774683952,0.736347992
0.831592798,5.763728142,0.942337592
0.834787428,5.77873373,1.154931922
0.829687476,5.736354828,-0.283757876
0.833969593,5.758865833,1.36340775
0.834999859,5.758893967,-0.081573005
0.837616146,5.769846439,1.582231779
0.842014551,5.7437253,0.121328671
0.846050501,5.764245987,0.325327982
0.847154915,5.757781029,0.529163857
0.855323315,5.799241543,0.739760358
0.8501243,5.757030487,0.941711862
0.854666412,5.773842335,1.154550333
0.849998832,5.735399246,-0.283862572
0.855782807,5.767485142,1.366107125
0.855097055,5.755944252,-0.081573005
0.856898904,5.761155128,1.58067884
0.860573947,5.730863571,0.121154149
0.868244886,5.775083065,0.326060672
0.869029522,5.766609669,0.530209739
0.800718427,5.307032585,-0.830064874
0.870817244,5.764815331,0.735860546
0.872282624,5.767700195,0.943901975
0.871563792,5.756152153,-0.48933814
0.873932898,5.76500082,1.153405447
0.869114876,5.726473331,-0.283548545
0.877959132,5.777949333,1.369256396
0.876086116,5.758854866,-0.081677723
0.878167391,5.765768051,1.582749386
0.885434866,5.759448051,0.121712622
0.887486875,5.766094685,0.325746645
0.890064776,5.769448757,0.530732651
0.821650743,5.319823265,-0.832567852
0.892148256,5.769587517,0.736835499
0.89361918,5.772428513,0.945153434
0.895255268,5.769675255,1.154931922
0.889711857,5.727352142,-0.283757876
0.898122609,5.774849415,1.369256396
0.895259976,5.749834061,-0.081573005
0.900254667,5.781912804,1.587925811
0.905222952,5.754346848,0.121677723
0.905123174,5.747178078,0.324909289
0.912994325,5.784018517,0.532301445
0.841757059,5.326678276,-0.834132175
0.914143622,5.778202534,0.738297899
0.914531052,5.774121761,-0.697810452
0.913763225,5.769274235,0.945153434
0.915697575,5.768454075,1.155313511
0.912519872,5.741963863,-0.284699928
0.915519357,5.754358292,1.365207334
0.916268826,5.752598286,-0.081677723
0.921440363,5.778574467,1.587925811
0.927209735,5.762998104,0.121887152
0.925227702,5.737906933,0.324595262
0.933178782,5.780796528,0.532301445
0.857194066,5.304206848,-0.831003468
0.933990717,5.77301693,0.738054175
0.934046149,5.766974926,-0.697322946
0.932948709,5.760199547,0.94421484
0.934982061,5.766376495,-0.491081278
0.93740046,5.77491188,1.157221575
0.918782234,5.653973579,-0.280199032
0.93622607,5.754974365,1.366107125
0.935379267,5.743443966,-0.081573005
0.939666152,5.769766808,1.586372871
0.946671605,5.755779743,0.12181734
0.949149013,5.758290291,0.32585134
0.951405585,5.765708923,0.531255562
0.872162521,5.279743671,-0.827561955
0.955108225,5.775597095,0.738785405
0.952225626,5.751928806,-0.695860546
0.955023587,5.762587547,0.945153434
0.951195776,5.739490986,-0.488989513
0.958838224,5.779351711,1.15874805
0.942766726,5.676345348,-0.281559776
0.957907081,5.761283398,1.368356605
0.956735194,5.748034,-0.081712622
0.960807085,5.766283989,1.586372871
0.966757298,5.752440453,0.12181734
0.971233666,5.766759396,0.326479365
0.973844528,5.776105404,0.532475789
0.973940194,5.764398575,0.737810452
0.97494626,5.764228344,-0.697810452
0.975774884,5.769127846,0.946717758
0.973552823,5.749886513,-0.490209739
0.973428667,5.74306345,1.152260561
0.97493726,5.745877266,-0.285432647
0.981275201,5.777116776,1.372855682
0.969754398,5.703259945,-0.080979626
0.979923546,5.763065815,1.586372871
0.986831129,5.74903059,0.12181734
0.988987446,5.749555588,0.325746645
0.993324757,5.768743992,0.532127161
0.90698725,5.261846542,-0.825684707
0.994055748,5.76096344,0.737810452
0.994385421,5.756877899,-0.697322946
0.997922957,5.771351814,0.947656353
0.996672928,5.764122486,-0.491778533
0.996483326,5.757040977,1.1556951
0.993965209,5.736535072,-0.28511862
1.000436068,5.767895699,1.371505876
0.993419528,5.721512794,-0.081363577
1.002693653,5.76895237,1.588961024
1.007643342,5.761660576,0.12209658
1.006700516,5.744452953,0.325641979
1.012819886,5.773444653,0.532824416
0.928979933,5.290100574,-0.830690603
1.013867855,5.767587662,0.739029129
1.010402083,5.741994858,-0.695860546
1.008195639,5.729455948,0.941398997
1.010974526,5.739378929,-0.489861112
1.016269207,5.763549328,1.157603283
1.012676477,5.737318039,-0.285327982
1.020585775,5.776238441,1.37420537
1.015916824,5.743962288,-0.08181734
1.022161245,5.779268265,1.59258451
0.585650623,3.28450346,-0.873960953
0.947788656,5.288770199,-0.831003468
1.032544374,5.750156403,-0.697322946
1.031355023,5.737776279,-0.490035396
1.038467526,5.771560192,1.159892936
1.037976384,5.75729847,1.370606084
1.041962743,5.767878532,1.590513964
0.594100893,3.259423971,-0.867749314
1.026513457,5.615107536,0.319152315
0.970580399,5.29869318,-0.833193581
1.053519487,5.728912354,1.152260561
1.059721947,5.751353741,1.370156188
1.062395334,5.760221481,1.589478631
0.60759306,3.268726349,-0.870855134
1.016093373,5.450488567,0.310569216
0.990521193,5.303040028,-0.83444504
1.005127311,5.360500813,1.080134768
1.081590533,5.75719595,1.372405787
1.084572554,5.761984348,1.59103157
0.620731175,3.281986952,-0.874996285
1.010507703,5.327570915,0.304184247
1.010086298,5.320277691,0.493778605
1.002750754,5.276614666,-0.830690603
1.008608103,5.302391052,0.682725508
1.010134578,5.305371761,0.875383635
1.020491362,5.349602699,1.078608294
1.056504488,5.527906418,1.319317241
1.014106035,5.301048756,-0.074208091
1.104204774,5.772023201,1.594655056
0.628527284,3.260830879,-0.86981986
1.023189306,5.303376198,0.114277896
1.02113831,5.282831192,0.301986117
1.027137518,5.308895111,0.49308138
1.023416877,5.284718037,-0.832567852
1.02484417,5.287145138,0.681263049
1.028035522,5.298658371,-0.642725508
1.027895212,5.297935009,0.874757905
1.031603217,5.31208849,-0.453430008
1.039158702,5.346007824,1.078608294
1.029498935,5.291382313,-0.262509506
1.049718738,5.390288353,1.287824173
1.03107357,5.289625645,-0.074068468
1.125824571,5.775718212,1.596725602
0.63990587,3.258616924,-0.86981986

你可能感兴趣的:(Pointnet)