stream-labs / facemask-plugin

(sl)obs filter plug-in for detecting faces and drawing masks on them
GNU General Public License v2.0
142 stars 48 forks source link

obs-facemask-plugin

A libOBS filter plugin that detects faces and draws masks with the detected data.

Compiling

How It Works

The plugin is an OBS filter plugin. It can be broken down into 2 main parts; the plugin, and the face detection. The face detection runs in its own thread, separate from OBS.

The plugin portion performs the following duties:

The face detection portion runs in its own thread. It consumes frame data from the circular buffer, does the face detection computation, then feeds the resulting face data to a circular buffer that is consumed by the rendering.

The process of face detection consists of four main operations:

The FaceDetect object manages these operations and a current state, so that it performs the face detection, then uses object tracking to follow the face, then does landmark/3d pose estimation, and then the mesh subdivision for face morphing.

Useful Links

Generating thumbnails

Setting up:

Generation:

Note: if you want to regenerate existing mask, restart the program and remove associated thumbnails from the demo folder

Unit Testing

For Unit Testing CppUtest framework is used

Video Comparison side by side

Setting up:

Adding red frame at the start of the video:

Formatting video makes start/end of the looped video detectable by adding a red frame at the start

Record Video:

Generate Side By Side Video: