public ImageProcessor(FormMain mainForm, LoginService loginService, GesturesService gesturesService, TrainingBox trainBox, CursorSimulator cursorSimulator) { try { this.cursorSimulator = cursorSimulator; this.webCam = new Capture(); //Inicializa la camara this.mainForm = mainForm; this.loginService = loginService; this.gesturesService = gesturesService; this.trainBox = trainBox; this.clickTimer = new Stopwatch(); this.mouthTimer = new Stopwatch(); this.speechProcessor = new SpeechProcessor(); this.eyeDetector = new EyeDetector(); this.faceDetector = new FaceDetector(this.eyeDetector); this.cursorLoopProcessor = new CursorLoopProcessor(this.cursorSimulator); this.cursorActionProcessor = new CursorActionProcessor(); this.deactivateActionProcessor = new DeactivateActionProcessor(this.speechProcessor, this.cursorLoopProcessor); this.activateSpeechAction = new ActivateSpeechAction(); Application.Idle += new EventHandler(this.cursorLoopProcessor.Pool); } catch (Exception ex) { throw ex; } }
//Implement priority public FaceDetector(EyeDetector eyeDetector) { this.eyeDetector = eyeDetector; this.lastDetected = new Face(); this.notDetectedTimer = new Stopwatch(); this.facePriority = new LifoAlgorithm<BaseFaceDetector>(); this.frontalFacePriorityItem = new FaceDetectorPriority(new FrontalFaceDetector()); this.profileFacePriorityItem = new FaceDetectorPriority(new ProfileFaceDetector()); this.rotatedFacePriorityItem = new FaceDetectorPriority(new RotatedFaceDetector()); this.facePriority.AddAlgorithmItem(this.frontalFacePriorityItem); this.facePriority.AddAlgorithmItem(this.profileFacePriorityItem); this.facePriority.AddAlgorithmItem(this.rotatedFacePriorityItem); }