Skip to content

Instantly share code, notes, and snippets.

@IvanShafran
Created April 29, 2020 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IvanShafran/769ee7fc33724cd1eedb8e7e9b386a6a to your computer and use it in GitHub Desktop.
Save IvanShafran/769ee7fc33724cd1eedb8e7e9b386a6a to your computer and use it in GitHub Desktop.
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