6 Star 21 Fork 13

OAKChina/depthai-experiments

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Gen2 WebRTC streaming example

This example demonstrates how to setup a WebRTC server to configure the device and stream the results and preview from it.

Demo

Gen2 WebRTC

Pre-requisites

Install requirements:

python3 -m pip install -r requirements.txt

Enable insecure origins to be treated as secure (Chrome)

To ignore Chrome’s secure origin policy, follow these steps. Navigate to chrome://flags/#unsafely-treat-insecure-origin-as-secure in Chrome.
Find and enable the Insecure origins treated as secure section (see below). Add any addresses you want to ignore the secure origin policy for. Remember to include the port number too (if required). example Save and restart Chrome. Remember this is for dev purposes only. The live working app will need to be hosted on https.

Usage

python3 main.py

And open http://0.0.0.0:8080

localhost preview

Modify the script

DepthAI part of the code is stored in transformators.py, as DepthAIVideoTransformTrack. You can add more capabilities there, like modify the pipeline or output.

If you'd like to send the nn results using datachannel, please use the following snippet inside get_frame method of the transformator

if self.pc_id in self.application.pcs_datachannels:
    channel = self.application.pcs_datachannels[self.pc_id]
    channel.send(json.dumps({
        'type': 'NEW_RESULTS',
        'payload': [] # your results array here
    }))

If you'd like to add more config options to the script, first add a new input with a correct name attribute to client/index.html inside #options-form. It will be automatically parsed and sent to the server. There, you can access them in the transformer by either referncing self.options.raw_options.get("<name_attribute>") or by adding a new property in OptionsWrapper class

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/oakchina/depthai-experiments.git
git@gitee.com:oakchina/depthai-experiments.git
oakchina
depthai-experiments
depthai-experiments
master

搜索帮助