C#QR位阵列解码

时间:2012-09-28 06:50:55

标签: c# qr-code

我想知道是否有任何库可以解码QR码位数组而不是图像。 例如:

{
    {1,1,1,1,1,1,1,0,0,0,1,0,1,0,1,1,1,1,1,1,1},
    {1,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1},
    {1,0,1,1,1,0,1,0,1,0,1,1,0,0,1,0,1,1,1,0,1},
    {1,0,1,1,1,0,1,0,0,0,0,0,1,0,1,0,1,1,1,0,1},
    {1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1},
    {1,0,0,0,0,0,1,0,1,1,1,0,0,0,1,0,0,0,0,0,1},
    {1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1},
    {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0},
    {1,1,0,1,0,0,1,1,0,0,1,1,1,0,1,1,1,0,1,1,0},
    {1,1,1,1,1,1,0,0,1,0,0,1,0,1,0,1,0,1,1,1,1},
    {0,1,1,0,0,0,1,1,0,1,1,1,0,0,1,1,1,1,1,0,1},
    {1,0,0,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1},
    {0,1,1,0,1,1,1,1,0,0,1,1,0,1,1,1,0,0,1,0,0},
    {0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,1,0,1,0,0},
    {1,1,1,1,1,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0},
    {1,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,1,1,1},
    {1,0,1,1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,1,1,1},
    {1,0,1,1,1,0,1,0,1,0,0,0,0,1,1,1,0,0,0,1,1},
    {1,0,1,1,1,0,1,0,0,1,1,1,0,1,1,1,0,1,1,0,1},
    {1,0,0,0,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0,0,0},
    {1,1,1,1,1,1,1,0,1,0,1,0,0,1,0,1,0,0,1,1,0}
}

会变成“嗨”。

我不需要任何图像功能。

2 个答案:

答案 0 :(得分:1)

您可以使用zxing解码位矩阵。但是,您需要将多维整数数组转换为锯齿状布尔数组。只需将'1'转换为'true',将'0'转换为'false'。执行以下操作(假设您已引用正确的库)以获得结果。

bool[][] bData; //this should be the converted bit matrix
com.google.zxing.qrcode.decoder.Decoder dec = new com.google.zxing.qrcode.decoder.Decoder();
com.google.zxing.common.DecoderResult result = dec.decode(bData);

答案 1 :(得分:0)

QrCode.Net的演示文稿来看,它似乎可以满足您的需求,因为它的一个功能是:

  

解码作为位矩阵给出的QR码