diff --git a/face_rec.py b/face_rec.py index 112226d..9219f87 100644 --- a/face_rec.py +++ b/face_rec.py @@ -18,6 +18,19 @@ import queue from compreface import CompreFace from compreface.service import RecognitionService, DetectionService +# 隐藏鼠标光标 +def hide_cursor(): + """隐藏鼠标光标(Linux/X11)""" + try: + import subprocess + # 创建空白cursor文件 + xbm = '/tmp/invisible_cursor.xbm' + with open(xbm, 'w') as f: + f.write('#define w 1\n#define h 1\n#define hot_x 0\n#define hot_y 0\nstatic char curs[] = {0};') + subprocess.run(['xsetroot', '-cursor', xbm, xbm], check=False) + except Exception: + pass + class FaceRecognitionSystem: def __init__(self, config_path: str = "config.yaml"): @@ -1605,6 +1618,9 @@ class FaceRecognitionSystem: cv2.setWindowProperty(window_name, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN) self.logger.info("人脸识别窗口设置为全屏模式") + # 隐藏鼠标光标 + hide_cursor() + # 添加推流健康检查计数器 stream_check_counter = 0 stream_check_interval = 150 # 每150帧(约5秒)检查一次