DEV Community

Cover image for OpenCV-Snapchat Filter RestAPI with FastAPI
Deepak Raj
Deepak Raj

Posted on • Edited on

7 4

OpenCV-Snapchat Filter RestAPI with FastAPI

It's a Rest API for Face Filter using OpenCV, FastAPI.
Currently, It's using a simple haar cascade for face detection and applying mask by resizing on the face.
It can be integrated into the web app or Android/IOS mobile APP.

API-URL - http://opencv-api.herokuapp.com/
Documentation: http://opencv-api.herokuapp.com/docs
status: alpha

withot filter

face-filter

Try It with your picture.

you will get the Image Url in Response. open it in the browser.

Create a POST request with file-field to get the filtered Image.

import requests

url = "http://opencv-api.herokuapp.com/api/v1/facefilter"

# enter your full file path
file_path = ""

files ={
    'file': open(file_path, 'rb')
}

#choose mask 1 to 3
data ={
    'mask': 2
}

r = requests.post(url, files=files, data=data)
print(r.json())
Enter fullscreen mode Exit fullscreen mode

facefilter

face detection

Future roadmap

Facial keypoints and face emotion deep learning models for better accuracy and mask.

Share your Filtered Image in Comments and your Feedback.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (1)

Collapse
 
drakeentity profile image
Coding_Ninja

Great work buddy.

mypic

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay