本文整理汇总了C#中Result.putMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# Result.putMetadata方法的具体用法?C# Result.putMetadata怎么用?C# Result.putMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result.putMetadata方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: decodeMultiple
/// <summary>
/// Decodes the multiple.
/// </summary>
/// <param name="image">The image.</param>
/// <param name="hints">The hints.</param>
/// <returns></returns>
public Result[] decodeMultiple(BinaryBitmap image, IDictionary<DecodeHintType, object> hints)
{
var results = new List<Result>();
var detectorResults = new MultiDetector(image.BlackMatrix).detectMulti(hints);
foreach (DetectorResult detectorResult in detectorResults)
{
var decoderResult = getDecoder().decode(detectorResult.Bits, hints);
if (decoderResult == null)
continue;
var points = detectorResult.Points;
var result = new Result(decoderResult.Text, decoderResult.RawBytes, points, BarcodeFormat.QR_CODE);
var byteSegments = decoderResult.ByteSegments;
if (byteSegments != null)
{
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
}
var ecLevel = decoderResult.ECLevel;
if (ecLevel != null)
{
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
results.Add(result);
}
return results.Count == 0 ? EMPTY_RESULT_ARRAY : results.ToArray();
}
示例2: Decode
public Result Decode(BinaryBitmap image, System.Collections.Hashtable hints)
{
DecoderResult decoderResult;
ResultPoint[] points;
if (hints != null && hints.ContainsKey(DecodeHintType.PURE_BARCODE))
{
BitMatrix bits = extractPureBits(image.BlackMatrix);
decoderResult = decoder.decode(bits);
points = NO_POINTS;
}
else
{
DetectorResult detectorResult = new Detector(image.BlackMatrix).detect();
decoderResult = decoder.decode(detectorResult.Bits);
points = detectorResult.Points;
}
Result result = new Result(decoderResult.Text, decoderResult.RawBytes, points, BarcodeFormat.DATAMATRIX);
if (decoderResult.ByteSegments != null)
{
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.ByteSegments);
}
if (decoderResult.ECLevel != null)
{
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.ECLevel.ToString());
}
return result;
}
示例3: Decode
/// <summary>
/// Locates and decodes a MaxiCode within an image. This method also accepts
/// hints, each possibly associated to some data, which may help the implementation decode.
/// </summary>
/// <param name="image">image of barcode to decode</param>
/// <param name="hints">passed as a <see cref="IDictionary{TKey, TValue}"/> from <see cref="DecodeHintType"/>
/// to arbitrary data. The
/// meaning of the data depends upon the hint type. The implementation may or may not do
/// anything with these hints.</param>
/// <returns>
/// String which the barcode encodes
/// </returns>
public Result Decode(BinaryBitmap image, IDictionary<DecodeHintType, object> hints)
{
DecoderResult decoderResult;
if (hints != null && hints.ContainsKey(DecodeHintType.PURE_BARCODE))
{
BitMatrix bits = extractPureBits(image.BlackMatrix);
if (bits == null)
return null;
decoderResult = decoder.decode(bits, hints);
if (decoderResult == null)
return null;
}
else
{
return null;
}
ResultPoint[] points = NO_POINTS;
Result result = new Result(decoderResult.Text, decoderResult.RawBytes, points, BarcodeFormat.MAXICODE);
var ecLevel = decoderResult.ECLevel;
if (ecLevel != null)
{
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
return result;
}
示例4: decode
public Result decode(BinaryBitmap image, IDictionary<DecodeHintType, object> hints)
{
DecoderResult decoderResult;
ResultPoint[] points;
if (hints != null && hints.ContainsKey(DecodeHintType.PURE_BARCODE))
{
BitMatrix bits = extractPureBits(image.BlackMatrix);
if (bits == null)
return null;
decoderResult = decoder.decode(bits);
points = NO_POINTS;
}
else
{
DetectorResult detectorResult = new Detector(image.BlackMatrix).detect();
if (detectorResult == null)
return null;
decoderResult = decoder.decode(detectorResult.Bits);
points = detectorResult.Points;
}
if (decoderResult == null)
return null;
Result result = new Result(decoderResult.Text, decoderResult.RawBytes, points,
BarcodeFormat.DATA_MATRIX);
IList<byte[]> byteSegments = decoderResult.ByteSegments;
if (byteSegments != null)
{
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
}
var ecLevel = decoderResult.ECLevel;
if (ecLevel != null)
{
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
return result;
}
示例5: Decode
/// <summary>
/// Locates and decodes a Data Matrix code in an image.
/// </summary>
/// <param name="image">image of barcode to decode</param>
/// <param name="hints">passed as a {@link java.util.Hashtable} from {@link com.google.zxing.DecodeHintType}
/// to arbitrary data. The
/// meaning of the data depends upon the hint type. The implementation may or may not do
/// anything with these hints.</param>
/// <returns>
/// String which the barcode encodes
/// </returns>
public Result Decode(BinaryBitmap image, IDictionary<DecodeHintType, object> hints)
{
var blackmatrix = image.BlackMatrix;
if (blackmatrix == null)
return null;
AztecDetectorResult detectorResult = new Detector(blackmatrix).detect();
if (detectorResult == null)
return null;
ResultPoint[] points = detectorResult.Points;
if (hints != null &&
hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK))
{
var rpcb = (ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];
if (rpcb != null)
{
foreach (var point in points)
{
rpcb(point);
}
}
}
DecoderResult decoderResult = new Internal.Decoder().decode(detectorResult);
if (decoderResult == null)
return null;
Result result = new Result(decoderResult.Text, decoderResult.RawBytes, points, BarcodeFormat.AZTEC);
IList<byte[]> byteSegments = decoderResult.ByteSegments;
if (byteSegments != null)
{
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
}
var ecLevel = decoderResult.ECLevel;
if (ecLevel != null)
{
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
return result;
}
示例6: decode
/// <summary>
/// Locates and decodes a Data Matrix code in an image.
/// </summary>
/// <param name="image">image of barcode to decode</param>
/// <param name="hints">passed as a {@link java.util.Hashtable} from {@link com.google.zxing.DecodeHintType}
/// to arbitrary data. The
/// meaning of the data depends upon the hint type. The implementation may or may not do
/// anything with these hints.</param>
/// <returns>
/// String which the barcode encodes
/// </returns>
public Result decode(BinaryBitmap image, IDictionary<DecodeHintType, object> hints)
{
var blackmatrix = image.BlackMatrix;
if (blackmatrix == null)
return null;
Detector detector = new Detector(blackmatrix);
ResultPoint[] points = null;
DecoderResult decoderResult = null;
var detectorResult = detector.detect(false);
if (detectorResult != null)
{
points = detectorResult.Points;
decoderResult = new Decoder().decode(detectorResult);
}
if (decoderResult == null)
{
detectorResult = detector.detect(true);
if (detectorResult == null)
return null;
points = detectorResult.Points;
decoderResult = new Decoder().decode(detectorResult);
if (decoderResult == null)
return null;
}
if (hints != null &&
hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK))
{
var rpcb = (ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];
if (rpcb != null)
{
foreach (var point in points)
{
rpcb(point);
}
}
}
var result = new Result(decoderResult.Text, decoderResult.RawBytes, points, BarcodeFormat.AZTEC);
IList<byte[]> byteSegments = decoderResult.ByteSegments;
if (byteSegments != null)
{
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
}
var ecLevel = decoderResult.ECLevel;
if (ecLevel != null)
{
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
result.putMetadata(ResultMetadataType.AZTEC_EXTRA_METADATA,
new AztecResultMetadata(detectorResult.Compact, detectorResult.NbDatablocks, detectorResult.NbLayers));
return result;
}