Skip to content

Commit

Permalink
azure kinect example
Browse files Browse the repository at this point in the history
  • Loading branch information
neka-nat committed Oct 10, 2020
1 parent 2afe328 commit bc36bbb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: neka-nat
45 changes: 45 additions & 0 deletions examples/python/azure_kinect/azure_kinect_pcd_viewer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import numpy as np
import pyk4a
from pyk4a import Config, PyK4A
import cupoch as cph

def main():
k4a = PyK4A(
Config(
color_resolution=pyk4a.ColorResolution.RES_720P,
depth_mode=pyk4a.DepthMode.NFOV_UNBINNED,
synchronized_images_only=True,
)
)
k4a.start()

# getters and setters directly get and set on device
k4a.whitebalance = 4500
assert k4a.whitebalance == 4500
k4a.whitebalance = 4510
assert k4a.whitebalance == 4510

vis = cph.visualization.Visualizer()
vis.create_window()
pcd = cph.geometry.PointCloud()
frame_count = 0
while True:
capture = k4a.get_capture()
if not np.any(capture.depth) or not np.any(capture.color):
break
points = capture.depth_point_cloud.reshape((-1, 3))
colors = capture.transformed_color[..., (2, 1, 0)].reshape((-1, 3)) / 255
pcd.points = cph.utility.Vector3fVector(points)
pcd.colors = cph.utility.Vector3fVector(colors)

if frame_count == 0:
vis.add_geometry(pcd)

vis.update_geometry(pcd)
vis.poll_events()
vis.update_renderer()
frame_count += 1
k4a.stop()

if __name__ == "__main__":
main()

0 comments on commit bc36bbb

Please sign in to comment.