Git Product home page Git Product logo

rxing's People

Contributors

agkyunromb avatar asha20 avatar cpwood avatar hschimke avatar olssdani avatar samwilsn avatar stevecooktu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rxing's Issues

Support Telepen barcodes for reading and writing

The Telepen barcode format is a widely-used format in the United Kingdom, especially in public libraries. The symbology is defined as per this document.

For a voluntary project to support UK libraries, I need to be able to read Telepen barcodes. With no existing open source libraries supporting this, I have now implemented Telepen in my fork of rxing and would like to add this back to the main codebase. Ultimately, I really want to make use of these changes within the WASM implementation.

There are two variants of Telepen: alphanumeric and numeric. Numeric is actually just an interpretation of the ASCII alphanumeric data returned after interpreting the barcodes, so this is left as an exercise for the user, however I can provide code samples. As such, only alphanumeric is implemented.

I appreciate this would create a divergence between zxing and rxing in that rxing would then support a wider range of symbologies, so I wanted to sound you out on whether the changes in my fork would be a welcome addition or not before we get to the pull request stage.

I'm also a fairly new Rust programmer (though a developer more generally for many years), so there may be some things people would like me to change in the code I've written. That said, there are no compiler warnings, etc, in the code and all new code has supporting tests that pass.

Is this a change you would welcome into rxing?

wasm?

Hi Henry,
found this well-written implementation, great work.

Was looking for browser implementation of datagram scanner I could use in a lab.
So as an idea, maybe you'll be interested in compiling your library to web assembly. At least in theory, that should keep close-to-rust speed while allowing to use right from the browser.

Just an idea, feel free to close the issue.

encoding pdf417_compact has extra white space

my code

use rxing::helpers::save_file;
use rxing::common::BitMatrix;
use rxing::pdf417::encoder::Dimensions;
use rxing::pdf417::PDF417Writer;
use rxing::BarcodeFormat::PDF_417;
use rxing::EncodeHintType::{ERROR_CORRECTION, MARGIN, PDF417_COMPACT, PDF417_DIMENSIONS};
use rxing::EncodeHintValue::{ErrorCorrection, Margin, Pdf417Compact, Pdf417Dimensions};
use rxing::EncodingHintDictionary as Hint;
use rxing::Writer;

fn main(){
    let ring = ring_code("test", 103, 270);
    save_file("test.jpg", &ring).unwrap();
}


fn ring_code(contents: &str, width: i32, height: i32) -> BitMatrix {
    let writer = PDF417Writer::default();
    let dimensions = Dimensions::new(2, 2, 70, 70);
    let mut hints = Hint::new();
    hints.insert(ERROR_CORRECTION, ErrorCorrection("6".to_string()));
    hints.insert(PDF417_DIMENSIONS, Pdf417Dimensions(dimensions));
    hints.insert(PDF417_COMPACT, Pdf417Compact("true".to_string()));
    hints.insert(MARGIN, Margin(("5").to_string()));

    writer
        .encode_with_hints(contents, &PDF_417, width, height, &hints)
        .unwrap()
}

result

test
as you can see it have extra white space

it should be

test

#34

Enable all ECI encodings

Some ECI Encodings do not work correctly with the test cases. Some research needs to be done into why this is the case.

At the moment those ECI and CharacterSet encodings are disabled.

Possible Use for Generics

I was playing around from "building from scratch" by deleting files and rewriting with generics in mind and it seems to start off well.

I'm curious if binary size or performance are preferred in the context of the library because with generics there should be an increase in performance instead of accessing vtables through dynamic dispatch but binary size will increase.

Wanted to open this issue to bring up the discussion of the possibility and implementation.

Performance Tuning

The library has unnecessary heap allocations and clone() calls which should be cleaned up or refactored.

Bug with aztec binary data?

Thanks for this nice library! I'm encountering a weird behavior with the --raw-bytes option:

For qrcode, everythong as expected:

> ./rxing-cli test.png encode --width 200 --height 200 --data "aaa" qrcode
Encode successful, saving...
Saved to 'test.png'
>  ./rxing-cli test.png decode --raw-bytes
Detection result:
 97 97 97

for aztec:

> ./rxing-cli test.png encode --width 200 --height 200 --data "aaa" aztec
Encode successful, saving...
Saved to 'test.png'
> ./rxing-cli test.png decode --raw-bytes
Detection result:
 224 132 47

I don't quite get the origin of the numbers above (should be 97 97 97).
The text representation is correct.

Code rustification; where to start?

Hi! I'd love to contribute to this project. Lately I've been using zxing-cpp for a hobby project that involved scanning QR codes in a web browser and seeing a Rusty version pop up on the r/rust front page put a smile on my face. :)

I'd like to help "rustify" the code, to improve readability and get to know the codebase a bit better without making major changes. I see in your Reddit post that you have in-progress work though, so before I start opening PRs, I wanted to ask:

What are some good files in the repo to get started with; files that you aren't working on currently, which could use some prettification?

Using webcam images in buffer

Hi,

I'm trying to get to scan a barcode from live images. Using image and rscam works fine to get the image into memory.
The following is my code to get the image from the live camera feed:

let img = match image::load_from_memory(&frame) {
        Ok(i) => i.to_rgba8(), // Convert to RGBA as required by rxing
        Err(e) => {
                eprintln!("Error processing image: {:?}", e);
                continue;
            }
};

I can't figure out how to get these types of images decoded to achieve the same as with an image on disk as per the example:

let results = rxing::helpers::detect_multiple_in_file(file_name).expect("decodes");
    for result in results {
        println!("{} -> {}", result.getBarcodeFormat(), result.getText())
    }

I am very new to Rust (and coding in general) and learning while I fail. Any help is welcome :)

Convert Repo to Workspace

I was thinking it would be useful to turn the base directory of the repository into a workspace. This way other crates this lib may depend on, such as the derive macro, can also be modified within the same PR when necessary.

I bring this up because I was looking into replacing the split type and values for decoding and encoding hints (Rust enums can take care of these as one enum). To make those changes, the derive macro would also have to be changed which I would need to open a PR for on the other repo along with needing to wait for it to be published.

detect_in_luma supports only square input

Firstly, thanks for a great library, it must have been quite a bit of work to rewrite in Rust.

I was testing it with rxing::helpers::detect_in_luma(), but it panics due to index being out of range in https://github.com/rxing-core/rxing/blob/main/src/luma_luma_source.rs#L114. Looking at the code, it seems that transpose indeed only works with square images. Is this intentional or a bug? In the former case, it would be nice to add a check for width == height.

On a similar note, I see that there are multiple source format options (Luma8LuminanceSource, PlanarYUVLuminanceSource, etc), so what would be the recommended source for in-memory data? My source is in opencv BGR matrix so I convert it into grayscale 8bit image, but maybe some other source would be better?

Thanks

Add Benchmarks

Creating this issue for discussion started in #20

I was looking at the original library and noticed there are android benchmark images but it looks like the implementation was removed. I think we can turn some of the integration tests into benchmarks with some slight changes.

Join forces with zxing-cpp?

I saw that you decided to port some of my improvements to the QRCode reader over to your rust port. I take that as a compliment, so thank you :). I also noticed that the development of this port seems to have effectively stalled around 6 months ago? I just released version 2.2 including support for rMQR codes, in case you are interested.

That said: I wanted to ask you whether you'd consider bringing your rust experience to the table and instead of reimplementing the whole library and keep on maintaining that, why not write a rust wrapper for zxing-cpp and contributing that to my project? It is obviously not nearly as much fun but also not nearly as much work ;).

There are already Android, iOS, C, Python, Flutter, WASM and WinRT wrappers available. I'd be curious to hear your thoughts. If you decide to stick to your port and want to dive in even more, I'd recommend to look at the zxing-cpp implementation of all the linear barcodes. That code has not much in common with the original Java version anymore and is around 10-20x faster.

rxing-cli fails to build

cargo install --root /build rxing-cli
    Updating crates.io index
 Downloading crates ...
  Downloaded rxing-cli v0.1.15
  Installing rxing-cli v0.1.15
 Downloading crates ...
  Downloaded autocfg v1.1.0
  Downloaded chrono-tz-build v0.1.0
  Downloaded cfg-if v1.0.0
  Downloaded color_quant v1.1.0
  Downloaded anstyle-query v1.0.0
  Downloaded ab_glyph_rasterizer v0.1.8
  Downloaded arrayref v0.3.7
  Downloaded arrayvec v0.7.2
  Downloaded unicode-segmentation v1.10.1
  Downloaded byteorder v1.4.3
  Downloaded encoding_index_tests v0.1.4
  Downloaded anstyle v1.0.0
  Downloaded colorchoice v1.0.0
  Downloaded anstyle-parse v0.2.0
  Downloaded approx v0.5.1
  Downloaded adler v1.0.2
  Downloaded utf8parse v0.2.1
  Downloaded phf_generator v0.11.1
  Downloaded codepage-437 v0.1.0
  Downloaded clap_lex v0.4.1
  Downloaded bitflags v1.3.2
  Downloaded bit-set v0.5.3
  Downloaded clap_derive v4.2.0
  Downloaded memoffset v0.8.0
  Downloaded encoding-index-singlebyte v1.20141219.5
  Downloaded bit-vec v0.6.3
  Downloaded bit_field v0.10.2
  Downloaded aho-corasick v1.0.1
  Downloaded anstream v0.3.2
  Downloaded fnv v1.0.7
  Downloaded imagesize v0.11.0
  Downloaded urlencoding v2.1.2
  Downloaded data-url v0.2.0
  Downloaded strict-num v0.1.0
  Downloaded conv v0.3.3
  Downloaded crc32fast v1.3.2
  Downloaded num v0.4.0
  Downloaded half v2.2.1
  Downloaded custom_derive v0.1.7
  Downloaded scopeguard v1.1.0
  Downloaded is-terminal v0.4.7
  Downloaded bytemuck v1.13.1
  Downloaded rxing-one-d-proc-derive v0.5.0
  Downloaded thiserror-impl v1.0.40
  Downloaded rand_chacha v0.2.2
  Downloaded lazy_static v1.4.0
  Downloaded lock_api v0.4.9
  Downloaded phf_codegen v0.11.1
  Downloaded multimap v0.9.0
  Downloaded heck v0.4.1
  Downloaded itoa v1.0.6
  Downloaded num_cpus v1.15.0
  Downloaded strsim v0.10.0
  Downloaded rand_core v0.6.4
  Downloaded rctree v0.5.0
  Downloaded num-integer v0.1.45
  Downloaded pin-project-internal v1.1.0
  Downloaded pico-args v0.5.0
  Downloaded svg v0.13.1
  Downloaded rand_core v0.5.1
  Downloaded quote v1.0.27
  Downloaded ppv-lite86 v0.2.17
  Downloaded smallvec v1.10.0
  Downloaded rosvgtree v0.1.0
  Downloaded thiserror v1.0.40
  Downloaded simplecss v0.2.1
  Downloaded fdeflate v0.3.0
  Downloaded phf v0.11.1
  Downloaded rgb v0.8.36
  Downloaded clap v4.2.7
  Downloaded xmlparser v0.13.5
  Downloaded weezl v0.1.7
  Downloaded crossbeam-epoch v0.9.14
  Downloaded getrandom v0.1.16
  Downloaded float-cmp v0.9.0
  Downloaded unicode-ident v1.0.8
  Downloaded io-lifetimes v1.0.10
  Downloaded phf_shared v0.11.1
  Downloaded time v0.1.45
  Downloaded proc-macro2 v1.0.57
  Downloaded rusttype v0.9.3
  Downloaded num-complex v0.4.3
  Downloaded zune-inflate v0.2.54
  Downloaded once_cell v1.17.1
  Downloaded siphasher v0.3.10
  Downloaded base64 v0.21.0
  Downloaded svgtypes v0.9.0
  Downloaded spin v0.9.8
  Downloaded crossbeam-utils v0.8.15
  Downloaded rand_distr v0.2.2
  Downloaded csv-core v0.1.10
  Downloaded getrandom v0.2.9
  Downloaded num-iter v0.1.43
  Downloaded typenum v1.16.0
  Downloaded pin-project v1.1.0
  Downloaded log v0.4.17
  Downloaded nanorand v0.7.0
  Downloaded paste v1.0.12
  Downloaded lebe v0.5.2
  Downloaded svgtypes v0.10.0
  Downloaded tiny-skia-path v0.8.4
  Downloaded ryu v1.0.13
  Downloaded simba v0.7.3
  Downloaded roxmltree v0.18.0
  Downloaded matrixmultiply v0.3.7
  Downloaded wide v0.7.8
  Downloaded miniz_oxide v0.6.2
  Downloaded num-traits v0.2.15
  Downloaded miniz_oxide v0.7.1
  Downloaded simd-adler32 v0.3.5
  Downloaded uriparse v0.6.4
  Downloaded qoi v0.4.1
  Downloaded num-rational v0.4.1
  Downloaded either v1.8.1
  Downloaded futures-sink v0.3.28
  Downloaded futures-core v0.3.28
  Downloaded usvg v0.29.0
  Downloaded flate2 v1.0.26
  Downloaded iana-time-zone v0.1.56
  Downloaded rawpointer v0.2.1
  Downloaded crossbeam-deque v0.8.3
  Downloaded png v0.17.8
  Downloaded memchr v2.5.0
  Downloaded safe_arch v0.6.0
  Downloaded kurbo v0.8.3
  Downloaded parse-zoneinfo v0.3.0
  Downloaded flume v0.10.14
  Downloaded serde v1.0.163
  Downloaded rand v0.8.5
  Downloaded resvg v0.29.0
  Downloaded encoding v0.2.33
  Downloaded crossbeam-channel v0.5.8
  Downloaded rayon-core v1.11.0
  Downloaded fancy-regex v0.11.0
  Downloaded num-bigint v0.4.3
  Downloaded ttf-parser v0.15.2
  Downloaded rand v0.7.3
  Downloaded kurbo v0.9.4
  Downloaded encoding-index-japanese v1.20141219.5
  Downloaded encoding-index-tradchinese v1.20141219.5
  Downloaded rayon v1.7.0
  Downloaded encoding-index-korean v1.20141219.5
  Downloaded itertools v0.10.5
  Downloaded encoding-index-simpchinese v1.20141219.5
  Downloaded owned_ttf_parser v0.15.2
  Downloaded tiny-skia v0.8.4
  Downloaded clap_builder v4.2.7
  Downloaded syn v1.0.109
  Downloaded syn v2.0.16
  Downloaded regex v1.8.1
  Downloaded rustix v0.37.19
  Downloaded chrono v0.4.24
  Downloaded regex-syntax v0.7.1
  Downloaded exr v1.6.3
  Downloaded rxing v0.4.6
  Downloaded image v0.24.6
  Downloaded tiff v0.8.1
  Downloaded nalgebra v0.30.1
  Downloaded chrono-tz v0.8.2
  Downloaded gif v0.12.0
  Downloaded libc v0.2.144
  Downloaded jpeg-decoder v0.3.0
  Downloaded csv v1.2.1
  Downloaded linux-raw-sys v0.3.7
  Downloaded imageproc v0.23.0
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.144
   Compiling proc-macro2 v1.0.57
   Compiling unicode-ident v1.0.8
   Compiling quote v1.0.27
   Compiling simd-adler32 v0.3.5
   Compiling scopeguard v1.1.0
   Compiling crossbeam-utils v0.8.15
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling memoffset v0.8.0
   Compiling bytemuck v1.13.1
   Compiling adler v1.0.2
   Compiling crossbeam-epoch v0.9.14
   Compiling crc32fast v1.3.2
   Compiling bitflags v1.3.2
   Compiling syn v2.0.16
   Compiling serde v1.0.163
   Compiling miniz_oxide v0.7.1
   Compiling siphasher v0.3.10
   Compiling arrayvec v0.7.2
   Compiling rayon-core v1.11.0
   Compiling flate2 v1.0.26
   Compiling phf_shared v0.11.1
   Compiling crossbeam-deque v0.8.3
   Compiling num_cpus v1.15.0
   Compiling crossbeam-channel v0.5.8
   Compiling lock_api v0.4.9
   Compiling num-bigint v0.4.3
   Compiling memchr v2.5.0
   Compiling getrandom v0.1.16
   Compiling rand_core v0.6.4
   Compiling rand v0.8.5
   Compiling num-rational v0.4.1
   Compiling futures-core v0.3.28
   Compiling encoding_index_tests v0.1.4
   Compiling io-lifetimes v1.0.10
   Compiling log v0.4.17
   Compiling either v1.8.1
   Compiling regex-syntax v0.7.1
   Compiling phf_generator v0.11.1
   Compiling getrandom v0.2.9
   Compiling fdeflate v0.3.0
   Compiling paste v1.0.12
   Compiling regex v1.8.1
   Compiling rustix v0.37.19
   Compiling pin-project-internal v1.1.0
   Compiling float-cmp v0.9.0
   Compiling strict-num v0.1.0
   Compiling parse-zoneinfo v0.3.0
   Compiling png v0.17.8
   Compiling csv-core v0.1.10
   Compiling nanorand v0.7.0
   Compiling spin v0.9.8
   Compiling pin-project v1.1.0
   Compiling rand_core v0.5.1
   Compiling phf_codegen v0.11.1
   Compiling rayon v1.7.0
   Compiling phf v0.11.1
   Compiling kurbo v0.8.3
   Compiling num-complex v0.4.3
   Compiling safe_arch v0.6.0
   Compiling num-iter v0.1.43
   Compiling matrixmultiply v0.3.7
   Compiling ppv-lite86 v0.2.17
   Compiling ryu v1.0.13
   Compiling itoa v1.0.6
   Compiling xmlparser v0.13.5
   Compiling typenum v1.16.0
   Compiling weezl v0.1.7
   Compiling linux-raw-sys v0.3.7
   Compiling futures-sink v0.3.28
   Compiling flume v0.10.14
   Compiling csv v1.2.1
   Compiling jpeg-decoder v0.3.0
   Compiling roxmltree v0.18.0
   Compiling rand_chacha v0.2.2
   Compiling wide v0.7.8
   Compiling svgtypes v0.9.0
   Compiling chrono-tz-build v0.1.0
   Compiling simplecss v0.2.1
   Compiling kurbo v0.9.4
   Compiling approx v0.5.1
   Compiling miniz_oxide v0.6.2
   Compiling zune-inflate v0.2.54
   Compiling lebe v0.5.2
   Compiling half v2.2.1
   Compiling color_quant v1.1.0
   Compiling arrayref v0.3.7
   Compiling syn v1.0.109
   Compiling smallvec v1.10.0
   Compiling utf8parse v0.2.1
   Compiling bit_field v0.10.2
   Compiling rawpointer v0.2.1
   Compiling ttf-parser v0.15.2
   Compiling exr v1.6.3
   Compiling anstyle-parse v0.2.0
   Compiling tiny-skia-path v0.8.4
   Compiling gif v0.12.0
   Compiling simba v0.7.3
   Compiling owned_ttf_parser v0.15.2
   Compiling aho-corasick v1.0.1
   Compiling rosvgtree v0.1.0
   Compiling chrono-tz v0.8.2
   Compiling is-terminal v0.4.7
   Compiling codepage-437 v0.1.0
   Compiling tiff v0.8.1
   Compiling rand v0.7.3
   Compiling time v0.1.45
   Compiling qoi v0.4.1
   Compiling base64 v0.21.0
   Compiling colorchoice v1.0.0
   Compiling imagesize v0.11.0
   Compiling thiserror v1.0.40
   Compiling anstyle-query v1.0.0
   Compiling bit-vec v0.6.3
   Compiling rctree v0.5.0
   Compiling ab_glyph_rasterizer v0.1.8
   Compiling anstyle v1.0.0
   Compiling custom_derive v0.1.7
   Compiling iana-time-zone v0.1.56
   Compiling data-url v0.2.0
   Compiling byteorder v1.4.3
   Compiling conv v0.3.3
   Compiling image v0.24.6
   Compiling usvg v0.29.0
   Compiling chrono v0.4.24
   Compiling anstream v0.3.2
   Compiling rusttype v0.9.3
   Compiling bit-set v0.5.3
   Compiling nalgebra v0.30.1
   Compiling rand_distr v0.2.2
   Compiling num v0.4.0
   Compiling tiny-skia v0.8.4
   Compiling svgtypes v0.10.0
   Compiling thiserror-impl v1.0.40
   Compiling itertools v0.10.5
   Compiling encoding-index-japanese v1.20141219.5
   Compiling encoding-index-korean v1.20141219.5
   Compiling encoding-index-simpchinese v1.20141219.5
   Compiling encoding-index-tradchinese v1.20141219.5
   Compiling encoding-index-singlebyte v1.20141219.5
   Compiling rgb v0.8.36
   Compiling heck v0.4.1
   Compiling clap_lex v0.4.1
   Compiling lazy_static v1.4.0
   Compiling once_cell v1.17.1
   Compiling pico-args v0.5.0
   Compiling strsim v0.10.0
   Compiling fnv v1.0.7
   Compiling uriparse v0.6.4
   Compiling clap_builder v4.2.7
   Compiling resvg v0.29.0
   Compiling imageproc v0.23.0
   Compiling clap_derive v4.2.0
   Compiling encoding v0.2.33
   Compiling rxing-one-d-proc-derive v0.5.0
   Compiling multimap v0.9.0
   Compiling fancy-regex v0.11.0
   Compiling svg v0.13.1
   Compiling urlencoding v2.1.2
   Compiling unicode-segmentation v1.10.1
   Compiling clap v4.2.7
   Compiling rxing v0.4.6
error[E0277]: the trait bound `f64: From<bool>` is not satisfied
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/rxing-0.4.6/src/common/cpp_essentials/pattern.rs:504:50
    |
504 |             space: modSize[1] / (2.0 + f64::from(LEN < 6)) + 0.5,
    |                                        --------- ^^^^^^^ the trait `From<bool>` is not implemented for `f64`
    |                                        |
    |                                        required by a bound introduced by this call
    |
    = help: the following other types implement trait `From<T>`:
              <f64 as From<f32>>
              <f64 as From<half::bfloat::bf16>>
              <f64 as From<half::binary16::f16>>
              <f64 as From<i16>>
              <f64 as From<i32>>
              <f64 as From<i8>>
              <f64 as From<u16>>
              <f64 as From<u32>>
              <f64 as From<u8>>

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rxing` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `rxing-cli v0.1.15`, intermediate artifacts can be found at `/tmp/cargo-installAhEugw`

Barcode rotate bug

my code

use rxing::common::BitMatrix;
use rxing::helpers::save_file;
use rxing::pdf417::encoder::Dimensions;
use rxing::pdf417::PDF417Writer;
use rxing::BarcodeFormat::PDF_417;
use rxing::EncodeHintType::{ERROR_CORRECTION, MARGIN, PDF417_DIMENSIONS};
use rxing::EncodeHintValue::{ErrorCorrection, Margin, Pdf417Dimensions};
use rxing::EncodingHintDictionary as Hint;
use rxing::Writer;

fn main() {
    let not_rotate = short_code("test", 154, 80);
    save_file("not_roasted.jpg", &not_rotate).unwrap();
    let rotated = short_code("test", 80, 154);
    save_file("roasted.jpg", &rotated).unwrap();
}

fn short_code(contents: &str, width: i32, height: i32) -> BitMatrix {
    let writer = PDF417Writer::default();
    let dimensions = Dimensions::new(5, 5, 20, 20);
    let mut hints = Hint::new();
    hints.insert(ERROR_CORRECTION, ErrorCorrection("3".to_string()));
    hints.insert(PDF417_DIMENSIONS, Pdf417Dimensions(dimensions));
    hints.insert(MARGIN, Margin(("5").to_string()));

    writer
        .encode_with_hints(contents, &PDF_417, width, height, &hints)
        .unwrap()
}

result

not_rotated.jpg

not_rotated

rotated.jpg

rotated

correct result (might-_-)

rotated.jpg

roasted
#34

Simplifying the creation of Exceptions

Currently, exceptions are being created like this:

Exceptions::IllegalArgumentException(Some(
  "file does not exist".to_owned(),
))

Exceptions::FormatException(Some("could not create image buffer".to_owned()))

Exceptions::IllegalArgumentException(None)

I'm thinking we could simplify the code by introducing helper functions to construct them, so we end up with this:

Exceptions::illegalArgument("file does not exist")

Exceptions::format("could not create image buffer")

Exceptions::illegalArgumentEmpty() // better function name TBD

What do you think? I can open a PR if it looks like a good idea to you.

Evaluate moving to encoding_rs

As encoding crate hasn't been updated in some time, there may be a benefit I using a more frequently updated crate. A feasibility analysis is needed.

The multiple barcodes decoder issue

Hi, when I want to decode an image containing multiples barcodes, it's not working as expected, the first and second barcodes are detected (datamatrix) but the third one is not found.

Here is the image I used to test it.

multiple_barcodes

Thanks!

Any plan of porting it to native Node.js module?

Great project! Appropriate for your amazing work in porting ZXing to Rust.

I noticed you had published the rxing-wasm node modules on NPM. I wonder if there is any plan to port it to the native Node.js module. This could be done easily with NAPI.rs. I've done the PoC locally and I could provide help if necessary.

Add special case reader for multiple reuse situations

The generic version being merged with #20 appears be more performant (and uses less memory) than the original dynamic dispatch version. This does not hold true for frequent re-use of a single MultiFormatReader. This special case requires a new implementation of the MultiFormatReader which stores the readers in memory between runs to reduce the overhead associated with creating new ones each time.

Decouple encoding crate from library

Currently the encoding crate is tightly coupled to the library. It is accessed in several modules and a fair bit of the code passes EncoderRef values around. This seems like a bad design (it probably doesn’t just seem that way, it probably is just bad).

Possible solutions include:

  • Refactoring one of the ECI enums to handle more of the encoding work.
  • Adding a new enum that can be used in the string encoding modules.

This last has a benefit if we’re going to rewrite the ECIStringEncoder module to be more like how the c++ port handles it.

Refactoring RXingResultPoint usage

Since this is a library that works with images, naturally there's a ton of 2D point math going on in the code. I feel like putting in effort here will have a big return on investment, since it's such an integral part of the program logic.

Some points that can be improved in particular:

  1. The struct seems to be mostly passed around by reference. This means we end up with dereferences everywhere and the code is harder to follow. The struct itself only holds two floats, so passing it by value would be better I think.
  2. Point logic can be refactored in some places to make the intent clearer.
  3. Some functions expect rectangles, which are typed as &[RXingResultPoint]. A dedicated rectangle type would be better here for type safety.

I'm opening a PR that addresses the first point, and I'd like to tackle points 2 and 3, though that's a more long-term goal.

Goals

  • Rename RXingResultPoint to just Point
    • Rename in this repo
    • Remove references to RXingResultPoint and similarly named methods in the rxing-one-d-proc-derive crate
  • Remove the MathUtils module, since it holds duplicated logic
  • Remove the ResultPoint trait (all uses in repo removed, but the type still remains because of proc macro)
  • Remove the Point type in the aztec module
  • Replace all f32 parameter pairs and (f32, f32) tuples with Point
  • Refactor point math code (use a + b instead of let x = a.x + b.x; let y = a.y + b.y)

Index out of bounds in FitQadrilateralToPoints try_get_range

panicked at /Users/dan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rxing-0.4.9/src/common/cpp_essentials/concentric_finder.rs:393:25:
slice index starts at 18 but ends at 17
...

This will happen occasionally while trying to detecting codes in wasm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.