为所有函数和类添加中文注释文档字符串
This commit is contained in:
@@ -6,16 +6,20 @@ WINDOW_NAME = "Android Camera (WebRTC)"
|
||||
|
||||
|
||||
def show_frame(image, window_name: str = WINDOW_NAME) -> None:
|
||||
"""在OpenCV窗口中显示图像帧"""
|
||||
cv2.imshow(window_name, image)
|
||||
|
||||
|
||||
def wait_key(delay_ms: int = 1) -> int:
|
||||
"""等待按键并返回ASCII码"""
|
||||
return cv2.waitKey(delay_ms) & 0xFF
|
||||
|
||||
|
||||
def is_esc_pressed() -> bool:
|
||||
"""检测ESC键是否被按下"""
|
||||
return wait_key(1) == 27
|
||||
|
||||
|
||||
def close_window() -> None:
|
||||
"""关闭所有OpenCV窗口"""
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
Reference in New Issue
Block a user