Capacitor Wrapper for TextRecognition of Gogoles ML-Kit
npm install @pantrist/capacitor-plugin-ml-kit-text-recognition
!npm downloads per month
Capacitor Wrapper for TextRecognition of Googles ML-Kit
``bash`
npm install @pantrist/capacitor-plugin-ml-kit-text-recognition
npx cap sync
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:
`xml`
...
android:value="ocr" />
Nothing to do for iOS
| Name | Android | iOS | Web |
| ----------- | ----------- |-----|-----|
| detectText | ✅ | ✅ | ❌ |
`typescript`
detectText(options: DetectImageOptions) => Promise
Tries to detect text from the given image
| Param | Type | Description |
| ------------- | ----------------------------------------------------------------- | ------------------------------ |
| options | DetectImageOptions | Options for the text detection |
Returns: Promise<TextDetectionResult>
--------------------
#### 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 |