Ask Your Question

Revision history [back]

Opencv does not works (Python 3)

Hi everybody! I`m trying to use opencv(opencv-contrib-python) + Python3.8 and my webcamera. And I have a warning:

"[ WARN:0] global C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-j8nxabm_\opencv\modules\videoio\src\cap_msmf.cpp (677) CvCapture_MSMF::initStream Failed to set mediaType (stream 0, (640x480 @ 30) MFVideoFormat_RGB24(codec not found)" My code is:

import cv2

cap = cv2.VideoCapture(0)

while True:
    ret, img = cap.read()
    cv2.imshow("camera", img)
    if cv2.waitKey(10) == 27:
        break
cap.release()
cv2.destroyAllWindows()

Tell me, please, what is the problem?