Skip to content

Instantly share code, notes, and snippets.

@onmyway133
Created June 15, 2018 17:19
Show Gist options
  • Save onmyway133/e530d1d65b8287f47cc4a591b43cae79 to your computer and use it in GitHub Desktop.
Save onmyway133/e530d1d65b8287f47cc4a591b43cae79 to your computer and use it in GitHub Desktop.
let tesseract = G8Tesseract(language: "eng")!
tesseract.engineMode = .tesseractCubeCombined
tesseract.pageSegmentationMode = .singleBlock
private func handleWithTesseract(image: UIImage) {
tesseract.image = image.g8_blackAndWhite()
tesseract.recognize()
let text = tesseract.recognizedText ?? ""
delegate?.ocrService(self, didDetect: text)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment