如何从Python使用OpenCV的C

如何从Python使用OpenCV的C

本文介绍了如何从Python使用OpenCV的C ++函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OpenCV的Python绑定,这真的很棒.但是,C ++版本中的某些功能在Python绑定,BackgroundSubstractorMOG2和许多功能检测算法中是缺失的.从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.

这是 github存储库,其中包含我为使用OpenCV的Mat类公开代码而编写的开放C ++代码尽可能少的痛苦.它最初是受 Yati Sagade的启发例子.

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 support for Python 3.X are now also available.

我还发现,在写完原始实用程序几个月后,Sudeep Pillai还写了一个类似C ++/CMake的东西.似乎也有OpenCV 2和OpenCV 3支持.可能值得一试.

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.

这篇关于如何从Python使用OpenCV的C ++函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 20:42