Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension CameraViewController: AVCapturePhotoCaptureDelegate {
- func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
- if let imageData = photo.fileDataRepresentation() {
- self.image = UIImage(data: imageData)
- let text = TextViewController()
- text.image = self.image
- self.present(text, animated: true, completion: nil)
- }
- }
- }
- @IBOutlet weak var textView: UITextView!
- var image: UIImage?
- override func viewDidLoad() {
- super.viewDidLoad()
- if let tesseract = G8Tesseract(language: "eng") {
- tesseract.delegate = self
- tesseract.image = self.image
- tesseract.recognize()
- textView.text = tesseract.recognizedText
- }
- }
Add Comment
Please, Sign In to add comment