Skip to content

Instantly share code, notes, and snippets.

@yektasarioglu
Last active January 5, 2021 08:52
Show Gist options
  • Save yektasarioglu/e88478b3c6f1ee0dd3112f69063d6160 to your computer and use it in GitHub Desktop.
Save yektasarioglu/e88478b3c6f1ee0dd3112f69063d6160 to your computer and use it in GitHub Desktop.
// TextRecognitionViewModel
fun analyzeStream() {
if (isCameraStarted)
textRecognizer.analyzeStream {
it.forEach { _, value ->
Timber.d("stringValue is ${value?.stringValue}")
outputLiveData.postValue(value?.stringValue)
value?.contents?.forEachIndexed { index, element ->
Timber.d("[$index] is ${element.stringValue}")
}
}
Timber.d("itemList is $it")
}
}
// TextRecognizer
fun analyzeStream(onSuccess: (SparseArray<MLText.Block?>) -> Unit) {
ocrDetectorProcessor.resultAction = onSuccess
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment