简体   繁体   中英

How to use the C++ functions of OpenCV from Python?

I'm using the Python bindings of OpenCV and it's really great. However, there are functions in the C++ version that are missing from the Python bindings, BackgroundSubstractorMOG2, and a lots of feature detection algorithms for example. What would be the easiest way to call them from Python?

I hope this helps people looking for a fast and easy way.

Here is the github repo with the open C++ code I wrote for exposing code using OpenCV's Mat class with as little pain as possible. It was originally inspired by Yati Sagade's example .

[Update] This code now works for OpenCV 2.X and OpenCV 3.X . CMake and experimental support for Python 3.X are now also available.

I also found that a few months after my original utility was written, Sudeep Pillai also wrote a similar thing for C++/CMake. There seems to be OpenCV 2 and OpenCV 3 support as well. May be worth a try.

Have a look to SimpleCV . It Python base and it a warping OpenCV. Maybe you can found something there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM