public VideoSource(String name, IVideoSource source) { //establish source captureDevice = source; //setup system tray menu InitalizeToolstrip(); miMain.Text = name; //initalize default detector detectorType = DetectorType.FastBlock; loadDetectorType(); //setup viewing window view = new Viewer(); view.Text = name; //you have to set this to be able to move the viewer programatically view.StartPosition = FormStartPosition.Manual; view.moveToTopRight(); view.Hide(); view.moveToTopRight(); //defaults enableAlert = true; }
public static int GetDecimationStageCount(double inputSampleRate, DetectorType detector = DetectorType.AM) { int num = 20; int num2; if (StreamControl.ReducedBandwidth) { if (inputSampleRate <= (double)StreamControl._minReducedNarrowBandwidth) { return(0); } num2 = ((detector == DetectorType.WFM) ? StreamControl._minReducedWideBandwidth : StreamControl._minReducedNarrowBandwidth); } else { if (inputSampleRate <= (double)StreamControl._minOutputSampleRate) { return(0); } num2 = ((detector == DetectorType.WFM) ? 250000 : StreamControl._minOutputSampleRate); } while (inputSampleRate / (double)(1 << num) < (double)num2 && num > 0) { num--; } return(num); }
public static string ToLongName(this DetectorMode detectorMode, DetectorType detectorType) { switch (detectorType) { case DetectorType.STEM3_GMode: switch (detectorMode) { case DetectorMode.Custom: return "Custom Annular 1"; case DetectorMode.Custom2: return "Custom Annular 2"; case DetectorMode.Custom3: return "Custom Angular"; case DetectorMode.Custom4: return "Custom Annular 3"; case DetectorMode.Custom5: return "Custom Annular 4"; default: return GetDefaultLongName(detectorMode); } case DetectorType.CBS: switch (detectorMode) { case DetectorMode.Custom: return "Custom 1"; case DetectorMode.Custom2: return "Custom 2"; default: return GetDefaultLongName(detectorMode); } default: return GetDefaultLongName(detectorMode); } }
public static string ToShortName(this DetectorType type) { string detectorTypeName; switch (type) { case DetectorType.QuadBSD: detectorTypeName = "Quad BSED"; break; case DetectorType.PMT: detectorTypeName = "PMD-BSE"; break; case DetectorType.HiResOptical: detectorTypeName = "HRO"; break; case DetectorType.HiResOpticalLowMag: detectorTypeName = "HRO-LM"; break; case DetectorType.None: detectorTypeName = "No Det."; break; default: detectorTypeName = type.ToName(); break; } return(detectorTypeName); }
public Detector AddDetector(DetectorType type) { IDetector d; switch (type) { case DetectorType.NPC: d = new NPCDetector(settings); break; case DetectorType.Object: d = new ObjectDetector(settings); break; case DetectorType.FarmAnimal: d = new FarmAnimalDetector(settings); break; case DetectorType.WaterEntity: d = new WaterEntityDetector(settings); break; case DetectorType.Crop: d = new CropDetector(settings); break; default: return(this); } detectors.Add(type, d); return(this); }
/// <summary> /// The AgastFeatureDetector constructor /// </summary> /// <param name="threshold">threshold on difference between intensity of the central pixel /// and pixels of a circle around this pixel.</param> /// <param name="nonmaxSuppression">if true, non-maximum suppression is applied to detected corners (keypoints).</param> /// <param name="type"></param> public static AgastFeatureDetector Create( int threshold = 10, bool nonmaxSuppression = true, DetectorType type = DetectorType.OAST_9_16) { IntPtr ptr = NativeMethods.features2d_AgastFeatureDetector_create( threshold, nonmaxSuppression ? 1 : 0, (int) type); return new AgastFeatureDetector(ptr); }
public MidiEntry(MidiEntry midiEntry) { _frequency = midiEntry._frequency; _stepsize = midiEntry._stepsize; _audiogain = midiEntry._audiogain; _bandbreite = midiEntry._bandbreite; _detectorType = midiEntry._detectorType; _startstop = midiEntry._startstop; }
/// <summary> /// The AgastFeatureDetector constructor /// </summary> /// <param name="threshold">threshold on difference between intensity of the central pixel /// and pixels of a circle around this pixel.</param> /// <param name="nonmaxSuppression">if true, non-maximum suppression is applied to detected corners (keypoints).</param> /// <param name="type"></param> public static AgastFeatureDetector Create( int threshold = 10, bool nonmaxSuppression = true, DetectorType type = DetectorType.OAST_9_16) { NativeMethods.HandleException( NativeMethods.features2d_AgastFeatureDetector_create( threshold, nonmaxSuppression ? 1 : 0, (int)type, out var ptr)); return(new AgastFeatureDetector(ptr)); }
public MemoryEntry(MemoryEntry memoryEntry) { this._name = memoryEntry._name; this._groupName = memoryEntry._groupName; this._detectorType = memoryEntry._detectorType; this._frequency = memoryEntry._frequency; this._shift = memoryEntry._shift; this._centerFrequency = memoryEntry._centerFrequency; this._filterBandwidth = memoryEntry._filterBandwidth; this._isFavourite = memoryEntry._isFavourite; }
public MemoryEntryFrequencyRange(MemoryEntryFrequencyRange memoryEntryFrequencyRange) { this._startFrequency = memoryEntryFrequencyRange._startFrequency; this._endFrequency = memoryEntryFrequencyRange._endFrequency; this._rangeName = memoryEntryFrequencyRange._rangeName; this._detectorType = memoryEntryFrequencyRange._detectorType; this._lastLocation = memoryEntryFrequencyRange._lastLocation; this._lastSize = memoryEntryFrequencyRange._lastSize; this._stepSize = memoryEntryFrequencyRange._stepSize; this._filterBandwidth = memoryEntryFrequencyRange._filterBandwidth; }
/// <summary> /// Generates fallback name for the given detector type based on its string representation. /// The method was introduced in order to allow developers to distinguish new detectors /// until they are assigned a proper name. /// </summary> private static string ProvideFallbackName(DetectorType type) { string fallbackName = type.ToString(); if (fallbackName.StartsWith("en") && fallbackName.Length > 2) { fallbackName = fallbackName.Substring(2); } return(fallbackName); }
public void Initialize(ISharpControl control) { _control = control; _control.PropertyChanged += PropertyChangedHandler; _LastRadioFrequency = _control.Frequency; _LastRadioMode = _control.DetectorType; _Protocol = new Protocol_TS50(this); _serialPort = new SerialPortCtrl(_Protocol); _controlPanel = new SerialControllerPanel(_serialPort); _controlPanel.readSettings(); }
public MemoryEntry(MemoryEntry memoryEntry) { _name = memoryEntry._name; _groupName = memoryEntry._groupName; _detectorType = memoryEntry._detectorType; _frequency = memoryEntry._frequency; _shift = memoryEntry._shift; _centerFrequency = memoryEntry._centerFrequency; _filterBandwidth = memoryEntry._filterBandwidth; _isFavourite = memoryEntry._isFavourite; _stayTunedLevel = memoryEntry._stayTunedLevel; }
private void Configure(bool refreshOnly = true) { if (this._sampleRate != 0.0) { this._actualDetectorType = this._detectorType; bool refresh = false; this._baseBandDecimationStageCount = StreamControl.GetDecimationStageCount(this._sampleRate, this._actualDetectorType); this._audioDecimationStageCount = this._decimationStageCount - this._baseBandDecimationStageCount; int num = 1 << this._baseBandDecimationStageCount; double num2 = this._sampleRate / (double)num; if (!refreshOnly || this._mainDownConverter == null || this._mainDownConverter.SampleRate != this._sampleRate || this._mainDownConverter.DecimationRatio != num) { this._mainDownConverter = new DownConverter(this._sampleRate, num); refresh = true; this.ConfigureHookSampleRates(); } this._mainDownConverter.Frequency = (double)this._frequency; if (!refreshOnly || this._ifOffsetTranslator == null || this._ifOffsetTranslator.SampleRate != num2) { this._ifOffsetTranslator = new FrequencyTranslator(num2); } this._ifOffsetTranslator.Frequency = (double)(-this._ifOffset); this.UpdateFilters(refresh); this._carrierLocker.SampleRate = num2; this._cwDetector.SampleRate = num2; this._fmDetector.SampleRate = num2; this._fmDetector.SquelchThreshold = this._squelchThreshold; this._amDetector.SquelchThreshold = this._squelchThreshold; this._stereoDecoder.Configure(this._fmDetector.SampleRate, this._audioDecimationStageCount); this._rdsDecoder.SampleRate = this._fmDetector.SampleRate; this._stereoDecoder.ForceMono = !this._fmStereo; switch (this._actualDetectorType) { case DetectorType.CW: this._cwDetector.BfoFrequency = this._cwToneShift; break; case DetectorType.NFM: this._fmDetector.Mode = FmMode.Narrow; break; case DetectorType.WFM: this._fmDetector.Mode = FmMode.Wide; break; } this._agc.SampleRate = this._sampleRate / (double)(1 << this._decimationStageCount); this._agc.Decay = this._agcDecay; this._agc.Slope = this._agcSlope; this._agc.Threshold = this._agcThreshold; this._agc.UseHang = this._agcUseHang; this._needConfigure = false; } }
public static string ToName(this DetectorType type, DetectorTypeNameForm name) { switch (name) { case DetectorTypeNameForm.Normal: return(type.ToName()); case DetectorTypeNameForm.Short: return(type.ToShortName()); default: throw new ArgumentException("Unknown name kind"); } }
public ChannelAnalizerMemoryEntry(ChannelAnalizerMemoryEntry ChannelAnalizerMemoryEntry) { this._frequency = ChannelAnalizerMemoryEntry._frequency; this._centerFrequency = ChannelAnalizerMemoryEntry._centerFrequency; this._level = ChannelAnalizerMemoryEntry._level; this._activity = ChannelAnalizerMemoryEntry._activity; this._skipped = ChannelAnalizerMemoryEntry._skipped; this._isStore = ChannelAnalizerMemoryEntry._isStore; this._storeName = ChannelAnalizerMemoryEntry._storeName; this._filterBandwidth = ChannelAnalizerMemoryEntry._filterBandwidth; this._detectorType = ChannelAnalizerMemoryEntry._detectorType; this._stepSize = ChannelAnalizerMemoryEntry._stepSize; this._startBins = ChannelAnalizerMemoryEntry._startBins; this._endBins = ChannelAnalizerMemoryEntry._endBins; }
internal static string ToSerializedValue(this DetectorType value) { switch (value) { case DetectorType.Detector: return("Detector"); case DetectorType.Analysis: return("Analysis"); case DetectorType.CategoryOverview: return("CategoryOverview"); } return(null); }
public static string ToShortName(this DetectorMode detectorMode, DetectorType detectorType) { switch (detectorType) { case DetectorType.STEM3_GMode: switch (detectorMode) { case DetectorMode.Custom: return("Custom 1"); case DetectorMode.Custom2: return("Custom 2"); case DetectorMode.Custom3: return("Custom"); case DetectorMode.Custom4: return("Custom 3"); case DetectorMode.Custom5: return("Custom 4"); default: return(GetDefaultShortName(detectorMode)); } case DetectorType.CBS: switch (detectorMode) { case DetectorMode.Custom: return("Custom 1"); case DetectorMode.Custom2: return("Custom 2"); default: return(GetDefaultLongName(detectorMode)); } default: return(GetDefaultShortName(detectorMode)); } }
/// <summary> /// 探测 /// </summary> /// <returns></returns> protected override bool Detect() { bool isBaseCS = base.Detect(); bool isCS = GetDetection(EpochSat.RecevingTime, EpochSat.Prn, EpochSat[SatObsDataType].Value); if (IsSaveResultToTable && isCS) { var table = GetOutTable(); if (!isBaseCS) { table.NewRow(); table.AddItem("Epoch", EpochSat.ReceiverTime); } table.AddItem(DetectorType.ToString(), true); } if (!isBaseCS && isCS) { CycleSlipStorage.Regist(EpochSat.Prn.ToString(), EpochSat.Time.Value); } return(isCS); }
public ConfigGridViewModel(Station _station, DetectorType _t) { string prefix = ""; if (_t == DetectorType.Master) { prefix = "mas"; } else { prefix = "slv"; } string[] ver = _station.Configuration.GetString($"{prefix}_version").Replace("\"", "").Replace(" ", "-").Split('-'); string serial = ver[0].Split(':')[1]; string fpga = ver[1].Split(':')[1]; ObservableCollection <ConfigEntry> ConfigEntryCollection = new ObservableCollection <ConfigEntry>(); ConfigEntryCollection.Add(new ConfigEntry("Serial", serial, ConfigType.Mainboard)); ConfigEntryCollection.Add(new ConfigEntry("FPGA", fpga, ConfigType.Mainboard)); ConfigEntryCollection.Add(new ConfigEntry("Voltage", _station.Configuration.GetFloat($"{prefix}_ch1_thres_low").ToString(), ConfigType.Channel1)); ConfigEntryCollection.Add(new ConfigEntry("Threshold Low", _station.Configuration.GetFloat($"{prefix}_ch1_thres_low").ToString(), ConfigType.Channel1)); ConfigEntryCollection.Add(new ConfigEntry("Threshold High", _station.Configuration.GetFloat($"{prefix}_ch1_thres_high").ToString(), ConfigType.Channel1)); ConfigEntryCollection.Add(new ConfigEntry("Voltage", _station.Configuration.GetFloat($"{prefix}_ch2_thres_low").ToString(), ConfigType.Channel2)); ConfigEntryCollection.Add(new ConfigEntry("Threshold Low", _station.Configuration.GetFloat($"{prefix}_ch2_thres_low").ToString(), ConfigType.Channel2)); ConfigEntryCollection.Add(new ConfigEntry("Threshold High", _station.Configuration.GetFloat($"{prefix}_ch2_thres_high").ToString(), ConfigType.Channel2)); CollectionView = new ListCollectionView(ConfigEntryCollection); CollectionView.GroupDescriptions.Add(new PropertyGroupDescription("ConfigType")); }
/// <summary> /// Create a fast detector with the specific parameters /// </summary> /// <param name="threshold">Threshold on difference between intensity of center pixel and pixels on circle around /// this pixel.</param> /// <param name="nonmaxSupression">Specify if non-maximum suppression should be used.</param> /// <param name="type">One of the three neighborhoods as defined in the paper</param> public FastDetector(int threshold = 10, bool nonmaxSupression = true, DetectorType type = DetectorType.Type9_16) { _ptr = CvInvoke.cveFASTGetFeatureDetector(threshold, nonmaxSupression, type, ref _feature2D); }
public static string ToSerialString(this DetectorType value) => value switch {
private void Configure() { this._actualDetectorType = this._detectorType; bool flag = this._sampleRate >= this._minThreadedSampleRate; if (this._downConverter == null || flag && this._downConverter.PhaseCount > 1) this._downConverter = new DownConverter(flag ? Environment.ProcessorCount : 1); this._downConverter.SampleRate = this._sampleRate; this._downConverter.Frequency = (double) this._frequency; if (this._needNewDecimators || this._baseBandDecimator == null) { this._needNewDecimators = false; if (this._actualDetectorType == DetectorType.WFM) { double num = this._sampleRate / (double) (1 << this._decimationStageCount); this._audioDecimationStageCount = 0; while (num * (double) (1 << this._audioDecimationStageCount) < 200000.0 && this._audioDecimationStageCount < this._decimationStageCount) ++this._audioDecimationStageCount; this._baseBandDecimationStageCount = this._decimationStageCount - this._audioDecimationStageCount; } else { this._baseBandDecimationStageCount = this._decimationStageCount; this._audioDecimationStageCount = 0; } this._baseBandDecimator = new IQDecimator(this._baseBandDecimationStageCount, this._useHighDynamicRangeDecimation, this._actualDetectorType == DetectorType.WFM ? this._wideBandDecimationQuality : this._narrowBandDecimationQuality, Environment.ProcessorCount > 1); this.ConfigureHookSampleRates(); this._needNewFilters = true; } if (this._needNewFilters) { this._needNewFilters = false; this.InitFilters(); } double num1 = this._sampleRate / (double) (1 << this._baseBandDecimationStageCount); this._carrierLocker.SampleRate = num1; this._usbDetector.SampleRate = num1; this._lsbDetector.SampleRate = num1; this._cwDetector.SampleRate = num1; this._fmDetector.SampleRate = num1; this._fmDetector.SquelchThreshold = this._squelchThreshold; this._amDetector.SquelchThreshold = this._squelchThreshold; this._stereoDecoder.Configure(this._fmDetector.SampleRate, this._audioDecimationStageCount); this._rdsDecoder.SampleRate = this._fmDetector.SampleRate; this._stereoDecoder.ForceMono = !this._fmStereo; switch (this._actualDetectorType) { case DetectorType.NFM: this._fmDetector.Mode = FmMode.Narrow; break; case DetectorType.WFM: this._fmDetector.Mode = FmMode.Wide; break; case DetectorType.LSB: this._lsbDetector.BfoFrequency = -this._bandwidth / 2; this._downConverter.Frequency += (double) this._lsbDetector.BfoFrequency; break; case DetectorType.USB: this._usbDetector.BfoFrequency = -this._bandwidth / 2; this._downConverter.Frequency -= (double) this._usbDetector.BfoFrequency; break; case DetectorType.CW: this._cwDetector.BfoFrequency = this._cwToneShift; break; } this._agc.SampleRate = this._sampleRate / (double) (1 << this._decimationStageCount); this._agc.Decay = this._agcDecay; this._agc.Slope = this._agcSlope; this._agc.Threshold = this._agcThreshold; this._agc.UseHang = this._agcUseHang; this._decimationModeHasChanged = false; }
/// <summary> /// Converts <paramref name="type"/> to name. /// </summary> /// <param name="type">Detector type.</param> public static string ToName(this DetectorType type) { string detectorTypeName; switch (type) { case DetectorType.TLD: detectorTypeName = "TLD"; break; case DetectorType.ETD: detectorTypeName = "ETD"; break; case DetectorType.TLD2: detectorTypeName = "TLD"; break; case DetectorType.BSD: detectorTypeName = "BSED"; break; case DetectorType.DualBSD: detectorTypeName = "Dual BSD"; break; case DetectorType.QuadBSD: detectorTypeName = "Quad BSED"; break; case DetectorType.SingleBSD: detectorTypeName = "vCD"; break; case DetectorType.GAD: case DetectorType.GAD2: detectorTypeName = "Dual GAD"; break; case DetectorType.STEM: detectorTypeName = "STEM I"; break; case DetectorType.STEM3: detectorTypeName = "STEM 3"; break; case DetectorType.STEM3_GMode: detectorTypeName = "STEM 3+"; break; case DetectorType.InColumnBSD: detectorTypeName = "ICD"; break; case DetectorType.LFD: detectorTypeName = "LFD"; break; case DetectorType.LVD: detectorTypeName = "LVD"; break; case DetectorType.LVSED: detectorTypeName = "LVSED"; break; case DetectorType.CRD: detectorTypeName = "Helix"; break; case DetectorType.GSED: detectorTypeName = "GSED"; break; case DetectorType.GBSD: detectorTypeName = "GBSD"; break; case DetectorType.CDEM: detectorTypeName = "CDEM"; break; case DetectorType.PMT: detectorTypeName = "PMD - BSE"; break; case DetectorType.ICE: detectorTypeName = "ICE"; break; case DetectorType.ABS: detectorTypeName = "ABS"; break; case DetectorType.CBS: detectorTypeName = "CBS"; break; case DetectorType.Mirror: detectorTypeName = "MD"; break; case DetectorType.External: detectorTypeName = "External"; break; case DetectorType.IR: detectorTypeName = "CCD"; break; case DetectorType.IR2: detectorTypeName = "CCD II"; break; case DetectorType.IRCameraDetector: detectorTypeName = "IR Camera"; break; case DetectorType.OM: detectorTypeName = "OM"; break; case DetectorType.NOC: detectorTypeName = "Nav-Cam"; break; case DetectorType.HiResOptical: detectorTypeName = "HiRes Optical"; break; case DetectorType.HiResOpticalLowMag: detectorTypeName = "HiRes Optical LowMag"; break; case DetectorType.Mix: detectorTypeName = "Mix"; break; case DetectorType.SICD: detectorTypeName = "ICD"; break; case DetectorType.ECD: detectorTypeName = "ECD"; break; case DetectorType.T1: detectorTypeName = "T1"; break; case DetectorType.T2: detectorTypeName = "T2"; break; case DetectorType.T3: detectorTypeName = "T3"; break; case DetectorType.LmABS: detectorTypeName = "GAD-ABS"; break; case DetectorType.LmCBS: detectorTypeName = "GAD-CBS"; break; case DetectorType.VsABS: detectorTypeName = "LV-ABS"; break; case DetectorType.VsCBS: detectorTypeName = "LV-CBS"; break; case DetectorType.None: detectorTypeName = "No Detector"; break; default: detectorTypeName = ProvideFallbackName(type); break; } return(detectorTypeName); }
private void Configure() { _actualDetectorType = _detectorType; var multiThreaded = _sampleRate >= _minThreadedSampleRate; if (_downConverter == null || (multiThreaded && _downConverter.PhaseCount > 1)) { _downConverter = new DownConverter(multiThreaded ? Environment.ProcessorCount : 1); } _downConverter.SampleRate = _sampleRate; _downConverter.Frequency = _frequency; if (_needNewDecimators || _baseBandDecimator == null) { _needNewDecimators = false; if (_actualDetectorType == DetectorType.WFM) { var afSamplerate = _sampleRate / (1 << _decimationStageCount); _audioDecimationStageCount = 0; while (afSamplerate * (1 << _audioDecimationStageCount) < DefaultWFMBandwidth && _audioDecimationStageCount < _decimationStageCount) { _audioDecimationStageCount++; } _baseBandDecimationStageCount = _decimationStageCount - _audioDecimationStageCount; } else { _baseBandDecimationStageCount = _decimationStageCount; _audioDecimationStageCount = 0; } _baseBandDecimator = new IQDecimator(_baseBandDecimationStageCount, _sampleRate, false, Environment.ProcessorCount > 1); if (_hookManager != null) { _hookManager.SetProcessorSampleRate(ProcessorType.RawIQ, _sampleRate); _hookManager.SetProcessorSampleRate(ProcessorType.FrequencyTranslatedIQ, _sampleRate); _hookManager.SetProcessorSampleRate(ProcessorType.DecimatedAndFilteredIQ, _sampleRate / (1 << _baseBandDecimationStageCount)); _hookManager.SetProcessorSampleRate(ProcessorType.DemodulatorOutput, _sampleRate / (1 << _baseBandDecimationStageCount)); _hookManager.SetProcessorSampleRate(ProcessorType.FilteredAudioOutput, _sampleRate / (1 << _decimationStageCount)); } _needNewFilters = true; } if (_needNewFilters) { _needNewFilters = false; InitFilters(); } var baseBandSampleRate = _sampleRate / (1 << _baseBandDecimationStageCount); _usbDetector.SampleRate = baseBandSampleRate; _lsbDetector.SampleRate = baseBandSampleRate; _cwDetector.SampleRate = baseBandSampleRate; _fmDetector.SampleRate = baseBandSampleRate; _fmDetector.SquelchThreshold = _squelchThreshold; _amDetector.SquelchThreshold = _squelchThreshold; _stereoDecoder.Configure(_fmDetector.SampleRate, _audioDecimationStageCount); _rdsDecoder.SampleRate = _fmDetector.SampleRate; _stereoDecoder.ForceMono = !_fmStereo; switch (_actualDetectorType) { case DetectorType.USB: _usbDetector.BfoFrequency = -_bandwidth / 2; _downConverter.Frequency -= _usbDetector.BfoFrequency; break; case DetectorType.LSB: _lsbDetector.BfoFrequency = -_bandwidth / 2; _downConverter.Frequency += _lsbDetector.BfoFrequency; break; case DetectorType.CW: _cwDetector.BfoFrequency = _cwToneShift; break; case DetectorType.NFM: _fmDetector.Mode = FmMode.Narrow; break; case DetectorType.WFM: _fmDetector.Mode = FmMode.Wide; break; } _agc.SampleRate = _sampleRate / (1 << _decimationStageCount); _agc.Decay = _agcDecay; _agc.Slope = _agcSlope; _agc.Threshold = _agcThreshold; _agc.UseHang = _agcUseHang; _decimationModeHasChanged = false; }
/// <summary> /// Create a fast detector with the specific parameters /// </summary> /// <param name="threshold">Threshold on difference between intensity of center pixel and pixels on circle around /// this pixel.</param> /// <param name="nonmaxSupression">Specify if non-maximum suppression should be used.</param> /// <param name="type">One of the three neighborhoods as defined in the paper</param> public FastFeatureDetector(int threshold = 10, bool nonmaxSupression = true, DetectorType type = DetectorType.Type9_16) { _ptr = CvInvoke.cveFASTGetFeatureDetector(threshold, nonmaxSupression, type, ref _feature2D, ref _sharedPtr); }
private static Accord.Vision.Detection.HaarObjectDetector Create(DetectorType type) { Accord.Vision.Detection.HaarCascade cascade = null; float scalingFactor = 1.2f; string data = ""; switch (type) { case DetectorType.Face: { data = Properties.Resources.haarcascade_frontalface_default; scalingFactor = 1.2f; } break; case DetectorType.Eye: { data = Properties.Resources.haarcascade_eye; scalingFactor = 1.1f; } break; case DetectorType.Nose: { data = Properties.Resources.haarcascade_mcs_nose; scalingFactor = 1.2f; } break; case DetectorType.Mouth: { data = Properties.Resources.haarcascade_mcs_mouth; scalingFactor = 1.05f; } break; case DetectorType.EarLeft: { data = Properties.Resources.haarcascade_mcs_leftear; scalingFactor = 1.15f; } break; case DetectorType.EarRight: { data = Properties.Resources.haarcascade_mcs_rightear; scalingFactor = 1.15f; } break; case DetectorType.FaceProfile: { data = Properties.Resources.haarcascade_profileface; scalingFactor = 1.2f; } break; } cascade = Accord.Vision.Detection.HaarCascade.FromXml(new System.IO.StringReader(data)); var detector = new Accord.Vision.Detection.HaarObjectDetector(cascade); detector.MinSize = new System.Drawing.Size(10, 10); detector.ScalingFactor = scalingFactor; detector.ScalingMode = Accord.Vision.Detection.ObjectDetectorScalingMode.SmallerToGreater; detector.SearchMode = Accord.Vision.Detection.ObjectDetectorSearchMode.Single; detector.UseParallelProcessing = true; return(detector); }
private void configure() { this._actualDetectorType = this._detectorType; this._downConverter.SampleRate = this._sampleRate; this._downConverter.Frequency = (double)this._frequency; this._downConverter2.SampleRate = this._sampleRate; this._downConverter2.Frequency = (double)(this._frequency - 6000); if (this._needNewDecimators) { this.setDecimationCount(); this._baseBandDecimator = new IQDecimator(this._baseBandDecimationStageCount, this._sampleRate, false, Utils.ProcessorCount > 1); this._envelopeDecimator = new IQDecimator(this._envelopeDecimationStageCount, this._sampleRate, false, Utils.ProcessorCount > 1); if (this._hookManager != null) { this._hookManager.SetProcessorSampleRate(ProcessorType.RawIQ, this._sampleRate); this._hookManager.SetProcessorSampleRate(ProcessorType.FrequencyTranslatedIQ, this._sampleRate); this._hookManager.SetProcessorSampleRate(ProcessorType.DecimatedAndFilteredIQ, this._sampleRate / (double)(1 << this._baseBandDecimationStageCount)); this._hookManager.SetProcessorSampleRate(ProcessorType.DemodulatorOutput, this._sampleRate / (double)(1 << this._baseBandDecimationStageCount)); this._hookManager.SetProcessorSampleRate(ProcessorType.FilteredAudioOutput, this._sampleRate / (double)(1 << this._decimationStageCount)); } this._needNewFilters = true; } if (this._needNewFilters) { this.initFilters(); this._samDetector.Range = (float)(this._bandwidth / 2); } if (this._needNewDecimators) { double num = this._sampleRate / Math.Pow(2.0, (double)this._baseBandDecimationStageCount); this._usbDetector.SampleRate = num; this._lsbDetector.SampleRate = num; this._cwDetector.SampleRate = num; this._fmDetector.SampleRate = num; this._pmDetector.SampleRate = num; this._samDetector.SampleRate = (float)num; this._samDetector.BandWidth = 500f; this._samDetector.LockTime = 2f; this._samDetector.LockTreshold = 3f; this._stereoDecoder.Configure(this._fmDetector.SampleRate, this._audioDecimationStageCount); this._rdsDecoder.SampleRate = this._fmDetector.SampleRate; } this._fmDetector.SquelchThreshold = this._squelchThreshold; this._amDetector.SquelchThreshold = this._squelchThreshold; this._stereoDecoder.ForceMono = !this._stereo; switch (this._actualDetectorType) { case DetectorType.AM: case DetectorType.DSB: case DetectorType.SAM: this._downConverter.Frequency += (double)this._frequencyOffset; break; case DetectorType.USB: this._usbDetector.BfoFrequency = -this._bandwidth / 2; this._downConverter.Frequency -= (double)this._usbDetector.BfoFrequency; break; case DetectorType.LSB: this._lsbDetector.BfoFrequency = -this._bandwidth / 2; this._downConverter.Frequency += (double)this._lsbDetector.BfoFrequency; break; case DetectorType.CW: this._cwDetector.BfoFrequency = this._cwToneShift; this._downConverter.Frequency += (double)this._frequencyOffset; break; case DetectorType.NFM: this._fmDetector.Mode = FmMode.Narrow; this._downConverter.Frequency += (double)this._frequencyOffset; break; case DetectorType.WFM: this._fmDetector.Mode = FmMode.Wide; this._downConverter.Frequency += (double)this._frequencyOffset; break; } this._agc.SampleRate = this._sampleRate / Math.Pow(2.0, (double)this._decimationStageCount); this._agc.Decay = this._agcDecay; this._agc.Slope = this._agcSlope; this._agc.Threshold = this._agcThreshold; this._agc.UseHang = this._agcUseHang; this._agcX.SampleRate = this._sampleRate / Math.Pow(2.0, (double)this._decimationStageCount); this._agcX.Decay = this._agcDecay; this._agcX.Slope = this._agcSlope; this._agcX.Threshold = this._agcThreshold; this._agcX.UseHang = this._agcUseHang; this._agcY.SampleRate = this._sampleRate / Math.Pow(2.0, (double)this._decimationStageCount); this._agcY.Decay = this._agcDecay; this._agcY.Slope = this._agcSlope; this._agcY.Threshold = this._agcThreshold; this._agcY.UseHang = this._agcUseHang; this._agcEnv.SampleRate = this._sampleRate / Math.Pow(2.0, (double)this._decimationStageCount); this._agcEnv.Decay = this._agcDecay; this._agcEnv.Slope = this._agcSlope; this._agcEnv.Threshold = this._agcThreshold; this._agcEnv.UseHang = this._agcUseHang; this._decimationModeHasChanged = false; this._needNewDecimators = false; this._needNewFilters = false; }
/// <summary> /// Generates fallback name for the given detector type based on its string representation. /// The method was introduced in order to allow developers to distinguish new detectors /// until they are assigned a proper name. /// </summary> private static string ProvideFallbackName(DetectorType type) { string fallbackName = type.ToString(); if (fallbackName.StartsWith("en") && fallbackName.Length > 2) { fallbackName = fallbackName.Substring(2); } return fallbackName; }
private void Configure() { _actualDetectorType = _detectorType; var multiThreaded = _sampleRate >= _minThreadedSampleRate; if (_downConverter == null || (multiThreaded && _downConverter.PhaseCount > 1)) { _downConverter = new DownConverter(multiThreaded ? Environment.ProcessorCount : 1); } _downConverter.SampleRate = _sampleRate; _downConverter.Frequency = _frequency; if (_needNewDecimators || _baseBandDecimator == null) { _needNewDecimators = false; if (_actualDetectorType == DetectorType.WFM) { var afSamplerate = _sampleRate / Math.Pow(2.0, _decimationStageCount); _audioDecimationStageCount = 0; while (afSamplerate * Math.Pow(2.0, _audioDecimationStageCount) < DefaultWFMBandwidth && _audioDecimationStageCount < _decimationStageCount) { _audioDecimationStageCount++; } _baseBandDecimationStageCount = _decimationStageCount - _audioDecimationStageCount; } else { _baseBandDecimationStageCount = _decimationStageCount; _audioDecimationStageCount = 0; } _baseBandDecimator = new IQDecimator(_baseBandDecimationStageCount, _sampleRate, false, Environment.ProcessorCount > 1); _needNewFilters = true; } if (_needNewFilters) { _needNewFilters = false; InitFilters(); } var baseBandSampleRate = _sampleRate / Math.Pow(2.0, _baseBandDecimationStageCount); _usbDetector.SampleRate = baseBandSampleRate; _lsbDetector.SampleRate = baseBandSampleRate; _cwDetector.SampleRate = baseBandSampleRate; _fmDetector.SampleRate = baseBandSampleRate; _fmDetector.SquelchThreshold = _squelchThreshold; _amDetector.SquelchThreshold = _squelchThreshold; _stereoDecoder.Configure(_fmDetector.SampleRate, _audioDecimationStageCount); _rdsDecoder.SampleRate = _fmDetector.SampleRate; _stereoDecoder.ForceMono = !_fmStereo; switch (_actualDetectorType) { case DetectorType.USB: _usbDetector.BfoFrequency = -_bandwidth / 2; _downConverter.Frequency -= _usbDetector.BfoFrequency; break; case DetectorType.LSB: _lsbDetector.BfoFrequency = -_bandwidth / 2; _downConverter.Frequency += _lsbDetector.BfoFrequency; break; case DetectorType.CW: _cwDetector.BfoFrequency = _cwToneShift; break; case DetectorType.NFM: _fmDetector.Mode = FmMode.Narrow; break; case DetectorType.WFM: _fmDetector.Mode = FmMode.Wide; break; } _agc.SampleRate = _sampleRate / Math.Pow(2.0, _decimationStageCount); _agc.Decay = _agcDecay; _agc.Slope = _agcSlope; _agc.Threshold = _agcThreshold; _agc.UseHang = _agcUseHang; _decimationModeHasChanged = false; }
private static IDetector GetDetectorWithType(IEnumerable <IDetector> detectors, DetectorType type) { foreach (IDetector detector in detectors) { if ((type == DetectorType.Both) || ((detector is ICodecDetector) == (type == DetectorType.Codec))) { return(detector); } } return(null); }