A C++ library for Background Matting using openvino and deep learning models.
Now support models such as BackgroundMattingV2, MODNet.
...
The code of libovmatting is released under the MIT License.
CentOS 7
Ubuntu
Windows 10
Please refer https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit.html
Use version: openvino_2021.2.185
Clone the project
$git clone https://github.com/kingpeter2015/libovmatting.git
$cd libovmatting
$mkdir build
$cmake ..
$make
Run the test program
$cd ./build/
Install Visual Studio 2019
open Win64\ovmatting.sln
build and run in the Visual Studio IDE
- Win64: Windows Solution and projects
- include: contains header files. ovmatter.h is api header file
- libovmatting: CMakefiles for compile libovmatting.so under linux
- samples: four samples using libovmatting library
- share: contains model files which are used by openvino inference engine.
- src: contains source code files
main.cpp: startup point of demos
- 'include/ovmatter.h' is one only sdk header file which exposes api to applications.
- libovmatting library only supports two matting method: METHOD_BACKGROUND_MATTING_V2 and METHOD_MODNET. They are defined in include/ovmatter.h
- METHOD_BACKGROUND_MATTING_V2 method uses cnn model defined 'pytorch_mobilenetv2.bin/pytorch_mobilenetv2.xml'.
- METHOD_MODNET method uses cnn model defined in 'modnet.bin/modnet.xml'
if you want to use your own model, you can do following steps:
- Add a enum item in enum OV_MATTER_API MattingMethod which is defined in include/ovmatter.h
- declare and implement a new ovmatter class, and inherit 'MatterBaseImpl', then write a new cnn that uses your own models
That's all, have fun !
OpenVINO https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit.html
BackgroundMattingV2 https://github.com/PeterL1n/BackgroundMattingV2
MODNet https://github.com/ZHKKKe/MODNet