Esempio n. 1
0
            public void Inference(ZXingCode result, InferenceInput <PointerBitmap> input, Rectangle?inputWindow = null)
            {
                var bmp = input.GetClippedPointerBitmap(ref inputWindow);

                var luminance = _Implementation.CreateLuminanceSource(bmp.AsSpanBitmap(), ref _RecyclableBuffer);

                var r = _Reader.Decode(luminance);

                result._Results.Clear();
                result._Results.Add(r);
                result._ResultRect = inputWindow; // we need to store the crop to reinterpret the results as full image.

                result.CaptureTime   = input.CaptureTime;
                result.CaptureDevice = input.CaptureDeviceName;
            }
Esempio n. 2
0
        public static ZXing.Result ScanAndDecodeQRCode <TPixel>(this SpanBitmap <TPixel> src)
            where TPixel : unmanaged
        {
            var reader = new ZXing.BarcodeReaderGeneric();

            reader.Options.PureBarcode = false;
            reader.Options.Hints.Add(ZXing.DecodeHintType.TRY_HARDER, true);
            reader.Options.PossibleFormats = new ZXing.BarcodeFormat[] { ZXing.BarcodeFormat.QR_CODE };
            reader.Options.TryHarder       = true;

            Byte[] buffer = null;

            _TempBuffer?.TryGetTarget(out buffer);

            var luminance = _Implementation.CreateLuminanceSource(src, ref buffer);

            _TempBuffer = new WeakReference <byte[]>(buffer);

            return(reader.Decode(luminance));
        }
Esempio n. 3
0
        public ZXing.Result SearchForQRCodes(SpanBitmap src)
        {
            var luminance = _Implementation.CreateLuminanceSource(src, ref _Buffer);

            return(_Reader.Decode(luminance));
        }