#!/usr/bin/python """ This program is demonstration for face and object detection using haar-like features. The program finds faces in a camera image or video stream and displays a red box around them. Original C implementation by: ? Python implementation by: Roman Stanchak, James Bowman """ import sys import cv2.cv as cv from optparse import OptionParser # Parameters for haar detection # From the API: # The default parameters (scale_factor=2, min_neighbors=3, flags=0) are tuned # for accurate yet slow object detection. For a faster operation on real video # images the settings are: # scale_factor=1.2, min_neighbors=2, flags=CV_HAAR_DO_CANNY_PRUNING, # min_size== 0: break else: image = cv.LoadImage(input_name, 1) detect_and_draw(image, cascade) cv.WaitKey(0) cv.DestroyWindow("result")