mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
work on facedetect sample
This commit is contained in:
parent
64de562db2
commit
9af213bf60
23
samples/python2/facedetect.py
Normal file
23
samples/python2/facedetect.py
Normal file
@ -0,0 +1,23 @@
|
||||
import numpy as np
|
||||
import cv2
|
||||
from video import create_capture
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys, getopt
|
||||
|
||||
args, video_src = getopt.getopt(sys.argv[1:], '', ['cascade=', 'nested-cascade='])
|
||||
try: video_src = video_src[0]
|
||||
except: video_src = '0'
|
||||
cascade_fn = args.get('--cascade', "../../data/haarcascades/haarcascade_frontalface_alt.xml")
|
||||
nested_fn = args.get('--nested-cascade', "../../data/haarcascades/haarcascade_eye.xml.xml")
|
||||
|
||||
|
||||
cam = create_capture(video_src)
|
||||
|
||||
while True:
|
||||
ret, img = cam.read()
|
||||
cv2.imshow('facedetect', img)
|
||||
|
||||
if cv2.waitKey(5) == 27:
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user