From 78bb632edefa3fd9e2789d9d6d266cbebbe9e175 Mon Sep 17 00:00:00 2001 From: Christoph Oberhofer Date: Sat, 1 Nov 2014 19:54:36 +0100 Subject: [PATCH] Initial page --- .gitignore | 1 + Gemfile | 2 + Gemfile.lock | 117 ++++++++++++++ README.md | 3 + _config.yml | 2 + _layouts/default.html | 43 ++++++ assets/code128.png | Bin 0 -> 544 bytes examples/index.md | 6 + index.html | 1 - index.md | 71 +++++++++ javascripts/scale.fix.js | 17 +++ stylesheets/pygment_trac.css | 69 +++++++++ stylesheets/styles.css | 287 +++++++++++++++++++++++++++++++++++ 13 files changed, 618 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.md create mode 100644 _config.yml create mode 100644 _layouts/default.html create mode 100644 assets/code128.png create mode 100644 examples/index.md delete mode 100644 index.html create mode 100644 index.md create mode 100644 javascripts/scale.fix.js create mode 100644 stylesheets/pygment_trac.css create mode 100644 stylesheets/styles.css diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c08f9ad --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +_site \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3a1ebf3 --- /dev/null +++ b/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'github-pages' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..99f50ca --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,117 @@ +GEM + remote: https://rubygems.org/ + specs: + RedCloth (4.2.9-x86-mingw32) + activesupport (4.1.7) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.1) + tzinfo (~> 1.1) + blankslate (2.1.2.4) + celluloid (0.16.0) + timers (~> 4.0.0) + classifier-reborn (2.0.1) + fast-stemmer (~> 1.0) + coffee-script (2.3.0) + coffee-script-source + execjs + coffee-script-source (1.8.0) + colorator (0.1) + execjs (2.2.2) + fast-stemmer (1.0.2) + ffi (1.9.6-x86-mingw32) + gemoji (2.1.0) + github-pages (28) + RedCloth (= 4.2.9) + jekyll (= 2.4.0) + jekyll-coffeescript (= 1.0.0) + jekyll-mentions (= 0.1.3) + jekyll-redirect-from (= 0.6.2) + jekyll-sass-converter (= 1.2.0) + jekyll-sitemap (= 0.6.0) + jemoji (= 0.3.0) + kramdown (= 1.3.1) + liquid (= 2.6.1) + maruku (= 0.7.0) + pygments.rb (= 0.6.0) + rdiscount (= 2.1.7) + redcarpet (= 3.1.2) + hitimes (1.2.2) + html-pipeline (1.9.0) + activesupport (>= 2) + nokogiri (~> 1.4) + i18n (0.6.11) + jekyll (2.4.0) + classifier-reborn (~> 2.0) + colorator (~> 0.1) + jekyll-coffeescript (~> 1.0) + jekyll-gist (~> 1.0) + jekyll-paginate (~> 1.0) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 1.1) + kramdown (~> 1.3) + liquid (~> 2.6.1) + mercenary (~> 0.3.3) + pygments.rb (~> 0.6.0) + redcarpet (~> 3.1) + safe_yaml (~> 1.0) + toml (~> 0.1.0) + jekyll-coffeescript (1.0.0) + coffee-script (~> 2.2) + jekyll-gist (1.1.0) + jekyll-mentions (0.1.3) + html-pipeline (~> 1.9.0) + jekyll (~> 2.0) + jekyll-paginate (1.1.0) + jekyll-redirect-from (0.6.2) + jekyll (~> 2.0) + jekyll-sass-converter (1.2.0) + sass (~> 3.2) + jekyll-sitemap (0.6.0) + jekyll-watch (1.1.1) + listen (~> 2.7) + jemoji (0.3.0) + gemoji (~> 2.0) + html-pipeline (~> 1.9) + jekyll (~> 2.0) + json (1.8.1) + kramdown (1.3.1) + liquid (2.6.1) + listen (2.7.11) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + maruku (0.7.0) + mercenary (0.3.4) + mini_portile (0.6.0) + minitest (5.4.2) + nokogiri (1.6.3.1-x86-mingw32) + mini_portile (= 0.6.0) + parslet (1.5.0) + blankslate (~> 2.0) + posix-spawn (0.3.9) + pygments.rb (0.6.0) + posix-spawn (~> 0.3.6) + yajl-ruby (~> 1.1.0) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + rdiscount (2.1.7) + redcarpet (3.1.2) + safe_yaml (1.0.4) + sass (3.4.7) + thread_safe (0.3.4) + timers (4.0.1) + hitimes + toml (0.1.2) + parslet (~> 1.5.0) + tzinfo (1.2.2) + thread_safe (~> 0.1) + yajl-ruby (1.1.0-x86-mingw32) + +PLATFORMS + x86-mingw32 + +DEPENDENCIES + github-pages diff --git a/README.md b/README.md new file mode 100644 index 0000000..831455d --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# QuaggaJS + +An advanced barcode-scanner written in JavaScript \ No newline at end of file diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..a1e8322 --- /dev/null +++ b/_config.yml @@ -0,0 +1,2 @@ +name: QuaggaJS +markdown: redcarpet diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 0000000..802b642 --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,43 @@ + + + + + + QuaggaJS, an advanced barcode-reader written in JavaScript + + + + + + + +
+
+

QuaggaJS

+

An advanced barcode-reader written in JavaScript

+ +

View the Project on GitHub serratus/quaggaJS

+ +
+
+ + {{ content }} +
+ +
+ + + \ No newline at end of file diff --git a/assets/code128.png b/assets/code128.png new file mode 100644 index 0000000000000000000000000000000000000000..14bb80ff9d705ab3cc8573e869da3352bf53c1aa GIT binary patch literal 544 zcmeAS@N?(olHy`uVBq!ia0vp^-+;J`g9%8M9Qf(Zz`*$2)5S5Q;?~=nxBHq5L>vOM z{``+$$FK6FC2mbeL&{opcGM%jd0st2Od1KXoj-?7|svhOa3E!D@WTJ(Kj0&F+ zduQ_z$45v^g+jQfLg56UBCrAoQ>7267Ruxkaz`*hrr!O1!Gmk7(+UL27ef9si+5lhgKj90*%WqCxyFF@&PycV3vUSIw zw;z1(85Ta({>~P&PuC9Yt@8fy(*2QpP5P$O*LB$VJMS<2bgsQ2H{#I;UHb>hg+J2u YV~<ur>mdKI;Vst0FpcIyZ`_I literal 0 HcmV?d00001 diff --git a/examples/index.md b/examples/index.md new file mode 100644 index 0000000..77a33bd --- /dev/null +++ b/examples/index.md @@ -0,0 +1,6 @@ +--- +layout: default +title: Examples +--- + +# Examples \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 308ddaf..0000000 --- a/index.html +++ /dev/null @@ -1 +0,0 @@ -"My Github Page" diff --git a/index.md b/index.md new file mode 100644 index 0000000..4d3182c --- /dev/null +++ b/index.md @@ -0,0 +1,71 @@ +--- +layout: default +title: Home +--- + +quaggaJS +======== + +QuaggaJS is a barcode-scanner entirely written in JavaScript supporting real-time localization and decoding of various types of barcodes such as EAN and CODE128. The library is also configured to use `getUserMedia` to get direct access to the user's camera stream. Although the code contains some heavy image-processing parts even recent smartphones are capable of locating and decoding barcodes in real-time. + +![teaser][teaser_left]![teaser][teaser_right] + + +## Yet another barcode library? + +This is not yet another port of the great [zxing][zxing_github] library, but more of an extension to it. This implementation features a barcode locator which is capable of finding a barcode-like pattern in an image resulting in an estimated bounding box including rotation. Simply speaking, this reader is invariant in scale and rotation, whereas other libraries require the barcode to be aligned with the viewport. + + +## Requirements + +In order to take full advantage of quaggaJS, the browser needs to support the `getUserMedia` API which is already implemented by the recent versions of Firefox, Chrome and Opera. The API is also available on their mobile counterparts installed on Android. Safari and IE do not allow the access to the camera yet, neither on desktop, nor on mobile. You can check [caniuse][caniuse_getusermedia] for updates. + +In cases where real-time decoding is not needed, or the platform does not support `getUserMedia` QuaggaJS is also capable of decoding image-files. + +## Installation + +Just clone the repository and include `quagga.min.js` in your project. The code uses [requirejs][requirejs] for dependency management. + +## Usage + +The library exposes the following API + +### quagga.init(config, callback) + +This method initializes the library for a given configuration and a function which is called when the loading-process has finished. The initialization process also requests for camera access if real-time detection is configured. + +### quagga.start() + +When the library is initialized, the `start()` method starts the video-stream and begins locating and decoding the images. + +### quagga.stop() + +If the decoder is currently running, after calling `stop()` the decoder does not process any more images. + +### onDetected(callback) + +Registeres a callback function which is triggered whenever a barcode-pattern has been located and decoded successfully. The callback function is called with the decoded data as the first parameter. + +### decodeSingle(config, callback) + +In contrast to the calls described above, this method does not rely on `getUserMedia` and operates on a single image instead. The provided callback is the same as in `onDetected` and contains the decoded data as first parameter. + +## Examples + +The following example takes an image `src` as input and prints the result on the console. The decoder is configured to detect _Code128_ barcodes and enables the locating-mechanism for more robust results. + +```javascript +quagga.decodeSingle({ + readers: [quagga.Reader.Code128Reader], + locate: true, // try to locate the barcode in the image + src: src //'data:image/jpg;base64,' + data +}, function(result){ + console.log(result); +}); +``` + +[zxing_github]: https://github.com/zxing/zxing +[teaser_left]: https://github.com/serratus/quaggaJS/blob/master/doc/img/mobile-located.png +[teaser_right]: https://github.com/serratus/quaggaJS/blob/master/doc/img/mobile-detected.png +[caniuse_getusermedia]: http://caniuse.com/#feat=stream +[requirejs]: http://requirejs.org/ diff --git a/javascripts/scale.fix.js b/javascripts/scale.fix.js new file mode 100644 index 0000000..87a40ca --- /dev/null +++ b/javascripts/scale.fix.js @@ -0,0 +1,17 @@ +var metas = document.getElementsByTagName('meta'); +var i; +if (navigator.userAgent.match(/iPhone/i)) { + for (i=0; i