去掉删除鼠标。
This commit is contained in:
parent
b551fb4f97
commit
eb4da825d0
42
face_rec.py
42
face_rec.py
@ -18,45 +18,6 @@ import queue
|
||||
from compreface import CompreFace
|
||||
from compreface.service import RecognitionService, DetectionService
|
||||
|
||||
# 隐藏鼠标光标
|
||||
def hide_cursor():
|
||||
"""隐藏鼠标光标(Linux/X11)"""
|
||||
try:
|
||||
import ctypes
|
||||
from ctypes import cdll, c_char_p, c_void_p, c_int, byref
|
||||
|
||||
libx11 = cdll.LoadLibrary('libX11.so.6')
|
||||
|
||||
# 打开 Display
|
||||
display = libx11.XOpenDisplay(None)
|
||||
if not display:
|
||||
print("Cannot open X display")
|
||||
return
|
||||
|
||||
root = libx11.XDefaultRootWindow(display)
|
||||
|
||||
# 创建空白 bitmap
|
||||
no_data = b'\x00'
|
||||
bitmap = libx11.XCreateBitmapFromData(display, root, no_data, 8, 8)
|
||||
|
||||
# 创建完全透明的光标(前景和背景都是0,即透明)
|
||||
black = c_int(0)
|
||||
invisible_cursor = libx11.XCreatePixmapCursor(display, bitmap, bitmap,
|
||||
byref(black), byref(black), 0, 0)
|
||||
|
||||
# 设置到根窗口
|
||||
libx11.XDefineCursor(display, root, invisible_cursor)
|
||||
libx11.XFlush(display)
|
||||
|
||||
print("Cursor hidden successfully")
|
||||
|
||||
# 清理
|
||||
libx11.XFreeCursor(display, invisible_cursor)
|
||||
libx11.XFreePixmap(display, bitmap)
|
||||
libx11.XCloseDisplay(display)
|
||||
except Exception as e:
|
||||
print(f"Hide cursor error: {e}")
|
||||
|
||||
|
||||
class FaceRecognitionSystem:
|
||||
def __init__(self, config_path: str = "config.yaml"):
|
||||
@ -1644,9 +1605,6 @@ 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秒)检查一次
|
||||
|
||||
Loading…
Reference in New Issue
Block a user