'**SUMMARY**
A Haar like feature cascase is a really robust way of finding the location
of a known object. This technique works really well for a few specific applications
like face, pedestrian, and vehicle detection. It is worth noting that this
approach **IS NOT A MAGIC BULLET** . Creating a cascade file requires a large
number of images that have been sorted by a human.vIf you want to find Haar
Features (useful for face detection among other purposes) this will return
Haar feature objects in a FeatureSet.
For more information, consult the cv.HaarDetectObjects documentation.
To see what features are available run img.listHaarFeatures() or you can
provide your own haarcascade file if you have one available.
Note that the cascade parameter can be either a filename, or a HaarCascade
loaded with cv.Load(), or a SimpleCV HaarCascade object.
**PARAMETERS**
* *cascade* - The Haar Cascade file, this can be either the path to a cascade
file or a HaarCascased SimpleCV object that has already been
loaded.
* *scale_factor* - The scaling factor for subsequent rounds of the Haar cascade
(default 1.2) in terms of a percentage (i.e. 1.2 = 20% increase in size)
* *min_neighbors* - The minimum number of rectangles that makes up an object. Ususally
detected faces are clustered around the face, this is the number
of detections in a cluster that we need for detection. Higher
values here should reduce false positives and decrease false negatives.
* *use-canny* - Whether or not to use Canny pruning to reject areas with too many edges
(default yes, set to 0 to disable)
* *min_size* - Minimum window size. By default, it is set to the size
of samples the classifier has been trained on ((20,20) for face detection)
* *max_size* - Maximum window size. By default, it is set to the size
of samples the classifier has been trained on ((1000,1000) for face detection)
**RETURNS**
A feature set of HaarFeatures
**EXAMPLE**
>>> faces = HaarCascade("./SimpleCV/Features/HaarCascades/face.xml","myFaces")
>>> cam = Camera()
>>> while True:
>>>     f = cam.getImage().findHaarFeatures(faces)
>>>     if( f is not None ):
>>>          f.show()
**NOTES**
OpenCV Docs:
- http://opencv.willowgarage.com/documentation/python/objdetect_cascade_classification.html
Wikipedia:
- http://en.wikipedia.org/wiki/Viola-Jones_object_detection_framework
- http://en.wikipedia.org/wiki/Haar-like_features
The video on this pages shows how Haar features and cascades work to located faces:
- http://dismagazine.com/dystopia/evolved-lifestyles/8115/anti-surveillance-how-to-hide-from-machines/'

def findHaarFeatures(self, cascade, scale_factor=1.2, min_neighbors=2, use_canny=cv.CV_HAAR_DO_CANNY_PRUNING, min_size=(20, 20), max_size=(1000, 1000)):

    storage = cv.CreateMemStorage(0)
    from SimpleCV.Features.HaarCascade import HaarCascade
    if isinstance(cascade, basestring):
        cascade = HaarCascade(cascade)
        if (not cascade.getCascade()):
            return None
    elif isinstance(cascade, HaarCascade):
        pass
    else:
        logger.warning('Could    not    initialize    HaarCascade.    Enter    Valid    cascade    value.')
    try:
        import cv2
        haarClassify = cv2.CascadeClassifier(cascade.getFHandle())
        objects = haarClassify.detectMultiScale(self.getGrayNumpyCv2(), scaleFactor=scale_factor, minNeighbors=min_neighbors, minSize=min_size, flags=use_canny)
        cv2flag = True
    except ImportError:
        objects = cv.HaarDetectObjects(self._getEqualizedGrayscaleBitmap(), cascade.getCascade(), storage, scale_factor, min_neighbors, use_canny, min_size)
        cv2flag = False
    if (objects is not None):
        return FeatureSet([HaarFeature(self, o, cascade, cv2flag) for o in objects])
    return None
