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