Opencv video capture Error:ret, frame = cap.read()
23:16 24 Sep 2021

I am trying to make an application that makes use of the webcam to get the video. But I run the program, I am getting the following error: unkown c++ exception from opencv code.

My code is

Import cv2

Import mediapipe as mp 

cap = cv2.VedioCapture(0)

while True:

      ret, frame=cap.read()

      cv2.imshow("Frame", frame)
      cv2.waitKey(1)

I am getting an error

ret, frame = cap.read()

Error: unknown c++ exception  from opencv code.

I am getting this error and frame opens but gray then.The camera open a frame and it blocks:frame not responding.

There is an error related to accessing the camera,but I found that my camera was working well and also has provided permissions to all app. Also after running this program i found my flash was on so I released the camera,but unable to capture video.

python opencv video video-capture