diff --git a/app.yaml b/app.yaml index a9728e9..d15c02d 100644 --- a/app.yaml +++ b/app.yaml @@ -1,6 +1,6 @@ id: t11 name: t11 -version: 1.0.2 +version: 1.0.3 author: t11 icon: '' desc: t11 diff --git a/main.py b/main.py index 583d63e..a78c449 100644 --- a/main.py +++ b/main.py @@ -154,8 +154,8 @@ LASER_OFF_CMD = bytes([0xAA, MODULE_ADDR, 0x01, 0xBE, 0x00, 0x01, 0x00, 0x00, 0x # 相机标定参数(用于距离估算) # FOCAL_LENGTH_PIX = 3800.0 # 焦距(像素) -FOCAL_LENGTH_PIX = 1900.0 # 焦距(像素) -REAL_RADIUS_CM = 15 # 靶心实际半径(厘米) +FOCAL_LENGTH_PIX = 2200.0 # 焦距(像素) +REAL_RADIUS_CM = 15 # 靶心实际半径(厘米) # TCP 连接状态 tcp_connected = False @@ -684,7 +684,10 @@ def detect_circle(frame): circularity = 4 * np.pi * area / (perimeter ** 2) if circularity > 0.75 and len(cnt) >= 5: center, axes, angle = cv2.fitEllipse(cnt) - radius = (axes[0] + axes[1]) / 4 + radius = axes[0] + if axes[1] < radius: + radius = axes[1] + radius /= 2 best_center = (int(center[0]), int(center[1])) best_radius = int(radius) best_radius1 = best_radius @@ -1348,7 +1351,7 @@ def cmd_str(): # 初始化硬件 init_ina226() - load_laser_point() + # load_laser_point() disp = display.Display() cam = camera.Camera(640, 480)