在 OpenCV 中,一些方法只存在于 c++ 中,如何在 python 中做同样的事情?

Posted

技术标签:

【中文标题】在 OpenCV 中,一些方法只存在于 c++ 中,如何在 python 中做同样的事情?【英文标题】:Within OpenCV,some methods exist in c++ only,how to do same thing in python? 【发布时间】:2017-04-24 09:57:10 【问题描述】:

例如:

  BackgroundSubtractorMOG2::setShadowThreshold(double threshold)

在python中

cv2.createBackgroundSubtractorMOG2(detectShadows=True)

会返回一个对象,但是这个对象没有任何方法,那么如何在python中设置shadow threshod呢?

【问题讨论】:

【参考方案1】:

当执行help(cv2.createBackgroundSubtractorMOG2()) 时,它会显示Python 绑定上可用的方法。 setShadowThreshold() 在那里。创建一个 MOG2 对象并调用该方法。

 |  setShadowThreshold(...)
 |      setShadowThreshold(threshold) -> None

希望对您有所帮助。

【讨论】:

以上是关于在 OpenCV 中,一些方法只存在于 c++ 中,如何在 python 中做同样的事情?的主要内容,如果未能解决你的问题,请参考以下文章