How to Be Language All-rounder with HUAWEI ML Kit?

46 posts
Thanks Meter: 2
By Freemind R, Official Huawei Rep on 20th May 2020, 12:04 PM
Post Reply Email Thread
The original article is from HUAWEI Developer Forum
(forum link:

1. Introduction

Optical Character Recognition is the function to detect and process characters from a determined alphabet. With HUAWEI Text recognition service allows you to extract text from images, documents or any print representation of characters.

This service can run on the cloud or device. If the service needs to scan characters from Simplified Chinese, Japanese, Korean and Latin based language the service can use on Device text recognition.

The cloud service supports languages such as Simplified Chinese, English, Spanish, Portuguese, Italian, German, French, Russian, Japanese, Korean, Polish, Finnish, Norwegian, Swedish, Danish, Turkish, Thai, Arabic and Hindi.

2. Preparations

To enable the ML Kit, It is needed to follow these steps.

· Login to Huawei Developer

· Access HUAWEI AppGallery

· Select My Apps and the select the app you want to integrate the service.

· Access the Develop section and click on Manage APIs

· Enable ML Kit

· Set Storage Location

· Download agconnect-services.json and add it in the app root directory of your Android Studio project

· Open the build.gradle file in the root directory

· Add the maven “maven{url’’}” and Classpath “classpath’com.huawei.agconnect:agcp:’”

· Add the SDKs dependencies to your project


 // Import the base SDK.

 implementation 'com.huawei.hms:ml-computer-vision-ocr:'

 // Import the Latin-based language model package.

 implementation 'com.huawei.hms:ml-computer-vision-ocr-latin-model:'

 // Import the Japanese and Korean model package.

 implementation 'com.huawei.hms:ml-computer-vision-ocr-jk-model:'

 // Import the Chinese and English model package.

 implementation 'com.huawei.hms:ml-computer-vision-ocr-cn-model:'


· Add the configuration inside the same build.gradle file

“apply plugin: ‘com.huawei.agconnect’”

· In the Android Manifest File add the following code to enable your app to automatically update the latest ML models on the device.




        android:value= "ocr"/>


3. Development
Text recognition from images on the device

1. Need to create the MLTextAnalyzer to recognize text in images. Also set MLLocalTextSetting to specify languages, if none are specified, only Latin-based languages are going to being recognized

This is not the end. For more information about this article, you can visit HUAWEI Developer Forum.
Post Reply Subscribe to Thread

huawei ml kit

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes