Neural Depth 基础示例
Supported on:RVC4
Pipeline
源代码
Python
PythonGitHub
1#!/usr/bin/env python3
2
3import cv2
4import depthai as dai
5
6FPS = 25
7
8# Create pipeline
9with dai.Pipeline() as pipeline:
10 cameraLeft = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B, sensorFps=FPS)
11 cameraRight = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C, sensorFps=FPS)
12 leftOutput = cameraLeft.requestFullResolutionOutput()
13 rightOutput = cameraRight.requestFullResolutionOutput()
14
15 neuralDepth = pipeline.create(dai.node.NeuralDepth).build(leftOutput, rightOutput, dai.DeviceModelZoo.NEURAL_DEPTH_LARGE)
16
17 depthQueue = neuralDepth.depth.createOutputQueue()
18
19 # Connect to device and start pipeline
20 pipeline.start()
21 while pipeline.isRunning():
22 depthData = depthQueue.get()
23 assert isinstance(depthData, dai.ImgFrame)
24 colorizedDepth = dai.utility.colorizeDepthFrame(depthData).getCvFrame()
25 cv2.imshow("depth", colorizedDepth)
26
27 key = cv2.waitKey(1)
28 if key == ord('q'):
29 pipeline.stop()
30 break
31
32 if cv2.waitKey(1) == ord('q'):
33 break需要帮助?
请前往 OAKChina 官网 获取技术支持或解答您的任何疑问。