1.0.15 • Published 2 years ago

@dannadori/barcode-scanner-worker-js v1.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

BarcodeScanner

image

Note: Safari is not supported with webworker. This porcess needs offscreencanvas.

API

init: (config: BarcodeScannerConfig | null) => Promise<void>;
predict: (src: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, params?: BarcodeScannerOperationParams) => Promise<BarcodeInfo[]>;

Configuration and Parameter

export interface BarcodeScannerConfig {
    browserType: BrowserType;
    processOnLocal: boolean;
    modelPath: string;
    workerPath: string;
    enableSIMD: boolean;
}
export interface BarcodeScannerOperationParams {
    type: BarcodeScannerType;
    processWidth: number;
    processHeight: number;
    scale: number;
    sizeThreshold: number;
    interpolation: number;
    useSIMD: boolean;
}
export declare enum BarcodeScannerType {
    original = 0,
    zbar = 1,
    zxing = 2
}

Step by step

Create environment and install package

$ npx create-react-app demo --template typescript
$ cd demo/
$ npm install
$ npm install @dannadori/barcode-scanner-worker-js
$ cp node_modules/\@dannadori/barcode-scanner-worker-js/dist/barcode-scanner-worker-worker.js public/
$ mkdir -p public/static/js
$ cp node_modules/\@dannadori/barcode-scanner-worker-js/resources/tflite.wasm public/static/js
$ cp node_modules/\@dannadori/barcode-scanner-worker-js/resources/tflite-simd.wasm public/static/js

Download Model

Model file is under "CC BY-NC-SA 4.0" license.

https://flect-lab-web.s3-us-west-2.amazonaws.com/P01_wokers/t12_barcode-scanner/models/barcode172_light.tflite

Add source image to public.

In this time, the name is "srcImage.jpg"

Edit src/App.tsx

TBD

build and start

$ npm run start
1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago