Yes, as you say, it's not the best because it doubles the size needed, but
it's better than "getExternalDir" as it's in the application directory.

The last solution as you say is to modify the tesseract source. After some
research, It should be possible. Here are some hints:
- Access to asset from native code:
https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/MLn1q_SDR6A
- The path is load in the "getpath" function at the line 40 of the
basedir.cpp if you use tess-two.

Give us a feedback if you could make it work.



2012/9/13 Napalm <[email protected]>

> I modified my project using GetFilesDir(), it's solution is not ideal
> because i do copies at app execution. Now I will try to modify tesseract
> source code to read trainneddatas from the tessdata directory on api. For
> me is the last chance.
>
> Other ideas?
>
> Thanks
>
> Em quarta-feira, 12 de setembro de 2012 15h54min46s UTC-3, Hrk escreveu:
>>
>> You can't get the path to asset manager as it is packed in the
>> application file. The best solution as I said is to try to copy the file in
>> your application directory through the "getFilesDir" function: http://**
>> developer.**android.com/**reference/android/**content/**Context.html#**
>> getFilesDir()<http://developer.android.com/reference/android/content/Context.html#getFilesDir()>
>>
>>
>>
>> 2012/9/12 Napalm <gabriel.no...@gmail.**com>
>>
>> Using getExternalStorageDirectory not resolves the problem, in the source
>>> code he copies trained data from assetManager to the root folder of
>>> android. For me it's not good solution. If I can pass path from the
>>> tessdata directory direct from my AssetManager or using another approach
>>> that not uses statical paths(including external paths from the app such as
>>> getExternalStorageDirectory ) or do copies would better.
>>>
>>> The better solution would add trained languages in the app and use them
>>> without any copy or acessing external paths. The AssetManager would be a
>>> good solution, i can create a tessdata folder and insert all trained data.
>>> But i don't know  how to get path from AssetManager that i can put to the
>>> tesseract initialization.
>>>
>>> if anyone has any ideas would greatly help my progress, thanks.
>>>
>>> Em quarta-feira, 12 de setembro de 2012 10h37min15s UTC-3, Hrk escreveu:
>>>>
>>>> Have a look at:
>>>> https://github.com/**GautamGupta**/Simple-Android-**OCR/blob/**
>>>> master/src/com/**datumdroid/**android/ocr/simple/**SimpleAndro**
>>>> idOCRActivity.java<https://github.com/GautamGupta/Simple-Android-OCR/blob/master/src/com/datumdroid/android/ocr/simple/SimpleAndroidOCRActivity.java>
>>>>
>>>> They use the getExternalStorageDirector****y Android function. It
>>>> stores the data on the common storage, but you can try to use
>>>> "getFilesDir": http://**develope**r.android.com/**reference/**
>>>> android/content/**Context.html#**getFilesDir()<http://developer.android.com/reference/android/content/Context.html#getFilesDir()>
>>>>
>>>> I'm not sure the NDK Tesseract project will have access to this storage
>>>> that is linked to the application, but it should.
>>>>
>>>> Keep us informed
>>>>
>>>>
>>>>
>>>> 2012/9/12 Napalm <gabriel.no...@gmail.**com>
>>>>
>>>>>  I'm using tesseract for android and dont know how to include
>>>>> trainned data languages in to my application. I'm seeing that most people
>>>>> use static path to the tessdata. The code below show this:
>>>>>
>>>>> TessBaseAPI ocrManager = new TessBaseAPI();
>>>>> if(!ocrManager.init("/mnt/**sdca**rd/", "eng")){
>>>>>  Log.e(TAG, "Error on tesseract...");
>>>>> }
>>>>>
>>>>> It's not good because if I install my app in another device must copy
>>>>> manually the trained language to the /mnt/sdcard/tessdata/.
>>>>>
>>>>> Another approach is to include language data to the app AssetManager.
>>>>> But if not mistaken its not possible to gets path from AssetManager. A
>>>>> workaround is to copy trained language to an statical path that i showed 
>>>>> in
>>>>> code above. Again it's bad because app generates files outside your memory
>>>>> space.
>>>>>
>>>>> It's possible to include somehow the trained data in my app and use it
>>>>> in tesseract initialization without any workaround(statical path or copy 
>>>>> to
>>>>> statical path)?
>>>>>
>>>>> Thanks
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "tesseract-ocr" group.
>>>>> To post to this group, send email to [email protected]
>>>>>
>>>>> To unsubscribe from this group, send email to
>>>>> tesseract-oc...@**googlegroups.**com
>>>>>
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/**group**/tesseract-ocr?hl=en<http://groups.google.com/group/tesseract-ocr?hl=en>
>>>>>
>>>>
>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "tesseract-ocr" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> tesseract-oc...@**googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**group/tesseract-ocr?hl=en<http://groups.google.com/group/tesseract-ocr?hl=en>
>>>
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "tesseract-ocr" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/tesseract-ocr?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

Reply via email to