def __init__(self, min_size=(100, 100), max_size=None): storage = lib.cvCreateMemStorage(0) assert storage is not None self._storage = storage if min_size is None: min_width = min_height = 0 else: min_width, min_height = min_size if max_size is None: max_width = max_height = 0 else: max_width, max_height = max_size self._min_size = lib.cvSize(min_width, min_height) self._max_size = lib.cvSize(max_width, max_height)
def from_path(cls, path, **kwargs): cascade = lib.cvLoadHaarClassifierCascade( path.path, lib.cvSize(1, 1), ) if cascade == ffi.NULL: raise _CannotLoadClassifierCascade(path, cascade) return cls(cascade=cascade, **kwargs)