private void StartCameraProcessing() { try { btnStartCamera.IsEnabled = false; btnResetCamera.IsEnabled = Metrics.IsEnabled = btnStopCamera.IsEnabled = btnAppShot.IsEnabled = btnExit.IsEnabled = true; const int cameraId = 0; const int numberOfFaces = 1; const int cameraFPS = 15; const int processFPS = 15; Detector = new CameraDetector(cameraId, cameraFPS, processFPS, numberOfFaces, Affdex.FaceDetectorMode.LARGE_FACES); Detector.setClassifierPath(FilePath.GetClassifierDataFolder()); TurnOnClassifiers(); Detector.setImageListener(this); Detector.setProcessStatusListener(this); Detector.start(); canvas.Visibility = Visibility.Visible; cameraDisplay.Visibility = Visibility.Visible; } catch (AffdexException ex) { if (!String.IsNullOrEmpty(ex.Message)) { if (ex.Message.Equals("Unable to open webcam.")) { MessageBoxResult result = MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); StopCameraProcessing(); return; } } String message = String.IsNullOrEmpty(ex.Message) ? "AffdexMe error encountered." : ex.Message; ShowExceptionAndShutDown(message); } catch (Exception ex) { String message = String.IsNullOrEmpty(ex.Message) ? "error encountered." : ex.Message; ShowExceptionAndShutDown(message); } }
// Start is called before the first frame update void Start() { cameraDetector = GetComponent <CameraDetector>(); float menorRotacion; if (rotationRangeA < 0) { rotationRangeA = 360 + rotationRangeA; } else if (rotationRangeA == 0) { rotationRangeA = 1; } if (rotationRangeB < 0) { rotationRangeB = 360 + rotationRangeB; } else if (rotationRangeB == 0) { rotationRangeB = 1; } if (rotationRangeB > rotationRangeA) { menorRotacion = rotationRangeA; } else { menorRotacion = rotationRangeB; } menorRotacion = rotationRangeA; ///////// if (isRotating) { transform.Rotate(0f, 0f, menorRotacion); } }
public CameraModels GetCameraModels(CardInfo cardInfo, SoftwareInfo softwareInfo, IProgress <double> progress, CancellationToken token) { Logger.LogTrace("Detecting camera models from {0}", cardInfo.DriveLetter); var cameraInfo = CameraDetector.GetCamera(cardInfo, progress, token); if (cameraInfo == null) { return(null); } var cameraModels = CameraModelDetectors .Select(d => d.GetCameraModels(cardInfo, cameraInfo, progress, token)) .FirstOrDefault(c => c != null); return(new CameraModels { Info = cameraInfo, Models = cameraModels.Collapse(cameraInfo) }); }