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 218d357 commit 4d7722c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions remotecv/detectors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com

from os.path import join, dirname, abspath, isabs
from os.path import join, dirname, abspath

import cv2
import numpy as np
Expand All @@ -25,10 +25,6 @@ def detect(self, context):
class CascadeLoaderDetector(BaseDetector):

def load_cascade_file(self, module_path, cascade_file_path):
# if not hasattr(self.__class__, 'cascade'):
# if isabs(cascade_file_path):
# cascade_file = cascade_file_path
# else:
cascade_file = join(abspath(dirname(module_path)), cascade_file_path)
self.__class__.cascade = cv2.CascadeClassifier(cascade_file)

Expand All @@ -37,8 +33,8 @@ def get_features(self, image):

faces = self.__class__.cascade.detectMultiScale(
img,
1.2,
2,
1.7,
1,
)
faces_scaled = []

Expand Down
2 changes: 1 addition & 1 deletion tests/test_image_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_when_detector_unavailable(self):

def test_when_image_is_huge(self):
image_processor = ImageProcessor()
detect = image_processor.detect('face', read_fixture('huge_image.jpg'))
detect = image_processor.detect('all', read_fixture('huge_image.jpg'))
expect(detect).Not.to_be_empty()

def test_when_not_animated_gif(self):
Expand Down

0 comments on commit 4d7722c

Please sign in to comment.