public static void CleanUp() { int numberCameras = WebcamManager.NumberConnectedCameras(); for (int i = 0; i < numberCameras; i++) { StopCamera(i); } }
public static bool SetPropertyValueAuto(int cameraindex, CAMERA_PROPERTY prop) { int numberCameras = WebcamManager.NumberConnectedCameras(); if (cameraindex > -1 && cameraindex < numberCameras) { return(DllImport.SetPropertyValueAuto(cameraindex, Convert.ToInt32(prop))); } return(false); }
public static bool GetMaxPropertyValue(int cameraindex, CAMERA_PROPERTY prop, ref long val) { int numberCameras = WebcamManager.NumberConnectedCameras(); if (cameraindex > -1 && cameraindex < numberCameras) { return(DllImport.GetMaxPropertyValue(cameraindex, Convert.ToInt32(prop), ref val)); } return(false); }
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); } } }
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); } }
public static bool StartCamera(int index, int CaptureWidth, int CaptureHeight) { int numberCameras = WebcamManager.NumberConnectedCameras(); if (index > -1 && index < numberCameras) { WebCam camera = WebcamManager.GetCamera(index); camera.Width = CaptureWidth; camera.Height = CaptureHeight; try { camera.Start(); } catch (Exception e) { //System.Windows.Forms.MessageBox.Show(e.ToString()); camera.Stop(); return(false); } return(true); } return(false); }