Detect faces and draw overlay images
Project description
Snappy 2
Introduction
Snappy2 makes it easy to draw fun overlays on images. It uses a neural network to detect face keypoints and then uses those key points to draw overlays such as glasses, mustaches, hats, ears, and custom overlays on the face. The library is easy to use and comes with several code examples to get started quickly with a variety of drawing options:
- draw glasses
- draw mustache
- draw hat
- draw ears
- draw any overlay
- draw text
Classes
- Snappy2: the main class object and one place for all snappy library control.
- Detector: provides advanced functionality for getting face keypoints.
- FacePainter: helper functions for drawing on top of images based on the received keypoints.
Imports
from snappy2 import Snappy2
Code Examples (How to)
- Draw Mustache on face (3 lines)
human_image = snappy2.load_image('<file_path>')
snappy2 = Snappy2()
snappy2.set_mustache(human_image, mus_index=0)
- Draw glasses on face (3 lines)
human_image = snappy2.load_image('<file_path>')
snappy2 = Snappy2()
snappy2.set_glasses(human_image, gls_index=0)
- Draw ears on face (3 lines)
human_image = snappy2.load_image('<file_path>')
snappy2 = Snappy2()
snappy2.set_ears(human_image, gls_index=0)
Github setup
Github code available here. For more examples check the (Demo.py).
Disclaimer
This library utilizes photos that are freely accessible on the web. If any of the example photos have licensing restrictions, please reach out to the library owner directly for clarification or removal.
License
The MIT License (MIT)
Copyright (c) 2017 Ahmad Barqawi (github.com/Barqawiz)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snappy2-0.2.tar.gz.
File metadata
- Download URL: snappy2-0.2.tar.gz
- Upload date:
- Size: 22.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0bde1aa8fa3805f784cde0ef9c61f2ba0b7d298a7dbd829e09a9538b3ed0594
|
|
| MD5 |
824cd53727df4dd653f1721e6030dadf
|
|
| BLAKE2b-256 |
a1bb98706acfcf6579a5e5fd37f111d92fc898576bb82258e23e167e774d7276
|
File details
Details for the file snappy2-0.2-py3-none-any.whl.
File metadata
- Download URL: snappy2-0.2-py3-none-any.whl
- Upload date:
- Size: 44.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0387057ac1796d9a35cf617093abb3b90c0e717d36409032a7fcf74b2d25c779
|
|
| MD5 |
354baef590ead51a868594a7b756df4a
|
|
| BLAKE2b-256 |
cd06f521c185c8d29a9bd7da5546a982e089ec353990b346eeea71f6daccd230
|