Giter Club home page Giter Club logo

rxing-wasm's People

Contributors

akx avatar cpwood avatar hschimke 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

Watchers

 avatar

rxing-wasm's Issues

Weird error on windows

I have a project running with rxing-wasm on my mac and worked fine. But when I wanted to move to windows - running the same code that works on mac - gives me this error
image

this is the code I was trying to run:

const ctx = canvas.getContext('2d'); if (!ctx) { throw 'no context'; } const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); try { // @ts-ignore const luma_data = convert_js_image_to_luma(imageData.data); const hints = new DecodeHintDictionary(); hints.set_hint(DecodeHintTypes.PossibleFormats, 'UpcEanExtension'); hints.set_hint(DecodeHintTypes.TryHarder, 'true'); const result = decode_barcode_with_hints(luma_data, canvas.width, canvas.height, hints); console.warn(result.text()); } catch (e) { console.log(e); }

Allow hints to be passed to encode_barcode

Currently, a new, empty HashMap is passed into the Rust library when encode_barcode is called. However for Telepen Numeric, I would need to pass a hint.

Could there either be an additional method - e.g. encode_barcode_with_hints?

"Uncaught RuntimeError: unreachable executed" errors

Hi,

My knowledge of Rust and of WebAssembly internals is still pretty shallow so apologies in advance if I am missing something obvious. I am trying to use the rxing-wasm package as bundled by the wasm-pack build command described here:

https://www.furidamu.org/blog/2020/07/10/rust-webassembly-in-the-browser/

That seems to work fine and I am able to initialize the resultant WASM binary and invoke the convert_js_image_to_luma function but when I try to call decode_barcode it panics with the following error:

Uncaught RuntimeError: unreachable executed
    decode_barcode http://localhost:8080/rxing_wasm.js:187
    onload http://localhost:8080/?:43
    onclick http://localhost:8080/?:30
    main http://localhost:8080/?:24
    async* http://localhost:8080/?:54
[rxing_wasm_bg.wasm:1171526:1](http://localhost:8080/rxing_wasm_bg.wasm)
    __rust_start_panic http://localhost:8080/rxing_wasm_bg.wasm:1171526
    rust_panic http://localhost:8080/rxing_wasm_bg.wasm:1157051
    hc53aea0352e77326 http://localhost:8080/rxing_wasm_bg.wasm:1006605
    ha183a8279614f03a http://localhost:8080/rxing_wasm_bg.wasm:1062504
    hc33870f333461503 http://localhost:8080/rxing_wasm_bg.wasm:1154372
    rust_begin_unwind http://localhost:8080/rxing_wasm_bg.wasm:1116658
    hf4a9df75710ece83 http://localhost:8080/rxing_wasm_bg.wasm:1147033
    h8c0b59521a475ac0 http://localhost:8080/rxing_wasm_bg.wasm:1085500
    hac996b83e550b52f http://localhost:8080/rxing_wasm_bg.wasm:624364
    he1247e4575455453 http://localhost:8080/rxing_wasm_bg.wasm:746459
    hc2a7bc7f939092d4 http://localhost:8080/rxing_wasm_bg.wasm:882929
    hf770383115561eeb http://localhost:8080/rxing_wasm_bg.wasm:947342
    <rxing::qrcode::qr_code_reader::QRCodeReader as rxing::reader::Reader>::decode_with_hints::h004a4523f4768536 http://localhost:8080/rxing_wasm_bg.wasm:389867

I have been testing this with a PDF417 barcode image that can be successfully decoded using the rxing-cli tool. All the code in question can be found here:

https://github.com/sfomuseum/rust-rxing-wasm/blob/main/www/index.html

The image I've been testing with is here:

https://github.com/sfomuseum/rust-rxing-wasm/blob/main/images/deltabp.png

Whic was taken from here:

https://krebsonsecurity.com/2015/10/whats-in-a-boarding-pass-barcode-a-lot/

Do you have any thoughts on what might be happening here or what I am doing wrong?

exporting the convert methods

I noticed that you need to convert the image to an array of 8bit luma data, or rgb before passing it to decode_barcode. why not also expose the methods that do that?
Maybe I'm wrong and you can do this in vanilla js, but I couldn't find any example that do that without installing zxing (for js).
If there are other ways to pass image from js to the decoding function without installing zxing, I will be happy to know .

"Not found" errors decoding barcodes (that can be decoded by rxing-cli)

Hi,

My Rust-knowledge is a little better than the last time I asked a question but it is still pretty raw so apologies if I've missed something obvious.

I have (4) barcodes all created by, and which can be decoded by, rxing-cli in the PDF-417, Aztec, DataMatrix and QR code formats. Copies of these barcodes can be found here:

https://github.com/sfomuseum/rs-rxing-wasm/tree/main/images

When I try to decode them using a rxing-wasm binary created by wasm-pack build --target web only the PDF-417 can be decoded. All the others fail with a "Not found" error. For example:

Uncaught not found [rxing_wasm.js:293:14](http://localhost:8080/rxing_wasm.js)
    decode_barcode_with_hints http://localhost:8080/rxing_wasm.js:293
    onload http://localhost:8080/:59
    (Async: EventHandlerNonNull)
    onclick http://localhost:8080/:44
    (Async: EventHandlerNonNull)
    main http://localhost:8080/:38
    AsyncFunctionNext self-hosted:810
    (Async: async)
    <anonymous> http://localhost:8080/:79

The code in question can be found here:

https://github.com/sfomuseum/rs-rxing-wasm/blob/main/www/index.html

I have spent some time poking around the rxing-cli package to see whether there are hints, or other arguments, I should be passing to the decode_barcode function but it doesn't seem like it? I get the same results if I call decode_barcode or decode_barcode_with_hints. I feel like I must be missing something obvious but I am having trouble seeing what. Do you have any ideas?

Thanks,

Add documentation and lookups for values

          looks great. tried to play with it and was going great. I do think you will need to eventually create a table that maps between properties and thier type ( and maybe even a column of an example value at the so it will be explicit) .

one last this is that with TryHarder true nad UpcEanExtension - I managed to make the browser totally freeze while trying to scan this particular image.
I will be more than happy if you could have a look why would that be .
WhatsApp Image 2023-01-19 at 18 12 21

Originally posted by @VerioN1 in #1 (comment)

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.