Skip to content

Instantly share code, notes, and snippets.

@giolaq
Created May 27, 2020 15:31
Show Gist options
  • Select an option

  • Save giolaq/a8b5de773e0dab45df89c37f8586f915 to your computer and use it in GitHub Desktop.

Select an option

Save giolaq/a8b5de773e0dab45df89c37f8586f915 to your computer and use it in GitHub Desktop.
class WordSearchAiViewModel(
private val resourceProvider: ResourceProvider,
private val recognizer: DocumentTextRecognizer
) : ViewModel() {
val resultList: MutableLiveData<List<String>> = MutableLiveData()
val resultBoundingBoxes: MutableLiveData<List<Symbol>> = MutableLiveData()
private lateinit var dictionary: List<String>
fun detectDocumentTextIn(bitmap: Bitmap) {
loadDictionary()
recognizer.processImage(bitmap, {
postWordsFound(it)
postBoundingBoxes(it)
},
{
Log.e("WordSearchAIViewModel", it)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment