Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
scripts
check_cascadeclassifier.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
import
numpy
as
np
4
import
cv2
5
import
sys
6
7
def
main
():
8
if
len(sys.argv) < 3:
9
print(
"Usage: check_cascadeclassifier.py cascade.xml [image_files ...]"
)
10
sys.exit(1)
11
classifier_file = sys.argv[1]
12
files = sys.argv[2:]
13
cascade = cv2.CascadeClassifier(classifier_file)
14
for
f
in
files:
15
img = cv2.imread(f)
16
try
:
17
if
img !=
None
:
18
faces = cascade.detectMultiScale(img, 1.3, 10)
19
for
(x,y,w,h)
in
faces:
20
cv2.rectangle(img,(x,y),(x+w,y+h),(0,0,255),2)
21
cv2.imshow(
'img'
, img)
22
cv2.waitKey(100)
23
except
KeyboardInterrupt
as
e:
24
raise
e
25
except
Exception
as
e:
26
pass
27
28
if
__name__ ==
"__main__"
:
29
main
()
30
check_cascadeclassifier.main
def main()
Definition:
check_cascadeclassifier.py:7
jsk_perception
Author(s): Manabu Saito, Ryohei Ueda
autogenerated on Mon May 3 2021 03:03:27