DepthAI v2 has been superseded by DepthAI v3. You are viewing legacy documentation.
此页面由 AI 自动翻译。查看英文原版

本页目录

  • 输入和输出
  • 节点输入
  • 节点输出

节点

节点是在填充 Pipeline 时使用的构建块。每个节点在 DepthAI 上提供特定的功能、一组可配置的属性以及输入/输出。在管道中创建节点后,您还可以根据需要对其进行配置并将其链接到其他节点。在目录(页面左侧)中,所有节点都列在 Node 条目下。您可以点击它们以了解更多信息。

输入和输出

每个节点可以具有零个、一个或多个输入和输出。例如,SystemLogger 节点没有输入但有 1 个输出,而 EdgeDetector 节点有 2 个输入和 1 个输出(如下图所示)。Script 节点可以具有任意数量的输入/输出。
每个节点的输出都有自己的池;RAM 中的块,用于存储消息。每个节点的输入都有一个消息指针队列(不存储消息本身,只存储指向它的指针)。

节点输入

节点输入队列是消息队列。它可以与其他节点的输出链接(这就是您链接节点的方式)。节点输入是可配置的 - 使用 input.setBlocking(bool)input.setQueueSize(num),例如 edgeDetector.inputImage.setQueueSize(10) 如果输入队列已满,输入行为取决于 blocking 属性。假设我们将 ColorCamera 的 preview 输出链接到 NeuralNetwork 的 input 输入。
如果输入设置为阻塞模式,并且输入队列已满,则来自 ColorCamera 的新消息将无法进入输入队列。这意味着 ColorCamera 将阻塞并等待发送其消息,直到它可以将消息推送到 NeuralNetwork 输入的队列中。如果 ColorCamera 预览连接到 多个输入,则会发生相同的情况,消息将按顺序推送到每个输入。如果禁用了阻塞,新消息将覆盖旧消息。这消除了管道冻结的风险,但可能导致消息丢失(例如 ImgFrame)。

节点输出

节点输出消息。一些节点具有可配置的输出消息池。输出消息池是保留的内存区域(以减少内存碎片),用于保存输出消息。节点创建输出消息(例如 ImgFrame)后,它将按照链接节点输入/输出时指定的将消息发送到其他节点。 目前,一些节点(VideoEncoder、NeuralNetwork、ImageManip、XLinkIn)可以配置池大小。 池的大小指定了在其他消息已在管道中时可以创建和发送多少条消息。
class

depthai.Node

class
Connection
Connection between an Input and Output
class
class
Id
Node identificator. Unique for every node on a single Pipeline
class
class
class
class
variable
method
method
method
method
getName(self) -> str: str
Retrieves nodes name
method
method
method
property
id
Id of node
class

depthai.Node.DatatypeHierarchy

class

depthai.Node.Input

class
Type
Members:    SReceiver    MReceiver
variable
variable
variable
variable
method
getBlocking(self) -> bool: bool
Get input queue behavior  Returns:     True blocking, false overwriting
method
method
getQueueSize(self) -> int: int
Get input queue size.  Returns:     Maximum input queue size
method
getReusePreviousMessage(self) -> bool: bool
Equivalent to getWaitForMessage but with inverted logic.
method
getWaitForMessage(self) -> bool: bool
Get behavior whether to wait for this input when a Node processes certain data or not  Returns:     Whether to wait for message to arrive to this input or not
method
setBlocking(self, blocking: bool)
Overrides default input queue behavior.  Parameter ``blocking``:     True blocking, false overwriting
method
setQueueSize(self, size: typing.SupportsInt)
Overrides default input queue size. If queue size fills up, behavior depends on `blocking` attribute  Parameter ``size``:     Maximum input queue size
method
setReusePreviousMessage(self, reusePreviousMessage: bool)
Equivalent to setWaitForMessage but with inverted logic.
method
setWaitForMessage(self, waitForMessage: bool)
Overrides default wait for message behavior. Applicable for nodes with multiple inputs. Specifies behavior whether to wait for this input when a Node processes certain data or not.  Parameter ``waitForMessage``:     Whether to wait for message to arrive to this input or not
property
method
class

depthai.Node.Output

class
Type
Members:    MSender    SSender
variable
variable
variable
method
canConnect(self, input: Node.Input) -> bool: bool
Check if connection is possible  Parameter ``in``:     Input to connect to  Returns:     True if connection is possible, false otherwise
method
getConnections(self) -> list[Node.Connection]: list[Node.Connection]
Retrieve all connections from this output  Returns:     Vector of connections
method
method
isSamePipeline(self, input: Node.Input) -> bool: bool
Check if this output and given input are on the same pipeline.  See also:     canConnect for checking if connection is possible  Returns:     True if output and input are on the same pipeline
method
method
property
method