private string DecodeQrCode(WriteableBitmap wb) { IBarcodeReader reader = QrTools.GetQrReader(); var result = reader.Decode(wb); return(result?.Text); }
private void UninitializeCamera() { StopAutofocusTimer(); StopScanning(); if (_phoneCamera != null) { // Cleanup _phoneCamera.Initialized -= CameraInitialized; CameraButtons.ShutterKeyHalfPressed -= CameraButtons_ShutterKeyHalfPressed; _phoneCamera.CancelFocus(); _phoneCamera.Dispose(); _phoneCamera = null; } if (_autofocusTimer != null) { _autofocusTimer = null; } if (_scanTimer != null) { _scanTimer = null; } if (_previewBuffer != null) { _previewBuffer = null; } if (_barcodeReader != null) { _barcodeReader = null; } }
/// <summary> /// The camera object has been initialised. /// </summary> /// <param name="sender"> /// The sender object is not used. /// </param> /// <param name="e"> /// The event arguments. /// </param> private void CameraInitialised(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(delegate() { this.camera.FlashMode = FlashMode.Off; this.camera.Focus(); var pixelWidth = (int)this.camera.PreviewResolution.Width; var pixelHeight = (int)this.camera.PreviewResolution.Height; this.previewBuffer = new WriteableBitmap(pixelWidth, pixelHeight); this.barcodeReader = new BarcodeReader(); this.barcodeReader.Options.TryHarder = true; this.barcodeReader.ResultFound += this.BarcodeReaderResultFound; this.scanTimer.Start(); }); } else { Dispatcher.BeginInvoke(() => { this.ResolveWithError("Unable to initialize the camera"); }); } }
void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(delegate() { _phoneCamera.FlashMode = FlashMode.Off; _previewBuffer = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height); _barcodeReader = new BarcodeReader(); // By default, BarcodeReader will scan every supported barcode type // If we want to limit the type of barcodes our app can read, // we can do it by adding each format to this list object //var supportedBarcodeFormats = new List<BarcodeFormat>(); //supportedBarcodeFormats.Add(BarcodeFormat.QR_CODE); //supportedBarcodeFormats.Add(BarcodeFormat.DATA_MATRIX); //_barcodeReader.PossibleFormats = supportedBarcodeFormats; _barcodeReader.TryHarder = true; _barcodeReader.ResultFound += _bcReader_ResultFound; _scanTimer.Start(); }); } else { Dispatcher.BeginInvoke(() => { MessageBox.Show("Unable to initialize the camera"); }); } }
void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(delegate() { _phoneCamera.FlashMode = FlashMode.Off; _previewBuffer = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height); _barcodeReader = new BarcodeReader(); _barcodeReader.Options.TryHarder = true; _barcodeReader.ResultFound += _bcReader_ResultFound; _barcodeReader.Options.PossibleFormats = new List <BarcodeFormat>() { BarcodeFormat.EAN_13 }; _scanTimer.Start(); }); } else { Dispatcher.BeginInvoke(() => { MessageBox.Show("Unable to initialize the camera"); }); } }
private void OnCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(() => { this.phoneCamera.FlashMode = FlashMode.Auto; this.phoneCamera.Focus(); this.previewBuffer = new WriteableBitmap((int)this.phoneCamera.PreviewResolution.Width, (int)this.phoneCamera.PreviewResolution.Height); this.barcodeReader = new BarcodeReader(); // By default, BarcodeReader will scan every supported barcode type // If we want to limit the type of barcodes our app can read, // we can do it by adding each format to this list object //var supportedBarcodeFormats = new List<BarcodeFormat>(); //supportedBarcodeFormats.Add(BarcodeFormat.QR_CODE); //supportedBarcodeFormats.Add(BarcodeFormat.DATA_MATRIX); //_bcReader.PossibleFormats = supportedBarcodeFormats; this.barcodeReader.Options.TryHarder = true; this.barcodeReader.ResultFound += this.OnBarcodeResultFound; this.scanTimer.Start(); }); } else { this.Dispatcher.BeginInvoke(() => { this.BarcodeScannerPlugin.OnScanFailed("Unable to initialize the camera"); }); } }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { if (this.scanTimer != null) { this.scanTimer.Stop(); this.scanTimer.Tick -= this.OnTimerTick; this.scanTimer = null; } if (this.phoneCamera != null) { this.phoneCamera.CancelFocus(); this.phoneCamera.Initialized -= this.OnCameraInitialized; this.phoneCamera.Dispose(); } if (this.barcodeReader != null) { this.barcodeReader.ResultFound -= this.OnBarcodeResultFound; this.barcodeReader = null; } if (!this.scanSucceeded && e.NavigationMode == NavigationMode.Back) { this.BarcodeScannerPlugin.OnScanFailed("Cancelled by user"); } }
//Used to do dependency injection in testing public CameraConnection(ITimer <Timer> timer, IBarcodeReader barcodeReader, IVideoSource videoSource, IOutput output) { _timer = timer; _reader = barcodeReader; _videoCaptureDevice = videoSource; _output = output; }
public CodeReader(BarcodeFormat format) { reader = new BarcodeReader(); reader.Options.PossibleFormats = new List <BarcodeFormat>(); reader.Options.PossibleFormats.Add(format /*BarcodeFormat.PDF_417*/); reader.Options.TryHarder = true; }
void ScannerControl_Loaded(object sender, RoutedEventArgs e) { _barcodeReader = new BarcodeReader(); _barcodeReader.Options.TryHarder = true; LoadCameraBrush(); }
void Start() { Application.RequestUserAuthorization(UserAuthorization.WebCam); //gotta ask first string camname = GetBackCamera(); if (camname != "") { cameraFeedTexture = new WebCamTexture(camname); Renderer renderer = GetComponent <Renderer> (); renderer.material.mainTexture = cameraFeedTexture; cameraFeedTexture.Play(); qrReader = new BarcodeReader(); hasCamera = true; } //Plane plane = GetComponent<Plane> (); //transform.localScale = new Vector3 (1*(1/Screen.width), 1, 1*(1/Screen.height)); //float height = 5; //height = height / 3; //transform.localScale = new Vector3 (height, (float)(1), (float)(1)); }
public void Setup() { _barcodeReader = Substitute.For <IBarcodeReader>(); _timer = Substitute.For <ITimer <Timer> >(); _video = Substitute.For <IVideoSource>(); _output = Substitute.For <IOutput>(); _uut = new CameraConnection(_timer, _barcodeReader, _video, _output); }
void stopAll() { camTexture.Stop(); barcodeReader = null; camTexture = null; GetComponent <UIHandler>().changePage(newPage); thisPage.gameObject.SetActive(false); }
public WindowsCEDemoForm() { InitializeComponent(); barcodeReader = new BarcodeReader { AutoRotate = true, TryHarder = false }; barcodeReader.PossibleFormats = new List<BarcodeFormat>(); barcodeReader.PossibleFormats.Add(BarcodeFormat.QR_CODE); }
public BarcodeReaderService(ICurrentActivity currentActivity) { _currentActivity = currentActivity; BarcodeReader = new BarcodeReader(_currentActivity.AppContext); IsReaderEnabled = true; }
public void Setup() { _fakeVideoSource = Substitute.For <IVideoSource>(); _timer = new TimerClock(100); _barcodeReader = new ReadBarcode(); _fakeOutput = Substitute.For <IOutput>(); _sut = new CameraConnection(_timer, _barcodeReader, _fakeVideoSource, _fakeOutput); }
public BarcodeScannerService() { InitializeComponent(); barcodeReader = new BarcodeReader { AutoRotate = true, TryHarder = true }; }
public WindowsCEDemoForm() { InitializeComponent(); barcodeReader = new BarcodeReader { AutoRotate = true, TryHarder = false }; barcodeReader.PossibleFormats = new List <BarcodeFormat>(); barcodeReader.PossibleFormats.Add(BarcodeFormat.QR_CODE); }
public BarcodeScannerService() { barcodeReader = new BarcodeReader { AutoRotate = true, Options = new DecodingOptions { TryHarder = true } }; }
// Use this for initialization void Start() { screenRect = new RectInt(0, 0, Screen.width, Screen.height); screenRectF = new Rect(0, 0, Screen.width, Screen.height); thisCamera = GetComponent <Camera>(); barcodeReader = new BarcodeReader(); texture = new Texture2D(screenRect.width, screenRect.height, TextureFormat.RGB24, false); rt = new RenderTexture(screenRect.width, screenRect.height, 24); frameReady = false; previousVideoURL = ""; }
public MainWindow() { InitializeComponent(); _reader = new BarcodeReader(); CapturingDevicesComboBox.ItemsSource = WebCameraControl.GetVideoCaptureDevices(); if (CapturingDevicesComboBox.Items.Count > 0) { CapturingDevicesComboBox.SelectedItem = CapturingDevicesComboBox.Items[0]; } }
void Start() { Debug.Log("Start bliver kaldt igen"); barCodeReader = new BarcodeReader(); uiMethods = FindObjectOfType <UIMethods>(); uiMethods.Hide(GameObject.Find("Canvas full")); uiMethods.Show(GameObject.Find("Canvas Start")); StartCoroutine(InitializeCamera()); }
public cb() { this.writer = new BarcodeWriter(); this.reader = new BarcodeReader(); this.writer.Format = this.formato; this.writer.Options.Height = 150; this.writer.Options.Width = 160; this.result = null; this.ms = null; this.stream = null; this.Sres = null; }
public BarcodeScannerService() { InitializeComponent(); barcodeReader = new BarcodeReader { AutoRotate = true, Options = new DecodingOptions { TryHarder = true } }; }
void Start() { // Vuforia VuforiaBehaviour.Instance.enabled = true; VuforiaRuntime.Instance.InitVuforia(); // Zxing barCodeReader = new BarcodeReader(); StartCoroutine(InitializeCamera()); // Firebase FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://simplear-e9683.firebaseio.com"); }
private void UninitializeBarcodeReader() { if (_barcodeReader != null) { _barcodeReader.ResultFound -= BarcodeReader_ResultFound; _barcodeReader = null; } if (_previewBuffer != null) { _previewBuffer = null; } }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { var width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); var height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); Dispatcher.BeginInvoke(() => { _previewTransform.Rotation = _photoCamera.Orientation; // create a luminance source which gets its values directly from the camera // the instance is returned directly to the reader _luminance = new PhotoCameraLuminanceSource(width, height); _reader = new BarcodeReader(null, bmp => _luminance, null); }); }
public WindowsCEDemoForm() { InitializeComponent(); barcodeReader = new BarcodeReader { AutoRotate = true, Options = new DecodingOptions { TryHarder = false, PossibleFormats = new List<BarcodeFormat> {BarcodeFormat.QR_CODE} } }; }
public void Setup() { _fakeVideoSource = Substitute.For <IVideoSource>(); _timer = new TimerClock(100); _barcodeReader = new ReadBarcode(); _fakeOutput = Substitute.For <IOutput>(); _camConnection = new CameraConnection(_timer, _barcodeReader, _fakeVideoSource, _fakeOutput); _soundPlayer = new SoundPlayer(_fakeOutput); _obj = new object(); myBitmap = new Bitmap(Environment.CurrentDirectory + @"\barcode.png"); myBitmap.Save("myBitmap.bmp", System.Drawing.Imaging.ImageFormat.Bmp); _sut = new CameraViewModel(_camConnection, _soundPlayer); }
private void InitializeBarcodeReader() { _phoneCamera.FlashMode = FlashMode.Off; _previewBuffer = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height); _barcodeReader = new BarcodeReader(); var supportedBarcodeFormats = new List <BarcodeFormat>(); supportedBarcodeFormats.Add(BarcodeFormat.QR_CODE); _barcodeReader.Options.PossibleFormats = supportedBarcodeFormats; _barcodeReader.Options.TryHarder = true; _barcodeReader.ResultFound += BarcodeReader_ResultFound; }
public void Setup() { _fakeVideoSource = Substitute.For <IVideoSource>(); _timer = new TimerClock(100); _barcodeReader = new ReadBarcode(); _fakeOutput = Substitute.For <IOutput>(); _camConnection = new CameraConnection(_timer, _barcodeReader, _fakeVideoSource, _fakeOutput); _soundPlayer = new SoundPlayer(_fakeOutput); _cameraViewModel = new CameraViewModel(_camConnection, _soundPlayer); _fakeBackendConnection = Substitute.For <IBackendConnection>(); _findItemViewModel = new FindItemViewModel(_fakeBackendConnection, _cameraViewModel); _obj = new object(); _sut = new ShoppingListViewModel(_fakeBackendConnection, _findItemViewModel); }
/// <summary> /// Called before any MonoBehaviour Start callbacks. /// </summary> private void Awake() { // Disable logging when in build #if UNITY_EDITOR Debug.unityLogger.logEnabled = true; #else Debug.unityLogger.logEnabled = false; #endif barcodeReader = new BarcodeReader(); VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStart); VuforiaARController.Instance.RegisterTrackablesUpdatedCallback(OnTrackablesUpdate); VuforiaARController.Instance.RegisterBackgroundTextureChangedCallback(OnBackgroundTextureChange); VuforiaARController.Instance.RegisterOnPauseCallback(OnPause); }
private void cam_Initialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { Dispatcher.BeginInvoke(delegate { _phoneCamera.FlashMode = FlashMode.Off; _previewBuffer = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height); _barcodeReader = new BarcodeReader { Options = { TryHarder = true } }; _barcodeReader.ResultFound += _bcReader_ResultFound; _scanTimer.Start(); }); } else Dispatcher.BeginInvoke(() => MessageBox.Show("No se ha podido inicializar la cámara!")); }
void Camera_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(delegate() { _phoneCamera.FlashMode = FlashMode.Off; _previewBuffer = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height); _barcodeReader = new BarcodeReader(); _barcodeReader.TryHarder = true; _barcodeReader.ResultFound += BarcodeReader_ResultFound; _scanTimer.Start(); OpticalReaderTask.TaskPending = true; }); } else { Dispatcher.BeginInvoke(() => { MessageBox.Show("Unable to initialize the camera"); }); } }
private void cameraInitialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(delegate() { phoneCamera.FlashMode = FlashMode.Off; previewBuffer = new WriteableBitmap((int)phoneCamera.PreviewResolution.Width, (int)phoneCamera.PreviewResolution.Height); barCodeReader = new BarcodeReader(); var supportedBarcodeFormats = new List<BarcodeFormat>(); supportedBarcodeFormats.Add(BarcodeFormat.QR_CODE); barCodeReader.Options.PossibleFormats = supportedBarcodeFormats; barCodeReader.Options.TryHarder = true; barCodeReader.ResultFound += barCodeReaderResultFound; scanTimer.Start(); }); } else { Dispatcher.BeginInvoke(() => { MessageBox.Show("Unable to initialize the camera"); }); } }
private bool stopCamera() { if (_photoCamera == null) { return false; } _luminance = null; _reader = null; _photoCamera.Initialized -= OnPhotoCameraInitialized; _photoCamera.Dispose(); CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress; _photoCamera = null; return true; }
// Update the UI if initialization succeeds. void PhotoCameraOnInitialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e) { if (e.Succeeded) { // Disable the flash to avoid reflections _photoCamera.FlashMode = FlashMode.Off; int width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); int height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); _luminance = new PhotoCameraLuminanceSource(width, height); _reader = new BarcodeReader(null, bmp => _luminance, null); _reader.ResultFound += ReaderOnResultFound; Dispatcher.BeginInvoke(() => _photoCamera.Focus()); } }
private void InitializeBarcodeReader() { _phoneCamera.FlashMode = FlashMode.Off; _previewBuffer = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height); _barcodeReader = new BarcodeReader(); var supportedBarcodeFormats = new List<BarcodeFormat>(); supportedBarcodeFormats.Add(BarcodeFormat.QR_CODE); _barcodeReader.Options.PossibleFormats = supportedBarcodeFormats; _barcodeReader.Options.TryHarder = true; _barcodeReader.ResultFound += BarcodeReader_ResultFound; }
public SaleController(IBarcodeReader barcodeReader, IConsoleOutput consoleOutput, IDictionary<string, string> pricesByProduct) : this(barcodeReader, new SaleView(consoleOutput), new Catalog(pricesByProduct)) { }
public SaleController(IBarcodeReader barcodeReader, ISaleView saleView, ICatalog catalog) { _saleView = saleView; _catalog = catalog; barcodeReader.OnBarcode += HandleBarcode; }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { var width = Convert.ToInt32(photoCamera.PreviewResolution.Width); var height = Convert.ToInt32(photoCamera.PreviewResolution.Height); Dispatcher.BeginInvoke(() => { previewTransform.Rotation = photoCamera.Orientation; // create a luminance source which gets its values directly from the camera // the instance is returned directly to the reader luminance = new PhotoCameraLuminanceSource(width, height); reader = new BarcodeReader(null, bmp => luminance, null); }); }
void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(delegate() { _phoneCamera.FlashMode = FlashMode.Off; _previewBuffer = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width, (int)_phoneCamera.PreviewResolution.Height); _barcodeReader = new BarcodeReader(); // By default, BarcodeReader will scan every supported barcode type // If we want to limit the type of barcodes our app can read, // we can do it by adding each format to this list object //var supportedBarcodeFormats = new List<BarcodeFormat>(); //supportedBarcodeFormats.Add(BarcodeFormat.QR_CODE); //supportedBarcodeFormats.Add(BarcodeFormat.DATA_MATRIX); //_bcReader.PossibleFormats = supportedBarcodeFormats; _barcodeReader.Options.TryHarder = true; _barcodeReader.ResultFound += _bcReader_ResultFound; _scanTimer.Start(); }); } else { Dispatcher.BeginInvoke(() => { MessageBox.Show("Unable to initialize the camera"); }); } }