readme v04 zip update
This commit is contained in:
parent
4ce6161761
commit
d2e9293edf
13
README.md
13
README.md
|
@ -259,6 +259,19 @@ python opencv_webcam.py -lm w # 设置为覆盖模式
|
|||
|
||||
|
||||
|
||||
#### :bulb: 视频帧压缩
|
||||
|
||||
```shell
|
||||
# 常规压缩,默认test.zip(以自动版为例)
|
||||
python opencv_webcam.py -isasf -ic
|
||||
# 自定义压缩文件名称
|
||||
python opencv_webcam.py -isasf -ic -zn test02.zip
|
||||
# 自动命名压缩文件
|
||||
python opencv_webcam.py -isasf -ic -isazn
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### :bulb: 指令查询
|
||||
|
|
|
@ -65,6 +65,8 @@ def parse_args(known=False):
|
|||
# 压缩
|
||||
parser.add_argument('--is_compress', '-ic',
|
||||
action='store_true', help='is compress file')
|
||||
parser.add_argument('--is_autoZipName', '-isazn',
|
||||
action='store_true', help='is auto zip name')
|
||||
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()
|
||||
|
@ -92,6 +94,7 @@ def webcam_opencv(device_index="0",
|
|||
logName="test.log",
|
||||
logMode="a",
|
||||
is_compress=False,
|
||||
is_autoZipName=False,
|
||||
zipName="test.zip"):
|
||||
|
||||
keyList = [quit_key, frame_capKey, pause_key] # 快捷键列表
|
||||
|
@ -186,7 +189,7 @@ def webcam_opencv(device_index="0",
|
|||
|
||||
# ------------------压缩文件------------------
|
||||
if (is_compress):
|
||||
webcam_zip(f'{ROOT_PATH}/{zipName}', frame_savePath) # 自定义压缩文件名称
|
||||
webcam_zip(is_autoZipName, f'{ROOT_PATH}/{zipName}', frame_savePath) # 自定义压缩文件名称
|
||||
|
||||
|
||||
def main(args):
|
||||
|
@ -214,6 +217,7 @@ def main(args):
|
|||
|
||||
# 压缩
|
||||
is_compress = args.is_compress
|
||||
is_autoZipName = args.is_autoZipName
|
||||
zipName = args.zipName
|
||||
|
||||
argsYaml(args) # 脚本参数
|
||||
|
@ -239,6 +243,7 @@ def main(args):
|
|||
logName,
|
||||
logMode,
|
||||
is_compress,
|
||||
is_autoZipName,
|
||||
zipName)
|
||||
|
||||
|
||||
|
|
|
@ -18,10 +18,14 @@ def is_zipFile(zipName):
|
|||
|
||||
|
||||
# zip压缩
|
||||
def webcam_zip(zipName, preZipFilePath):
|
||||
is_zipFile(zipName)
|
||||
def webcam_zip(is_autoZipName, zipName, preZipFilePath):
|
||||
if (is_autoZipName):
|
||||
auto_zipName = str(preZipFilePath).split('/')[-1]
|
||||
zip_file = zipfile.ZipFile(f'{auto_zipName}.zip', 'a')
|
||||
|
||||
zip_file = zipfile.ZipFile(zipName, 'a')
|
||||
else:
|
||||
is_zipFile(zipName)
|
||||
zip_file = zipfile.ZipFile(zipName, 'a')
|
||||
|
||||
# ----------压缩开始----------
|
||||
file_list = os.listdir(preZipFilePath)
|
||||
|
|
Loading…
Reference in New Issue