Files
Feeding_control_system/vision/angle_detector.py

28 lines
813 B
Python
Raw Permalink Normal View History

# vision/angle_detector.py
import sys
import os
2025-11-17 00:05:40 +08:00
from vision.obb_angle_model.obb_angle import detect_two_box_angle
# 添加项目根目录到Python路径
2025-11-17 00:05:40 +08:00
# sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
2025-11-17 00:05:40 +08:00
def get_current_door_angle(model,image=None, image_path=None):
"""
通过视觉系统获取当前出砼门角度
:param model: 模型实例
:param image: 图像数组numpy array
:param image_path: 图片路径
:return: 角度值
"""
try:
# 调用实际的角度检测函数
2025-11-17 00:05:40 +08:00
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