conflict merge

This commit is contained in:
huangzhenwei2
2025-12-28 16:30:11 +08:00
2 changed files with 8 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
id: t11 id: t11
name: t11 name: t11
version: 1.0.2 version: 1.0.3
author: t11 author: t11
icon: '' icon: ''
desc: t11 desc: t11

11
main.py
View File

@@ -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 = 3800.0 # 焦距(像素)
FOCAL_LENGTH_PIX = 1900.0 # 焦距(像素) FOCAL_LENGTH_PIX = 2200.0 # 焦距(像素)
REAL_RADIUS_CM = 15 # 靶心实际半径(厘米) REAL_RADIUS_CM = 15 # 靶心实际半径(厘米)
# TCP 连接状态 # TCP 连接状态
tcp_connected = False tcp_connected = False
@@ -684,7 +684,10 @@ def detect_circle(frame):
circularity = 4 * np.pi * area / (perimeter ** 2) circularity = 4 * np.pi * area / (perimeter ** 2)
if circularity > 0.75 and len(cnt) >= 5: if circularity > 0.75 and len(cnt) >= 5:
center, axes, angle = cv2.fitEllipse(cnt) 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_center = (int(center[0]), int(center[1]))
best_radius = int(radius) best_radius = int(radius)
best_radius1 = best_radius best_radius1 = best_radius
@@ -1348,7 +1351,7 @@ def cmd_str():
# 初始化硬件 # 初始化硬件
init_ina226() init_ina226()
load_laser_point() # load_laser_point()
disp = display.Display() disp = display.Display()
cam = camera.Camera(640, 480) cam = camera.Camera(640, 480)