2.0.0 • Published 11 days ago

vision-camera-dynamsoft-label-recognizer v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 days ago

vision-camera-dynamsoft-label-recognizer

React Native Vision Camera Frame Processor Plugin of Dynamsoft Label Recognizer

Demo video

Versions

For vision-camera v2, use versions 0.x.

For vision-camera v3, use versions 1.x.

For vision-camera v4, use versions >= 2.0.0.

Installation

yarn add vision-camera-dynamsoft-label-recognizer
cd ios && pod install

Add the plugin to your babel.config.js:

module.exports = {
   plugins: [['react-native-worklets-core/plugin']],
    // ...

Note: You have to restart metro-bundler for changes in the babel.config.js file to take effect.

Usage

  1. Scan text with vision camera.

    import { recognize } from 'vision-camera-dynamsoft-label-recognizer';
    
    // ...
    const frameProcessor = useFrameProcessor((frame) => {
      'worklet';
      const scanResult = recognize(frame);
    }, []);
  2. Scan text from base64-encoded static images.

    const scanResult = await decodeBase64(base64);
  3. License initialization (apply for a trial license).

    await initLicense("your license");

Interfaces

Scanning configuration:

//the value is in percentage
export interface ScanRegion{
  left: number;
  top: number;
  width: number;
  height: number;
}

export interface ScanConfig{
  scanRegion?: ScanRegion;
  includeImageBase64?: boolean;
}

export interface CustomModelConfig {
  customModelFolder: string;
  customModelFileNames: string[];
}

You can use a custom model like a model for MRZ passport reading using the CustomModelConfig prop and update the template. You can find the MRZ model and template in the example.

You need to put the model folder in the assets folder for Android or the root for iOS.

About the result:

export interface ScanResult {
  results: DLRResult[];
  imageBase64?: string;
}

export interface DLRResult {
  referenceRegionName: string;
  textAreaName: string;
  pageNumber: number;
  location: Quadrilateral;
  lineResults: DLRLineResult[];
}

export interface Quadrilateral{
  points:Point[];
}

export interface Point {
  x:number;
  y:number;
}

export interface DLRLineResult {
  text: string;
  confidence: number;
  characterModelName: string;
  characterResults: DLRCharacherResult[];
  lineSpecificationName: string;
  location: Quadrilateral;
}

export interface DLRCharacherResult {
  characterH: string;
  characterM: string;
  characterL: string;
  characterHConfidence: number;
  characterMConfidence: number;
  characterLConfidence: number;
  location: Quadrilateral;
}

Supported Platforms

  • Android
  • iOS

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

2.0.0

11 days ago

1.2.0

3 months ago

1.1.0

3 months ago

1.0.0

5 months ago

0.5.2

8 months ago

0.5.1

8 months ago

0.5.0

12 months ago

0.3.0

2 years ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.3

1 year ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago