# Pipeline

Pipeline is a collection of [Nodes](https://docs.luxonis.com/software/depthai-components/nodes.md) and links between them. This
flow provides an extensive flexibility that users get for their OAK device. When pipeline object is passed to the
[Device](https://docs.luxonis.com/software/depthai-components/device.md) object, pipeline gets serialized to JSON and sent to the
OAK device via XLink.

## Pipeline first steps

To get DepthAI up and running, you have to create a pipeline, populate it with nodes, configure the nodes and link them together.
After that, the pipeline can be loaded onto the [Device](https://docs.luxonis.com/software/depthai-components/device.md) and be
started.

```python
pipeline = depthai.pipeline()

# If required, specify OpenVINO version
pipeline.setOpenVINOVersion(depthai.OpenVINO.Version.VERSION_2021_4)

# Create nodes, configure them and link them together

# Upload the pipeline to the device
with depthai.Device(pipeline) as device:
  # Set input/output queues to configure device/host communication through the XLink...
```

## Specifying OpenVINO version

When using a NN blob that was not compiled with the latest OpenVINO (that DepthAI supports), you have to specify the OpenVINO
version of the pipeline. The reason behind this is that OpenVINO doesn't provide version inside the blob.

```python
pipeline = depthai.pipeline()
# Set the correct version:
pipeline.setOpenVINOVersion(depthai.OpenVINO.Version.VERSION_2021_4)
```

## Using multiple devices

If user has multiple Luxonis' devices, each device can run a different pipeline or the same pipeline ([demo
here](https://github.com/luxonis/oak-examples/tree/master/gen2-multiple-devices)). To use different pipeline for each device, you
can create multiple pipelines and pass the desired pipeline to the desired device on initialization. See [Multi-device
Setup](https://docs.luxonis.com/software/depthai/multi-device-setup.md) for more information.

## How to place it

#### Python

```python
pipeline = dai.Pipeline()
```

#### C++

```cpp
dai::Pipeline pipeline;
```

## Reference

### depthai.Pipeline

Kind: Class

#### __init__(self)

Kind: Method

Constructs a new pipeline

#### create(self, arg0: typing.Any) -> Node: Node

Kind: Method

#### createAprilTag(self) -> node.AprilTag: node.AprilTag

Kind: Method

#### createCamera(self) -> node.Camera: node.Camera

Kind: Method

#### createColorCamera(self) -> node.ColorCamera: node.ColorCamera

Kind: Method

#### createDetectionParser(self) -> node.DetectionParser: node.DetectionParser

Kind: Method

#### createEdgeDetector(self) -> node.EdgeDetector: node.EdgeDetector

Kind: Method

#### createFeatureTracker(self) -> node.FeatureTracker: node.FeatureTracker

Kind: Method

#### createIMU(self) -> node.IMU: node.IMU

Kind: Method

#### createImageManip(self) -> node.ImageManip: node.ImageManip

Kind: Method

#### createMobileNetDetectionNetwork(self) -> node.MobileNetDetectionNetwork: node.MobileNetDetectionNetwork

Kind: Method

#### createMobileNetSpatialDetectionNetwork(self) -> node.MobileNetSpatialDetectionNetwork: node.MobileNetSpatialDetectionNetwork

Kind: Method

#### createMonoCamera(self) -> node.MonoCamera: node.MonoCamera

Kind: Method

#### createNeuralNetwork(self) -> node.NeuralNetwork: node.NeuralNetwork

Kind: Method

#### createObjectTracker(self) -> node.ObjectTracker: node.ObjectTracker

Kind: Method

#### createSPIIn(self) -> node.SPIIn: node.SPIIn

Kind: Method

#### createSPIOut(self) -> node.SPIOut: node.SPIOut

Kind: Method

#### createScript(self) -> node.Script: node.Script

Kind: Method

#### createSpatialLocationCalculator(self) -> node.SpatialLocationCalculator: node.SpatialLocationCalculator

Kind: Method

#### createStereoDepth(self) -> node.StereoDepth: node.StereoDepth

Kind: Method

#### createSystemLogger(self) -> node.SystemLogger: node.SystemLogger

Kind: Method

#### createUVC(self) -> node.UVC: node.UVC

Kind: Method

#### createVideoEncoder(self) -> node.VideoEncoder: node.VideoEncoder

Kind: Method

#### createWarp(self) -> node.Warp: node.Warp

Kind: Method

#### createXLinkIn(self) -> node.XLinkIn: node.XLinkIn

Kind: Method

#### createXLinkOut(self) -> node.XLinkOut: node.XLinkOut

Kind: Method

#### createYoloDetectionNetwork(self) -> node.YoloDetectionNetwork: node.YoloDetectionNetwork

Kind: Method

#### createYoloSpatialDetectionNetwork(self) -> node.YoloSpatialDetectionNetwork: node.YoloSpatialDetectionNetwork

Kind: Method

#### getAllNodes()

Kind: Method

#### getAssetManager()

Kind: Method

#### getBoardConfig(self) -> BoardConfig: BoardConfig

Kind: Method

Gets board configuration

#### getCalibrationData(self) -> CalibrationHandler: CalibrationHandler

Kind: Method

gets the calibration data which is set through pipeline

Returns:
the calibrationHandler with calib data in the pipeline

#### getConnectionMap(self) -> dict[int, set[Node.Connection]]: dict[int, set[Node.Connection]]

Kind: Method

Get a reference to internal connection representation

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

Kind: Method

Get all connections

#### getDeviceConfig(self) -> Device.Config: Device.Config

Kind: Method

Get device configuration needed for this pipeline

#### getGlobalProperties(self) -> GlobalProperties: GlobalProperties

Kind: Method

Returns:
Global properties of current pipeline

#### getNode()

Kind: Method

#### getNodeMap(self) -> dict[int, Node]: dict[int, Node]

Kind: Method

Get a reference to internal node map

#### getOpenVINOVersion(self) -> OpenVINO.Version: OpenVINO.Version

Kind: Method

Get possible OpenVINO version to run this pipeline

#### getRequiredOpenVINOVersion(self) -> depthai.OpenVINO.Version|None: depthai.OpenVINO.Version|None

Kind: Method

Get required OpenVINO version to run this pipeline. Can be none

#### link(self, arg0: Node.Output, arg1: Node.Input)

Kind: Method

Link output to an input. Both nodes must be on the same pipeline

Throws an error if they aren't or cannot be connected

Parameter ``out``:
Nodes output to connect from

Parameter ``in``:
Nodes input to connect to

#### remove(self, node: Node)

Kind: Method

Removes a node from pipeline

#### serializeToJson(self) -> json: json

Kind: Method

Returns whole pipeline represented as JSON

#### setBoardConfig(self, arg0: BoardConfig)

Kind: Method

Sets board configuration

#### setCalibrationData(self, calibrationDataHandler: CalibrationHandler)

Kind: Method

Sets the calibration in pipeline which overrides the calibration data in eeprom

Parameter ``calibrationDataHandler``:
CalibrationHandler object which is loaded with calibration information.

#### setCameraTuningBlobPath(self, path: Path)

Kind: Method

Set a camera IQ (Image Quality) tuning blob, used for all cameras

#### setOpenVINOVersion(self, version: OpenVINO.Version)

Kind: Method

Set a specific OpenVINO version to use with this pipeline

#### setSippBufferSize(self, sizeBytes: typing.SupportsInt)

Kind: Method

SIPP (Signal Image Processing Pipeline) internal memory pool. SIPP is a
framework used to schedule HW filters, e.g. ISP, Warp, Median filter etc.
Changing the size of this pool is meant for advanced use cases, pushing the
limits of the HW. By default memory is allocated in high speed CMX memory.
Setting to 0 will allocate in DDR 256 kilobytes. Units are bytes.

#### setSippDmaBufferSize(self, sizeBytes: typing.SupportsInt)

Kind: Method

SIPP (Signal Image Processing Pipeline) internal DMA memory pool. SIPP is a
framework used to schedule HW filters, e.g. ISP, Warp, Median filter etc.
Changing the size of this pool is meant for advanced use cases, pushing the
limits of the HW. Memory is allocated in high speed CMX memory Units are bytes.

#### setXLinkChunkSize(self, sizeBytes: typing.SupportsInt)

Kind: Method

Set chunk size for splitting device-sent XLink packets, in bytes. A larger value
could increase performance, with 0 disabling chunking. A negative value won't
modify the device defaults - configured per protocol, currently 64*1024 for both
USB and Ethernet.

#### unlink(self, arg0: Node.Output, arg1: Node.Input)

Kind: Method

Unlink output from an input.

Throws an error if link doesn't exists

Parameter ``out``:
Nodes output to unlink from

Parameter ``in``:
Nodes input to unlink to
