Rotieren PointCloud um die Z-Achse in open3d. Error "incompatible function arguments"
Verfasst: Dienstag 2. Juni 2020, 13:58
hallo zusammen,
Ich möchte eine Punktwolke um die Z-Achse drehen und habe dafür die folgende Methode geschrieben:
die Methode wird folgendermaßen aufgerufen:
ich erhalte dabei folgende Fehlermeldung:
Ich verstehe nicht, warum ich eine Fehlermeldung erhalte. Ich übergebe ein Geometrieobjekt. Es hat bisher immer funktioniert und keine Probleme verursacht. Ich weiß nicht, was ich versehentlich geändert habe.
Für Anregungen bin ich dankbar.
Grüsse
Dan
Ich möchte eine Punktwolke um die Z-Achse drehen und habe dafür die folgende Methode geschrieben:
Code: Alles auswählen
def rotate_Geometry(pcd,is_pointcloud=True):
#Rotationsmatrix um die Z-Achse
alpha = m.radians(angle_against_true_north)
#rotation Matrix for Z-Axis
rotationMatrix = [[m.cos(alpha),-m.sin(alpha)],
[m.sin(alpha), m.cos(alpha),0],
[0,0,1]]
print(rotationMatrix)
#Rotate Pointcloud
if is_pointcloud == True:
print("Es wird ein PointCloud()-Objekt verarbeitet")
pcd_rotate = o3d.geometry.PointCloud.rotate(pcd,rotationMatrix,center=True)
return pcd_rotate,angle_against_true_north
#Rotate Points_np.shape()
if is_pointcloud == False:
print("Keine Punktwolke als Input")
Code: Alles auswählen
#Imports
import open3d as o3d
import numpy as np
import pandas as pd
import math as m
# Randam Numpy-Array for testing
x = np.linspace(-3, 3, 401)
mesh_x, mesh_y = np.meshgrid(x, x)
z = np.sinc((np.power(mesh_x, 2) + np.power(mesh_y, 2)))
z_norm = (z - z.min()) / (z.max() - z.min())
xyz = np.zeros((np.size(mesh_x), 3))
xyz[:, 0] = np.reshape(mesh_x, -1)
xyz[:, 1] = np.reshape(mesh_y, -1)
xyz[:, 2] = np.reshape(z_norm, -1)
print('xyz')
print(xyz)
pcd_test = o3d.geometry.PointCloud()
pcd_test.points = o3d.utility.Vector3dVector(xyz)
print(pcd_test)
pcd_rotate, alpha = rotate_Geometry(pcd_test,is_pointcloud=True)
#Save Cropped PointCloud
path_outcloud = ('/gdrive/My Drive/Colab Notebooks/Georeferenzierung/CropPointCloud/PointCloud/pcd_rotate_{}.pcd'.format(alpha))
o3d.io.write_point_cloud(path_outcloud, pcd_rotate)
Code: Alles auswählen
[[0.5417082102827399, -0.8405666034956842], [0.8405666034956842, 0.5417082102827399, 0], [0, 0, 1]]
Es wird ein PointCloud()-Objekt verarbeitet
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-262-a72bd2c346d8> in <module>()
3 pcd_offground = pcd_offground.voxel_down_sample(voxel_size=0.05)
4 #print(pcd_offground)
----> 5 pcd_rotate, alpha = rotate_Geometry(pcd_test,is_pointcloud=True)
6 #Save Cropped PointCloud
7 path_outcloud = ('/gdrive/My Drive/Colab Notebooks/Georeferenzierung/CropPointCloud/PointCloud/pcd_rotate_{}.pcd'.format(alpha))
<ipython-input-244-32aa39b15edc> in rotate_Geometry(pcd, is_pointcloud)
15 if is_pointcloud == True:
16 print("Es wird ein PointCloud()-Objekt verarbeitet")
---> 17 pcd_rotate = o3d.geometry.PointCloud.rotate(pcd,rotationMatrix,center=True)
18
19 return pcd_rotate,angle_against_true_north
TypeError: rotate(): incompatible function arguments. The following argument types are supported:
1. (self: open3d.open3d.geometry.Geometry3D, R: numpy.ndarray[float64[3, 3]], center: bool = True) -> open3d.open3d.geometry.Geometry3D
Invoked with: geometry::PointCloud with 160801 points., [[0.5417082102827399, -0.8405666034956842], [0.8405666034956842, 0.5417082102827399, 0], [0, 0, 1]]; kwargs: center=True
Für Anregungen bin ich dankbar.
Grüsse
Dan