二维码解析:使用 JavaScript 库reqrcode.js解析二维码
上次使用QRCode.js可以来生成二维码,但是我没有找到有文档说明可以对存在的二维码进行扫描解析其中的内容。
幸亏查找到了可行的解决方案,而且很好使哦!就是reqrcode.js
地址:https://gitee.com/weijunw/erweima/tree/master
|
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
,)),ne
w _a2( )),n ew _a2(, ){return new _ae(c-d,b-c,d,m-p ,k-m,p,,d+k);var e=new _ak(this.image,h,b,i-h,c-b,g,this._am);return e.find()};this.createTransform=function(l,h,k, b,g){)]};_ax._ci=function(a){var b=_ax._cj(a);)}}}}function _dl(a,b){this._dv=a;this._dw=b;this.__defineGetter__("_du",function(){return this._dv});this.__defineGetter__("Codewords",function(){return this._dw})}_dl._gn=function(c,h,r) {}}}}n^=true}if(m!=o. _dp){){throw"ReedSolomonException Bad error location"}j[h]=_az._bd(j[ h],e[g])}};;k<l;k++){j=_az._bd(this._fa.multiply(h,j),t his._dd[k])}){return zero}var h=new Array(j+ );return}else{qrcode.canvas_qr ,i.width,i.height);qrcode.width=i.width;qrcode.height=i.height;try{qrcode .imagedata=h.getImageData(+qrcod e.imagedata.data[a+;this._aj=b;this.__defineGetter__(" _ei",function(){return this._aj});this.__defineGetter__("Count",function(){return this.count});this.__defineGetter__("X",function(){return this.x});this.__defineGetter__("Y",function(){return this.y});this._ek=function(){this.count++};this._ev=function(f,e,d){if(Math.abs(e-this.y)<=f&&Math.abs(d-this.x)<=f){var g=Math.abs(f-this._aj);return g<=1||g/this._aj<=1}return false}}function _es(a){this._go=a[0];this._gu=a[1];this._gr=a[2];this.__defineGetter__("_gp",function(){return this._go});this.__defineGetter__("_gq",function(){return this._gu});this.__defineGetter__("_gs",function(){return this._gr})}function _cc(){this.image=null;this._cv=[];this._ge=false;this._al=new Array(0,0,0,0,0);this._am=null;this.__defineGetter__("_da",function(){this._al[0]=0;this._al[1]=0;this._al[2]=0;this._al[3]=0;this._al[4]=0;return this._al});this._ao=function(f){var b=0;for(var d=0;d<5;d++){var e=f[d];if(e==0){return false}b+=e}if(b<7){return false}var c=Math.floor((b<<_el)/7);var a=Math.floor(c/2);return Math.abs(c-(f[0]<<_el))<a&&Math.abs(c-(f[1]<<_el))<a&&Math.abs(3*c-(f[2]<<_el))<3*a&&Math.abs(c-(f[3]<<_el))<a&&Math.abs(c-(f[4]<<_el))<a};this._an=function(b,a){return(a-b[4]-b[3])-b[2]/2};this._ap=function(a,j,d,g){var c=this.image;var h=qrcode.height;var b=this._da;var f=a;while(f>=0&&c[j+f*qrcode.width]){b[2]++;f--}if(f<0){return NaN}while(f>=0&&!c[j+f*qrcode.width]&&b[1]<=d){b[1]++;f--}if(f<0||b[1]>d){return NaN}while(f>=0&&c[j+f*qrcode.width]&&b[0]<=d){b[0]++;f--}if(b[0]>d){return NaN}f=a+1;while(f<h&&c[j+f*qrcode.width]){b[2]++;f++}if(f==h){return NaN}while(f<h&&!c[j+f*qrcode.width]&&b[3]<d){b[3]++;f++}if(f==h||b[3]>=d){return NaN}while(f<h&&c[j+f*qrcode.width]&&b[4]<d){b[4]++;f++}if(b[4]>=d){return NaN}var e=b[0]+b[1]+b[2]+b[3]+b[4];if(5*Math.abs(e-g)>=2*g){return NaN}return this._ao(b)?this._an(b,f):NaN};this._ej=function(b,a,e,h){var d=this.image;var i=qrcode.width;var c=this._da;var g=b;while(g>=0&&d[g+a*qrcode.width]){c[2]++;g--}if(g<0){return NaN}while(g>=0&&!d[g+a*qrcode.width]&&c[1]<=e){c[1]++;g--}if(g<0||c[1]>e){r *c};this._ce=function(e){var o=false;this.image=e;var n=qrcode.height;var k=qrcode. width; ]+l[}else{return ;i<m.length;i++){k[i]=m.charCodeAt(i)}h.push(k);break;case d:var n=this.get8bitByteArray(g);h.push(n);break;case o:var m=this.getKanjiString(g);h.push(m);break}}while(true);return h})}; |
|
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
<!DOCTYPE html>
<html> <head> <body> <script> newfile.onchange = function () { </html> |
运行


注意:reqrcode.js格式是不是不好看,但是格式化后就不好使了 ~
二维码解析:使用 JavaScript 库reqrcode.js解析二维码的更多相关文章
- 二维码生成:使用 JavaScript 库QRCode.js生成二维码
QRCode.js:跨浏览器的javascript二维码生成库,支持html5的Canvas画布,没有任何依赖. Github 地址:https://github.com/davidshimjs/qr ...
- 使用医学影像开源库cornerstone.js解析Dicom图像显示到HTML中
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- HTML5 Canvas JavaScript库 Fabric.js 使用经验
首先,表明我的态度:采用 Flash 才是最优方案,不建议使用 HTML 5 的 Canvas 做一些生产/工业级的网页应用. Flash的优势一是浏览器支持好,二是代码成熟稳定.而HTML5 的 C ...
- 网页3D效果库Three.js学习[二]-了解照相机
camera 上篇大致了解了three.js ,并可以创建一个简单的可动的立方体.下来我们着重了解下camera (照相机),照相机其实就是视角,就像你的眼睛.Three.js有两种不同的相机模式:直 ...
- 一个用于格式化和处理数字的javascript库----Numeral.js
npm地址:https://www.npmjs.com/package/numeral 1.转化成百分比: numeral(num).format('0.00%')
- 脸部识别JavaScript类库Tracking.js
作者 王文刚 发布于 2014年8月10日 | 对Web开发者而言,开源的JavaScript库Tracking.js正在使计算机视觉和增强现实技术变得简单, 使用它可以展示效果类似Kinect或 ...
- QRCode.js一个生成二维码的javascript库
前言 最近在开发中遇到一个需求:将后端返回的链接转换成二维码,那么如何来实现呢?我们可以使用QRCode.js来解决这一问题 什么是 QRCode.js? QRCode.js 是一个用于生成二维码的 ...
- 你不可错过的二维码生成与解析-java后台与前端js都有
1.二维码分类 二维条码也有许多不同的码制,就码制的编码原理而言,通常分为三种类型. 线性堆叠式二维码 编码原理: 建立在一维条码基础之上,按需要堆积成两行或多行. 图示: 矩阵式二维码 最常用编 ...
- QRCode.js生成二维码
QRCode的GitHub地址: https://github.com/KeeeX/qrcodejs 该版本解决了主版本(https://github.com/davidshimjs/qrcodejs ...
随机推荐
- 【Android】打电话Demo及Android6.0的运行时权限
新手开局,查看一些旧资料,从打电话.发短信的小应用开始.代码很简单,主要是学习了: 用StartActivity()激活一个Activity组件.这里是激活了系统原生的打电话和发短信Activity. ...
- 关于Linux系统指令 top 之 %si 占用高,分析实例一
续“top %wa 高的问题”之后,又遇到top之%si过高(高峰时段超过95%)的问题. %wa高,说明磁盘忙.譬如磁盘读写次数非常高.%si高,是否说明软中断忙?是否也说明软中断次数非常高呢? 为 ...
- update更新另一个字段
1. 写法轻松,更新效率高:update table1 set field1=table2.field1,field2=table2.field2from table2where table1.id= ...
- Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment add these lines... LANG=en_US.utf-8 LC_ALL=en_US.utf-8 QQ技术交流群:576269252 ------- ...
- NetBeans Support Weblog
https://blogs.oracle.com/NetBeansSupport/entry/tomcat_log_files ———————————————————————————————————— ...
- 使用OpenOffice.org将各类文档转为PDF
http://blog.zhaojie.me/2010/05/convert-document-to-pdf-via-openoffice.html ————————————————————————— ...
- R语言-向量化操作(apply、tapply、lapply、sapply、mapply、table等)
一.apply函数(对一个数组按行或者按列进行计算): 使用格式为:apply(X, MARGIN, FUN, ...) 其中X为一个数组:MARGIN为一个向量(表示要将函数FUN应用到X的行还是列 ...
- Linux进程间通信之管道(pipe)、命名管道(FIFO)与信号(Signal)
整理自网络 Unix IPC包括:管道(pipe).命名管道(FIFO)与信号(Signal) 管道(pipe) 管道可用于具有亲缘关系进程间的通信,有名管道克服了管道没有名字的限制,因此,除具有管道 ...
- ViewPager自定义选项卡
转自:http://www.open-open.com/lib/view/open1352621601262.html
- Git安装遇到的问题fatal: Could not read from remote repository.的解决办法
转自:https://blog.csdn.net/huahua78/article/details/52330792 查看远端地址 git remote –v 查看配置 git config --li ...