コード例 #1
0
    public void Setup()
    {
        _tesseract = new TesseractWrapper();
        string datapath = Application.streamingAssetsPath
                          + "/tessdata/";

        if (_tesseract.Init("eng", datapath))
        {
            Debug.Log("Init Successful");
        }
    }
コード例 #2
0
    public void Setup()
    {
        _tesseract = new TesseractWrapper();
        // Set the Streaming / Dictionary assets path
        string datapath = Application.streamingAssetsPath
                          + "/tessdata/";

        // Attempt to init Tesseract using the streaming assets data path
        if (_tesseract.Init("eng", datapath))
        {
            Debug.Log("Init Successful");
        }
    }
コード例 #3
0
    public string CheckTessVersion()
    {
        _tesseract = new TesseractWrapper();

        try
        {
            string version = "Tesseract version: " + _tesseract.Version();
            Debug.Log(version);
            return(version);
        }
        catch (Exception e)
        {
            string errorMessage = e.GetType() + " - " + e.Message;
            Debug.LogError("Tesseract version: " + errorMessage);
            return(errorMessage);
        }
    }
コード例 #4
0
    private void OcrSetup(UnityAction onSetupComplete)
    {
        _tesseract = new TesseractWrapper();

#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());
        }
    }