Skip to main content

Easy symmetrizer for an image contained face(s)

Project description

face-symmetrizer

PyPI version GitHub release

pre-commit.ci status

  • Easy symmetrizer for an image contained face(s)

Install

pip install face-symmetrizer

How

  • Here is an example image of two people

fig0

Command

$ fsym -h
usage: fsym [-h] [-s] [-S] [-q] [-o 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
  -s, --show            show images (default: False)
  -S, --save            save images (default: False)
  -q, --quiet           make log quiet (default: False)
  -o dir, --outdir dir  directory when saving images (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>

fig1

  • Get & show an image of a rectangle drawn around a face.
f.get_face_box_drawed_image(show=True) #=> <PIL.Image.Image>

fig2

  • Get & show cropped face(s)
f.get_cropped_face_images(show=True) #=> [<PIL.Image.Image>, ...]

fig3 fig4

  • 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)

fig5

  • Get & show symmetrized images (face: 1)
f.get_symmetrized_images(show=True, idx=1)

fig6

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.8.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

face_symmetrizer-1.8.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file face_symmetrizer-1.8.1.tar.gz.

File metadata

  • Download URL: face_symmetrizer-1.8.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for face_symmetrizer-1.8.1.tar.gz
Algorithm Hash digest
SHA256 0f4b831b0f584d8329049cbc8885dcd1b38cab7a7c3ff990bbdc6eff7e397f6e
MD5 e74d3981b97e4061fb91aa6d01037062
BLAKE2b-256 95a96b310be341b2922b3c0bff03b799ea21e0a2a3841b5ca83e5d0d9a18300a

See more details on using hashes here.

File details

Details for the file face_symmetrizer-1.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for face_symmetrizer-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd4bcadf237bedb582815826b7ea23fbce7e0f4b41377ade7cea5f42de1e71e5
MD5 b6e07937c5a80a267a40d75eea41975f
BLAKE2b-256 a4ab79db3e7ee8a98b5f8d9b9c33406ad5f3c93fea58b937b6d476d4fed16cd6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page