Created
April 29, 2020 00:32
-
-
Save IvanShafran/769ee7fc33724cd1eedb8e7e9b386a6a to your computer and use it in GitHub Desktop.
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
val image: FirebaseVisionImage | |
try { | |
val uri = Uri.fromFile(imageFile) | |
image = FirebaseVisionImage.fromFilePath(context, uri) | |
val detector: FirebaseVisionTextRecognizer = FirebaseVision.getInstance().onDeviceTextRecognizer | |
val task = detector.processImage(image) | |
.addOnSuccessListener { result -> | |
val text = result.text | |
} | |
.addOnFailureListener { error -> | |
// Handle exception | |
} | |
} catch (e: IOException) { | |
// Handle exception | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment