Skip to content

Commit

Permalink
minor improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidDoukhan committed Jun 26, 2023
1 parent f4f607e commit 5f69611
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions inaFaceAnalyzer/face_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
methods on resulting images.
"""

import glob
from .face_detector import PrecomputedDetector
from .face_preprocessing import preprocess_face
from .opencv_utils import imwrite_rgb
Expand All @@ -44,9 +45,13 @@ def face_extractor(df, stream, output_dir, oshape, bbox2square, bbox_scale, face
for ituple, t in enumerate(df.itertuples()):
while iframe != t.frame:
iframe, frame = next(stream)
print(iframe, t.frame)
detection = detector(frame)
assert len(detection) == 1, len(detection)
detection = detection[0]
img, _ = preprocess_face(frame, detection, bbox2square, bbox_scale, face_aligner, oshape, False)
imwrite_rgb('%s/%08d.%s' % (output_dir, ituple, ext), img)
dst = '%s/%08d.%s' % (output_dir, ituple, ext)
if verbose:
print(dst)
imwrite_rgb(dst, img)
df['fname'] = sorted(glob.glob(output_dir + '/*.' + ext))
return df

0 comments on commit 5f69611

Please sign in to comment.