Easy symmetrizer for an image contained face(s)
Project description
face-symmetrizer
- Easy symmetrizer for an image contained face(s)
Install
pip install face-symmetrizer
How
- Here is an example image of two people
Command
$ fsym -h
usage: fsym [-h] [--show] [--save] [--outdir dir] file [file ...]
Easy symmetrizer for an image contained face(s)
positional arguments:
file input image files
optional arguments:
-h, --help show this help message and exit
--show, -s show images (default: False)
--save save images (default: False)
--outdir dir, -o dir output directory of image (default: .)
- Detect with window and save symmetrized images to outimg
$ fsym img/two_people.jpg -o outimg -s --save
[+]image: img/two_people.jpg
[+]2 face(s) was detected.
[+]face: 0 # open window when using `-s`
[+]save: outimg/two_people.face-0.left_cropped.jpg
[+]save: outimg/two_people.face-0.left_cropped_inner.jpg
[+]save: outimg/two_people.face-0.left_cropped_outer.jpg
[+]save: outimg/two_people.face-0.right_cropped.jpg
[+]save: outimg/two_people.face-0.right_cropped_inner.jpg
[+]save: outimg/two_people.face-0.right_cropped_outer.jpg
[+]face: 1 # open window when using `-s`
[+]save: outimg/two_people.face-1.left_cropped.jpg
[+]save: outimg/two_people.face-1.left_cropped_inner.jpg
[+]save: outimg/two_people.face-1.left_cropped_outer.jpg
[+]save: outimg/two_people.face-1.right_cropped.jpg
[+]save: outimg/two_people.face-1.right_cropped_inner.jpg
[+]save: outimg/two_people.face-1.right_cropped_outer.jpg
Library
- First, load an image
from face_symmetrizer import FaceSym
# load from local file path
f = FaceSym("img/two_people.jpg")
# or, load from URL
# f = FaceSym("https://raw.githubusercontent.com/ageitgey/"
# "face_recognition/master/examples/two_people.jpg")
# ATTRS: ['image_location',
# 'f_img', 'f_img_PIL', 'image_size',
# 'face_locations', 'face_landmarks',
# 'mid_face_locations', 'face_count']
- Get & show a full image
f.get_full_image(show=True) #=> <PIL.Image.Image>
- Get & show an image of a rectangle drawn around a face.
f.get_face_box_drawed_image(show=True) #=> <PIL.Image.Image>
- Get & show cropped face(s)
f.get_cropped_face_images(show=True) #=> [<PIL.Image.Image>, ...]
- Get & show symmetrized images (face: 0)
f.get_symmetrized_images(show=True, idx=0)
#=> (left_cropped, left_cropped_inner, left_cropped_outer,
# right_cropped, right_cropped_inner, right_cropped_outer)
- Get & show symmetrized images (face: 1)
f.get_symmetrized_images(show=True, idx=1)
LICENSE
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
face_symmetrizer-1.4.tar.gz
(6.5 kB
view hashes)
Built Distribution
Close
Hashes for face_symmetrizer-1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b9a05f35d32367a7948597150dd75727e3eea4150e6513a0e9630539d59a6b9 |
|
MD5 | 400c5f3bc060ffb493b21df650ee562d |
|
BLAKE2b-256 | a5bca0a3be9d5bf2b7df1d19f93d134a1b4fe7c786bd78ddd4e06e57cd1c2785 |