如何在C#中使用zxing申请里德 - 所罗门算法 [英] How to apply Reed-Solomon algorithm using zxing in C#

查看:372
本文介绍了如何在C#中使用zxing申请里德 - 所罗门算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个嘈杂的信道传输二进制数据。

I want to transmit binary data over a noisy channel.

我读了一个很好的ECC算法来检测错误是里德 - 所罗门。 问题是我不明白输入这个算法。

I read that a good ECC algorithm to detect errors is Reed-Solomon. The problem is i don't understand the input for this algorithm.

这是我天真的失败尝试与zxing.net:

here is my naive failed attempt with zxing.net:

int[] toEncode = { 123,232,432};
var gf = GenericGF.AZTEC_DATA_12;
ReedSolomonEncoder rse = new ReedSolomonEncoder(gf);
rse.encode(toEncode, 2);

ReedSolomonDecoder rsd = new ReedSolomonDecoder(gf);
rse.encode(toEncode, 2);

请向我解释,其输入为EN codeR和去codeR。

please explain to me the input for the encoder and decoder.

推荐答案

这是你正在使用这里的实现:<一href="https://$c$c.google.com/p/zxing/source/browse/trunk/csharp/common/reedsolomon/ReedSolomonEn$c$cr.cs?r=2558"相对=nofollow> ReedSolomonEn coder.cs ?

Is this the implementation you are using here: ReedSolomonEncoder.cs?

如果是这样,以EN code N整数,M数据校正整数,你需要传递长度为N + M的数组。你的数据应在第一N个索引和codeS外表到在末端在最后的m组加入。

If so, to encode N integers with M data correction integers, you need to pass an array of length N+M. Your data should be in the first N indices and the codes look to be added at the end in the final M entries.

<打击>另外,注意在连接codeR以下限制:

更新:更新版本的是在这里: HTTP://zxingnet.$c$cplex.com/ 。其最新版本的<一个href="https://zxingnet.svn.$c$cplex.com/svn/trunk/Source/lib/common/reedsolomon/ReedSolomonEn$c$cr.cs"相对=nofollow> ReedSolomonEn coder.cs 没有这个限制。

Update: a more recent version is here: http://zxingnet.codeplex.com/. Its most recent version of ReedSolomonEncoder.cs does not have this restriction.

这个类实现加工 QR $ C采用Reed-Solomon编码方案$ CS 的。里德所罗门编码一个非常简短的描述是在这里:里德 - 所罗门codeS

This class implements Reed-Solomon encoding schemes used in processing QR codes. A very brief description of Reed Solomon encoding is here: Reed-Solomon Codes.

这是编码的选择QR_ code_FIELD_256(这可能是一个合理的选择。)意味着被你的消息,字节大小的块(符号)产生CS纠错$ C $其中意味着你的最大消息长度(数据连接code以及纠错codeS)是255个字节。如果要发送更多的数据,您将需要它分解成块。

An encoding choice of "QR_CODE_FIELD_256" (which is probably a reasonable choice for you) means that error correction codes are being generated on byte-sized chunks ("symbols") of your message, which means your maximum message length (data to encode plus error correction codes) is 255 bytes long. If you are sending more data you will need to break it into chunks.

更新2:使用QR_ code_FIELD_256,你的整数​​必须介于0和255为好,所以EN codeA一般的字节流,你需要把每一个字节到一个单独的整数的整数数组通过EN codeR传递int数组(加上空间纠错codeS),然后重新转换到(大)字节数组。和反向译码

Update 2: Using QR_CODE_FIELD_256, your integers need to be between 0 and 255 as well, so to encode a general byte stream, you need to put each byte into a separate integer in the integer array, pass the int array (plus space for error correction codes) through the encoder, then reconvert to a (larger) byte array. And the reverse for decoding.

这篇关于如何在C#中使用zxing申请里德 - 所罗门算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆