二维码小工具

现在大家随处可以看到二维码,二维码是相对于原来的一维条形码来说的,二维码的种类很多,常见的包括QR Code,PDF417码等。我们目前经常看到的微信支付宝的付款码等都是QR code,QR Code相比其他二维码有很多优势,包括容错性,快速响应性等,它支持40种尺寸,从21*21到177*177。随着尺寸的增大,每个二维码保存的信息量也随之增大,但也有个问题就是手机扫描识别的成功率会降低,特别的对于大尺寸的码很多程序是不识别的。关于QR Code大家可以参考这篇文章,写的很棒。

二维码本质是一种保存信息的载体,它可以保存二进制、数字、字符等,不同类型编码方式不同,保存的信息量略有区别。二维码的存在也使得信息快速传递成为可能,相比原来的输入一长串网址,扫描一个二维码要快捷准确的多,这方面二维码相对于目前的图像识别也要更准确、容错性更高。你可以利用二维码保存、传递很多东西,限制你的只是你的想象力。

近期突发奇想,想通过二维码来传递大数据量的信息,找了相关资料后,发现单个二维码容量是有限制的,具体可以参考这个网站,例如VERSION 20的二维码可以保存1600个数字,保存970个字符,具体保存的多少还和容错率有关。为了实现通过二维码传递大量字符的目的,可以按照下面步骤来做:

  1. 将原始信息进行编码,可以采用UTF-8或其他格式。
  2. 将原始信息拆分为固定大小的子串,并且标明子串的序号(便于后续还原)。简单的方式可以在字符串开头几位用于表示顺序。
  3. 将这些子串编码,生成二维码。

上述过程是可行的,但有一个问题是由于大尺寸的二维码识别率不高,只能采用小尺寸的,但小尺寸的保存的信息又少,这样就导致生成的图片过多。为了解决这个问题,可以在一个图片中放多个二维码,这样的话可以提高保存信息量,并且保证每个二维码识别率;在还原的时候加一个预处理,将图片进行拆分即可。

针对上面说的内容我写了个java小程序,大家可以在这里查看使用,其中使用的是zxing的库。

文章未经特殊标明皆为本人原创,未经许可不得用于任何商业用途,转载请保持完整性并注明来源链接 《ITechLib》

留言:

It's an remarkable post for all the online users; they will obtain benefit from it I am sure.

I found this post to be incredibly well put together and exceptionally clear. The objective approach you used to break down the information makes it highly easy to follow for anyone reading it today.

<a href=https://www.thegameroom.org/gb-gb/online-casinos/nongamstop/>在线购买无处方安定片 xxx Pornhub</a>

This post presents the ideas with clarity and respectfully, creating a discussion that feels pleasant and enjoyable for readers.

<a href=https://accessjustice.ca/>online casino canada</a>

The discussion here feels very smooth and easy to follow, because the ideas are introduced smoothly and the overall tone remains relaxed, pleasant, and open for readers who want to participate in the conversation.

<a href=https://helmuttspetsupply.ca/>best online casino in canada</a>

There is a good balance here between keeping the content informative and maintaining a natural tone, because it allows the discussion to feel more smooth, enjoyable, and comfortable for people reading and interacting with the post.

<a href=https://thebikepedaler.ca/>best online casino in canada</a>

The formatting and overall presentation of this post are absolutely top-notch, making it a breeze to read through and ensuring that the most critical pieces of information stand out clearly without feeling overly heavy.

<a href=https://trustmyscience.com/casino-en-ligne/argent-reel/>在线购买无处方安定片 xxx Pornhub</a>

The way you seamlessly transitioned from one point to the next kept me fully engaged the entire time, and I walk away feeling significantly more knowledgeable about the subject matter than I did beforehand.

<a href=https://www.culture-games.com/casino/>Watch sexual porno video xxx sex adults site</a>

Reading through this material was a great use of my time today. You managed to capture all the most important aspects of the topic while keeping the narrative totally balanced and direct, which is something I always value in online content.

<a href=https://deadspin.com/es/mx/brazino777/codigo-promocional/>CONTENIDO DE VÍDEOS PORNO XXX A LA VENTA</a>

I find this post surprisingly interesting because it explains the ideas in a clear and balanced way without making the topic feel too heavy, and that combination makes the content much more pleasant and accessible for a wide audience of readers.

<a href=https://deadspin.com/sweepstakes-casinos/promo-codes/no-deposit/>CANNABIS FOR SALE SITE</a>

What stands out to me here is the way the discussion flows so naturally from one point to another, making the post feel enjoyable, organized, and comfortable to read from beginning to end.

<a href=https://zondercruks.nl/>Porr på svenska</a>

(lesstile enabled - surround code blocks with ---)