Skip to content

pascholda1/capacitor-plugin-ai-text-recognition

 
 

Repository files navigation

@pascholda1/capacitor-plugin-ai-text-recognition

Capacitor Wrapper for TextRecognition of Googles ML-Kit / Apples Vision Framework

Install

// TODO: publish plugin on npm and replace install command

npm install @pantrist/capacitor-plugin-ml-kit-text-recognition
npx cap sync

Configuration

Android

Optional but recommended: You can configure your app to automatically download the ML model to the device after your app is installed from the Play Store. To do so, add the following declaration to your app's AndroidManifest.xml file:

<application ...>
		...
<meta-data
    android:name="com.google.mlkit.vision.DEPENDENCIES"
    android:value="ocr"
/>
        <!-- To use multiple models: android:value="ocr,model2,model3" -->
</application>

iOS

Nothing to do for iOS

Note that the Vision framework only works with lines. So the bounding boxes of blocks, lines and elements are the same, and each block contains only a single line.

Supported methods

Name Android iOS Web
detectText

API

detectText(...)

detectText(options:DetectImageOptions) => Promise<TextDetectionResult>

Tries to detect text from the given image

Param Type Description
options DetectImageOptions Options for the text detection

Returns: Promise<TextDetectionResult>


Interfaces

TextDetectionResult

Prop Type Description
text string Found text
blocks Block[] Parsed text by lines

Block

Prop Type
lines Line[]

Line

Prop Type
elements Element[]

Element

DetectImageOptions

Prop Type Description
base64Image string The image to detect texts from
rotation number The image's counter-clockwise orientation degrees. Only 0, 90, 180, 270 are supported. Default 0

Thanks!

Thanks to the contributors of the original plugin.

About

Recognizes text on images using Google's ML KIT & Apple's Vision Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 36.8%
  • Kotlin 26.5%
  • TypeScript 13.4%
  • Java 8.2%
  • Ruby 7.0%
  • Objective-C 4.8%
  • JavaScript 3.3%