PluginsMLKit Text
Overview
Recognize text using Google ML Kit.
MLKit Text
The mlkit-text plugin enables real-time text recognition (OCR) on the camera feed.
Installation
implementation("io.github.l2hyunwoo:camera-plugin-mlkit-text:1.0.0")Usage
1. Create the Plugin
val textRecognizer = remember { TextRecognizer() }2. Register with CameraController
Using DSL:
val controller = rememberCameraController {
plugins {
+textRecognizer
}
}3. Observe Results
The plugin exposes a text StateFlow that emits the recognition results.
LaunchedEffect(textRecognizer) {
textRecognizer.text.collect { result ->
result?.let {
println("Full Text: ${it.text}")
it.blocks.forEach { block ->
println("Block: ${block.text}")
}
}
}
}