public ColorDetectRunner(ICaptureGrab capture) : base(capture)
 {
     Settings = new ColourDetectSettings();
     // useful defaults - red under lights
     Settings.LowThreshold  = new MCvScalar(140, 57, 25);
     Settings.HighThreshold = new MCvScalar(187, 153, 82);
     Settings.MomentArea    = new RangeF(200, 400);
 }
Example #2
0
        private void ReadColorSettings()
        {
            var repo = new ColourSettingsRepository();

            if (repo.IsPresent)
            {
                ColourSettings    = repo.Read();
                HasColourSettings = true;
                Log.Info(m => m("Color detection settings found: {0}", ColourSettings));
            }
            else
            {
                Log.Info(m => m("No color detection settings found"));
            }
        }
Example #3
0
        private void ReadColorSettings()
        {
            var appData           = ExecutionEnvironment.GetApplicationMetadata();
            var settingsFilename  = Path.Combine(appData.ExeFolder, "colordetectsettings.xml");
            var colorSettingsFile = new FileInfo(settingsFilename);

            if (colorSettingsFile.Exists)
            {
                ColourSettings = Kelvin <ColourDetectSettings> .FromXmlFile(settingsFilename);

                Log.Info(m => m("Color detection settings found: {0}", ColourSettings));
            }
            else
            {
                Log.Info(m => m("No color detection settings found at '{0}'", settingsFilename));
            }
        }
Example #4
0
        public ServoSorter(
            ICaptureGrab capture
            , ConsoleOptions options) : base(capture)
        {
            _servoPosition = 70;

            Settings = options.ColourSettings;

            _debounceWatch = new Stopwatch();

            var deviceFactory = new Pca9685DeviceFactory();
            var device        = deviceFactory.GetDevice(options.UseFakeDevice);

            SetLogLevel(device);

            _pwmControl = new ServoSortPwmControl(device);
            _pwmControl.Init();

            _detector = new ColourDetector();
        }
 public ColorDetectRunner(ICaptureGrab capture, ColourDetectSettings settings)
     : base(capture)
 {
     Settings = settings;
 }