This commit is contained in:
13339479676 2022-01-19 09:08:16 +08:00
parent a1bc00e74c
commit b6625d9cb8
2 changed files with 26 additions and 2 deletions

View File

@ -15,6 +15,9 @@ from utils.hotkey import hotkey_judge
from utils.frame_opt import frame_opt
from utils.log import is_logSuffix, log_management
from utils.args_yaml import argsYaml
from utils.compress import webcam_zip
ROOT_PATH = sys.path[0] # 项目根目录
def parse_args(known=False):
@ -59,6 +62,11 @@ def parse_args(known=False):
default="test.log", type=str, help='log save name')
parser.add_argument('--logMode', '-lm',
default="a", type=str, help='log write mode')
# 压缩
parser.add_argument('--is_compress', '-ic',
action='store_true', help='is compress file')
parser.add_argument('--zipName', '-zn',
default="test.zip", type=str, help='zip save name')
args = parser.parse_known_args()[0] if known else parser.parse_args()
return args
@ -82,7 +90,9 @@ def webcam_opencv(device_index="0",
jpg_quality=95,
png_quality=3,
logName="test.log",
logMode="a"):
logMode="a",
is_compress=False,
zipName="test.zip"):
keyList = [quit_key, frame_capKey, pause_key] # 快捷键列表
hotkey_judge(keyList) # 快捷键冲突判断
@ -174,6 +184,10 @@ def webcam_opencv(device_index="0",
print(outTimeMsg)
log_management(f'{outTimeMsg}\n', logName, logMode) # 记录用时
# ------------------压缩文件------------------
if (is_compress):
webcam_zip(f'{ROOT_PATH}/{zipName}', frame_savePath)
def main(args):
device_index = args.device
@ -193,9 +207,15 @@ def main(args):
png_quality = args.png_quality
pause_key = args.pause
auto_frameNum = args.auto_frameNum
# 日志
logName = args.logName
logMode = args.logMode
# 压缩
is_compress = args.is_compress
zipName = args.zipName
argsYaml(args) # 脚本参数
# 调用webcam opencv
@ -217,7 +237,9 @@ def main(args):
jpg_quality,
png_quality,
logName,
logMode)
logMode,
is_compress,
zipName)
if __name__ == '__main__':

2
v04.md
View File

@ -8,6 +8,8 @@
### 功能更新
- 加入docker vim编辑器
- 加入视频帧压缩功能
- 加入自定义压缩文件名称
### BUG修复