All Projects → piderman314 → Bardecoder

piderman314 / Bardecoder

Licence: mit
Detect and decode QR Codes, written in 100% Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Bardecoder

Vue Qrcode Reader
A set of Vue.js components for detecting and decoding QR codes.
Stars: ✭ 1,240 (+755.17%)
Mutual labels:  qr-code, qrcode-scanner, qrcode
qrcode
A flutter plugin for scanning QR codes. Use AVCaptureSession in iOS and zxing in Android.
Stars: ✭ 69 (-52.41%)
Mutual labels:  qrcode, qr-code, qrcode-scanner
Zxinglite
🔥 ZXing的精简版,优化扫码和生成二维码/条形码,内置闪光灯等功能。扫描风格支持:微信的线条样式,支付宝的网格样式。几句代码轻松拥有扫码功能 ,ZXingLite让集成更简单。(扫码识别速度快如微信)
Stars: ✭ 2,117 (+1360%)
Mutual labels:  qr-code, qrcode-scanner, qrcode
QR Attendance
This project is an attendance system which provides attendance on scanning QR code. The attendance is stored in Excel sheet named with the date of attendance taken. In this folder a file named Generate.py is used to generate the QR code for given input file. Attend.py file is for scanning the QR code
Stars: ✭ 17 (-88.28%)
Mutual labels:  qrcode, qr-code, qrcode-scanner
quagga2-reader-qr
Quagga2 sample external reader for QR codes
Stars: ✭ 20 (-86.21%)
Mutual labels:  qrcode, qr-code, qrcode-scanner
Qr Code Scanner
📠 A simple, fast and useful progressive web application
Stars: ✭ 982 (+577.24%)
Mutual labels:  qr-code, qrcode-scanner, qrcode
Qrcodereader.swift
Simple QRCode reader in Swift
Stars: ✭ 1,202 (+728.97%)
Mutual labels:  qrcode-scanner, qrcode
Barcodescanner.xf
Barcode Scanner using GoogleVision API for Xamarin Form
Stars: ✭ 82 (-43.45%)
Mutual labels:  qrcode-scanner, qrcode
Qrscanner
A simple QR Code scanner framework for iOS. Provides a similar scan effect to ios13.
Stars: ✭ 134 (-7.59%)
Mutual labels:  qrcode-scanner, qrcode
Qrcodescanner
A lib to aid you quickly achieve qrcode scan
Stars: ✭ 98 (-32.41%)
Mutual labels:  qrcode-scanner, qrcode
Qrcode
💮 amazing QRCode generator in Python (supporting animated gif) - Python amazing 二维码生成器(支持 gif 动态图片二维码)
Stars: ✭ 8,613 (+5840%)
Mutual labels:  qrcode, qr-code
Awesome Qr.js
An awesome QR code generator written in JavaScript.
Stars: ✭ 1,247 (+760%)
Mutual labels:  qr-code, qrcode
Barcode
barcode.php - Generate barcodes from a single PHP file. MIT license.
Stars: ✭ 141 (-2.76%)
Mutual labels:  qr-code, qrcode
Qrcode
A pure JavaScript QRCode encode and decode library.
Stars: ✭ 69 (-52.41%)
Mutual labels:  qrcode-scanner, qrcode
Scannermapp
A QR-code and barcode acanner app built in Delphi using ZXing and TFrameStand
Stars: ✭ 65 (-55.17%)
Mutual labels:  qrcode-scanner, qrcode
Qr Ascii
A small library to generate QR codes with ascii
Stars: ✭ 63 (-56.55%)
Mutual labels:  qr-code, qrcode
Awesomeqrcode
An awesome QR code generator for Android.
Stars: ✭ 1,718 (+1084.83%)
Mutual labels:  qr-code, qrcode
Qr Code With Logo
带头像(logo)的二维码(qrcode)生成工具,无jQuery依赖,自由调整大小
Stars: ✭ 104 (-28.28%)
Mutual labels:  qr-code, qrcode
React Qr Svg
React component for rendering SVG QR codes
Stars: ✭ 134 (-7.59%)
Mutual labels:  qr-code, qrcode
React Native Qrcode Scanner
A QR code scanner component for React Native.
Stars: ✭ 1,796 (+1138.62%)
Mutual labels:  qrcode-scanner, qrcode

Bardecoder

Detect and decode QR Codes, written in 100% Rust.

Travis Build License Crates.io docs.rs Rustc version

Background

This library came about after perusing the Not Yet Awesome Rust list. It strives to be modular so algorithms with different strengths, speeds and robustness can be used interchangeably.

How to use

Add the following to your Cargo.toml:

[dependencies]
bardecoder = "0.2.2"
image = "0.22"

Quick

The quickest way to integrate is to use the built-in default decoder. This will work for the vast majority of cases, though please keep in mind the Tips below.

fn main() {
    let img = image::open("<<image location>>").unwrap();

    // Use default decoder
    let decoder = bardecoder::default_decoder();

    let results = decoder.decode(&img);
    for result in results {
        println!("{}", result.unwrap());
    }
}

Modified

If you want a little customizability, you can start with the default builder instead. It will be pre-populated with the default components but you are free to replace any of them with modified parameters.

use bardecoder;
use bardecoder::prepare::BlockedMean;

use image;

fn main() {
    let img = image::open("<<image location>>").unwrap();

    // Use default decoder builder
    let mut db = bardecoder::default_builder();

    // Use some different arguments in one of the default components
    db.prepare(Box::new(BlockedMean::new(7, 9)));

    // Build the actual decoder
    let decoder = db.build();

    let results = decoder.decode(&img);
    for result in results {
        println!("{}", result.unwrap());
    }
}

You can also start with a completely empty builder but be aware that the build() function will Panic! if any of the components are missing.

use bardecoder::DecoderBuilder;

let mut decoder_builder = DecoderBuilder::new();

Advanced

If you want to go absolutely nuts, you can also provide your own implementations for the various components. Use at your own risk!

use bardecoder;
use bardecoder::prepare::BlockedMean;
use bardecoder::detect::{Detect, Location};

use image;
use image::GrayImage;

struct MyDetector {}

impl MyDetector {
    pub fn new() -> MyDetector {
        MyDetector {}
    }
}

impl Detect<GrayImage> for MyDetector {
    fn detect(&self, prepared: &GrayImage) -> Vec<Location> {
        vec![]
    }
}

fn main() {
    let img = image::open("<<image location>>").unwrap();

    // Use default decoder builder
    let mut db = bardecoder::default_builder();

    // Use some different arguments in one of the default components
    db.prepare(Box::new(BlockedMean::new(7, 9)));

    // Use your homemade Detector!
    db.detect(Box::new(MyDetector::new()));

    // Build the actual decoder
    let decoder = db.build();

    let results = decoder.decode(&img);
    for result in results {
        println!("{}", result.unwrap());
    }
}

Tips

Though this library can handle all sorts of QR images, here are some tips for optimal results:

  • Keep the resolution of the source image low-ish, say between 400x300 and 800x600 pixels. Any higher and it takes quite long to detect any codes.
  • Keep the QR code centered and zoomed in.
  • Keep the QR code free of errors, deliberate or otherwise. While QR codes are self-correcting, the actual correction is not cheap. However before starting that process it is easy to detect that a QR code is error free so in that case an early exit is taken.

Features

Bardecoder exposes the following features for use in your project:

  • debug-images : Some of the default components will output debug images in the <tmp>/bardecoder-debug-images folder, where <tmp> is the default OS temp folder. This can help show visually what the algorithms are doing. Be aware that some of the components (for example QRExtractor) output a lot of images so definitely do not use this feature other than to have a look what is happening when things are going wrong.

  • fail-on-warnings : if you fancy that sort of thing, though its purpose is mostly for travis-ci.

Support

If you find an image with a QR code that this library is unable to decode, please raise an Issue. Please include the image and the code you are trying to decode it with (especially when using the Modified method). I will try my best improve the algorithm though I cannot 100% guarantee that I will succeed, especially with more esoteric QR codes.

Contributing

If you find a small bug and manage to fix it yourself, please feel free to submit a pull request. For larger refactorings and more fundamental issues please submit a ticket outlining the problem and potential solution.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].