Files
Feeding_control_system/vision/angle_detector.py

28 lines
799 B
Python
Raw Permalink Normal View History

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