Skip to content

Instantly share code, notes, and snippets.

@elvismetaphor
Last active July 12, 2018 16:36
Show Gist options
  • Save elvismetaphor/0814f94d80295ec3ac8ec98a9fdd6512 to your computer and use it in GitHub Desktop.
Save elvismetaphor/0814f94d80295ec3ac8ec98a9fdd6512 to your computer and use it in GitHub Desktop.
Add on-device text recognition (iOS)
lazy var textDetector: VisionTextDetector = Vision.vision().textDetector()
func runTextRecognition(with image: UIImage) {
let visionImage = VisionImage(image: image)
textDetector.detect(in: visionImage) { (features, error) in
if let error = error {
print("Received error: \(error)")
}
self.processResult(from: features, error: error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment