qrscanner 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +2 -0
- data/README +9 -2
- data/Rakefile +2 -1
- data/ext/qrscanner/zxing/core/src/zxing/DecodeHints.h +1 -1
- data/ext/qrscanner/zxing/magick/src/qrscanner.cpp +4 -3
- data/qrscanner.gemspec +3 -4
- metadata +4 -12
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -12,24 +12,31 @@ Usage
|
|
12
12
|
|
13
13
|
Example:
|
14
14
|
|
15
|
+
First, gem install 'qrscanner'
|
16
|
+
|
15
17
|
require 'qrscanner'
|
16
18
|
|
17
19
|
QrScanner.decode '/path/to/hellworld.png'
|
18
20
|
=> "Hello, world"
|
19
21
|
|
20
22
|
The parameter accepts any image format that ImageMagick supports, which
|
21
|
-
should include
|
23
|
+
should include PDF for scanned documents as well as PNG/JPG/TIFF/etc.
|
22
24
|
|
23
25
|
Returns nil if it can't find a qr code or other error.
|
24
26
|
|
25
27
|
|
28
|
+
|
26
29
|
Dependencies
|
27
30
|
------------
|
28
31
|
|
29
32
|
* Python (for ZXing build script)
|
30
|
-
* ImageMagick
|
33
|
+
* ImageMagick: libMagick++, libMagickWand, libMagickCore
|
31
34
|
* gcc, g++, libstd++
|
35
|
+
* Operating system with a PREFIX of "/usr".
|
32
36
|
|
37
|
+
This last one means it really only works on Linux eg. Ubuntu, and not OSX or
|
38
|
+
BSD, because the ZXing CPP build script has hard coded paths for include
|
39
|
+
files etc. :-(
|
33
40
|
|
34
41
|
|
35
42
|
|
data/Rakefile
CHANGED
@@ -5,5 +5,6 @@ Echoe.new("qrscanner") do |p|
|
|
5
5
|
p.email = 'andrew@modulus.org'
|
6
6
|
p.summary = "Ruby gem QR code scanner based on ZXing"
|
7
7
|
p.url = "http://github.com/andys/qrscanner"
|
8
|
-
p.ignore_pattern = /^pkg|^doc|^\.svn|^\.git/
|
8
|
+
# p.ignore_pattern = /^pkg|^doc|^\.svn|^\.git/
|
9
|
+
p.ignore_pattern = /^(pkg|doc)|(\.svn|CVS|\.bzr|\.DS|\.git)$/
|
9
10
|
end
|
@@ -28,7 +28,7 @@ typedef unsigned int DecodeHintType;
|
|
28
28
|
|
29
29
|
class DecodeHints {
|
30
30
|
|
31
|
-
|
31
|
+
public:
|
32
32
|
|
33
33
|
static const DecodeHintType BARCODEFORMAT_QR_CODE_HINT = 1 << BarcodeFormat_QR_CODE;
|
34
34
|
static const DecodeHintType BARCODEFORMAT_DATA_MATRIX_HINT = 1 << BarcodeFormat_DATA_MATRIX;
|
@@ -68,6 +68,7 @@ extern "C" char *decode_qr_image(const char *fname) {
|
|
68
68
|
const char* result_format = "";
|
69
69
|
|
70
70
|
Image image;
|
71
|
+
image.density(Geometry(300,300)); // for PDFs or vector input with low, incorrect DPI set eg. some Canon scanners
|
71
72
|
try {
|
72
73
|
image.read(fname);
|
73
74
|
} catch (...) {
|
@@ -79,10 +80,10 @@ extern "C" char *decode_qr_image(const char *fname) {
|
|
79
80
|
try {
|
80
81
|
Ref<MagickBitmapSource> source(new MagickBitmapSource(image));
|
81
82
|
|
82
|
-
binarizer = new HybridBinarizer(source);
|
83
|
-
|
83
|
+
// binarizer = new HybridBinarizer(source);
|
84
|
+
binarizer = new GlobalHistogramBinarizer(source);
|
84
85
|
|
85
|
-
DecodeHints hints(DecodeHints::DEFAULT_HINT);
|
86
|
+
DecodeHints hints(DecodeHints::BARCODEFORMAT_QR_CODE_HINT /*DecodeHints::DEFAULT_HINT*/);
|
86
87
|
hints.setTryHarder(tryHarder);
|
87
88
|
Ref<BinaryBitmap> binary(new BinaryBitmap(binarizer));
|
88
89
|
Ref<Result> result(decode(binary, hints));
|
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.2"
|
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-04-05}
|
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,11 +18,10 @@ 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.6.2}
|
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
|
26
25
|
s.specification_version = 3
|
27
26
|
|
28
27
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qrscanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
version: "0.1"
|
4
|
+
prerelease:
|
5
|
+
version: "0.2"
|
9
6
|
platform: ruby
|
10
7
|
authors:
|
11
8
|
- Andrew Snow
|
@@ -13,7 +10,7 @@ autorequire:
|
|
13
10
|
bindir: bin
|
14
11
|
cert_chain: []
|
15
12
|
|
16
|
-
date: 2011-
|
13
|
+
date: 2011-04-05 00:00:00 +10:00
|
17
14
|
default_executable:
|
18
15
|
dependencies: []
|
19
16
|
|
@@ -1000,22 +997,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1000
997
|
requirements:
|
1001
998
|
- - ">="
|
1002
999
|
- !ruby/object:Gem::Version
|
1003
|
-
segments:
|
1004
|
-
- 0
|
1005
1000
|
version: "0"
|
1006
1001
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1007
1002
|
none: false
|
1008
1003
|
requirements:
|
1009
1004
|
- - ">="
|
1010
1005
|
- !ruby/object:Gem::Version
|
1011
|
-
segments:
|
1012
|
-
- 1
|
1013
|
-
- 2
|
1014
1006
|
version: "1.2"
|
1015
1007
|
requirements: []
|
1016
1008
|
|
1017
1009
|
rubyforge_project: qrscanner
|
1018
|
-
rubygems_version: 1.
|
1010
|
+
rubygems_version: 1.6.2
|
1019
1011
|
signing_key:
|
1020
1012
|
specification_version: 3
|
1021
1013
|
summary: Ruby gem QR code scanner based on ZXing
|