Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VisionX
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
Software
ArmarX
VisionX
Commits
bc24891d
Commit
bc24891d
authored
2 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Fix imports, handling images without faces
parent
3815c61a
No related branches found
No related tags found
1 merge request
!146
Face recognition
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/armarx_face_recognition/armarx_face_recognition/face_detection.py
+13
-6
13 additions, 6 deletions
...ace_recognition/armarx_face_recognition/face_detection.py
with
13 additions
and
6 deletions
python/armarx_face_recognition/armarx_face_recognition/face_detection.py
+
13
−
6
View file @
bc24891d
...
...
@@ -10,13 +10,16 @@ import cv2
import
numpy
as
np
import
face_recognition
from
armarx_core
import
cmake_helper
from
armarx_core
import
slice_loader
from
armarx
import
arviz
as
viz
from
armarx_memory
import
client
as
mem
from
armarx.pose_helper
import
convert_position_to_global
from
armarx
import
FramedPositionBase
slice_loader
.
load_armarx_slice
(
"
VisionX
"
,
"
core/ImageProcessorInterface.ice
"
)
slice_loader
.
load_armarx_slice
(
"
VisionX
"
,
"
components/Calibration.ice
"
)
from
armarx_vision.image_processor
import
ImageProcessor
from
visionx
import
StereoCalibrationInterfacePrx
...
...
@@ -80,11 +83,15 @@ class FaceDetection(ImageProcessor):
abs_path
=
face_image_path
.
get_system_path
()
if
os
.
path
.
isfile
(
abs_path
):
name
=
profile
.
names
.
spoken
[
0
]
or
id
.
entity_name
if
logger
is
not
None
:
logger
.
info
(
"
Loading person
'
%s
'
.
"
,
name
)
logger
.
debug
(
"
Creating face encoding for person
'
%s
'
.
"
,
name
)
image
=
face_recognition
.
load_image_file
(
abs_path
)
encoding
=
face_recognition
.
face_encodings
(
image
)[
0
]
encodings_of_faces
=
face_recognition
.
face_encodings
(
image
)
if
len
(
encodings_of_faces
)
>
0
:
if
logger
:
logger
.
info
(
f
"
Loaded image of person
'
{
name
}
'
from
'
{
abs_path
}
.
"
)
encoding
=
encodings_of_faces
[
0
]
else
:
if
logger
:
logger
.
info
(
f
"
Found no faces in image
'
{
abs_path
}
'
...
"
)
face_encodings
.
append
(
encoding
)
...
...
@@ -193,7 +200,7 @@ class FaceDetection(ImageProcessor):
position_3d
=
position_3d
,
position_2d
=
position_2d
,
extents_2d
=
extents_2d
,
profile_id
=
person
.
profile_id
profile_id
=
person
.
profile_id
,
)
face_recognitions
.
append
(
recognition
)
...
...
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