MathJax 3

Thursday, 12 August 2021

How to fix the webcam not working with opencv on Windows 10


If my blog is not ranked higher than stackoverflow.com, a good chance exists that you have been reading this SO's thread before landing here. Well, if you landed on my blog, it signifies SO didn't help you. If so, then keep reading.

 I installed OpenCV for the first time about 15 years ago. Since I can remember,  using a webcam has always been the most tricky part of working with it. Don't get me wrong, OpenCV is a magnificent open-source library, really of a high standard. But when it comes to closed source drivers, it may suffer from some compatibility problems, as it happens with nearly all open-source software.
There are other times instead when the causes for malfunctioning webcam lye outside of OpenCV source code.

As you may know already, Windows 10 offers some privacy setting which enables the user to exclude any program from using the webcam.
The good news is that these settings might be all that is preventing your webcam from working.
Open Settings and hit Privacy. On the left pane, hit Camera, go in the main panel and scroll all down. If you followed along, you should see this:

 



Make sure the last switch is on. Now, close the Settings and try out your OpenCV code.
Everything works, right?

With no shame, I admit that I reinstalled OpenCV 4.3.5 several times before realizing that switch had been turned off by Windows, for who knows which reasons.

I hope this helped you.

No comments:

Post a Comment