summaryrefslogtreecommitdiff
path: root/megapixels/commands/cv/face_landmark_3d_68.py
diff options
context:
space:
mode:
authoradamhrv <adam@ahprojects.com>2019-01-07 02:26:34 +0100
committeradamhrv <adam@ahprojects.com>2019-01-07 02:26:34 +0100
commit5e5a7d09774bde195fe31ae143704eb124a764ac (patch)
tree20e48a5f80e94c5021c01e9558de8af873e2eaf7 /megapixels/commands/cv/face_landmark_3d_68.py
parent4bcb82c0f295d79d3d247252e7e98b2d986ae821 (diff)
add demos, in progress
Diffstat (limited to 'megapixels/commands/cv/face_landmark_3d_68.py')
-rw-r--r--megapixels/commands/cv/face_landmark_3d_68.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/megapixels/commands/cv/face_landmark_3d_68.py b/megapixels/commands/cv/face_landmark_3d_68.py
index 56e60cda..a2d14d72 100644
--- a/megapixels/commands/cv/face_landmark_3d_68.py
+++ b/megapixels/commands/cv/face_landmark_3d_68.py
@@ -57,6 +57,7 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_dir_media, opt_data_store, opt_dataset,
import pandas as pd
from app.utils import logger_utils, file_utils, im_utils, display_utils, draw_utils
+ from app.utils import plot_utils
from app.processors import face_landmarks
from app.models.data_store import DataStore
from app.models.bbox import BBox
@@ -65,7 +66,7 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_dir_media, opt_data_store, opt_dataset,
# init here
log = logger_utils.Logger.getLogger()
- log.warn('3D landmark points are normalized in a (200, 200, 200) XYZ space')
+ log.warn('not normalizing points')
# init filepaths
data_store = DataStore(opt_data_store, opt_dataset)
# set file output path
@@ -76,7 +77,7 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_dir_media, opt_data_store, opt_dataset,
return
# init face landmark processors
- if opt_detector_type == types.FaceLandmark2D_5.FACE_ALIGNMENT:
+ if opt_detector_type == types.FaceLandmark3D_68.FACE_ALIGNMENT:
# use FaceAlignment 68 point 3D detector
landmark_detector = face_landmarks.FaceAlignment3D_68()
else:
@@ -122,16 +123,18 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_dir_media, opt_data_store, opt_dataset,
# get landmark points
points = landmark_detector.landmarks(im_resized, bbox)
# NB can't really normalize these points, but are normalized against 3D space
- points_norm = landmark_detector.normalize(points, dim) # normalized using 200
+ #points_norm = landmark_detector.normalize(points, dim) # normalized using 200
points_flattenend = landmark_detector.flatten(points)
# display to screen if optioned
if opt_display:
- draw_utils.draw_landmarks2D(im_resized, points)
+ draw_utils.draw_landmarks3D(im_resized, points)
draw_utils.draw_bbox(im_resized, bbox)
cv.imshow('', im_resized)
display_utils.handle_keyboard()
+ #plot_utils.generate_3d_landmark_anim(points, '/home/adam/Downloads/3d.gif')
+
results.append(points_flattenend)
# create DataFrame and save to CSV