Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yektasarioglu/dde9c3b81f1ad3d42705e2465d48a35f to your computer and use it in GitHub Desktop.
Save yektasarioglu/dde9c3b81f1ad3d42705e2465d48a35f to your computer and use it in GitHub Desktop.
The initialization of stream text analyzer
// TextRecognitionViewModel.kt
fun initializeStreamAnalyzer(context: Context) {
textRecognizer.initializeStreamAnalyzer(context)
}
// TextRecognizer.kt
fun initializeStreamAnalyzer(context: Context) {
initializeDeviceStreamAnalyzer(context)
}
private fun initializeDeviceStreamAnalyzer(context: Context) {
ocrDetectorProcessor = OcrDetectorProcessor()
analyzer = MLTextAnalyzer.Factory(context).create()
analyzer?.setTransactor(ocrDetectorProcessor)
lensEngine = LensEngine.Creator(context, analyzer)
.setLensType(LensEngine.BACK_LENS)
.applyDisplayDimension(1920, 1080)
.applyFps(60.0f)
.enableAutomaticFocus(true)
.create()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment