{"id":13648775,"url":"https://github.com/piderman314/bardecoder","last_synced_at":"2025-12-12T15:32:21.313Z","repository":{"id":43797802,"uuid":"132137517","full_name":"piderman314/bardecoder","owner":"piderman314","description":"Detect and decode QR Codes, written in 100% Rust.","archived":false,"fork":false,"pushed_at":"2024-02-13T13:04:41.000Z","size":746,"stargazers_count":271,"open_issues_count":20,"forks_count":34,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-09T23:36:20.648Z","etag":null,"topics":["qr-code","qr-codes","qrcode","qrcode-reader","qrcode-scanner","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piderman314.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-04T12:29:52.000Z","updated_at":"2024-11-06T20:43:17.000Z","dependencies_parsed_at":"2024-01-14T10:59:37.306Z","dependency_job_id":"bfcc33ce-1826-4286-b214-73ba621e7de7","html_url":"https://github.com/piderman314/bardecoder","commit_stats":{"total_commits":179,"total_committers":7,"mean_commits":"25.571428571428573","dds":0.05586592178770955,"last_synced_commit":"a57f997d07656f6341833a97a4368bef0eb77ad3"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piderman314%2Fbardecoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piderman314%2Fbardecoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piderman314%2Fbardecoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piderman314%2Fbardecoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piderman314","download_url":"https://codeload.github.com/piderman314/bardecoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250232522,"owners_count":21396658,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["qr-code","qr-codes","qrcode","qrcode-reader","qrcode-scanner","rust"],"created_at":"2024-08-02T01:04:31.893Z","updated_at":"2025-12-12T15:32:16.261Z","avatar_url":"https://github.com/piderman314.png","language":"Rust","readme":"# Bardecoder\n\nDetect and decode QR Codes, written in 100% Rust.\n\n* [Background](#background)\n* [How to use](#how-to-use)\n    * [Quick](#quick)\n    * [Modified](#modified)\n    * [Advanced](#advanced)\n* [Tips](#tips)\n* [Features](#features)\n* [Support](#support)\n* [Contributing](#contributing)\n\n![Github Actions](https://github.com/piderman314/bardecoder/actions/workflows/ci.yml/badge.svg)\n[![License](https://img.shields.io/github/license/piderman314/bardecoder.svg?color=success)](https://github.com/piderman314/bardecoder/blob/master/LICENSE)\n[![Crates.io](https://img.shields.io/crates/v/bardecoder.svg)](https://crates.io/crates/bardecoder)\n[![docs.rs](https://docs.rs/bardecoder/badge.svg)](https://docs.rs/bardecoder)\n[![Rustc version](https://img.shields.io/badge/rustc-1.65%2B-informational.svg)](https://www.rust-lang.org/)\n\n## Background\n\nThis library came about after perusing the [Not Yet Awesome Rust](https://github.com/not-yet-awesome-rust/not-yet-awesome-rust) list. It strives to be modular so algorithms with different strengths, speeds and robustness can be used interchangeably.\n\n## How to use\n\nAdd the following to your `Cargo.toml`:\n\n``` toml\n[dependencies]\nbardecoder = \"0.5.0\"\nimage = \"0.24\"\n```\n\nYou can also use `image` version 0.24 but some changes in that library seem to have degraded performance of `bardecoder` every so slightly.\n\n### Quick\nThe 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](#tips) below.\n\n``` rust\nfn main() {\n    let img = image::open(\"\u003c\u003cimage location\u003e\u003e\").unwrap();\n\n    // Use default decoder\n    let decoder = bardecoder::default_decoder();\n\n    let results = decoder.decode(\u0026img);\n    for result in results {\n        println!(\"{}\", result.unwrap());\n    }\n}\n```\n\n### Modified\nIf 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. \n\n``` rust\nuse bardecoder;\nuse bardecoder::prepare::BlockedMean;\n\nuse image;\n\nfn main() {\n    let img = image::open(\"\u003c\u003cimage location\u003e\u003e\").unwrap();\n\n    // Use default decoder builder\n    let mut db = bardecoder::default_builder();\n\n    // Use some different arguments in one of the default components\n    db.prepare(Box::new(BlockedMean::new(7, 9)));\n\n    // Build the actual decoder\n    let decoder = db.build();\n\n    let results = decoder.decode(\u0026img);\n    for result in results {\n        println!(\"{}\", result.unwrap());\n    }\n}\n```\n\nYou can also start with a completely empty builder but be aware that the `build()` function will `Panic!` if any of the components are missing.\n\n``` rust\nuse bardecoder::DecoderBuilder;\n\nlet mut decoder_builder = DecoderBuilder::new();\n```\n\n### Advanced\nIf you want to go absolutely nuts, you can also provide your own implementations for the various components. Use at your own risk!\n\n``` rust\nuse bardecoder;\nuse bardecoder::prepare::BlockedMean;\nuse bardecoder::detect::{Detect, Location};\n\nuse image;\nuse image::GrayImage;\n\nstruct MyDetector {}\n\nimpl MyDetector {\n    pub fn new() -\u003e MyDetector {\n        MyDetector {}\n    }\n}\n\nimpl Detect\u003cGrayImage\u003e for MyDetector {\n    fn detect(\u0026self, prepared: \u0026GrayImage) -\u003e Vec\u003cLocation\u003e {\n        vec![]\n    }\n}\n\nfn main() {\n    let img = image::open(\"\u003c\u003cimage location\u003e\u003e\").unwrap();\n\n    // Use default decoder builder\n    let mut db = bardecoder::default_builder();\n\n    // Use some different arguments in one of the default components\n    db.prepare(Box::new(BlockedMean::new(7, 9)));\n\n    // Use your homemade Detector!\n    db.detect(Box::new(MyDetector::new()));\n\n    // Build the actual decoder\n    let decoder = db.build();\n\n    let results = decoder.decode(\u0026img);\n    for result in results {\n        println!(\"{}\", result.unwrap());\n    }\n}\n```\n\n## Tips\nThough this library can handle all sorts of QR images, here are some tips for optimal results:\n\n* 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.\n* Keep the QR code centered and zoomed in.\n* 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.\n\n## Features\n\n`Bardecoder` exposes the following features for use in your project:\n\n* `debug-images` : Some of the default components will output debug images in the  `\u003ctmp\u003e/bardecoder-debug-images` folder, where `\u003ctmp\u003e` 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.\n\n* `fail-on-warnings` : if you fancy that sort of thing, though its purpose is mostly for `travis-ci`.\n\n## Support\n\nIf you find an image with a QR code that this library is unable to decode, please raise an [Issue](https://github.com/piderman314/bardecoder/issues). Please include the image and the code you are trying to decode it with (especially when using the [Modified](#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.\n\n## Contributing\n\nIf 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](https://github.com/piderman314/bardecoder/issues) outlining the problem and potential solution.","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiderman314%2Fbardecoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiderman314%2Fbardecoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiderman314%2Fbardecoder/lists"}