Skip to content

Commit

Permalink
added function to get anonymized image
Browse files Browse the repository at this point in the history
  • Loading branch information
faaip committed Apr 26, 2021
1 parent 4fd379c commit 23ed39c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions deface/deface.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,29 @@ def get_file_type(path):
return mime


def get_anonymized_image(frame,
threshold: float,
replacewith: str,
mask_scale: float,
ellipse: bool,
draw_scores: bool,
):
"""
Method for getting an anonymized image without CLI
returns frame
"""

centerface = CenterFace(in_shape=None, backend='auto')
dets, _ = centerface(frame, threshold=threshold)

anonymize_frame(
dets, frame, mask_scale=mask_scale,
replacewith=replacewith, ellipse=ellipse, draw_scores=draw_scores
)

return frame


def parse_cli_args():
parser = argparse.ArgumentParser(description='Video anonymization by face detection', add_help=False)
parser.add_argument(
Expand Down

0 comments on commit 23ed39c

Please sign in to comment.