1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #20471 from ibvfteh:pointcloudio

GSoC module to save and load point cloud

* Add functionality to read point cloud data from files

* address issues found on review, add tests for mesh, refactor

* enable fail-safe execution and empty arrays as output

* Some improvements for point cloud io module

Co-authored-by: Julie Bareeva <julia.bareeva@xperience.ai>
This commit is contained in:
Klepikov Dmitrii
2022-05-13 21:10:39 +03:00
committed by GitHub
parent 6bffbe4938
commit a99b4071a2
19 changed files with 1113 additions and 12 deletions
+23
View File
@@ -0,0 +1,23 @@
import numpy as np
import cv2 as cv
vertices, _ = cv.loadPointCloud("../data/teapot.obj")
vertices = np.squeeze(vertices, axis=1)
print(vertices)
color = [1.0, 1.0, 0.0]
colors = np.tile(color, (vertices.shape[0], 1))
obj_pts = np.concatenate((vertices, colors), axis=1)
obj_pts= np.float32(obj_pts)
cv.viz3d.showPoints("window", "points", obj_pts)
cv.viz3d.setGridVisible("window", True)
cv.waitKey(0)
vertices, _, indices = cv.loadMesh("../data/teapot.obj")
vertices = np.squeeze(vertices, axis=1)
cv.viz3d.showMesh("window", "mesh", vertices, indices)
cv.waitKey(0)