CoMiKx / face-smoothing

OpenCV implementation of facial smoothing. Facial detection is done using an pretrained TensorFlow face detection model.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Python 3.6

Face Smoothing: Detection and Beautification

Input Image Output Image w/ Facial Smoothing
alt text alt text

OpenCV implementation of facial smoothing. Facial detection is done using an pretrained TensorFlow face detection model. Facial smoothing is accomplished using the following steps:

  • Change image from BGR to HSV colorspace
  • Create mask of HSV image
  • Apply a bilateral filter to the Region of Interest
  • Apply filtered ROI back to original image

Install

git clone https://github.com/CoMiKx/face-smoothing.git
cd face-smoothing

Run

python [or python3] infer.py    --input 'path/to/input_file.jpg' (Input file - image, video, or folder with images and/or videos - default is hillary_clinton.jpg)
                                        'can/handle/videos.mp4'
                                        'as/well/as/directories'
                                --camera 'use your camera as input'
                                --output 'path/to/output_folder' (Output folder - default is data/output)
                                --save_steps 'path/to/file.jpg' (Concats images from each step of the process and saves them)
                                --show-detections (Saves bounding box detections to output)

Example: --save-steps flag

alt text

TODO

  • Finish documentation and cleanup functions
  • Reduce input image size for detections
  • Fix combined output
  • Test on multiple faces
  • Apply blurring on multiple faces
  • Video inference
  • Save bounding box to output
  • Add camera to input type
  • Apply different blurring techniques/advanced algo using facial landmarks to blur only skin regions
  • Unit tests
  • Run time tests on units

About

OpenCV implementation of facial smoothing. Facial detection is done using an pretrained TensorFlow face detection model.


Languages

Language:Python 67.4%Language:Jupyter Notebook 32.6%