-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_camera.py
More file actions
46 lines (38 loc) · 1.49 KB
/
test_camera.py
File metadata and controls
46 lines (38 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------
# 测试人脸对齐
# python ./tests/test_camera.py
# -----------------------------------------------
# 把父级目录(项目根目录)添加到工作路径
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
# ----------------------------------------------------------------------
import argparse
from src.utils.device import open_camera
from src.utils.image import del_image
from color_log.clog import log
def args() :
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
prog='测试摄像头',
description='测试摄像头初筛人脸',
epilog='\r\n'.join([
'仅开启摄像头: ',
' python ./tests/test_camera.py',
'启用人脸检测模型: ',
' python ./tests/test_camera.py -d',
'启用人脸网格模型: ',
' python ./tests/test_camera.py -m',
])
)
parser.add_argument('-d', '--detection', dest='detection', action='store_true', default=False, help='启用人脸检测模型')
parser.add_argument('-m', '--mesh', dest='mesh', action='store_true', default=False, help='启用人脸网格模型')
return parser.parse_args()
def test(args) :
imgpath = open_camera(True, args.detection, args.mesh)
log.info(imgpath)
del_image(imgpath)
if '__main__' == __name__ :
test(args())