device update

This commit is contained in:
13339479676 2022-01-08 09:31:28 +08:00
parent 822bd8f9f0
commit a11702ea5a
2 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,6 @@
# OpenCV Webcam Script v0.2
# OpenCV Webcam Script v0.3
# 创建人:曾逸夫
# 创建时间2022-01-02
# 创建时间2022-01-08
import cv2
from pathlib import Path
@ -16,8 +16,8 @@ from utils.frame_opt import frame_opt
def parse_args(known=False):
parser = argparse.ArgumentParser(description='OpenCV Webcam Script v0.2')
parser.add_argument('--device', '-dev', default=0,
type=int, help='device index for webcam')
parser.add_argument('--device', '-dev', default='0',
type=str, help='device index for webcam, 0 or rtsp')
parser.add_argument('--quit', '-q', default="q",
type=str, help='quit key for webcam')
parser.add_argument('--is_autoSaveFrame', '-isasf',
@ -62,7 +62,9 @@ def webcam_opencv(device_index=0, quit_key="q", pause_key="p", is_autoSaveFrame=
# ------------------程序开始------------------
s_time = time.time() # 起始时间
cap = cv2.VideoCapture(device_index) # 连接设备
dev_index = eval(device_index) if device_index.isnumeric(
) else device_index # 设备选择 (usb 0,1,2; rtsp)
cap = cv2.VideoCapture(dev_index) # 连接设备
frame_width = cap.get(3) # 宽度
frame_height = cap.get(4) # 高度
fps = cap.get(5) # 帧率

2
v03.md
View File

@ -7,7 +7,7 @@
### 功能更新
- 加入rtsp功能
### BUG修复