public void SimpleScan(Emgu.CV.Image <Emgu.CV.Structure.Bgra, byte> pColorImage) { if (OnCodeDetected == null) { return; } if (pColorImage == null) { return; } BarcodeReader reader = new BarcodeReader(); ZXing.Common.DecodingOptions options = new ZXing.Common.DecodingOptions(); options.TryHarder = TryHarder; reader.Options = options; var barcodeBitmap = pColorImage.Bitmap; if (barcodeBitmap != null) { Result result = reader.Decode(barcodeBitmap); if (result != null) { handleResult(result); } } }
public void FullScan(Emgu.CV.Image <Emgu.CV.Structure.Bgra, byte> pColorImage) { if (OnCodeDetected == null) { return; } BarcodeReader reader = new BarcodeReader(); ZXing.Common.DecodingOptions options = new ZXing.Common.DecodingOptions(); options.TryHarder = TryHarder; reader.Options = options; var barcodeBitmap = pColorImage.Bitmap; // detect and decode the barcode inside the bitmap Result[] result = reader.DecodeMultiple(barcodeBitmap); // do something with the result foreach (Result r in result) { if (r != null) { handleResult(r); } } }
/// <summary> /// 识别图片 /// </summary> /// <param name="writeableBmp"></param> /// <returns></returns> private async Task <Result> ScanQRCodeAsync(WriteableBitmap writeableBmp) { Result res = null; var options = new ZXing.Common.DecodingOptions() { TryHarder = true }; this.barcodeReader = new BarcodeReader { Options = options, AutoRotate = true }; await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { //二维码解码 res = barcodeReader.Decode(writeableBmp); }); return(res); }
//private Result ScanQRCode(WriteableBitmap writeableBmp) //{ // var barcodeReader = new BarcodeReader // { // TryHarder = true, // AutoRotate = true // }; // var result = barcodeReader.Decode(writeableBmp); // if (result != null) // { // Debug.WriteLine(result.Text); // } // return result; //} private async Task<Result> ScanQRCodeAsync(WriteableBitmap writeableBitmap) { Result res = null; var options = new ZXing.Common.DecodingOptions() { TryHarder = true, }; this.barcodeReader = new BarcodeReader { Options = options, AutoRotate = true }; await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { res = barcodeReader.Decode(writeableBitmap); }); return res; }
public BarcodeFormatCollection(ZXing.Common.DecodingOptions options) { this.options = options; }
internal DecodingOptions(ZXing.Common.DecodingOptions other) { wrappedDecodingOptions = other; formatCollection = new BarcodeFormatCollection(wrappedDecodingOptions); }
/// <summary> /// Initializes a new instance of the <see cref="DecodingOptions"/> class. /// </summary> public DecodingOptions() { wrappedDecodingOptions = new ZXing.Common.DecodingOptions(); formatCollection = new BarcodeFormatCollection(wrappedDecodingOptions); }