public View ViewForTrackedBarcode(BarcodeTrackingAdvancedOverlay overlay, TrackedBarcode trackedBarcode) { return(this.listener?.GetOrCreateViewForBubbleData( trackedBarcode, this.bubbleDataProvider.GetDataForBarcode(trackedBarcode.Barcode.Data), this.listener.ShouldShowBubble(trackedBarcode))); }
private void SetupRecognition() { // Create data capture context using your license key. this.context = DataCaptureContextExtensions.LicensedContext; // Use the camera and set it as the frame source of the context. The camera is off by // default and must be turned on to start streaming frames to the data capture context for recognition. // See viewWillAppear and viewDidDisappear above. this.context.SetFrameSourceAsync(this.camera); // Use the recommended camera settings for the BarcodeTracking mode as default settings. // The preferred resolution is automatically chosen, which currently defaults to HD on all devices. // Setting the preferred resolution to full HD helps to get a better decode range. var cameraSettings = BarcodeTracking.RecommendedCameraSettings; cameraSettings.PreferredResolution = VideoResolution.Uhd4k; this.camera?.ApplySettingsAsync(cameraSettings); // The barcode tracking process is configured through barcode tracking settings // and are then applied to the barcode tracking instance that manages barcode tracking. var settings = BarcodeTrackingSettings.Create(BarcodeTrackingScenario.A); // The settings instance initially has all types of barcodes (symbologies) disabled. For the purpose of this // sample we enable a very generous set of symbologies. In your own app ensure that you only enable the // symbologies that your app requires as every additional enabled symbology has an impact on processing times. settings.EnableSymbologies(new HashSet <Symbology> { Symbology.Ean13Upca, Symbology.Ean8, Symbology.Upce, Symbology.Code39, Symbology.Code128 }); // Create new barcode tracking mode with the settings from above. this.barcodeTracking = BarcodeTracking.Create(this.context, settings); this.barcodeTracking.AddListener(this); // To visualize the on-going barcode tracking process on screen, setup a data capture view that renders the // camera preview. The view must be connected to the data capture context. this.captureView = DataCaptureView.Create(this.context, this.View.Bounds); this.captureView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(this.captureView); this.View.SendSubviewToBack(this.captureView); // Add a barcode tracking overlay to the data capture view to render the tracked barcodes on top of the video // preview. This is optional, but recommended for better visual feedback. The overlay is automatically added // to the view. this.basicOverlay = BarcodeTrackingBasicOverlay.Create(this.barcodeTracking, this.captureView); this.basicOverlay.Listener = this; // Add another barcode tracking overlay to the data capture view to render other views. The overlay is // automatically added to the view. this.advancedOverlay = BarcodeTrackingAdvancedOverlay.Create(this.barcodeTracking, this.captureView); this.advancedOverlay.Listener = this; }
public PointWithUnit OffsetForTrackedBarcode( BarcodeTrackingAdvancedOverlay overlay, TrackedBarcode trackedBarcode, View view) { // We want to center the view on top of the barcode. return(new PointWithUnit( new FloatWithUnit(0f, MeasureUnit.Fraction), new FloatWithUnit(-1f, MeasureUnit.Fraction))); }
public PointWithUnit OffsetForTrackedBarcode(BarcodeTrackingAdvancedOverlay overlay, TrackedBarcode trackedBarcode) { // We set the offset's height to be equal of the 100 percent of our overlay. // The minus sign means that the overlay will be above the barcode. return(new PointWithUnit() { X = new FloatWithUnit() { Value = 0, Unit = MeasureUnit.Fraction }, Y = new FloatWithUnit() { Value = -1, Unit = MeasureUnit.Fraction } }); }
public Anchor AnchorForTrackedBarcode(BarcodeTrackingAdvancedOverlay overlay, TrackedBarcode trackedBarcode) { // The offset of our overlay will be calculated from the top center anchoring point. return(Anchor.TopCenter); }
public UIView ViewForTrackedBarcode(BarcodeTrackingAdvancedOverlay overlay, TrackedBarcode trackedBarcode) { return(CreateStockOverlay(trackedBarcode)); }
public Anchor AnchorForTrackedBarcode( BarcodeTrackingAdvancedOverlay overlay, TrackedBarcode trackedBarcode) { return(Anchor.TopCenter); }