Skip to content

Commit

Permalink
Merge pull request #1048 from luxonis/fix/pointcloud_example
Browse files Browse the repository at this point in the history
Add time.sleep to pointcloud example
  • Loading branch information
daniilpastukhov authored Jun 7, 2023
2 parents a001a2a + aac4b7a commit 32d80f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion depthai_sdk/examples/PointcloudComponent/pointcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
from depthai_sdk.classes.packets import PointcloudPacket, FramePacket
import rerun as rr
import subprocess
import time

subprocess.Popen(["rerun", "--memory-limit", "200MB"])
time.sleep(1) # Wait til rerun spins up
rr.init("Rerun ", spawn=False)
rr.connect()

def callback(packet: PointcloudPacket):
colors = packet.color_frame.getCvFrame()[..., ::-1] # BGR to RGB
rr.log_image('Color Image', colors)
points = packet.points.reshape(-1, 3)
rr.log_points("Pointcloud", points, colors=colors.reshape(-1, 3))


with OakCamera() as oak:
pcl = oak.create_pointcloud()
oak.callback(pcl, callback=callback)
oak.start(blocking=True)
oak.start(blocking=True)

0 comments on commit 32d80f5

Please sign in to comment.