Skip to content

Instantly share code, notes, and snippets.

@n1ckfg
Created April 16, 2023 16:07
Show Gist options
  • Select an option

  • Save n1ckfg/889ba461fc44c2a409217846fc9c8702 to your computer and use it in GitHub Desktop.

Select an option

Save n1ckfg/889ba461fc44c2a409217846fc9c8702 to your computer and use it in GitHub Desktop.
import numpy as np
import open3d as o3d
rgb = o3d.io.read_image("rgb_image.jpg")
depth = o3d.io.read_image("depth_image.png")
#intrinsics = o3d.io.read_pinhole_camera_intrinsic("intrinsics.json")
intrinsics = o3d.camera.PinholeCameraIntrinsic(640, 480, fx=525.0, fy=525.0, cx=319.5, cy=239.5)
rgbd = o3d.geometry.RGBDImage.create_from_color_and_depth(rgb, depth)
pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd, intrinsics)
o3d.io.write_point_cloud("output.ply", pcd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment