v04 update 03
This commit is contained in:
parent
0c93d0703b
commit
fa1c915ccb
|
@ -120,7 +120,8 @@ def webcam_opencv(device_index="0",
|
|||
Path(f"{frame_saveDir}") / frame_dirName, exist_ok=False) # 增量运行
|
||||
frame_savePath.mkdir(parents=True, exist_ok=True) # 创建目录
|
||||
|
||||
frame_num = 0 # 帧数
|
||||
frame_num = 0 # 总帧数
|
||||
frame_hand_num = 0 # 手动保存帧数
|
||||
ows_version = 'OpenCV Webcam Script v0.4' # 版本号
|
||||
while(cap.isOpened()):
|
||||
wait_key = cv2.waitKey(20) & 0xFF # 键盘监听
|
||||
|
@ -138,6 +139,7 @@ def webcam_opencv(device_index="0",
|
|||
frame_namePrefix, frame_saveStyle, jpg_quality, png_quality)
|
||||
if (is_handSaveFrame): # 手动保存
|
||||
if wait_key == ord(frame_capKey): # 保存键
|
||||
frame_hand_num += 1 # 手动帧计数
|
||||
frame_opt(frame, frame_savePath, frame_num, is_resizeFrame, resize_frame, resizeRatio_frame,
|
||||
frame_namePrefix, frame_saveStyle, jpg_quality, png_quality)
|
||||
|
||||
|
@ -147,10 +149,14 @@ def webcam_opencv(device_index="0",
|
|||
print(f'已暂停!按任意键继续。。。')
|
||||
cv2.waitKey(0) # 暂停,按任意键继续
|
||||
|
||||
if (frame_savePath != ""):
|
||||
if (is_autoSaveFrame):
|
||||
frameSaveMsg = f'共计{frame_num}帧,已保存在:{frame_savePath}'
|
||||
print(frameSaveMsg)
|
||||
log_management(f'{frameSaveMsg}\n', logName, logMode) # 记录帧保存信息
|
||||
elif (is_handSaveFrame):
|
||||
frameSaveMsg = f'共计{frame_hand_num}帧,已保存在:{frame_savePath}'
|
||||
print(frameSaveMsg)
|
||||
log_management(f'{frameSaveMsg}\n', logName, logMode) # 记录帧保存信息
|
||||
|
||||
cap.release() # 释放缓存资源
|
||||
cv2.destroyAllWindows() # 删除所有窗口
|
||||
|
|
Loading…
Reference in New Issue