如何放置它
Python
Python
1import depthai as dai
2
3with dai.Pipeline() as pipeline:
4 rgbd = pipeline.create(dai.node.RGBD)
5 # 将 color 和 depth 的输出链接到 RGBD 的输入
6 color.out.link(rgbd.inColor)
7 depth.out.link(rgbd.inDepth)
8
9 # 或者使用 autocreate
10 rgbd = pipeline.create(dai.node.RGBD).build(
11 autocreate=True,
12 presetMode=dai.StereoDepth.PresetMode.DEFAULT,
13 size=(640, 400)
14 )
15 pipeline.start()输入和输出
配置
build()/build(autocreate, presetMode, size)- 创建节点,可以选择自动创建 color/depth 节点,选择StereoDepth::PresetMode,并指定帧大小为(width, height)。setDepthUnit(depthUnit)- 通过StereoDepthConfig::AlgorithmControl::DepthUnit选择用于转换的深度单位(例如,毫米或米)。useCPU()- 强制单线程 CPU 处理(默认)。useCPUMT(numThreads)- 启用多线程 CPU 处理,指定numThreads(默认:2)。useGPU(device)- 将处理卸载到 GPU(需要 Kompute 支持),可以选择指定 GPU 设备索引。printDevices()- 打印可用的 GPU 设备和功能。
用法
Python
1with dai.Pipeline() as p:
2 qPcl = rgbd.pcl.createOutputQueue()
3 qRgbd = rgbd.rgbd.createOutputQueue()
4 pipeline.start()
5 pipeline.start()
6 pclData = qPcl.get() # type: dai.PointCloudData
7 rgbdData = qRgbd.get() # type: dai.RGBDData功能示例
参考
class
dai::node::RGBD
variable
Subnode< node::Sync > sync
variable
InputMap & inputs
variable
std::string colorInputName
variable
std::string depthInputName
variable
Input & inColor
variable
Input & inDepth
variable
Output pcl
Output point cloud.
variable
Output rgbd
function
RGBD()function
~RGBD()function
std::shared_ptr< RGBD > build()function
std::shared_ptr< RGBD > build(bool autocreate, StereoDepth::PresetMode mode, std::pair< int, int > frameSize, std::optional< float > fps)function
std::shared_ptr< RGBD > build(const std::shared_ptr< Camera > & camera, const DepthSource & depthSource, std::pair< int, int > frameSize, std::optional< float > fps)function
void setDepthUnit(StereoDepthConfig::AlgorithmControl::DepthUnit depthUnit)function
void useCPU()function
void useCPUMT(uint32_t numThreads)function
void useGPU(uint32_t device)function
void printDevices()function
void buildInternal()需要帮助?
请前往 Discussion Forum 获取技术支持或提出您可能有的任何其他问题。