# Streaming an OAK-D using Xlink

## Streaming from an [OAK-D](https://store.opencv.ai/products/oak-d) PoE using Xlink and Using OpenVINO for inference

Currently the OAK-D Xlink build is dependent on OpenVINO library for functionality. Even if you decide to not use OpenVINO the library still requires OpenVINO to be installed to function properly.

### 1.0 Build Sensor Stream Pipe for OAK-D Xlink

1.1 Ensure that OpenVINO environment variables are set in the command terminal

Linux: `source /opt/intel/openvino_2021/bin/setupvars.sh`

Windows: `C:\Program Files (x86)\Intel\openvino_<version>/bin/setupvars.sh`

1.1 Follow the instructions: [Installation Windows](/windows.md) or [Installation Linux](/linux.md) and use the `-DXLINK_ENABLED=TRUE` flag when building

### 2.0 Use Sensor Stream Pipe to Stream OAK-D frames using Xlink

{% hint style="info" %}
**You will likely need to edit** **oakd\_xlink\_reader.cc to grab the exact frames and run the model you want on those frames**

Currently oakd\_xlink\_reader.cc does the following:

* requests a 300x300 RGB image and streams it
* runs inference on the 300x300 image [using the model from the OpenVINO HelloClassification example](https://docs.openvino.ai/latest/openvino_inference_engine_samples_hello_classification_README.html)
  * running inference on the model in /models

**Why run inference and output the results in Sensor Stream Pipe?**

We wanted to use an example that you can follow from OpenVINO documentation so you can upload different models to /models. You can extend SSP to support additional frames such as inference results from an OpenVINO model.
{% endhint %}

**2.1** Run SSP client to show the color frames

`./ssp_client_opencv 9999`

**2.2** Update serve\_xlink\_raw\.yaml to use the IP address of your OAK-D PoE (line 8)

**2.3 (only if Linux)** Create USB rules for PoE

`echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules`

This creates that /etc/udev/rules.d/80-movidius.rules . It's required when using the DepthAI USB interface, for regular users (non root)

**2.4 Trigger OAK-D to send SSP reader frames through Xlink**

`./ssp_server ../../configs/serve_xlink_raw.yaml`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sensor-stream-pipe.moetsi.com/streaming-an-oak-d-using-xlink.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
