Open3D-Python (70%)

Jupyter ๋ฒ„์ ผ์€ [์ด๊ณณ]์—์„œ ํ™•์ธ ๊ฐ€๋Šฅ ํ•ฉ๋‹ˆ๋‹ค.

1. ์ฝ๊ธฐ

import open3d
import numpy as np


#PCD ํŒŒ์ผ ์ฝ๊ธฐ
pc = open3d.read_point_cloud("./sample/lobby.pcd") 
print(pc)

#txt ํŒŒ์ผ ์ฝ๊ธฐ
open3d.read_point_cloud("./sample/open3d_xyz.txt", format='xyz')

2. ์ƒ์„ฑ

import open3d
import numpy as np

pc_array = np.array([[1, 2, 3], [3, 4, 5]], dtype=np.float32)
print(pc_array)

pc = open3d.PointCloud()
pc.points = open3d.Vector3dVector(pc_array)
print(pc)

3. ์“ฐ๊ธฐ

์ง€์› ํ•˜๋Š” ํ™•์žฅ์ž : pcd, ply, xyz, xyzrgb, xyzn, pts

import open3d

open3d.write_point_cloud("pc2pcd.pcd", pc)

4. ๋ณ€ํ™˜

import open3d
import numpy as np

# Open3D to numpy
pcd_load = read_point_cloud("../../TestData/sync.pcd")
pc_array = np.asarray(pcd_load.points)
print("pc Type : {}".format(type(pc)))
print("pc_array Type : {}".format(type(pc_array)))

# numpy to Open3D
pc_new = open3d.PointCloud()
pc_new.points = open3d.Vector3dVector(pc_array)
open3d.write_point_cloud("pc2pcd.pcd", pc_new)

5. ์ •๋ณด ์ถœ๋ ฅ

import open3d
import numpy as np

print("ํฌ์ธํŠธ ์ˆ˜ : {}".format(pc.dimension))


#print ('Loaded ' + str(pc.width * pc.height) + ' data points from test_pcd.pcd with the following fields: ')

for i in range(0, 10):
    print ('x: ' + str(pc.points[i][0]) + ', y : ' + str(pc.points[i][1]) + ', z : ' + str(pc.points[i][2]))

Last updated

Was this helpful?