So I want to take a picture of some text, but when using tesseract it gives me the following error:
actual_tessdata_num_entries_ <= TESSDATA_NUM_ENTRIES:Error:Assert failed:in file tessdatamanager.cpp, line 53
so when ViewController1
captures a picture it sends it to the TextViewController
like this:
send from ViewController1
:
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)
}
}
}
And it should receive like this in TextViewController()
and display on textView
, but it just crashes:
@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
}
}