コード例 #1
0
        /// <summary>
        /// sudo mono picamcv.con.exe -m=pantiltmultimode
        /// </summary>
        public MultimodePanTiltController(
            IPanTiltMechanism panTiltMech
            , CaptureConfig captureConfig
            , IScreen screen
            , IServerToCameraBus serverToCameraBus
            , params IOutputProcessor[] outputPipelines) : base(panTiltMech, captureConfig)
        {
            _screen            = screen;
            _serverToCameraBus = serverToCameraBus;
            _outputPipelines   = outputPipelines;

            _faceTrackingController     = new FaceTrackingPanTiltController(panTiltMech, captureConfig);
            _camshiftTrackingController = new CamshiftPanTiltController(panTiltMech, captureConfig);
            _colourTrackingController   = new ColourTrackingPanTiltController(panTiltMech, captureConfig);

            _thresholdSelector = new ThresholdSelector();
            _thresholdSelector.ColourCheckTick += thresholdSelector_ColourCheckTick;

            _colourDetectorInput = new ColourDetectorInput();
            _colourDetectorInput.SetCapturedImage    = true;
            _colourDetectorInput.Settings.MomentArea = new RangeF(50, 10000);

            _faceTrackManager   = new FaceTrackStateManager(screen);
            _colourTrackManager = new ColourTrackStateManager(screen);
            _autonomousManager  = new AutonomousTrackStateManager(this, screen);

            screen.Clear();
            SetMode(ProcessingMode.Autonomous);

            _autonomousManager.IsFaceFound       = i => _faceTrackingController.Process(i).IsDetected;
            _autonomousManager.IsColourFullFrame = IsColourFullFrame;

            InitController();
        }
コード例 #2
0
        /// <summary>
        /// sudo mono picamcv.con.exe -m=pantiltmultimode
        /// </summary>
        public MultimodePanTiltController(
            IPanTiltMechanism panTiltMech
            , CaptureConfig captureConfig
            , IScreen screen
            , IServerToCameraBus serverToCameraBus
            , params IOutputProcessor[] outputPipelines) : base(panTiltMech, captureConfig)
        {
            _screen            = screen;
            _serverToCameraBus = serverToCameraBus;
            _outputPipelines   = outputPipelines;

            _colourSettingsRepository = new ColourSettingsRepository();

            _faceTrackingController     = new FaceTrackingPanTiltController(panTiltMech, captureConfig);
            _camshiftTrackingController = new CamshiftPanTiltController(panTiltMech, captureConfig);
            _colourTrackingController   = new ColourTrackingPanTiltController(panTiltMech, captureConfig);

            _thresholdSelector = new ThresholdSelector();
            _thresholdSelector.ColourCheckTick += thresholdSelector_ColourCheckTick;

            _colourDetectorInput = new ColourDetectorInput();
            _colourDetectorInput.SetCapturedImage = true;
            var repoSettings = _colourSettingsRepository.Read();

            if (repoSettings != null)
            {
                _colourDetectorInput.Settings = repoSettings;
            }

            _faceTrackManager   = new FaceTrackStateManager(screen);
            _colourTrackManager = new ColourTrackStateManager(screen);
            _staticManager      = new StaticStateManager(screen);
            _autonomousManager  = new AutonomousTrackStateManager(this, screen);

            SoundService = new SoundService();


            screen.Clear();
            ChangeMode(ProcessingMode.Autonomous);

            _autonomousManager.IsFaceFound       = i => _faceTrackingController.Process(i).IsDetected;
            _autonomousManager.IsColourFullFrame = IsColourFullFrame;

            _faceTrackingController.ClassifierParams.MinSize = new Size(20, 20);
            _faceTrackingController.ClassifierParams.MaxSize = new Size(50, 50);

            screen.WriteLine(_faceTrackingController.ClassifierParams.ToString());

            InitController();

            ServoSettleTimeChanged += (s, e) =>
            {
                _faceTrackingController.ServoSettleTime   = ServoSettleTime;
                _colourTrackingController.ServoSettleTime = ServoSettleTime;
            };

            _colourDetector = new ColourDetector();
        }