check_cascadeclassifier.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import numpy as np
00004 import cv2
00005 import sys
00006 
00007 def main():
00008     if len(sys.argv) < 3:
00009         print "Usage: check_cascadeclassifier.py cascade.xml [image_files ...]"
00010         sys.exit(1)
00011     classifier_file = sys.argv[1]
00012     files = sys.argv[2:]
00013     cascade = cv2.CascadeClassifier(classifier_file)
00014     for f in files:
00015         img = cv2.imread(f)
00016         try:
00017             if img != None:
00018                 faces = cascade.detectMultiScale(img, 1.3, 10)
00019                 for (x,y,w,h) in faces:
00020                     cv2.rectangle(img,(x,y),(x+w,y+h),(0,0,255),2)
00021                 cv2.imshow('img', img)
00022                 cv2.waitKey(100)
00023         except KeyboardInterrupt, e:
00024             raise e
00025         except Exception, e:
00026             pass
00027 
00028 if __name__ == "__main__":
00029     main()
00030     


jsk_perception
Author(s): Manabu Saito, Ryohei Ueda
autogenerated on Wed Sep 16 2015 04:36:15