We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all
I am working on a project that monitors a webcam video feed and then analyses it for motion detected. It is imperative that I be able to determine when a webcam that has been connected to my system is disconnected.
Up until now I have tried using various different methods including monitoring to see if the frame feed has stopped. But all to no avail. I either get too many false alarms or the solution does not work at all (i.e it still thinks the webcam is connected even when I have physically disconnected the USB cable).
So my question is this, is there ANY possible way to determine if a webcam has been disconnected using Processing?
Thanks David
Answers
on what operating system are you? on linux (and i assume in mac) i guess it would be easy with lsusb so either go native or try to find a library
http://stackoverflow.com/questions/14118178/how-to-get-the-details-of-usb-devices-connected-to-computer-using-java
Will check out the link thanks. I am running Windows 7 64 bit
At the moment I am using the Capture object itself in the following form:
And then something like
Webcam.list().length;
to determine if the webcam is connected, as soon as it disconnects the list value drops to 0, and then I can detect a disconnection. The only problem with this is, the .list().length command takes a fair amount of time to run ( a couple of hundred milliseconds) this then means that for that time, the webcam feed is stopped. This is the issue I am trying to find a workaround for.
so it works but you want to make it faster?
Yes it works but I want to know if there is any way to eliminate that slight delay when the check happens.