qrscanner 0.3.1 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/ext/qrscanner/qrscanner.c +11 -3
- data/ext/qrscanner/zxing/core/src/zxing/MultiFormatReader.cpp +1 -1
- data/ext/qrscanner/zxing/magick/src/qrscanner.cpp +26 -16
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Action.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Builder.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/CacheDir.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Conftest.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Debug.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Defaults.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Environment.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Errors.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Executor.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Job.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Memoize.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Node/Alias.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Node/FS.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Node/Python.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Node/__init__.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Options/BoolOption.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Options/EnumOption.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Options/ListOption.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Options/PackageOption.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Options/PathOption.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Options/__init__.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/PathList.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Platform/__init__.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Platform/posix.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConf.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Scanner/C.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Scanner/D.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Scanner/Dir.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Scanner/Fortran.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Scanner/LaTeX.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Scanner/Prog.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Scanner/__init__.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Script/Interactive.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Script/Main.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Script/SConsOptions.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Script/SConscript.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Script/__init__.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Subst.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Taskmaster.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/BitKeeper.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/CVS.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/FortranCommon.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/JavaCommon.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/Perforce.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/PharLapCommon.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/RCS.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/SCCS.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/ar.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/as.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/c++.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/cc.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/default.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/dmd.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/dvipdf.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/dvips.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/f77.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/f90.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/f95.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/filesystem.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/fortran.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/g++.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/g77.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/gas.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/gcc.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/gfortran.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/gnulink.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/gs.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/ifl.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/ifort.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/install.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/jar.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/javac.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/javah.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/latex.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/lex.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/link.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/m4.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/pdf.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/pdflatex.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/pdftex.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/rmic.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/rpcgen.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/rpm.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/swig.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/tar.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/tex.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/wix.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/yacc.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/zip.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Util.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Variables/BoolVariable.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Variables/EnumVariable.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Variables/ListVariable.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Variables/PackageVariable.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Variables/PathVariable.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Variables/__init__.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Warnings.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/__init__.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/compat/__init__.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/compat/_scons_builtins.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/cpp.pyc +0 -0
- data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/dblite.pyc +0 -0
- data/qrscanner.gemspec +4 -3
- metadata +12 -4
data/CHANGELOG
CHANGED
data/ext/qrscanner/qrscanner.c
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
#include "ruby.h"
|
6
6
|
|
7
|
-
char *decode_qr_image(const char *fname);
|
7
|
+
char *decode_qr_image(const char *fname, int dpi, int blur);
|
8
8
|
|
9
9
|
VALUE QrScanner = Qnil;
|
10
10
|
|
@@ -19,8 +19,16 @@ void Init_qrscanner() {
|
|
19
19
|
|
20
20
|
VALUE method_decode(VALUE self, VALUE fn) {
|
21
21
|
VALUE ret;
|
22
|
-
char *str;
|
23
|
-
|
22
|
+
char *str = NULL;
|
23
|
+
int dpis[] = {0, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 220, 240, 260, 280, 300, 450};
|
24
|
+
int blurs[] = {0, 2, 4, 6, 8, 10, 15, 20, 50};
|
25
|
+
int dpi, blur;
|
26
|
+
|
27
|
+
for(blur=0; !str && blur<9; blur++) {
|
28
|
+
for(dpi=0; !str && dpi<11; dpi++) {
|
29
|
+
str = decode_qr_image(StringValuePtr(fn), dpis[dpi], blurs[blur]);
|
30
|
+
}
|
31
|
+
}
|
24
32
|
if(!str)
|
25
33
|
return Qnil;
|
26
34
|
|
@@ -18,6 +18,7 @@
|
|
18
18
|
*/
|
19
19
|
|
20
20
|
#include <iostream>
|
21
|
+
#include <cstdio>
|
21
22
|
#include <fstream>
|
22
23
|
#include <string>
|
23
24
|
#include <Magick++.h>
|
@@ -58,7 +59,7 @@ Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints) {
|
|
58
59
|
}
|
59
60
|
|
60
61
|
|
61
|
-
extern "C" char *decode_qr_image(const char *fname) {
|
62
|
+
extern "C" char *decode_qr_image(const char *fname, int dpi, int blur) {
|
62
63
|
|
63
64
|
string cell_result;
|
64
65
|
int res = -1;
|
@@ -66,19 +67,23 @@ extern "C" char *decode_qr_image(const char *fname) {
|
|
66
67
|
Ref<BitMatrix> matrix(NULL);
|
67
68
|
Ref<Binarizer> binarizer(NULL);
|
68
69
|
const char* result_format = "";
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
} catch (...) {
|
79
|
-
cerr << "Unable to open image" << endl;
|
80
|
-
return(NULL);
|
70
|
+
|
71
|
+
Image image;
|
72
|
+
if(dpi) {
|
73
|
+
image.density(Geometry(dpi,dpi));
|
74
|
+
}
|
75
|
+
try {
|
76
|
+
image.read(fname);
|
77
|
+
if(blur) {
|
78
|
+
image.blur(2, ((double)blur)/10.0);
|
81
79
|
}
|
80
|
+
} catch (exception& e) {
|
81
|
+
cerr << "exception: ";
|
82
|
+
cerr << string(e.what()) << endl;
|
83
|
+
} catch (...) {
|
84
|
+
cerr << "Unable to open image" << endl;
|
85
|
+
return(NULL);
|
86
|
+
}
|
82
87
|
|
83
88
|
|
84
89
|
try {
|
@@ -95,8 +100,12 @@ extern "C" char *decode_qr_image(const char *fname) {
|
|
95
100
|
result_format = barcodeFormatNames[result->getBarcodeFormat()];
|
96
101
|
res = 0;
|
97
102
|
} catch (ReaderException e) {
|
98
|
-
|
99
|
-
|
103
|
+
if(strlen(e.what())==0) {
|
104
|
+
cell_result = "";
|
105
|
+
} else {
|
106
|
+
cell_result = "zxing::ReaderException: " + string(e.what());
|
107
|
+
res = -2;
|
108
|
+
}
|
100
109
|
} catch (zxing::IllegalArgumentException& e) {
|
101
110
|
cell_result = "zxing::IllegalArgumentException: " + string(e.what());
|
102
111
|
res = -3;
|
@@ -109,7 +118,8 @@ extern "C" char *decode_qr_image(const char *fname) {
|
|
109
118
|
}
|
110
119
|
|
111
120
|
if(res<0) {
|
112
|
-
|
121
|
+
if(cell_result.length() > 0)
|
122
|
+
cerr << cell_result << endl;
|
113
123
|
return(NULL);
|
114
124
|
}
|
115
125
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Variables/PackageVariable.pyc
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/qrscanner.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{qrscanner}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Andrew Snow"]
|
9
|
-
s.date = %q{2011-
|
9
|
+
s.date = %q{2011-07-27}
|
10
10
|
s.default_executable = %q{qrscanner}
|
11
11
|
s.description = %q{Ruby gem QR code scanner based on ZXing}
|
12
12
|
s.email = %q{andrew@modulus.org}
|
@@ -18,10 +18,11 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Qrscanner", "--main", "README"]
|
19
19
|
s.require_paths = ["lib", "ext"]
|
20
20
|
s.rubyforge_project = %q{qrscanner}
|
21
|
-
s.rubygems_version = %q{1.
|
21
|
+
s.rubygems_version = %q{1.3.7}
|
22
22
|
s.summary = %q{Ruby gem QR code scanner based on ZXing}
|
23
23
|
|
24
24
|
if s.respond_to? :specification_version then
|
25
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
26
|
s.specification_version = 3
|
26
27
|
|
27
28
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qrscanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 4
|
8
|
+
version: "0.4"
|
6
9
|
platform: ruby
|
7
10
|
authors:
|
8
11
|
- Andrew Snow
|
@@ -10,7 +13,7 @@ autorequire:
|
|
10
13
|
bindir: bin
|
11
14
|
cert_chain: []
|
12
15
|
|
13
|
-
date: 2011-
|
16
|
+
date: 2011-07-27 00:00:00 +10:00
|
14
17
|
default_executable:
|
15
18
|
dependencies: []
|
16
19
|
|
@@ -997,17 +1000,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
997
1000
|
requirements:
|
998
1001
|
- - ">="
|
999
1002
|
- !ruby/object:Gem::Version
|
1003
|
+
segments:
|
1004
|
+
- 0
|
1000
1005
|
version: "0"
|
1001
1006
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1002
1007
|
none: false
|
1003
1008
|
requirements:
|
1004
1009
|
- - ">="
|
1005
1010
|
- !ruby/object:Gem::Version
|
1011
|
+
segments:
|
1012
|
+
- 1
|
1013
|
+
- 2
|
1006
1014
|
version: "1.2"
|
1007
1015
|
requirements: []
|
1008
1016
|
|
1009
1017
|
rubyforge_project: qrscanner
|
1010
|
-
rubygems_version: 1.
|
1018
|
+
rubygems_version: 1.3.7
|
1011
1019
|
signing_key:
|
1012
1020
|
specification_version: 3
|
1013
1021
|
summary: Ruby gem QR code scanner based on ZXing
|