Skip to content

dreamsoftin/FaceTool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FaceTool

A simple python package to crop and align faces. Uses Mediapipe for face detection

Input Output
before after
before after

Output ZoomFactor 1 ZoomFactor 4 Offset -200
before after_zoom_1 after_zoom_4 after_offset_200

Requirements

  • Python 3.6
  • MediaPipe
  • OpenCV

install all dependencies

pip install -r requirements.txt

Usage

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

This repository contains some stock photos from Pexels.

About

Simple Python script to crop and align faces

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages