qrscanner 0.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,8 @@
1
1
 
2
+ v0.3.1. Released for rubygems
3
+
4
+ v0.3. Blur image to reduce noise
5
+
2
6
  v0.2. Choose better binarizer, ignore non-QR barcodes, override DPI
3
7
 
4
8
  v0.1. initial commit
data/README CHANGED
@@ -12,7 +12,8 @@ Usage
12
12
 
13
13
  Example:
14
14
 
15
- First, gem install 'qrscanner'
15
+ First, gem install 'qrscanner'. This also provides you with a command-line
16
+ tool ("qrscanner") for testing.
16
17
 
17
18
  require 'qrscanner'
18
19
 
@@ -22,7 +23,9 @@ First, gem install 'qrscanner'
22
23
  The parameter accepts any image format that ImageMagick supports, which
23
24
  should include PDF for scanned documents as well as PNG/JPG/TIFF/etc.
24
25
 
25
- Returns nil if it can't find a qr code or other error.
26
+ Returns nil if it can't find a qr code or other error. It currently prints
27
+ the error to STDERR.
28
+
26
29
 
27
30
 
28
31
 
@@ -45,4 +48,3 @@ Contact the author
45
48
 
46
49
  Andrew Snow <andrew@modulus.org>
47
50
  Andys^ on irc.freenode.net
48
- @andy_snow on the twitter
data/Rakefile CHANGED
@@ -5,6 +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/
9
8
  p.ignore_pattern = /^(pkg|doc)|(\.svn|CVS|\.bzr|\.DS|\.git)$/
10
9
  end
10
+
@@ -2,8 +2,5 @@
2
2
 
3
3
  require 'qrscanner'
4
4
 
5
- if source_file = ARGV.shift
6
- QrScanner.decode(File.new(source_file).read)
7
- else
8
- QrScanner.decode(STDIN.read)
9
- end
5
+ source_file = ARGV.shift or raise 'Missing argument: path to image'
6
+ puts QrScanner.decode(source_file)
@@ -71,8 +71,12 @@ extern "C" char *decode_qr_image(const char *fname) {
71
71
  image.density(Geometry(300,300)); // for PDFs or vector input with low, incorrect DPI set eg. some Canon scanners
72
72
  try {
73
73
  image.read(fname);
74
+ image.blur(2, 0.5);
75
+ } catch (exception& e) {
76
+ cerr << "exception: ";
77
+ cerr << string(e.what()) << endl;
74
78
  } catch (...) {
75
- cerr << "Unable to open image, ignoring" << endl;
79
+ cerr << "Unable to open image" << endl;
76
80
  return(NULL);
77
81
  }
78
82
 
@@ -104,8 +108,10 @@ extern "C" char *decode_qr_image(const char *fname) {
104
108
  res = -5;
105
109
  }
106
110
 
107
- if(res<0)
111
+ if(res<0) {
112
+ cerr << cell_result << endl;
108
113
  return(NULL);
114
+ }
109
115
 
110
116
  return(strdup(cell_result.c_str()));
111
117
  }
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{qrscanner}
5
- s.version = "0.2"
5
+ s.version = "0.3.1"
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-04-05}
9
+ s.date = %q{2011-04-28}
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}
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: qrscanner
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.2"
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrew Snow
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-05 00:00:00 +10:00
13
+ date: 2011-04-28 00:00:00 +10:00
14
14
  default_executable:
15
15
  dependencies: []
16
16