public SummaryBitmap(IFrameData summaryData, IFrameData onsetData) { Resolution = summaryData.Resolution; _bitmap = new Bitmap(summaryData.Length, 250, PixelFormat.Format24bppRgb); var graphics = Graphics.FromImage(_bitmap); graphics.Clear(Color.CadetBlue); graphics.DrawRectangle(Pens.Black, 0, 0, _bitmap.Width - 1, _bitmap.Height - 1); var x = 0; foreach (var m in summaryData.Left) { var h = 240 * m; var d = (_bitmap.Height - h) / 2; graphics.DrawLine(Pens.Black, x, d, x, _bitmap.Height - d); ++x; } if (onsetData != null) { x = 0; foreach (var m in onsetData.Left) { if (m > 0) { graphics.DrawRectangle(Pens.Chartreuse, x, 0, x+1, _bitmap.Height); } ++x; } } }
public IFrameData MakeSummaryData(IFrameData input, int ratio) { var max = new List<float>(); input.BeginChunkyRead(ratio); IFrameDataSubset subset = null; while(input.ReadChunk(ref subset)) { var maxmag = Math.Max(subset.Left.Max(), subset.Right.Max()); var minmag = Math.Min(subset.Left.Min(), subset.Right.Min()); max.Add(Math.Max(maxmag, Math.Abs(minmag))); } return new FrameData(max.ToArray(), null, ratio); }
public float[] DetectOnsets(IFrameData waveData, int samplesPerSecond, int sampleWindowSize, float sensitivity = 1.5f) { _onsetDetection = new OnsetDetection(sampleWindowSize, samplesPerSecond); waveData.BeginChunkyRead(sampleWindowSize); IFrameDataSubset subset = null; while(waveData.ReadChunk(ref subset)) { var mono = ConvertStereoToMono(subset); _onsetDetection.AddFlux(mono); } var onsets = _onsetDetection.FindOnsets(sensitivity); _onsetDetection.NormalizeOnsets(onsets, 0); return onsets; }
public Tune(IFrameData frameData) { _frameData = frameData; }
public void AddEntry(IFrameData item) { Entries.Add((ActionEntry)item); }
public void OnSessionUpdated(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData data) { //NOP }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData data) { if (session.NewlyRecognizedBarcodes.Count == 0) { return; } var barcode = session.NewlyRecognizedBarcodes[0]; // If the code scanned doesn't start with "09:", we will just ignore it and continue // scanning. if (barcode.Data?.StartsWith("09:") == false) { // We temporarily change the brush, used to highlight recognized barcodes, to a // transparent brush. overlay.Brush = Brush.TransparentBrush; return; } // If the code is recognized, we want to make sure to use a brush to highlight the code. overlay.Brush = this.highlightingBrush; // We also want to emit a feedback (vibration and, if enabled, sound). feedback.Emit(); // Stop recognizing barcodes for as long as we are displaying the result. There won't be any // new results until the capture mode is enabled again. Note that disabling the capture mode // does not stop the camera, the camera continues to stream frames until it is turned off. barcodeCapture.Enabled = false; // If you are not disabling barcode capture here and want to continue scanning, consider // setting the codeDuplicateFilter when creating the barcode capture settings to around 500 // or even -1 if you do not want codes to be scanned more than once. // Get the human readable name of the symbology and assemble the result to be shown. using (var description = SymbologyDescription.Create(barcode.Symbology)) { var result = "Scanned: " + barcode.Data + " (" + description.ReadableName + ")"; RunOnUiThread(() => ShowResult(result)); } }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { if (session.NewlyRecognizedBarcodes.Any()) { if (!this.ContinuousScanningEnabled) { this.PauseScanning(); } Barcode barcode = session.NewlyRecognizedBarcodes[0]; this.listener?.ShowDialog(barcode); } }
public void OnSessionUpdated(BarcodeTracking barcodeTracking, BarcodeTrackingSession session, IFrameData frameData) { var products = session.TrackedBarcodes.Values .Select(trackedBarcode => trackedBarcode.Barcode) .Where(barcode => barcode.Data != null) .Select(barcode => Model.Product.Create(barcode.Data, barcode.Symbology.HumanReadableName())); if (this.Element?.BindingContext is MainViewModel viewModel) { viewModel.ScannedProducts = products.ToList(); } }
public void OnSessionUpdated(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { // Dispose the frame when you have finished processing it. If the frame is not properly disposed, // different issues could arise, e.g. a frozen, non-responsive, or "severely stuttering" video feed. frameData.Dispose(); }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { var barcode = session?.NewlyRecognizedBarcodes.FirstOrDefault(); if (barcode == null) { return; } // Stop recognizing barcodes for as long as we are displaying the result. There won't be any new // results until the capture mode is enabled again. Note that disabling the capture mode does // not stop the camera, the camera continues to stream frames until it is turned off. this.barcodeCapture.Enabled = false; // If you are not disabling barcode capture here and want to continue scanning, consider // setting the codeDuplicateFilter when creating the barcode capture settings to around 500 // or even -1 if you do not want codes to be scanned more than once. // Get the human readable name of the symbology and assemble the result to be shown. string symbology = SymbologyDescription.Create(barcode.Symbology).ReadableName; string result = string.Format("Scanned {0} ({1})", barcode.Data, symbology); this.ShowResult(result); // Dispose the frame when you have finished processing it. If the frame is not properly disposed, // different issues could arise, e.g. a frozen, non-responsive, or "severely stuttering" video feed. frameData.Dispose(); }
public void RemoveEntry(IFrameData i) { CameraCommandEntry entry = (CameraCommandEntry)i; Entries.Remove(entry); }
public void AddEntry(IFrameData d) { throw new NotImplementedException(); }
public void OnSessionUpdated(BarcodeTracking barcodeTracking, BarcodeTrackingSession session, IFrameData frameData) { // This method is called whenever objects are updated and it's the right place to react to the tracking results. var products = session.TrackedBarcodes.Values .Select(trackedBarcode => trackedBarcode.Barcode) .Where(barcode => barcode.Data != null) .Select(barcode => Model.Product.Create(barcode.Data, barcode.Symbology.HumanReadableName())); if (this.Element?.BindingContext is MainViewModel viewModel) { viewModel.ScannedProducts = products.ToList(); } frameData.Dispose(); }
public void Load(IFrameData frameData) { throw new System.NotImplementedException(); }
public void BuildOnsets() { var audioAnalysis = new AudioAnalysis(); var onsetData = audioAnalysis.DetectOnsets(_frameData, 44100, 1024); _onsets = new FrameData(onsetData, null, 1024); }
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData) { if (session.NewlyRecognizedBarcodes.Any()) { if (!this.ContinuousScanningEnabled) { this.PauseScanning(); } Barcode barcode = session.NewlyRecognizedBarcodes[0]; using SymbologyDescription description = SymbologyDescription.Create(barcode.Symbology); this.listener?.ShowDialog(description.ReadableName, barcode.Data, barcode.SymbolCount); } }
public void OnSessionUpdated(BarcodeTracking barcodeCapture, BarcodeTrackingSession session, IFrameData frameData) { lock (this.scanResults) { foreach (var trackedBarcode in session.AddedTrackedBarcodes) { using (SymbologyDescription description = SymbologyDescription.Create(trackedBarcode.Barcode.Symbology)) { this.scanResults.Add(new ScanResult { Data = trackedBarcode.Barcode.Data, Symbology = description.ReadableName }); } } } }