Skip to content

Commit

Permalink
improving detection speed
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermef committed Nov 6, 2015
1 parent 143f0a2 commit c487097
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions remotecv/detectors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ def load_cascade_file(self, module_path, cascade_file_path):
cascade_file = join(abspath(dirname(module_path)), cascade_file_path)
self.__class__.cascade = cv2.CascadeClassifier(cascade_file)

def get_min_size_for(self, size):
ratio = int(min(size[0], size[1]) / 15)
ratio = max(20, ratio)
return (ratio, ratio)

def get_features(self, image):
img = self.get_np_img(image)

faces = self.__class__.cascade.detectMultiScale(
img,
1.7,
1,
1.2,
4,
minSize=self.get_min_size_for(image.size)
)
faces_scaled = []

Expand Down
Binary file modified tests/fixtures/glasses.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c487097

Please sign in to comment.