Ask Your Question
0

How to check if camera is enabled?

asked 2020-11-27 18:07:56 -0600

NikosOpenCV gravatar image

updated 2020-11-27 21:24:52 -0600

crackwitz gravatar image

Hello. Is there any way to check if my camera is enabled (I don't mean available and I know that the light of computer is on when camera is on),but I'm writing a program with many files and functions and I want to check if camera is enabled -> do this ,if not -> do that ? So, I want to have a function to tell me if camera is enabled or not and use it to check other things in my program, but I want to know if can be happen.

Ubuntu 18 , Python 3 Thanks.

edit retag flag offensive close merge delete

Comments

what do you mean, "enabled"? OpenCV can't know if any video device in your system is currently being used. that's not OpenCV's purpose.

crackwitz gravatar imagecrackwitz ( 2020-11-27 21:23:44 -0600 )edit

Ok,I undestand.

NikosOpenCV gravatar imageNikosOpenCV ( 2020-11-28 01:59:41 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-11-28 02:21:26 -0600

berak gravatar image

the only way to check is to try it out:

VideoCapture cap;
bool ok = cap.open(0);
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-11-27 18:07:56 -0600

Seen: 517 times

Last updated: Nov 28 '20