# 实时视图

> **Deprecation Notice**
> 本页面描述了已在Luxonis Hub中移除或替换的功能。功能可能受限，仅对Hub Original客户可用。请参阅最新的指南来配置设备、管理车队和部署应用程序。

将实时视频流传输到Luxonis Hub或您的前端。

### 导入robothub并创建新的LiveView对象

每个机器人最多可以创建十个Live View。

```python
import robothub as rh

live_view = rh.DepthaiLiveView(name="live_view", unique_key="rgb", width=1920, height=1080)
```

### 添加叠加数据

通过添加__矩形__、__线条__和__文本__来呈现基本数据和神经网络结果，改善您的Live View体验。

```python
live_view.add_rectangle(rectangle=bbox, label=nn_config.labels[detection.label])
live_view.add_text(text="Cool and important text.", coords=[100, 150])
live_view.add_line(pt1=[x1, y1], pt2=[x2, y2])
```

### 发布帧

发布带有叠加数据的帧。此调用会清除叠加数据。确保您的流水线中有h264 encoder，因为只有__h264__编码的帧才能发布。 h264编码帧

```python
live_view.publish(h264_frame=h264_frame.getCvFrame())
```

### robothub.live_view.LiveView(abc.ABC)

Kind: Class

#### get(unique_key: str = None, name: str = None) -> Optional[LiveView]: Optional[LiveView]

Kind: Static Method

Gets a Live View by its unique key or name. Name takes precedence over unique key.

:param unique_key: Unique key of the Live View.
:param name: Name of the Live View.
:return: Live View with the given unique key or name.
:raises ValueError: If neither name nor unique_key is specified.

#### get_by_name(name: str) -> Optional[LiveView]: Optional[LiveView]

Kind: Static Method

Gets a Live View by its name.

:param name: Name of the Live View.
:return: Live View with the given name. None if a Live View with the given name does not exist.

#### get_by_unique_key(unique_key: str) -> Optional[LiveView]: Optional[LiveView]

Kind: Static Method

Gets a Live View by its unique key.

:param unique_key: Unique key of the Live View.
:return: Live View with the given unique key.
:raises ValueError: If a Live View with the given unique key does not exist.
