organize exampels according to products
This commit is contained in:
+10
-10
@@ -238,7 +238,7 @@ flow = sensor.read_info(sensor.info.VRAW)
|
||||
|
||||
## `orisys.finger` 手指 UV pipeline
|
||||
|
||||
`examples/finger_pipeline.py` 展示了一个更适合手指/单相机场景的高层 API:
|
||||
`examples/products/ory_finger/finger_pipeline.py` 展示了一个更适合手指/单相机场景的高层 API:
|
||||
|
||||
1. 使用 `FingerRuntime.open()` 打开视频源、加载 Blender 导出的资产,并构建 UV 展开映射。
|
||||
2. 用 `grab_and_process()` 或 `read_source() + process_frame()` 获取一帧展开后的触觉图像。
|
||||
@@ -262,7 +262,7 @@ flow = sensor.read_info(sensor.info.VRAW)
|
||||
#### 输入参数
|
||||
|
||||
* **export_dir** (`str`,可选): 手指导出资产目录,默认值来自 `orisys.finger.DEFAULT_FINGER_EXPORT_DIR`。目录下通常需要包含 `mesh.npz`、`camera_intrinsics.npz`、`world_to_cam.npy`。
|
||||
* **config** (`str`,可选): Orisys 配置文件路径,默认 `./config/dd02-ov.json`。
|
||||
* **config** (`str`,可选): Orisys 配置文件名称或路径,默认 `dd02`(兼容解析到 `dd02-ov`)。
|
||||
* **map_cache** (`str`,可选): UV 展开缓存文件路径,默认值来自 `orisys.finger.DEFAULT_FINGER_MAP_CACHE`。
|
||||
* **source_scale** (`float`,可选): 输入相机分辨率缩放比例;未提供时根据配置自动推断。
|
||||
* **calib** (`str | None`,可选): 外部相机标定文件路径;未提供时优先使用导出资产中的内参。
|
||||
@@ -282,7 +282,7 @@ flow = sensor.read_info(sensor.info.VRAW)
|
||||
from orisys.finger import FingerRuntime
|
||||
|
||||
runtime = FingerRuntime.open(
|
||||
config="./config/dd02-ov.json",
|
||||
config="dd02",
|
||||
video=0,
|
||||
verbose=True,
|
||||
)
|
||||
@@ -312,7 +312,7 @@ runtime = FingerRuntime.open(
|
||||
|
||||
#### 描述
|
||||
|
||||
对一帧原始输入执行源图预处理、UV 展开,并把展开后的结果送入内部 `TactileProcessor`。这是 `examples/finger_pipeline.py` 中 profile 模式使用的方法。
|
||||
对一帧原始输入执行源图预处理、UV 展开,并把展开后的结果送入内部 `TactileProcessor`。这是 `examples/products/ory_finger/finger_pipeline.py` 中 profile 模式使用的方法。
|
||||
|
||||
#### 输入参数
|
||||
|
||||
@@ -327,7 +327,7 @@ runtime = FingerRuntime.open(
|
||||
|
||||
#### 描述
|
||||
|
||||
先读取一帧视频源,再调用 `process_frame()` 完成 UV 展开并推入内部触觉处理器。非 profile 模式下,`examples/finger_pipeline.py` 使用该方法作为主循环入口。
|
||||
先读取一帧视频源,再调用 `process_frame()` 完成 UV 展开并推入内部触觉处理器。非 profile 模式下,`examples/products/ory_finger/finger_pipeline.py` 使用该方法作为主循环入口。
|
||||
|
||||
#### 输入参数
|
||||
|
||||
@@ -357,7 +357,7 @@ runtime = FingerRuntime.open(
|
||||
|
||||
#### 描述
|
||||
|
||||
先执行一次采集与 UV 展开,然后调用 `runtime.tactile.warmup()` 预热内部光流/HHD 相关缓存。`examples/finger_pipeline.py` 在进入主循环前会先执行一次 warmup。
|
||||
先执行一次采集与 UV 展开,然后调用 `runtime.tactile.warmup()` 预热内部光流/HHD 相关缓存。`examples/products/ory_finger/finger_pipeline.py` 在进入主循环前会先执行一次 warmup。
|
||||
|
||||
#### 输入参数
|
||||
|
||||
@@ -386,7 +386,7 @@ runtime = FingerRuntime.open(
|
||||
* **raw_sensor**: 底层 `Sensor` 对象。
|
||||
* **info**: 与 `Sensor.info` 相同的枚举入口。
|
||||
* **img / flow / vnormal / vshear / depth_map**: 当前帧处理结果。
|
||||
* **mask_stats**: 有效 UV 区域统计信息;`examples/finger_pipeline.py` 会读取 `mask_stats["coverage"]` 输出当前掩码覆盖率。
|
||||
* **mask_stats**: 有效 UV 区域统计信息;`examples/products/ory_finger/finger_pipeline.py` 会读取 `mask_stats["coverage"]` 输出当前掩码覆盖率。
|
||||
* **valid_mask**: 当前有效区域掩码。
|
||||
|
||||
#### 说明
|
||||
@@ -395,7 +395,7 @@ runtime = FingerRuntime.open(
|
||||
|
||||
### 10. 最小手指 pipeline 示例
|
||||
|
||||
下面的流程与 `examples/finger_pipeline.py` 一致:
|
||||
下面的流程与 `examples/products/ory_finger/finger_pipeline.py` 一致:
|
||||
|
||||
```python
|
||||
import time
|
||||
@@ -404,7 +404,7 @@ import orisys
|
||||
from orisys.finger import FingerRuntime
|
||||
|
||||
runtime = FingerRuntime.open(
|
||||
config="./config/dd02-ov.json",
|
||||
config="dd02",
|
||||
video=0,
|
||||
verbose=True,
|
||||
)
|
||||
@@ -462,7 +462,7 @@ finally:
|
||||
|
||||
### 11. 关于 profile 模式
|
||||
|
||||
`examples/finger_pipeline.py` 中的 `--profile` / `--profile-every` 是示例脚本参数,不属于 `orisys` SDK 核心 API。本质上它只是把主循环拆成:
|
||||
`examples/products/ory_finger/finger_pipeline.py` 中的 `--profile` / `--profile-every` 是示例脚本参数,不属于 `orisys` SDK 核心 API。本质上它只是把主循环拆成:
|
||||
|
||||
1. `runtime.read_source()`
|
||||
2. `runtime.process_frame(...)`
|
||||
|
||||
+17
-14
@@ -112,13 +112,16 @@ print(orisys.__version__)
|
||||
|
||||
# 使用方法
|
||||
## 运行示例程序
|
||||
套件里面包含了多个例子,建议都在仓库根目录运行(即 `config/`、`examples/`、`assets/` 同级目录)。常见入口分为两类:
|
||||
套件里面包含了多个例子,建议都在仓库根目录运行(即 `config/`、`examples/`、`assets/` 同级目录)。按产品入口如下:
|
||||
|
||||
1. `examples/basic_pipeline.py`:复眼/拼接传感器基础 OpenCV 示例
|
||||
2. `examples/finger_pipeline.py`:手指传感器2维显示最小流程示例
|
||||
3. `examples/finger_pipeline_3dview.py`:手指传感器 Qt 3D 可视化界面
|
||||
1. `examples/products/ory_box/basic_pipeline.py`:ORY-BOX 复眼/拼接传感器基础 OpenCV 示例(默认配置 `ddjx01`)
|
||||
2. `examples/products/ory_mini/basic_pipeline.py`:ORY-MINI 基础 OpenCV 示例(默认配置 `mini`)
|
||||
3. `examples/products/ory_finger/finger_pipeline.py`:ORY-FINGER 2D UV 最小流程(默认配置 `dd02`)
|
||||
4. `examples/products/ory_finger/finger_pipeline_3dview.py`:ORY-FINGER Qt 3D 可视化界面(默认配置 `dd02`)
|
||||
|
||||
下面先介绍最基础的 `basic_pipeline.py` 运行方式。
|
||||
`dd02` 是当前 ORY-FINGER 的稳定别名,实际会解析到 `dd02-ov`。旧路径 `examples/basic_pipeline.py` / `examples/finger_pipeline*.py` 仍可作为兼容入口。
|
||||
|
||||
下面先介绍最基础的 ORY-BOX 运行方式。
|
||||
|
||||
### Windows:
|
||||
1. 检查是否有其他正在连接的USB摄像头设备:打开powershell, 运行命令`Get-PnpDevice -PresentOnly | Where-Object { $_.Class -match '^Camera' }`,如果没有的话不会有输出。
|
||||
@@ -126,7 +129,7 @@ print(orisys.__version__)
|
||||
3. 如果第一步没有输出,传感器的ID就是“0”,如果第一步有一个设备,传感器的ID就是“1”,如此类推。
|
||||
4. 在确定了传感器的ID(下方例子假设为“0”)后,打开Anaconda Prompt, 切换到工作路径,然后在命令行中输入:
|
||||
``` bash
|
||||
python examples/basic_pipeline.py -v 0
|
||||
python examples/products/ory_box/basic_pipeline.py -v 0 -c ddjx01
|
||||
```
|
||||
5. 程序会运行,并自动打开可视化窗口和打印资料,在窗口上按键盘”q”键可以停止运行,按”r”键可以重设数据
|
||||
|
||||
@@ -136,22 +139,22 @@ print(orisys.__version__)
|
||||
3. 根据新增的输出,例如”/dev/video0”,确定传感器的ID为“0”, 如果是”/dev/video3”的话ID为“3” ,如此类推。
|
||||
4. 在确定了传感器的ID(下方例子假设为“0”)后,打开终端, 激活相应的python环境,切换到工作路径,然后在命令行中输入:
|
||||
``` bash
|
||||
python examples/basic_pipeline.py -v 0
|
||||
python examples/products/ory_box/basic_pipeline.py -v 0 -c ddjx01
|
||||
```
|
||||
5. 程序会运行,并自动打开可视化窗口和打印资料,在窗口上按键盘”q”键可以停止运行,按”r”键可以重设数据
|
||||
|
||||
### 手指传感器 UV 示例
|
||||
### ORY-FINGER UV 示例
|
||||
|
||||
如果您使用的是手指/单相机 UV 展开流程,可运行:
|
||||
如果您使用的是 ORY-FINGER(当前配置别名 `dd02`),可运行:
|
||||
|
||||
``` bash
|
||||
python examples/finger_pipeline.py --camera_id 0 --config ./config/dd02-ov.json
|
||||
python examples/products/ory_finger/finger_pipeline.py --camera_id 0 --config dd02
|
||||
```
|
||||
|
||||
如果输入来自视频文件,也可以改用:
|
||||
|
||||
``` bash
|
||||
python examples/finger_pipeline.py --video ./data/sample.mp4 --config ./config/dd02-ov.json
|
||||
python examples/products/ory_finger/finger_pipeline.py --video ./data/sample.mp4 --config dd02
|
||||
```
|
||||
|
||||
该示例会:
|
||||
@@ -168,10 +171,10 @@ python examples/finger_pipeline.py --video ./data/sample.mp4 --config ./config/d
|
||||
例如:
|
||||
|
||||
``` bash
|
||||
python examples/finger_pipeline.py --camera_id 0 --config ./config/dd02-ov.json
|
||||
python examples/products/ory_finger/finger_pipeline.py --camera_id 0 --config dd02
|
||||
```
|
||||
|
||||
### 手指 3D 可视化界面
|
||||
### ORY-FINGER 3D 可视化界面
|
||||
|
||||
如果要使用 GUI ,安装GUI依赖:
|
||||
``` bash
|
||||
@@ -180,7 +183,7 @@ pip install pyqt5 pyqtgraph
|
||||
```
|
||||
然后运行:
|
||||
``` bash
|
||||
python examples/finger_pipeline_3dview.py --video 0 --config ./config/dd02-ov.json
|
||||
python examples/products/ory_finger/finger_pipeline_3dview.py --video 0 --config dd02
|
||||
```
|
||||
|
||||
该界面会提供:
|
||||
|
||||
Reference in New Issue
Block a user