Skip to content

Commit

Permalink
add-grayscale-equalized (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbtravi committed Dec 6, 2022
1 parent a3ac472 commit 9888703
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 10 additions & 1 deletion remotecv/detectors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,17 @@ def get_min_size_for(self, size):
def get_features(self, image):
img = self.get_np_img(image)

return self.get_faces(img, image.size)

def get_grayscale_equalized_features(self, image):
img = self.get_np_img(image)
img_equalized = cv2.equalizeHist(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY))

return self.get_faces(img_equalized, image.size)

def get_faces(self, image, image_size):
faces = self.__class__.cascade.detectMultiScale(
img, 1.2, 4, minSize=self.get_min_size_for(image.size)
image, 1.2, 4, minSize=self.get_min_size_for(image_size)
)
faces_scaled = []

Expand Down
1 change: 0 additions & 1 deletion remotecv/detectors/complete_detector/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# thumbor imaging service
Expand Down
5 changes: 2 additions & 3 deletions remotecv/detectors/face_detector/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# thumbor imaging service
# https://github.com/globocom/thumbor/wiki

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
# Copyright (c) 2011 globo.com <thumbor@g.globo>

from remotecv.detectors import CascadeLoaderDetector

Expand All @@ -22,7 +21,7 @@ def __add_hair_offset(self, top, height):
return top

def detect(self, image):
features = self.get_features(image)
features = self.get_grayscale_equalized_features(image)
points = []
if features:
for (left, top, width, height), _neighbors in features:
Expand Down

0 comments on commit 9888703

Please sign in to comment.