add ArUco but no activated
This commit is contained in:
33
vision.py
33
vision.py
@@ -14,6 +14,10 @@ from maix import image
|
||||
import config
|
||||
from logger_manager import logger_manager
|
||||
|
||||
# 导入ArUco检测器(如果启用)
|
||||
if config.USE_ARUCO:
|
||||
from aruco_detector import detect_target_with_aruco, aruco_detector
|
||||
|
||||
# 存图队列 + worker
|
||||
_save_queue = queue.Queue(maxsize=16)
|
||||
_save_worker_started = False
|
||||
@@ -749,3 +753,32 @@ def save_shot_image(result_img, center, radius, method, ellipse_params,
|
||||
logger.error(f"[VISION] save_shot_image 转换图像失败: {e}")
|
||||
return None
|
||||
|
||||
|
||||
def detect_target(frame, laser_point=None):
|
||||
"""
|
||||
统一的靶心检测接口,根据配置自动选择检测方法
|
||||
|
||||
Args:
|
||||
frame: MaixPy图像帧
|
||||
laser_point: 激光点坐标(可选)
|
||||
|
||||
Returns:
|
||||
(result_img, center, radius, method, best_radius1, ellipse_params)
|
||||
与detect_circle_v3保持相同的返回格式
|
||||
"""
|
||||
logger = logger_manager.logger
|
||||
|
||||
if config.USE_ARUCO:
|
||||
# 使用ArUco检测
|
||||
if logger:
|
||||
logger.debug("[VISION] 使用ArUco标记检测靶心")
|
||||
|
||||
# 延迟导入以避免循环依赖
|
||||
from aruco_detector import detect_target_with_aruco
|
||||
return detect_target_with_aruco(frame, laser_point)
|
||||
else:
|
||||
# 使用传统黄色靶心检测
|
||||
if logger:
|
||||
logger.debug("[VISION] 使用传统黄色靶心检测")
|
||||
return detect_circle_v3(frame, laser_point)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user