2012-09-23 5 views
1

Android 용 Tesseract OCR을 here에서 다운로드했으며 NDK를 사용하여 내 앱용 라이브러리 프로젝트로 빌드하려고합니다. 이 작업을 수행하는 방법에 대한 유용한 의견을 받았습니다. here. 나는이 할, 그리고UnsatisfiedLinkError - Android 용 Tesseract

> cd [path]\tess-two 

> C:\android-ndk-r8b-windows\android-ndk-r8b\ndk-build -j8 

"Compile thumb : lept <= adaptmap.c 

[...] 

"Compile++ thumb : lept <= writefile.cpp 

Prebuilt  : libgnustl_static.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/ 

"Compile++ thumb : tess <= applybox.cpp 

[...] 

"Compile++ thumb : tess <= tessbaseapi.cpp 

"Compile thumb : lept <= adaptmap.c 

[...] 

"Compile++ thumb : lept <= pixa.cpp 

Prebuilt  : libgnustl_static.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/ 

"Compile++ thumb : lept <= jni.cpp 

[...] 

"Compile++ thumb : tess <= tessbaseapi.cpp 

"Compile x86 : lept <= affine.c 

[...] 

"Compile++ x86 : lept <= readfile.cpp 

Prebuilt  : libgnustl_static.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/ 

"Compile++ x86 : tess <= baseapi.cpp 

[...] 

"Compile++ x86 : tess <= wordclass.cpp 

SharedLibrary : liblept.so 

SharedLibrary : liblept.so 

"Compile++ x86 : tess <= tessbaseapi.cpp 

SharedLibrary : liblept.so 

"Compile++ x86 : tess <= wordrec.cpp 

SharedLibrary : libtess.so 

Install  : liblept.so => libs/x86/liblept.so 

Install  : liblept.so => libs/armeabi/liblept.so 

SharedLibrary : libtess.so 

Install  : liblept.so => libs/armeabi-v7a/liblept.so 

SharedLibrary : libtess.so 

Install  : libtess.so => libs/armeabi/libtess.so 

Install  : libtess.so => libs/armeabi-v7a/libtess.so 

Install  : libtess.so => libs/x86/libtess.so 


> C:\Users\User\android-sdk\tools\android.bat update project --path . 

Failed to convert path to a short DOS path: C:\Windows\system32\java.exe 
'javaw_exe' is not recognized as an internal or external command, 
operable program or batch file. 
Updated local.properties 

Updated file [path]\tess-two\proguard-project.txt 

It seems that there are sub-projects. If you want to update them 

please use the --subprojects parameter. 

> set JAVA_HOME=C:\Java\JDK 
> Buildfile: [path]\tess-two\build.xml 

-set-mode-check: 

-set-release-mode: 

-release-obfuscation-check: 
    [echo] proguard.config is ${proguard.config} 

-check-env: 
[checkenv] Android SDK Tools Revision 20.0.3 
[checkenv] Installed at C:\Users\User\android-sdks 

-setup: 
    [echo] Project Name: tess-two 
    [gettype] Project Type: Android Library 

-build-setup: 
    [echo] Resolving Build Target for tess-two... 
[gettarget] Project Target: Google APIs 
[gettarget] Vendor:   Google Inc. 
[gettarget] Platform Version: 4.1 
[gettarget] API level:  16 
    [echo] ---------- 
    [echo] Creating output directories if needed... 
    [echo] ---------- 
    [echo] Resolving Dependencies for tess-two... 
[dependency] Library dependencies: 
[dependency] No Libraries 
[dependency] 
[dependency] ------------------ 
[dependency] API<=15: Adding annotations.jar to the classpath. 
    [echo] ---------- 
    [echo] Building Libraries with 'release'... 
    [subant] No sub-builds to iterate on 

-pre-build: 

-code-gen: 
[mergemanifest] Found Deleted Target File 
[mergemanifest] Merging AndroidManifest files into one. 
[mergemanifest] Manifest merger disabled. Using project manifest only. 
    [echo] Handling aidl files... 
    [aidl] No AIDL files to compile. 
    [echo] ---------- 
    [echo] Handling RenderScript files... 
[renderscript] No RenderScript files to compile. 
    [echo] ---------- 
    [echo] Handling Resources... 
    [aapt] Found new input file 
    [aapt] Generating resource IDs... 
    [echo] ---------- 
    [echo] Handling BuildConfig class... 
[buildconfig] No need to generate new BuildConfig. 

-pre-compile: 

-compile: 
    [echo] Creating library output jar file... 

-post-compile: 

-obfuscate: 

-dex: 
    [echo] Library project: do not convert bytecode... 

-crunch: 
    [crunch] Crunching PNG Files in source dir: [path]\tess-two\res 
    [crunch] To destination dir: [path]\tess-two\bin\res 
    [crunch] Crunched 0 PNG files to update cache 

-package-resources: 
    [echo] Library project: do not package resources... 

-package: 
    [echo] Library project: do not package apk... 

-post-package: 

-release-prompt-for-password: 

-release-nosign: 
    [echo] 
[propertyfile] Updating property file: [path]\tess-two\bin\build.prop 
[propertyfile] Updating property file: [path]\tess-two\bin\build.prop 
[propertyfile] Updating property file: [path]\tess-two\bin\build.prop 
[propertyfile] Updating property file: [path]\tess-two\bin\build.prop 

-release-sign: 

-post-build: 

release: 

BUILD SUCCESSFUL 
Total time: 1 second 

: 첫째, 명령 줄에서이 작업을 수행 ([경로]는 TESS-이 프로젝트의 경로에 대한 속기) 파일 -> 가져 오기 -> 안드로이드 -> 기존 코드를 작업 공간으로 -> 찾아보기 -> 현재 작업 공간 디렉토리 선택 -> 나타나는 목록에서 tess-two가 선택되었는지 확인 -> 마침

내 자신의 응용 프로그램을 마우스 오른쪽 버튼으로 클릭하고 속성 -> Android 탭 -> 추가 (라이브러리 섹션 아래에 있음) -> tess-two 선택 -> 확인 -> "라이브러리 여부 확인" > OK. 내 응용 프로그램 실행시

그러나,이 모든 후, 난 여전히이 follwing을 오류가 : 내 자신의 응용 프로그램에 대한

09-23 13:02:42.532: E/AndroidRuntime(675): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lept: findLibrary returned null 
09-23 13:02:42.532: E/AndroidRuntime(675): at java.lang.Runtime.loadLibrary(Runtime.java:365) 
09-23 13:02:42.532: E/AndroidRuntime(675): at java.lang.System.loadLibrary(System.java:535) 
09-23 13:02:42.532: E/AndroidRuntime(675): at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:47) 

project.properties 것은 : 무슨 일 이죠

target=android-16 
android.library.reference.1=..\\OpenCV\\sdk\\java 
android.library.reference.2=../Tesseract/tess-two 
android.library=true 

?

+0

다른 사람들이 질문에 대답하는 데 도움이되는 다른 정보에 대한 피드백을 누군가가 줄 수 있다면 정말 고맙겠습니다. –

+0

project.properties도 포함하십시오. – rmtheis

+1

자신의 프로젝트에 대해 "라이브러리"를 선택하지 마십시오. Tess-two는 도서관 프로젝트 여야합니다. – rmtheis

답변

1

내가 얻은 문제는 내가 내 코드에서 API를 제대로 초기화하지 못한다는 것입니다. 올바른 구문은 다음과 같습니다

tesseract.init("/mnt/sdcard/", "eng"); 

당신이 MNT/SDCARD 아래의 폴더 "tessdata"를 가지고 가정. 이제 완벽하게로드됩니다! 모든 도움을 주셔서 대단히 감사합니다.

+0

안녕하세요 plz 내가 어디이 줄을 쓸 수있는 PLZ 도와주세요 PLZ 언급 할 수있는 클래스 –

0
나를 위해

대신 2에서 LoadLibrary 나는 4

System.loadLibrary("jpgt"); System.loadLibrary("pngt"); System.loadLibrary("lept"); System.loadLibrary("tess"); 를하고는했다.