wxscan 0.1.2 copy "wxscan: ^0.1.2" to clipboard
wxscan: ^0.1.2 copied to clipboard

QR decoding for Dart and Flutter - a Rust port of the wechat_qrcode algorithm (CNN detection, super resolution, decoding). Images and raw pixel buffers; for a camera see wxscan_live.

Changelog #

0.1.2 #

  • The image formats the native library carries decoders for, and the cargo release profile it is built with, are now the application's to set, in its own pubspec.yaml under hooks: user_defines: wxscan:. Both were fixed here before, and neither is this package's business: which formats an application will ever be handed is something only it knows, and a decoder for a format it never sees is pure size — 2.13 MB of Android library becomes 866 KB when the answer is "none of them, I scan camera frames".

    hooks:
      user_defines:
        wxscan:
          image_formats: [png, jpeg]
          cargo_profile:
            strip: symbols
    

    image_formats takes any of png, jpeg, gif, webp, bmp, tiff and heic, and defaults to all of them except on Apple, where ImageIO is lent to the library and reads them already. A format left out answers unsupportedFormat, the same as a format nothing here ever read. cargo_profile takes opt_level, lto, codegen_units, strip and panic. Both are validated: a misspelled format or key stops the build rather than quietly shipping a library missing a decoder. doc/image_formats.md and the README carry the measured sizes, including what opt_level: z costs per frame, which is more than it saves.

0.1.1 #

  • macOS builds for Intel as well as Apple Silicon. The darwin_universal archive the build hook pins holds both slices and the hook already thinned it to the one each build asked for; what stopped an x86_64 build was a check written when no x86_64 library existed to fetch. A macOS release build is universal by default, so this is what a release build wanted all along — ARCHS no longer has to be pinned to arm64 in macos/Runner/Configs/Release.xcconfig, and an application that wants one architecture alone still sets it.

0.1.0 #

First release.

  • Decodes images and raw pixel buffers through a Rust port of the wechat_qrcode algorithm: CNN detection, super resolution and decoding, with no OpenCV.
  • A plain Dart package rather than a Flutter plugin. hook/build.dart builds the native library and bundles it, together with the TFLite C library, as code assets, so dart run and dart test work as well as Flutter does and there are no platform build files.
  • Runs in a browser too, as WebAssembly on a worker, against the same TFLite weights and the same runtime as every other platform. The four files an application serves are placed by dart run wxscan:fetch_web, which fetches the compiled three from pinned releases rather than carrying them here; see doc/web_build.md.
  • Decodes pictures as well as pixels: scanPath for a file, scanImage for bytes already in hand — a picked image, a download, or a browser, which has no paths. PNG, JPEG and GIF everywhere; WebP, BMP and TIFF where the platform lends nothing; HEIC on Apple, Android and in Safari. doc/image_formats.md is the matrix, and the platform can be lent a decoder for the rest.
  • WxScanner.create takes the weights as bytes or as paths — detectModelPath and srModelPath — and the path form is read by the native library on the worker isolate, so the megabyte is never held on the isolate that asked. Flutter assets have no path and still go as bytes; a browser has no filesystem and refuses a path outright.
  • Scanning runs on a worker isolate owned by the scanner, so a stream costs one message round trip per frame rather than an isolate spawn.
  • scanPixels takes RGB, RGBA, BGR or BGRA and converts natively, so a caller decoding a PNG or a JPEG does not convert pixels in Dart.
  • Detection is configurable: confidenceThreshold, nmsThreshold and scaleFactor read and write without contending for the scanner's lock.
  • A scanner can be lent to wxscan_live, so an application that scans both live and from the photo library holds one scanner and one copy of the weights. The two sides may be disposed in either order: the native handle is a counted reference rather than a pointer, so whichever lets go last frees it, and one left over from an isolate that is gone names nothing rather than being followed.
  • WxScanner.use creates a scanner for one piece of work and disposes it however that ends, and WxScanner.liveCount says how many exist — enough to assert in a test that nothing leaked, which from the outside was previously invisible.
  • Mismatched dimensions raise ArgumentError instead of returning an empty result that looks like a frame with nothing in it.
0
likes
0
points
243
downloads

Publisher

unverified uploader

Weekly Downloads

QR decoding for Dart and Flutter - a Rust port of the wechat_qrcode algorithm (CNN detection, super resolution, decoding). Images and raw pixel buffers; for a camera see wxscan_live.

Repository (GitHub)
View/report issues

Topics

#qr-code #barcode #scanner #image #ffi

License

unknown (license)

Dependencies

archive, code_assets, crypto, ffi, hooks, meta, native_toolchain_rust

More

Packages that depend on wxscan