diff --git a/README.md b/README.md index e628cd9..8f6e55c 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,21 @@ python opencv_webcam.py -isasf -afn 100 +#### :bulb: 日志设置 + +```shell +# 日志文件默认保存在项目根目录,test.log +python opencv_webcam.py +# 设置日志文件名称及类型,类型包括.log、.txt、.data +python opencv_webcam.py -ln test02.txt +# 设置日志保存方式,,默认为追加模式 +python opencv_webcam.py -lm w # 设置为覆盖模式 +``` + + + + + #### :bulb: 指令查询 ```shell @@ -244,16 +259,21 @@ python opencv_webcam.py --help 指令查询结果 ```shell -usage: opencv_webcam.py [-h] [--device DEVICE] [--quit QUIT] [--is_autoSaveFrame] [--is_handSaveFrame] [--is_resizeFrame] [--frame_saveDir FRAME_SAVEDIR] [--frame_nSave FRAME_NSAVE] - [--frame_capKey FRAME_CAPKEY] [--resize_frame RESIZE_FRAME [RESIZE_FRAME ...]] [--resizeRatio_frame RESIZERATIO_FRAME] [--frame_namePrefix FRAME_NAMEPREFIX] - [--frame_saveStyle FRAME_SAVESTYLE] [--jpg_quality JPG_QUALITY] [--png_quality PNG_QUALITY] [--pause PAUSE] [--auto_frameNum AUTO_FRAMENUM] +usage: opencv_webcam.py [-h] [--device DEVICE] [--quit QUIT] [--is_autoSaveFrame] [--is_handSaveFrame] + [--is_resizeFrame] [--frame_saveDir FRAME_SAVEDIR] + [--frame_dirName FRAME_DIRNAME] [--frame_nSave FRAME_NSAVE] + [--frame_capKey FRAME_CAPKEY] [--resize_frame RESIZE_FRAME [RESIZE_FRAME ...]] + [--resizeRatio_frame RESIZERATIO_FRAME] [--frame_namePrefix FRAME_NAMEPREFIX] + [--frame_saveStyle FRAME_SAVESTYLE] [--jpg_quality JPG_QUALITY] + [--png_quality PNG_QUALITY] [--pause PAUSE] [--auto_frameNum AUTO_FRAMENUM] + [--logName LOGNAME] [--logMode LOGMODE] -OpenCV Webcam Script v0.2 +OpenCV Webcam Script v0.3 optional arguments: -h, --help show this help message and exit --device DEVICE, -dev DEVICE - device index for webcam + device index for webcam, 0 or rtsp --quit QUIT, -q QUIT quit key for webcam --is_autoSaveFrame, -isasf is auto save frame @@ -263,6 +283,8 @@ optional arguments: is resize frame --frame_saveDir FRAME_SAVEDIR, -fsd FRAME_SAVEDIR save frame dir + --frame_dirName FRAME_DIRNAME, -fdn FRAME_DIRNAME + save frame dir name --frame_nSave FRAME_NSAVE, -fns FRAME_NSAVE n frames save a frame (auto save frame) --frame_capKey FRAME_CAPKEY, -fck FRAME_CAPKEY @@ -283,6 +305,10 @@ optional arguments: webcam pause --auto_frameNum AUTO_FRAMENUM, -afn AUTO_FRAMENUM auto save number of frames + --logName LOGNAME, -ln LOGNAME + log Save Name + --logMode LOGMODE, -lm LOGMODE + log Save Mode ``` diff --git a/opencv_webcam.py b/opencv_webcam.py index 6c97e1c..6fcb1e2 100644 --- a/opencv_webcam.py +++ b/opencv_webcam.py @@ -70,7 +70,7 @@ def webcam_opencv(device_index=0, quit_key="q", pause_key="p", is_autoSaveFrame= hotkey_judge(keyList) # 快捷键冲突判断 # 日志文件 - is_logSuffix(logName) # 检测日志格式 + is_logSuffix(logName) # 检测日志格式 logTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) # 日志时间 log_management(f'{logTime}\n', logName, logMode) # 记录日志时间 # ------------------程序开始------------------