google_mlkit_text_recognition 0.0.2 google_mlkit_text_recognition: ^0.0.2 copied to clipboard
A Flutter plugin to use Google's ML Kit Text Recognition to recognize text in any Chinese, Devanagari, Japanese, Korean and Latin character set.
Google's ML Kit Text Recognition for Flutter #
A Flutter plugin to use Google's ML Kit Text Recognition to recognize text in any Chinese, Devanagari, Japanese, Korean and Latin character set.
Getting Started #
Before you get started read about the requirements and known issues of this plugin here.
Supported languages #
The ML Kit Text Recognition API can recognize text in any Chinese, Devanagari, Japanese, Korean and Latin character set. Supported languages are here.
Usage #
Text Recognition #
Create an instance of InputImage
Create an instance of InputImage
as explained here.
final InputImage inputImage;
Create an instance of TextRecognizer
final textRecognizer = TextRecognizer(script: TextRecognitionScript.latin);
Process image
final RecognizedText recognizedText = await textRecognizer.processImage(inputImage);
String text = recognizedText.text;
for (TextBlock block in recognizedText.blocks) {
final Rect rect = block.rect;
final List<Offset> cornerPoints = block.cornerPoints;
final String text = block.text;
final List<String> languages = block.recognizedLanguages;
for (TextLine line in block.lines) {
// Same getters as TextBlock
for (TextElement element in line.elements) {
// Same getters as TextBlock
}
}
}
Release resources with close()
textRecognizer.close();
Example app #
Find the example app here.
Contributing #
Contributions are welcome. In case of any problems look at existing issues, if you cannot find anything related to your problem then open an issue. Create an issue before opening a pull request for non trivial fixes. In case of trivial fixes open a pull request directly.