更新 main/README.md
This commit is contained in:
@ -30,19 +30,21 @@ pip install opencv-python numpy rknnlite
|
||||
|
||||
您也可以直接调用 calculate_offset_from_image 函数,以便集成到其他项目中:
|
||||
示例 1: 仅获取偏移量(不画图)
|
||||
**
|
||||
|
||||
```bash
|
||||
from calculate_offset import calculate_offset_from_image
|
||||
result = calculate_offset_from_image("your_image_path.jpg", visualize=False)
|
||||
if result['success']:
|
||||
print(f"Offset: DeltaX={result['dx_mm']:+.2f} mm, DeltaY={result['dy_mm']:+.2f} mm")
|
||||
else:
|
||||
print("Error:", result['message'])
|
||||
**
|
||||
```
|
||||
示例 2: 获取偏移量并保存可视化图
|
||||
**
|
||||
|
||||
```bash
|
||||
from calculate_offset import calculate_offset_from_image
|
||||
result = calculate_offset_from_image("your_image_path.jpg", visualize=True)
|
||||
**
|
||||
```
|
||||
|
||||
该函数返回一个包含下列字段的字典:
|
||||
|
||||
@ -51,4 +53,4 @@ result = calculate_offset_from_image("your_image_path.jpg", visualize=True)
|
||||
dy_mm: 垂直偏移(毫米)
|
||||
cx: 中心点 x 坐标(像素)
|
||||
cy: 中心点 y 坐标(像素)
|
||||
message: 错误信息或成功提示
|
||||
message: 错误信息或成功提示
|
||||
Reference in New Issue
Block a user