public TemporaryThresholdSettings(ColourDetectorInput target, ThresholdSettings tempSettings) { _original = new ThresholdSettings(); _original.Absorb(target.Settings); _target = target; target.Settings?.Absorb(tempSettings); }
public static ThresholdSettings Get(double lowHue, double lowSat, double lowValue, double highHue, double highSat, double highValue) { var s = new ThresholdSettings(); s.LowThreshold = GetScalar(lowHue, lowSat, lowValue); s.HighThreshold = GetScalar(highHue, highSat, highValue); return s; }
public static ThresholdSettings Get(double lowHue, double lowSat, double lowValue, double highHue, double highSat, double highValue) { var s = new ThresholdSettings(); s.LowThreshold = GetScalar(lowHue, lowSat, lowValue); s.HighThreshold = GetScalar(highHue, highSat, highValue); return(s); }
public void Absorb(ThresholdSettings s) { if (s == null) { return; } LowThreshold = s.LowThreshold; HighThreshold = s.HighThreshold; }
public ThresholdSettings Select(Mat input, Rectangle targetRegion) { _input = input; _targetRegion = targetRegion; const int hueMax = 180; const int satValueMax = 255; _settings = ThresholdSettings.Get(0, 0, 0, hueMax, 255, 255); // Hue var lowV0 = GetDimensionResults(0, hueMax, false, (i, s) => s.WithV0(i)); _settings.LowThreshold = _settings.LowThreshold.WithV0(lowV0); var highV0 = GetDimensionResults((int)_settings.LowThreshold.V0, hueMax, true, (i, s) => s.WithV0(i)); _settings.HighThreshold = _settings.HighThreshold.WithV0(highV0); // Saturation var lowV1 = GetDimensionResults(0, satValueMax, false, (i, s) => s.WithV1(i)); _settings.LowThreshold = _settings.LowThreshold.WithV1(lowV1); var highV1 = GetDimensionResults((int)_settings.LowThreshold.V1, satValueMax, true, (i, s) => s.WithV1(i)); _settings.HighThreshold = _settings.HighThreshold.WithV1(highV1); // Value var lowV2 = GetDimensionResults(0, satValueMax, false, (i, s) => s.WithV2(i)); _settings.LowThreshold = _settings.LowThreshold.WithV2(lowV2); var highV2 = GetDimensionResults((int)_settings.LowThreshold.V2, satValueMax, true, (i, s) => s.WithV2(i)); _settings.HighThreshold = _settings.HighThreshold.WithV2(highV2); return(_settings); }
public void Accept(ThresholdSettings settings) { HighThreshold = settings.HighThreshold; LowThreshold = settings.LowThreshold; }
public void Absorb(ThresholdSettings s) { LowThreshold = s.LowThreshold; HighThreshold = s.HighThreshold; }