androidgradleocrgoogle-translation-apikannada

Not able to use google ml kit for Indian languages OCR


I'm trying to build an app for kannada (An Indian language) OCR to flashcard conversion with help of cursor AI. I first created the android studio project for devanagari (A more widely used indian script which had easily available google ml-kit to start with) which works well. In my build.gradle.kts, i have the following line:

implementation("com.google.mlkit:text-recognition-devanagari:16.0.0")

In my OCR function, i have the lines:

import com.google.mlkit.vision.text.devanagari.DevanagariTextRecognizerOptions
class OCRProcessor {
    private val textRecognizer = TextRecognition.getClient(
       DevanagariTextRecognizerOptions.Builder().build()
    )
...

This works well for devanagari but i am not able to figure out how to do it for other Indian languages, in particular kannada?

Chatgpt and cursor tell me to add

implementation("com.google.mlkit:text-recognition-indian:16.0.0")

in my gradle file and

  import com.google.mlkit.vision.text.Indian.IndianTextRecognizerOptions
  
private val textRecognizer = TextRecognition.getClient(IndianTextRecognizerOptions.Builder().build())

in my OCR function but this gradle implementation is not working, I am not able to figure out how to make the changes.

Google ml kit has kannada model as mentioned on their page


Solution

  • Direct support for Kannada OCR is not available in the standard Google ML Kit Text Recognition as of the current version. The link you provided focuses on ML Kit Digital Ink Recognition, not OCR. The difference between the two is that Digital ink focuses on recognizing handwritten text by analyzing the strokes and movements of a pen or finger on a digital surface, while OCR focuses on extracting text from images of printed or handwritten documents by analyzing the visual shapes of the characters.

    I think the workaround for now is to leverage Vertex AI's custom model training capabilities to build a Kannada OCR model. This would involve preparing a dataset of Kannada text images and training a custom model using Vertex AI's AutoML or custom training options. However, this approach would require significant effort in data preparation and model training.

    Also, you might wanna check the release notes from time to time to keep you posted for the recent changes, bug fixes and updates.