Guest User

Untitled

a guest
Mar 22nd, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. extension CameraViewController: AVCapturePhotoCaptureDelegate {
  2. func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
  3. if let imageData = photo.fileDataRepresentation() {
  4. self.image = UIImage(data: imageData)
  5. let text = TextViewController()
  6. text.image = self.image
  7. self.present(text, animated: true, completion: nil)
  8. }
  9. }
  10. }
  11.  
  12. @IBOutlet weak var textView: UITextView!
  13. var image: UIImage?
  14.  
  15. override func viewDidLoad() {
  16. super.viewDidLoad()
  17.  
  18. if let tesseract = G8Tesseract(language: "eng") {
  19. tesseract.delegate = self
  20. tesseract.image = self.image
  21. tesseract.recognize()
  22.  
  23. textView.text = tesseract.recognizedText
  24. }
  25. }
Add Comment
Please, Sign In to add comment