public void Setup() { _tesseract = new MyTesseractWrapper(); string datapath = Application.streamingAssetsPath + "/tessdata/"; if (_tesseract.Init("eng", datapath)) { Debug.Log("Init Successful"); } }
public string CheckTessVersion() { _tesseract = new MyTesseractWrapper(); try { string version = "Tesseract version: " + _tesseract.Version(); Debug.Log(version); return(version); } catch (Exception e) { string errorMessage = e.GetType() + " - " + e.Message; Debug.LogError(errorMessage); return(errorMessage); } }
public string Recognize(Texture2D imageToRecognize) { if (_tesseract == null) { Debug.Log("Aqui el error"); try { _tesseract = new MyTesseractWrapper(); string answer = _tesseract.Recognize(imageToRecognize); Debug.Log("Ha leido esto: " + answer); return(answer); } catch (Exception e) { Debug.Log("Excepción: " + e.GetType() + " - " + e.Message); return(""); } } return(_tesseract.Recognize(imageToRecognize)); }
public void OcrSetup(UnityAction onSetupComplete) { _tesseract = new MyTesseractWrapper(); #if UNITY_EDITOR string datapath = Path.Combine(Application.streamingAssetsPath, "tessdata"); #elif UNITY_ANDROID string datapath = Application.persistentDataPath + "/tessdata/"; #else string datapath = Path.Combine(Application.streamingAssetsPath, "tessdata"); #endif if (_tesseract.Init("eng", datapath)) { Debug.Log("Init Successful"); onSetupComplete?.Invoke(); } else { Debug.LogError(_tesseract.GetErrorMessage()); } }