#!/usr/bin/python from opencv.cv import * from opencv.highgui import * class Camera(object): def __init__(self, debug=False): self.debug = debug self.cascade = cvLoadHaarClassifierCascade("haarcascade_frontalface_alt.xml", cvSize(1,1)) self.device = cvCreateCameraCapture(0) self.storage = cvCreateMemStorage(0) if self.debug: cvNamedWindow("result", 1) self.frame_copy = None # Parameters for haar detection # From the API: # The default parameters (scale_factor=1.1, 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=