OpenCV Broke Webcam?

Hi all,

I’m using OpenCV and python to do some image processing. 

Here is the gist of the code.

# start listening to video stream
cap = cv2.VideoCapture(0)

#%% main loop

# the actual image processing

    k = cv2.waitKey(5) & 0xFF
    if k == 27:

#%% clean up

# release camera
# close windows

It worked well for a while, but I think something has happened where the code hasn’t released hold of my webcam. Now when I try to use the same code, it doesn’t work. I tried to open the camera app on windows and it shows a “Webcam already in use” error with the code: 0xA00F4243(OXC00D3704)

I have tried:

  • Restarting

  • Shutting down and waiting

  • Uninstalling webcam driver

  • Disconnecting and connecting the webcam

I can’t find anything useful about this on Google and I’m feeling hopeless.

I had the same problem, though I changed settings of the video capture with cap.set(setting, value). No application (at least the Camera app and Discord wouldn’t work and the screen would be black.)

For me the problem was fixed by installing Skype, since Skype automatically changes the settings of the camera. After that it worked again. As soon as it works you can uninstall Skype again. There might be other applicatinos that also try to change the setting automatically, but I can’t think of any right now.

I know you were asking for help a long time ago and you might not need help anymore, but for anyone who Googles their problems and end up here will get to see this solution.