本文整理汇总了C#中Reader.decode方法的典型用法代码示例。如果您正苦于以下问题:C# Reader.decode方法的具体用法?C# Reader.decode怎么用?C# Reader.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reader
的用法示例。
在下文中一共展示了Reader.decode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryToRecognize
private bool TryToRecognize(WriteableBitmap wb, Reader reader, Dictionary<object, object> zxhints, out string output)
{
bool res = false;
output = null;
try
{
var luminiance = new RGBLuminanceSource(wb, wb.PixelWidth, wb.PixelHeight);
var binarizer = new com.google.zxing.common.HybridBinarizer(luminiance);
var binBitmap = new com.google.zxing.BinaryBitmap(binarizer);
// recognize
var results = reader.decode(binBitmap, zxhints); // exception will be thrown if reader cannot decode image.
output = results.Text;
res = true;
}
catch {}
return res;
}
示例2: QRDecode
private string QRDecode(Bitmap image, Reader decoder)
{
/*
MemoryStream ms = new MemoryStream();
image.Save(ms,System.Drawing.Imaging.ImageFormat.Bmp);
DataMatrix dmDecoder = new DataMatrix(ms.ToArray(), image.Width, image.Height, EncodingType.Binary);
return dmDecoder.HexPbm;
* */
var rgb = new RGBLuminanceSource(image, image.Width, image.Height);
var hybrid = new HybridBinarizer(rgb);
BinaryBitmap binBitmap = new BinaryBitmap(hybrid);
string sdecodedString = decoder.decode(binBitmap, null).Text;
//Byte[] result = decoder.decode(binBitmap, null).;
//return null;
return sdecodedString;
}