28 lines
813 B
Python
28 lines
813 B
Python
# vision/angle_detector.py
|
||
import sys
|
||
import os
|
||
from vision.obb_angle_model.obb_angle import detect_two_box_angle
|
||
|
||
# 添加项目根目录到Python路径
|
||
# sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||
|
||
def get_current_door_angle(model,image=None, image_path=None):
|
||
"""
|
||
通过视觉系统获取当前出砼门角度
|
||
:param model: 模型实例
|
||
:param image: 图像数组(numpy array)
|
||
:param image_path: 图片路径
|
||
:return: 角度值(度)
|
||
"""
|
||
try:
|
||
# 调用实际的角度检测函数
|
||
angle_deg, _ = detect_two_box_angle(
|
||
model_path=model,
|
||
rgb_frame=image
|
||
# ,image_path=image_path
|
||
)
|
||
return angle_deg
|
||
except Exception as e:
|
||
print(f"角度检测失败: {e}")
|
||
return None
|