Skip to content

In a Unity environment, images streamed using FFmpeg are Mat-converted using OpenCV and face detection is performed by Dlib.

Notifications You must be signed in to change notification settings

TakumiSenaha/FaceDetectionUsingFfmpegWithDlibInUnity

Repository files navigation

FaceDetectionUsingFfmpegWithDlibInUnity

In a Unity environment, images streamed using FFmpeg are Mat-converted using OpenCV and face detection is performed by Dlib.

Environmental Construction

  1. Create a Unity project with a 3D template.

  2. Window→Package Manager → Set "Packages" to "My Assets" in the upper left corner and import "OpenCV For Unity".

  • Set up the system using the setup tool.

  1. Import and setup Dlib Face Landmark Detector in the same way.

  2. Import and Setup FFmpeg for Unity.

  3. Import Runtime Inspector & Hierarchy.

  4. Import In-game Debug Console.

  5. Import FfmpegWithOpenCVForUnityExample.unitypackage.

  6. Rewrite the C# script named FfplayToMatHelperExample.cs in Assets/FfmpegWithOpenCVForUnityExample/FfplayToMatHelperExample/ (see diagram below) to the code named FfPlayStreamingFaceDetectionExample.cs

By setting the URL appropriately, face detection can be performed from streaming video. (However, we have confirmed that the delay is quite large.)

It is hard to see, but it detects a face and marks around the face. (All sky equirectangular format)

About

In a Unity environment, images streamed using FFmpeg are Mat-converted using OpenCV and face detection is performed by Dlib.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages