Ejemplo n.º 1
0
        public static void ReleaseInactiveCameras()
        {
            int numberCameras = WebcamManager.NumberConnectedCameras();

            for (int i = 0; i < numberCameras; i++)
            {
                WebCam camera = WebcamManager.GetCamera(i);
                if (camera.Subscribers.Count == 0)
                {
                    camera.Stop();
                    DllImport.StopWebCam(camera.WebCamID);
                }
            }
        }
Ejemplo n.º 2
0
        public static void StopCamera(int index)
        {
            int numberCameras = WebcamManager.NumberConnectedCameras();

            if (index > -1 && index < numberCameras)
            {
                WebCam camera = WebcamManager.GetCamera(index);
                for (int i = 0; i < camera.Subscribers.Count; i++)
                {
                    ImageListenerBase l = camera.Subscribers[i];
                    l.UnregisterForImages(camera);
                }
                camera.Subscribers.Clear();
                camera.Stop();
                DllImport.StopWebCam(camera.WebCamID);
            }
        }