public FacePipeline(FaceDetector faceDetector, FaceRecognizer faceRecognizer, FaceRepository faceLabelsRepository) { _faceDetector = faceDetector; _faceRecognizer = faceRecognizer; _faceLabelsRepository = faceLabelsRepository; }
public MainWindow() { InitializeComponent(); Loaded += MainWindow_Loaded; var faceRep = new FaceRepository("Faces"); _faceRecognizer = new FaceRecognizer("Assets\\haarcascade_frontalface_default.xml", faceRep); _mirrorService = new MirrorService("http://localhost:8080/"); _mirrorService.Start(); Mediator.Default.Subscribe <string>(this, username => { ChangeUI(() => Detected.Text = username); }); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { _faceRepository = new FaceRepository("Faces"); _faceDetector = new FaceDetector("Assets\\haarcascade_frontalface_alt_tree.xml"); _faceRecognizer = new FaceRecognizer(); _motionDetectorService = new MotionDetectorPublisher(); _facePipeline = new FacePipeline(_faceDetector, _faceRecognizer, _faceRepository); _facePipeline.Prepare(); _frameAggregator = new FrameAggregator(); var mirrorClient = new MirrorClient(); _mirrorUserStateMachine = new MirrorStateMachine(mirrorClient); Mediator.Default.Subscribe <MirrorUserChanged>(this, msg => { ChangeUI(() => Detected.Text = msg.Username); }); var turnMonitorOnOff = new TurnMonitorOnOffAction(); Task.Run(async() => await turnMonitorOnOff.Start()); Mediator.Default.Subscribe <MotionDetected>(turnMonitorOnOff, turnMonitorOnOff.Proccess); Task.Factory.StartNew(async() => { try { if (UseRealSense) { await StartRealSense(); } else { await StartCamera(); } } catch (Exception ex) { Log.Logger.Error(ex, "On StartCamera"); if (ex.InnerException != null) { Log.Logger.Error(ex.InnerException, "Inner exception"); } } }, TaskCreationOptions.LongRunning); }