Automatic face blur tool that follows contour of the face in both photos and videos.
This face blur tool started with this question. My face blur tool finds faces in an accurate and fast way using pretrained RetinaFace model. This tool stands out by generating a blur mask that precisely follows the contours of the face. I utilized dlib to create a custom polygon shape by connecting facial landmarks. You can apply this tool in both image and video data. I hope this tool can be helpful in creating visually comfortable face blurring :)
Street_people_short_after.mp4
- Clone this repo
git clone <<repo link>>
- Navigate to 'model' folder
cd model
- Install required packages
pip install -r requirements.txt
- Run the command
python auto_blur.py -i <<input img or video path>> -o <<output img or video path>> -t <<type "img" or "video">>
- If you are trying to blur the image : Type "img" for the -t argument.
- If you are trying to blur the video : Type "video" for the -t argument.
- Change the blur type or size!
: Current blur is using GaussianBlur. You may try other types of blur such as median blur, blur, or bilateral filter. You can even adjust the density of blur by changing the blur size at auto_blur.py file. - Modify the code if you want to add sound to the video
: You can add sound to the output video file by separately adding audio track or modifying code.