解析二维码

       public string Recognize(Bitmap image)
        {
            string text = string.Empty;
            var barcodeReader = new BarcodeReader();
            var options = new DecodingOptions();
            options.PureBarcode = false;
            options.TryHarder = true;
            options.PossibleFormats = new List<BarcodeFormat>() { BarcodeFormat.QR_CODE };
            barcodeReader.AutoRotate = true;
            barcodeReader.Options = options;
            //barcodeReader.TryInverted = true;
            var res = barcodeReader.Decode(image);
            if (res == null) return text;
            text = res.Text;
            return text;
        }
原文地址:https://www.cnblogs.com/dyxd/p/6704569.html