Skip to content

kingpeter2015/libovmatting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libovmatting

A C++ library for Background Matting using openvino and deep learning models.

Now support models such as BackgroundMattingV2, MODNet.

1 Application scenes


...

2 License

The code of libovmatting is released under the MIT License.

3 Development environment

CentOS 7
Ubuntu
Windows 10

4 Usage

4.1 Install openvino

Please refer https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit.html
Use version: openvino_2021.2.185

4.2 Build libovmatting library and test program

Clone the project
$git clone https://github.com/kingpeter2015/libovmatting.git

4.2.1 Ubuntu/CentOS

$cd libovmatting
$mkdir build
$cmake ..
$make

Run the test program
$cd ./build/
$LD_LIBRARY_PATH=./:$(LD_LIBRARY_PATH) ./sample

4.2.2 Windows 10

Install Visual Studio 2019
open Win64\ovmatting.sln
build and run in the Visual Studio IDE

5 About Source Code

5.1 Directory Structure

  • 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

5.2 Please Attention !!!

  • '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 !

6 Reference

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

About

A C++ library for Background Matting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published