【发布时间】:2020-10-08 22:10:33
【问题描述】:
我正在制作一个需要 openCV 库的 python 应用程序,这是我的代码:
# importing the required modules
import cv2
import numpy as np
# capturing from the first camera attached
cap = cv2.VideoCapture(0)
# will continue to capture until 'q' key is pressed
while True:
ret, frame = cap.read()
cv2.imshow('frame', frame)
# Program will terminate when 'q' key is pressed
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Releasing all the resources
cap.release()
cv2.destroyAllWindows()
当我运行代码时出现此错误:
[ WARN:0] global C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-wwma2wne\opencv\modules\videoio\src\cap_msmf.cpp (677) CvCapture_MSMF::initStream Failed to set mediaType (stream 0, (640x480 @ 30) MFVideoFormat_RGB24(codec not found)
我认为可能需要编解码器驱动程序,但我不知道如何修复错误 请朋友们帮帮我
【问题讨论】: