https://github.com/dreamsoftin/facetool
  
  
    Simple Python script to crop and align faces 
    https://github.com/dreamsoftin/facetool
  
        Last synced: about 2 months ago 
        JSON representation
    
Simple Python script to crop and align faces
- Host: GitHub
- URL: https://github.com/dreamsoftin/facetool
- Owner: dreamsoftin
- License: mit
- Created: 2021-06-13T12:48:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-17T07:41:56.000Z (over 4 years ago)
- Last Synced: 2023-03-02T15:09:25.147Z (over 2 years ago)
- Language: Python
- Size: 1.35 MB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 1
- 
            Metadata Files:
            - Readme: README.md
- License: LICENSE.txt
 
Awesome Lists containing this project
README
          # FaceTool
A simple python package to crop and align faces. Uses Mediapipe for face detection
|Input |Output|
--- | --- |
|||
|||
---
|Output |ZoomFactor 1| ZoomFactor 4| Offset -200|
--- | --- | --- | ----
||||
---
## Requirements
* Python 3.6
* MediaPipe
* OpenCV
install all dependencies
```bash
pip install -r requirements.txt
```
---
## Usage
```PYTHON
facetool = FaceTool(debug=False)
#Crop and Align, Returns 3 Parameters (face_count, faces array)
face_count, faces, message = facetool.crop_and_align(image, size=512, zoom_factor=2, offset_y=-10)
if face_count > 0:
    # face are sorted by area
    # takes the face with largest area.
    cv2.imshow("cropped_image_0", faces[0].image)
```
---
Acknowledgements
----------------
The alignment code is partially Based on the tutorial by [datahacker.rs](http://datahacker.rs/010-how-to-align-faces-with-opencv-in-python/)
This repository contains some stock photos from [Pexels].
[Pexels]: https://www.pexels.com/