- This topic has 1 reply, 2 voices, and was last updated 1 year, 10 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Home › Forums › Fórum Detecção de Movimentos com Python e OpenCV › Erro ao executar código
Boa tarde!
Estou tendo dificuldade de executar o código durante a aula, poderiam me ajudar, segue abaixo código de erro:
C:\Users\Glauco Paiva\Documents\curso_subtraction\pythonProject\.venv\Scripts\python.exe” “C:\Users\Glauco Paiva\Documents\curso_subtraction\outros_augoritimos.py”
Traceback (most recent call last):
File “C:\Users\Glauco Paiva\Documents\curso_subtraction\outros_augoritimos.py”, line 58, in <module>
bg_subtractor = getBGSubtractor(BGS_TYPES[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\Glauco Paiva\Documents\curso_subtraction\outros_augoritimos.py”, line 43, in getBGSubtractor
return cv2.bgsegm.createBackgroundSubtractorGMG(initializationFrames = 120, decisionThreshold = 0.8)
^^^^^^^^^^
AttributeError: module ‘cv2’ has no attribute ‘bgsegm’
Process finished with exit code 1
Olá Glauco,
Seguem algumas sugestões do próprio site do pypi:
Selecione o pacote correto para seu ambiente:
Desinstale as versões atuais do OpenCV e OpenCV-Contrib e instale a mesma versão que foi utilizada durante o curso. Abaixo, estão os comandos necessários:
pip uninstall opencv-contrib-python –user
pip uninstall opencv-python –user
pip install opencv-python==4.5.2 –user