首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >图像到文本android应用程序

图像到文本android应用程序
EN

Stack Overflow用户
提问于 2015-07-25 13:01:58
回答 1查看 242关注 0票数 0

试图使用TextFairy代码在GitHub上创建一个安卓应用程序,将图像转换为文本作为其功能之一:(https://github.com/renard314/textfairy/tree/master/app/src/main/res),但是它正在抛出这个错误:请帮助!或者建议使用其他图像来编写api/android应用程序代码。

代码语言:javascript
复制
 Executing tasks:      [:app:generateAV5DebugSources,:app:generateAV5DebugAndroidTestSources, :tesstwo:tess-two:generateDebugSources, :tess-two:tesstwo:generateDebugAndroidTestSources]

Configuration on demand is an incubating feature.
Returning version 640
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 240
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 140
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
signing.properties not found
:app:preBuild UP-TO-DATE
:app:preAV5DebugBuild UP-TO-DATE
:app:checkAV5DebugManifest
:app:preAV5ReleaseBuild UP-TO-DATE
:app:preAV7DebugBuild UP-TO-DATE
:app:preAV7ReleaseBuild UP-TO-DATE
:app:preX86DebugBuild UP-TO-DATE
:app:preX86ReleaseBuild UP-TO-DATE
:tess-two:tess-two:compileLint
:tess-two:tess-two:copyReleaseLint UP-TO-DATE
:tess-two:tess-two:mergeReleaseProguardFiles
:tess-two:tess-two:preBuild UP-TO-DATE
:tess-two:tess-two:preReleaseBuild UP-TO-DATE
:tess-two:tess-two:checkReleaseManifest
:tess-two:tess-two:prepareReleaseDependencies
:tess-two:tess-two:compileReleaseAidl
:tess-two:tess-two:compileReleaseRenderscript
:tess-two:tess-two:generateReleaseBuildConfig
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE
:tess-two:tess-two:mergeReleaseAssets
:tess-two:tess-two:generateReleaseResValues
:tess-two:tess-two:generateReleaseResources
:tess-two:tess-two:packageReleaseResources
:tess-two:tess-two:processReleaseManifest
:tess-two:tess-two:processReleaseResources
:tess-two:tess-two:generateReleaseSources
:tess-two:tess-two:ndkBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tess-two:tess-two:ndkBuild'.
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 29.02 secs
Executing tasks: [:app:assembleAV5Debug]

Configuration on demand is an incubating feature.
Returning version 640
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 240
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 140
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
signing.properties not found
:app:preBuild UP-TO-DATE
:app:preAV5DebugBuild UP-TO-DATE
:app:checkAV5DebugManifest
:app:preAV5ReleaseBuild UP-TO-DATE
:app:preAV7DebugBuild UP-TO-DATE
:app:preAV7ReleaseBuild UP-TO-DATE
:app:preX86DebugBuild UP-TO-DATE
:app:preX86ReleaseBuild UP-TO-DATE
:tess-two:tess-two:compileLint
:tess-two:tess-two:copyReleaseLint UP-TO-DATE
:tess-two:tess-two:mergeReleaseProguardFiles UP-TO-DATE
:tess-two:tess-two:preBuild UP-TO-DATE
:tess-two:tess-two:preReleaseBuild UP-TO-DATE
:tess-two:tess-two:checkReleaseManifest
:tess-two:tess-two:prepareReleaseDependencies
:tess-two:tess-two:compileReleaseAidl UP-TO-DATE
:tess-two:tess-two:compileReleaseRenderscript UP-TO-DATE
:tess-two:tess-two:generateReleaseBuildConfig UP-TO-DATE
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE
:tess-two:tess-two:mergeReleaseAssets UP-TO-DATE
:tess-two:tess-two:generateReleaseResValues UP-TO-DATE
:tess-two:tess-two:generateReleaseResources UP-TO-DATE
:tess-two:tess-two:packageReleaseResources UP-TO-DATE
:tess-two:tess-two:processReleaseManifest UP-TO-DATE
:tess-two:tess-two:processReleaseResources UP-TO-DATE
:tess-two:tess-two:generateReleaseSources UP-TO-DATE
:tess-two:tess-two:ndkBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tess-two:tess-two:ndkBuild'.
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.917 secs
Executing tasks: [:app:assembleAV5Debug]

Configuration on demand is an incubating feature.
Returning version 640
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 240
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 140
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
signing.properties not found
:app:preBuild UP-TO-DATE
:app:preAV5DebugBuild UP-TO-DATE
:app:checkAV5DebugManifest
:app:preAV5ReleaseBuild UP-TO-DATE
:app:preAV7DebugBuild UP-TO-DATE
:app:preAV7ReleaseBuild UP-TO-DATE
:app:preX86DebugBuild UP-TO-DATE
:app:preX86ReleaseBuild UP-TO-DATE
:tess-two:tess-two:compileLint
:tess-two:tess-two:copyReleaseLint UP-TO-DATE
:tess-two:tess-two:mergeReleaseProguardFiles UP-TO-DATE
:tess-two:tess-two:preBuild UP-TO-DATE
:tess-two:tess-two:preReleaseBuild UP-TO-DATE
:tess-two:tess-two:checkReleaseManifest
:tess-two:tess-two:prepareReleaseDependencies
:tess-two:tess-two:compileReleaseAidl UP-TO-DATE
:tess-two:tess-two:compileReleaseRenderscript UP-TO-DATE
:tess-two:tess-two:generateReleaseBuildConfig UP-TO-DATE
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE
:tess-two:tess-two:mergeReleaseAssets UP-TO-DATE
:tess-two:tess-two:generateReleaseResValues UP-TO-DATE
:tess-two:tess-two:generateReleaseResources UP-TO-DATE
:tess-two:tess-two:packageReleaseResources UP-TO-DATE
:tess-two:tess-two:processReleaseManifest UP-TO-DATE
:tess-two:tess-two:processReleaseResources UP-TO-DATE
:tess-two:tess-two:generateReleaseSources UP-TO-DATE
:tess-two:tess-two:ndkBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tess-two:tess-two:ndkBuild'.
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.946 secs
Executing tasks: [:app:assembleAV5Debug]

Configuration on demand is an incubating feature.
Returning version 640
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 240
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 140
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
signing.properties not found
:app:preBuild UP-TO-DATE
:app:preAV5DebugBuild UP-TO-DATE
:app:checkAV5DebugManifest
:app:preAV5ReleaseBuild UP-TO-DATE
:app:preAV7DebugBuild UP-TO-DATE
:app:preAV7ReleaseBuild UP-TO-DATE
:app:preX86DebugBuild UP-TO-DATE
:app:preX86ReleaseBuild UP-TO-DATE
:tess-two:tess-two:compileLint
:tess-two:tess-two:copyReleaseLint UP-TO-DATE
:tess-two:tess-two:mergeReleaseProguardFiles UP-TO-DATE
:tess-two:tess-two:preBuild UP-TO-DATE
:tess-two:tess-two:preReleaseBuild UP-TO-DATE
:tess-two:tess-two:checkReleaseManifest
:tess-two:tess-two:prepareReleaseDependencies
:tess-two:tess-two:compileReleaseAidl UP-TO-DATE
:tess-two:tess-two:compileReleaseRenderscript UP-TO-DATE
:tess-two:tess-two:generateReleaseBuildConfig UP-TO-DATE
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE
:tess-two:tess-two:mergeReleaseAssets UP-TO-DATE
:tess-two:tess-two:generateReleaseResValues UP-TO-DATE
:tess-two:tess-two:generateReleaseResources UP-TO-DATE
:tess-two:tess-two:packageReleaseResources UP-TO-DATE
:tess-two:tess-two:processReleaseManifest UP-TO-DATE
:tess-two:tess-two:processReleaseResources UP-TO-DATE
:tess-two:tess-two:generateReleaseSources UP-TO-DATE
:tess-two:tess-two:ndkBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tess-two:tess-two:ndkBuild'.
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 7.68 secs
Executing tasks: [:app:assembleAV5Debug]

Configuration on demand is an incubating feature.
Returning version 640
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 240
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
Returning version 140
WARNING [Project: :app] Current NDK support is deprecated.  Alternative will be provided in the future.
signing.properties not found
:app:preBuild UP-TO-DATE
:app:preAV5DebugBuild UP-TO-DATE
:app:checkAV5DebugManifest
:app:preAV5ReleaseBuild UP-TO-DATE
:app:preAV7DebugBuild UP-TO-DATE
:app:preAV7ReleaseBuild UP-TO-DATE
:app:preX86DebugBuild UP-TO-DATE
:app:preX86ReleaseBuild UP-TO-DATE
:tess-two:tess-two:compileLint
:tess-two:tess-two:copyReleaseLint UP-TO-DATE
:tess-two:tess-two:mergeReleaseProguardFiles UP-TO-DATE
:tess-two:tess-two:preBuild UP-TO-DATE
:tess-two:tess-two:preReleaseBuild UP-TO-DATE
:tess-two:tess-two:checkReleaseManifest
:tess-two:tess-two:prepareReleaseDependencies
:tess-two:tess-two:compileReleaseAidl UP-TO-DATE
:tess-two:tess-two:compileReleaseRenderscript UP-TO-DATE
:tess-two:tess-two:generateReleaseBuildConfig UP-TO-DATE
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE
:tess-two:tess-two:mergeReleaseAssets UP-TO-DATE
:tess-two:tess-two:generateReleaseResValues UP-TO-DATE
:tess-two:tess-two:generateReleaseResources UP-TO-DATE
:tess-two:tess-two:packageReleaseResources UP-TO-DATE
:tess-two:tess-two:processReleaseManifest UP-TO-DATE
:tess-two:tess-two:processReleaseResources UP-TO-DATE
:tess-two:tess-two:generateReleaseSources UP-TO-DATE
:tess-two:tess-two:ndkBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tess-two:tess-two:ndkBuild'.
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.703 secs
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-25 13:14:57

你可以用这段代码。

代码语言:javascript
复制
    Drawable d = imageView.getDrawable();

    Bitmap bitmap = ((BitmapDrawable) d).getBitmap();
    byte[] ba;
    do {
        ByteArrayOutputStream bao = new ByteArrayOutputStream();

        Log.e("BEFORE REDUCING",
                bitmap.getHeight() + " " + bitmap.getWidth() + " "
                        + bitmap.getRowBytes() * bitmap.getHeight());

        bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);

        ba = bao.toByteArray();
        if ((ba.length / 1024) >= 650) {
            bitmap = Bitmap.createScaledBitmap(bitmap,
                    (int) (bitmap.getWidth() * 0.95),
                    (int) (bitmap.getHeight() * 0.95), true);

        }

        Log.e("BYTE LENGTH", "" + ba.length / 1024);

    } while ((ba.length / 1024) >= 650);

    String ba1 = Base64.encodeToString(ba, Base64.DEFAULT);

此代码将图像转换为64位字符串。要获得更多信息,请遵循以下链接在这里输入链接描述

1如何将图像转换为base64字符串在这里输入链接描述

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31626724

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档