# 节点

节点是填充 [Pipeline](https://docs.luxonis.com/software/depthai-components/pipeline.md) 时的基础构建单元。每个节点在 DepthAI
上提供特定功能，并具有一组可配置的属性以及输入/输出。在流水线上创建节点后，您可以根据需要对其进行配置，并将其连接到其他节点。

在目录（页面左侧）中，所有节点都列在 Node 条目下。您可以点击它们以了解更多信息。

## 输入和输出

每个节点可以有零个、一个或多个输入和输出。例如，SystemLogger 节点没有输入，有 1 个输出；EdgeDetector 有 2 个输入和 1 个输出（如下所示）。Script 节点可以有任意数量的输入/输出。

每个节点的输出都有其内存池；即 RAM 中用于存储消息的块。每个节点的输入都有其用于消息指针的队列（不存储消息本身，仅存储指向消息的指针）。

### 节点输入

节点输入队列是用于消息的队列。它可以与其他节点的输出相连接（这就是节点之间的连接方式）。节点输入是可配置的——通过 input.setBlocking(bool) 和 input.setQueueSize(num)，例如
edgeDetector.inputImage.setQueueSize(10)。如果输入队列满了，输入的行为取决于阻塞属性。

假设我们将 ColorCamera 的 preview 输出连接到 NeuralNetwork 的 input 输入。

如果输入设置为阻塞模式，并且输入队列满了，来自 ColorCamera 的新消息将无法进入输入队列。这意味着 ColorCamera 将阻塞并等待，直到它能够将消息推送到 NeuralNetwork 输入的队列中。如果 ColorCamera preview
连接到多个输入，则会依次将消息推送到每个输入。

如果禁用了阻塞，新消息将挤出旧消息。这消除了流水线冻结的风险，但可能导致消息丢弃（例如 ImgFrame）。

### 节点输出

节点输出消息。一些节点具有可配置的输出消息池。输出消息池是预留的内存区域（用于减少内存碎片），用于持有输出消息。节点创建输出消息（例如
ImgFrame）后，它会将消息发送到其他节点（具体取决于节点输入/输出连接时的指定方式）。目前，某些节点（VideoEncoder、NeuralNetwork、ImageManip、XLinkIn）可以配置池大小。池大小指定了当其他消息仍在流水线中时，可以创建和发送多少条消息。

> **流水线冻结**
> 当池中的所有消息都已发送出去，但尚未有消息返回时，节点将阻塞（冻结）并等待，直到某个消息被释放（流水线中没有任何节点使用它）。

### depthai.Node

Kind: Class

Abstract Node

#### depthai.Node.Connection

Kind: Class

Connection between an Input and Output

##### inputGroup: str

Kind: Class Variable

##### inputName: str

Kind: Class Variable

##### outputGroup: str

Kind: Class Variable

##### outputName: str

Kind: Class Variable

##### inputId

Kind: Property

##### inputId.setter(self, arg0: typing.SupportsInt)

Kind: Method

##### outputId

Kind: Property

##### outputId.setter(self, arg0: typing.SupportsInt)

Kind: Method

#### depthai.Node.DatatypeHierarchy

Kind: Class

##### datatype: DatatypeEnum

Kind: Class Variable

##### descendants: bool

Kind: Class Variable

##### __init__(self, arg0: DatatypeEnum, arg1: bool)

Kind: Method

#### depthai.Node.Id

Kind: Class

Node identificator. Unique for every node on a single Pipeline

#### depthai.Node.Input

Kind: Class

##### depthai.Node.Input.Type

Kind: Class

Members:

SReceiver

MReceiver

###### MReceiver: typing.ClassVar[Node.Input.Type]

Kind: Class Variable

###### SReceiver: typing.ClassVar[Node.Input.Type]

Kind: Class Variable

###### __members__: typing.ClassVar[dict[str, Node.Input.Type]]

Kind: Class Variable

###### __eq__(self, other: typing.Any) -> bool: bool

Kind: Method

###### __getstate__(self) -> int: int

Kind: Method

###### __hash__(self) -> int: int

Kind: Method

###### __index__(self) -> int: int

Kind: Method

###### __init__(self, value: typing.SupportsInt)

Kind: Method

###### __int__(self) -> int: int

Kind: Method

###### __ne__(self, other: typing.Any) -> bool: bool

Kind: Method

###### __repr__(self) -> str: str

Kind: Method

###### __setstate__(self, state: typing.SupportsInt)

Kind: Method

###### __str__(self) -> str: str

Kind: Method

###### name

Kind: Property

###### value

Kind: Property

##### group: str

Kind: Class Variable

##### name: str

Kind: Class Variable

##### type: Node.Input.Type

Kind: Class Variable

##### waitForMessage: bool|None

Kind: Class Variable

##### getBlocking(self) -> bool: bool

Kind: Method

Get input queue behavior

Returns:
True blocking, false overwriting

##### getParent()

Kind: Method

##### getQueueSize(self) -> int: int

Kind: Method

Get input queue size.

Returns:
Maximum input queue size

##### getReusePreviousMessage(self) -> bool: bool

Kind: Method

Equivalent to getWaitForMessage but with inverted logic.

##### getWaitForMessage(self) -> bool: bool

Kind: Method

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

##### setBlocking(self, blocking: bool)

Kind: Method

Overrides default input queue behavior.

Parameter ``blocking``:
True blocking, false overwriting

##### setQueueSize(self, size: typing.SupportsInt)

Kind: Method

Overrides default input queue size. If queue size fills up, behavior depends on
`blocking` attribute

Parameter ``size``:
Maximum input queue size

##### setReusePreviousMessage(self, reusePreviousMessage: bool)

Kind: Method

Equivalent to setWaitForMessage but with inverted logic.

##### setWaitForMessage(self, waitForMessage: bool)

Kind: Method

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

##### possibleDatatypes

Kind: Property

##### possibleDatatypes.setter(self, arg0: collections.abc.Sequence [ Node.DatatypeHierarchy ])

Kind: Method

#### depthai.Node.InputMap

Kind: Class

##### __bool__(self) -> bool: bool

Kind: Method

Check whether the map is nonempty

##### __contains__(self, arg0: str) -> bool: bool

Kind: Method

##### __delitem__(self, arg0: str)

Kind: Method

##### __getitem__(self, arg0: str) -> Node.Input: Node.Input

Kind: Method

##### __iter__(self) -> collections.abc.Iterator[str]: collections.abc.Iterator[str]

Kind: Method

##### __len__(self) -> int: int

Kind: Method

##### __setitem__(self, arg0: str, arg1: Node.Input)

Kind: Method

##### items(self) -> collections.abc.Iterator[tuple[str, Node.Input]]: collections.abc.Iterator[tuple[str, Node.Input]]

Kind: Method

#### depthai.Node.Output

Kind: Class

##### depthai.Node.Output.Type

Kind: Class

Members:

MSender

SSender

###### MSender: typing.ClassVar[Node.Output.Type]

Kind: Class Variable

###### SSender: typing.ClassVar[Node.Output.Type]

Kind: Class Variable

###### __members__: typing.ClassVar[dict[str, Node.Output.Type]]

Kind: Class Variable

###### __eq__(self, other: typing.Any) -> bool: bool

Kind: Method

###### __getstate__(self) -> int: int

Kind: Method

###### __hash__(self) -> int: int

Kind: Method

###### __index__(self) -> int: int

Kind: Method

###### __init__(self, value: typing.SupportsInt)

Kind: Method

###### __int__(self) -> int: int

Kind: Method

###### __ne__(self, other: typing.Any) -> bool: bool

Kind: Method

###### __repr__(self) -> str: str

Kind: Method

###### __setstate__(self, state: typing.SupportsInt)

Kind: Method

###### __str__(self) -> str: str

Kind: Method

###### name

Kind: Property

###### value

Kind: Property

##### group: str

Kind: Class Variable

##### name: str

Kind: Class Variable

##### type: Node.Output.Type

Kind: Class Variable

##### canConnect(self, input: Node.Input) -> bool: bool

Kind: Method

Check if connection is possible

Parameter ``in``:
Input to connect to

Returns:
True if connection is possible, false otherwise

##### getConnections(self) -> list[Node.Connection]: list[Node.Connection]

Kind: Method

Retrieve all connections from this output

Returns:
Vector of connections

##### getParent()

Kind: Method

##### isSamePipeline(self, input: Node.Input) -> bool: bool

Kind: Method

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

##### link(self, input: Node.Input)

Kind: Method

Link current output to input.

Throws an error if this output cannot be linked to given input, or if they are
already linked

Parameter ``in``:
Input to link to

##### unlink(self, input: Node.Input)

Kind: Method

Unlink a previously linked connection

Throws an error if not linked.

Parameter ``in``:
Input from which to unlink from

##### possibleDatatypes

Kind: Property

##### possibleDatatypes.setter(self, arg0: collections.abc.Sequence [ Node.DatatypeHierarchy ])

Kind: Method

#### depthai.Node.OutputMap

Kind: Class

##### __bool__(self) -> bool: bool

Kind: Method

Check whether the map is nonempty

##### __contains__(self, arg0: str) -> bool: bool

Kind: Method

##### __delitem__(self, arg0: str)

Kind: Method

##### __getitem__(self, arg0: str) -> Node.Output: Node.Output

Kind: Method

##### __iter__(self) -> collections.abc.Iterator[str]: collections.abc.Iterator[str]

Kind: Method

##### __len__(self) -> int: int

Kind: Method

##### __setitem__(self, arg0: str, arg1: Node.Output)

Kind: Method

##### items(self) -> collections.abc.Iterator[tuple[str, Node.Output]]: collections.abc.Iterator[tuple[str, Node.Output]]

Kind: Method

#### properties: Properties

Kind: Class Variable

#### getAssetManager()

Kind: Method

#### getInputRefs()

Kind: Method

#### getInputs(self) -> list[Node.Input]: list[Node.Input]

Kind: Method

Retrieves all nodes inputs

#### getName(self) -> str: str

Kind: Method

Retrieves nodes name

#### getOutputRefs()

Kind: Method

#### getOutputs(self) -> list[Node.Output]: list[Node.Output]

Kind: Method

Retrieves all nodes outputs

#### getParentPipeline()

Kind: Method

#### id

Kind: Property

Id of node
