采集卡bug修复

This commit is contained in:
Ray
2025-10-29 15:37:48 +08:00
parent 3a8873acc2
commit f0fc28d827
3 changed files with 33 additions and 6 deletions

View File

@@ -202,11 +202,22 @@ class ConfigGUI:
import warnings
found = []
# 临时设置OpenCV日志级别
# 临时设置OpenCV日志级别(兼容不同版本)
import os
old_level = os.environ.get('OPENCV_LOG_LEVEL', '')
os.environ['OPENCV_LOG_LEVEL'] = 'ERROR'
cv2.setLogLevel(cv2.LOG_LEVEL_ERROR)
# 尝试设置日志级别不同版本的OpenCV API不同
try:
if hasattr(cv2, 'setLogLevel'):
# OpenCV 4.x
if hasattr(cv2, 'LOG_LEVEL_ERROR'):
cv2.setLogLevel(cv2.LOG_LEVEL_ERROR)
elif hasattr(cv2, 'utils'):
# 某些版本的OpenCV
cv2.utils.setLogLevel(0) # 0=ERROR级别
except Exception:
pass # 如果设置失败,继续执行
try:
for idx in range(max_index + 1):