gpt4 book ai didi

python-2.7 - GMG无法在Open CV 3.0中运行

转载 作者:行者123 更新时间:2023-12-02 16:39:05 24 4
gpt4 key购买 nike

我一直在尝试在新的Open CV版本Open CV 3.0中进行背景减法。我在Open CV 3.0和python 2.7中练习BackgroundSubtractorGMG。我在BackgroundSubtractorGMG上尝试代码。错误提示:

File "background.py", line 10, in fgbg = cv2.createBackgroundSubtractorGMG() AttributeError: 'module' object has no attribute 'createBackgroundSubtractorGMG'



我该如何解决这个错误?感谢您的关注和帮助,谢谢:-)

最佳答案

一旦构建了opencv以及opencv_contrib存储库:

>>> help(cv2.bgsegm)
Help on module cv2.bgsegm in cv2:

NAME
cv2.bgsegm

FILE
(built-in)

FUNCTIONS
createBackgroundSubtractorGMG(...)
createBackgroundSubtractorGMG([, initializationFrames[, decisionThreshol
d]]) -> retval

createBackgroundSubtractorMOG(...)
createBackgroundSubtractorMOG([, history[, nmixtures[, backgroundRatio[,
noiseSigma]]]]) -> retval

换句话说,使用:
gmg = cv2.bgsegm.createBackgroundSubtractorGMG()

关于python-2.7 - GMG无法在Open CV 3.0中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30748201/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com