Wp 8.1 and WinRT apps very slow work

May 19, 2014 at 5:35 PM
Hi. Just try zxing in universal apps.
var ct = DateTime.Now;
                var barcodeReader = new BarcodeReader
                {
                    AutoRotate = true
                };
                barcodeReader.Options.TryHarder = true;
                barcodeReader.Options.PossibleFormats = new BarcodeFormat[] {BarcodeFormat.QR_CODE};
                var result = barcodeReader.Decode(writeableBitmap);
                Debug.WriteLine((DateTime.Now - ct).TotalMilliseconds);
show me result 8425.1228 ms... and even when I wait this time I didn't get result. I try

This is how I get image from camera
bool decoded = false;
                    while (!decoded)
                    {
                       
                        if (_capture.VideoDeviceController.FocusControl.Supported)
                        {
                            await _capture.VideoDeviceController.FocusControl.SetPresetAsync(FocusPreset.AutoNormal);
                        }
                        stream.Seek(0);
                        
                        await _capture.CapturePhotoToStreamAsync(ImageEncodingProperties.CreateJpeg(), stream);
                        
                        stream.Seek(0);
                        await bmp.SetSourceAsync(stream);
                        
                        var result = ScanBitmap(bmp);
                        
                        if (result != null)
                        {
                            decoded = true;
                            ScanResult.Text = result.Text;
                        }
                    }
Is any way to make library faster?
May 20, 2014 at 2:44 PM
Did you try decoding a static image? Then you can determine what's not working/slow. Is the decoding itself slow or the camera image?
May 21, 2014 at 7:56 AM
with static image work excellent. but with image from camera very very slow. Can I do something to fix this?
May 21, 2014 at 8:33 AM
Hello,

I also tested it with a static image and it was indeed very fast. You also have something like a LowLagPhotoCapture method like described here:

http://msdn.microsoft.com/en-us/library/windows.media.capture.mediacapture.preparelowlagphotocaptureasync.aspx

You can also try to read the preview buffer (i've done something similar in WP7) and pass that into ZXING.