Created
January 4, 2021 20:57
-
-
Save yektasarioglu/dde9c3b81f1ad3d42705e2465d48a35f to your computer and use it in GitHub Desktop.
The initialization of stream text analyzer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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