Seite 1 von 1

Punktwolke als Bild speichern

Verfasst: Mittwoch 8. Juli 2020, 12:26
von DR88
Ich möchte ein .jpg-Bild aus einer Punktwolke aus einer definierten Ansicht erzeugen.

Dazu habe ich den folgenden Code:

Code: Alles auswählen

import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pyntcloud
from pyntcloud import PyntCloud
import open3d as o3d

#Random PoinCloud
#points = np.random.randint(0,10,size=(100,3),dtype=int)
#color = np.random.randint(0,1,size=(100,3),dtype=int)

pcd = o3d.io.read_point_cloud(path_incloud)
color = np.asarray(pcd.colors)
points = np.asarray(pcd.points)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d', elev=45, azim=0)
ax.scatter(xs=points[:,0],ys=points[:,1],zs=points[:,2], s=1, c=color)
plt.show()
fig.savefig("test.jpg")
Was ich bekomme, ist dies
Bild (https://www.bilder-upload.eu/bild-9b198 ... 6.png.html),

was ich erwarte, ist dies Bild (https://www.bilder-upload.eu/bild-274e9 ... 6.png.html)

Was ich nicht verstehe, ist: Warum ist meine Punktwolke komprimiert?

ich habe es auch mit pyntcloud versucht, und das Ergebnis ist dies mit diesem kleinen Code:

Code: Alles auswählen

path_incloud = r"C:\Users\RoosDan\Documents\Python\CropPointCloud\OutputClouds\pcd_format\OutputCloudsUrbanic_39_Stützen_2029610_Points_6460.pcd"
#Read PointCloud from path
cloud = PyntCloud.from_file(path_incloud)
cloud.plot(backend="matplotlib", initial_point_size=5,elev=45, azim=0)
Im Prinzip würde mir eins von beiden helfen:

wie ich die verzerrung aus dem plot in den Griff bekomme

oder

wie ich das Pyntcloudobjekt als Bild abspeichern kann.


Ich bin Anfänger im Programmieren, also wäre ein push in die richtige Richtung großartig.

Danke für eure Hilfe

Gruß
Daniele