Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.face
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.bio.face
Commits
8740b92f
Commit
8740b92f
authored
9 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Fixed FaceDetector to also accept color images
parent
5882bc98
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/bio/face/preprocessor/FaceDetect.py
+10
-6
10 additions, 6 deletions
bob/bio/face/preprocessor/FaceDetect.py
doc/implementation.rst
+1
-1
1 addition, 1 deletion
doc/implementation.rst
with
11 additions
and
7 deletions
bob/bio/face/preprocessor/FaceDetect.py
+
10
−
6
View file @
8740b92f
...
...
@@ -107,7 +107,7 @@ class FaceDetect (Base):
# get the landmarks in the face
if
self
.
flandmark
is
not
None
:
# use the flandmark detector
uint8_image
=
image
.
astype
(
numpy
.
uint8
)
# make the bounding box square shape by extending the horizontal position by 2 pixels times width/20
bb
=
bob
.
ip
.
facedetect
.
BoundingBox
(
topleft
=
(
bounding_box
.
top_f
,
bounding_box
.
left_f
-
bounding_box
.
size
[
1
]
/
10.
),
size
=
bounding_box
.
size
)
...
...
@@ -115,7 +115,7 @@ class FaceDetect (Base):
left
=
max
(
bb
.
left
,
0
)
bottom
=
min
(
bb
.
bottom
,
image
.
shape
[
0
])
right
=
min
(
bb
.
right
,
image
.
shape
[
1
])
landmarks
=
self
.
flandmark
.
locate
(
uint8_
image
,
top
,
left
,
bottom
-
top
,
right
-
left
)
landmarks
=
self
.
flandmark
.
locate
(
image
,
top
,
left
,
bottom
-
top
,
right
-
left
)
if
landmarks
is
not
None
and
len
(
landmarks
):
return
{
...
...
@@ -136,7 +136,7 @@ class FaceDetect (Base):
**Parameters:**
image : 2D :py:class:`numpy.ndarray`
image : 2D
or 3D
:py:class:`numpy.ndarray`
The face image to be processed.
annotations : any
...
...
@@ -144,14 +144,18 @@ class FaceDetect (Base):
**Returns:**
face : 2D :py:class:`numpy.ndarray` (float)
face : 2D
or 3D
:py:class:`numpy.ndarray` (float)
The detected and cropped face.
"""
uint8_image
=
image
.
astype
(
numpy
.
uint8
)
if
uint8_image
.
ndim
==
3
:
uint8_image
=
bob
.
ip
.
color
.
rgb_to_gray
(
uint8_image
)
# detect the face
bounding_box
,
self
.
quality
=
bob
.
ip
.
facedetect
.
detect_single_face
(
image
,
self
.
cascade
,
self
.
sampler
,
self
.
detection_overlap
)
bounding_box
,
self
.
quality
=
bob
.
ip
.
facedetect
.
detect_single_face
(
uint8_
image
,
self
.
cascade
,
self
.
sampler
,
self
.
detection_overlap
)
# get the eye landmarks
annotations
=
self
.
_landmarks
(
image
,
bounding_box
)
annotations
=
self
.
_landmarks
(
uint8_
image
,
bounding_box
)
# apply face cropping
return
self
.
cropper
.
crop_face
(
image
,
annotations
)
...
...
This diff is collapsed.
Click to expand it.
doc/implementation.rst
+
1
−
1
View file @
8740b92f
...
...
@@ -81,7 +81,7 @@ Or simply (using the face detector :ref:`Resource <bob.bio.face.preprocessors>`)
.. code-block:: py
preprocessor = bob.bio.face.preprocessor.TanTriggs(face_cropper = '
face-crop-eyes
')
preprocessor = bob.bio.face.preprocessor.TanTriggs(face_cropper = '
landmark-detect
')
.. _bob.bio.face.resources:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment