Unity Open CV Example


Demo project demonstrating a DLL interop interface for accessing OpenCV C++ in Unity/C#


This is an example project OpenCV C++ (V4.0.0) compiled, included, and accessed as a dynamic library in Unity.

OpenCV_For_Unity is the VS project for compiling the DLL, which is then included in the Unity project.

Unity_OpenCV_Demo is a Unity project that demonstrates usage of the DLL for facial recognition

This project implements this tutorial series by Thomas Mountainborn, and extends it to demonstrate passing a byte array pointer in order to output the OpenCV feed in a Unity scene:

It also provide handling for unplugging and plugging back in devices (hotswapping).


-currently the DLL must be built as Release, and the Unity project will only build for x64

-the lbpcascade_frontface.xml file must be included in the build folder for the demo build to work


-there is currently a delay (freeze of the Unity scene) when hotswapping. This should be fixed by multithreading the code in Update()