没有OpenCV Manager的Android上的OpenCV

时间:2014-04-16 07:02:12

标签: android opencv

我知道之前曾问过我的问题。

但没有解决方案适合我。

现在我尝试了这个解决方案:

  1. Solution 1

  2. Solution 2

  3. Solution 3

  4. Solution 4

  5. 但他们中没有人为我工作。

    我的应用程序项目包含一个JNI部分,所以我将THIS教程中提到的所有行添加到Android.mk文件中,

    我评论这一行:

    if(!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback));

    并补充道:

        static {
        if (!OpenCVLoader.initDebug()) {
            // Handle initialization error
        }
    }
    

    public void onResume()之后

    当OpenCV启动时,我的应用程序卡住了。

    这是LogCat输出:

    04-16 10:00:25.020: W/System.err(14797): java.io.FileNotFoundException: /storage/emulated/0/DCIM/Frames/20140416_100025.mp4: open failed: ENOENT (No such file or directory)
    04-16 10:00:25.020: W/System.err(14797):    at libcore.io.IoBridge.open(IoBridge.java:409)
    04-16 10:00:25.020: W/System.err(14797):    at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
    04-16 10:00:25.020: W/System.err(14797):    at java.io.FileOutputStream.<init>(FileOutputStream.java:128)
    04-16 10:00:25.020: W/System.err(14797):    at java.io.FileOutputStream.<init>(FileOutputStream.java:117)
    04-16 10:00:25.025: W/System.err(14797):    at android.media.MediaRecorder.prepare(MediaRecorder.java:776)
    04-16 10:00:25.025: W/System.err(14797):    at com.example.homedevice.SampleTestingAct.prepareRecorder(SampleTestingAct.java:371)
    04-16 10:00:25.025: W/System.err(14797):    at com.example.homedevice.SampleTestingAct.StartTest(SampleTestingAct.java:443)
    04-16 10:00:25.025: W/System.err(14797):    at com.example.homedevice.SampleTestingAct.access$0(SampleTestingAct.java:420)
    04-16 10:00:25.025: W/System.err(14797):    at com.example.homedevice.SampleTestingAct$2$1.run(SampleTestingAct.java:2037)
    04-16 10:00:25.025: W/System.err(14797):    at java.util.Timer$TimerImpl.run(Timer.java:284)
    04-16 10:00:25.025: W/System.err(14797): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
    04-16 10:00:25.025: W/System.err(14797):    at libcore.io.Posix.open(Native Method)
    04-16 10:00:25.030: W/System.err(14797):    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
    04-16 10:00:25.030: W/System.err(14797):    at libcore.io.IoBridge.open(IoBridge.java:393)
    04-16 10:00:25.030: W/System.err(14797):    ... 9 more
    04-16 10:00:25.260: E/MediaRecorder(14797): start called in an invalid state: 4
    04-16 10:00:25.260: W/dalvikvm(14797): threadid=16: thread exiting with uncaught exception (group=0x41c44700)
    04-16 10:00:25.260: E/AndroidRuntime(14797): FATAL EXCEPTION: Timer-2
    04-16 10:00:25.260: E/AndroidRuntime(14797): java.lang.IllegalStateException
    04-16 10:00:25.260: E/AndroidRuntime(14797):    at android.media.MediaRecorder.start(Native Method)
    04-16 10:00:25.260: E/AndroidRuntime(14797):    at com.example.homedevice.SampleTestingAct.StartTest(SampleTestingAct.java:445)
    04-16 10:00:25.260: E/AndroidRuntime(14797):    at com.example.homedevice.SampleTestingAct.access$0(SampleTestingAct.java:420)
    04-16 10:00:25.260: E/AndroidRuntime(14797):    at com.example.homedevice.SampleTestingAct$2$1.run(SampleTestingAct.java:2037)
    04-16 10:00:25.260: E/AndroidRuntime(14797):    at java.util.Timer$TimerImpl.run(Timer.java:284)
    04-16 10:00:32.555: I/Choreographer(14797): Skipped 436 frames!  The application may be doing too much work on its main thread.
    04-16 10:00:32.715: E/ViewSystem(14797): ViewRootImpl #2 Surface is not valid.
    04-16 10:00:32.725: E/MediaRecorder(14797): stop called in an invalid state: 4
    04-16 10:00:32.725: D/AndroidRuntime(14797): Shutting down VM
    04-16 10:00:32.725: W/dalvikvm(14797): threadid=1: thread exiting with uncaught exception (group=0x41c44700)
    04-16 10:00:32.730: I/Process(14797): Sending signal. PID: 14797 SIG: 9
    04-16 10:00:33.060: D/dalvikvm(15019): GC_FOR_ALLOC freed 56K, 12% free 9605K/10840K, paused 13ms, total 14ms
    04-16 10:00:33.060: I/dalvikvm-heap(15019): Grow heap (frag case) to 11.604MB for 1127536-byte allocation
    04-16 10:00:33.080: D/dalvikvm(15019): GC_FOR_ALLOC freed <1K, 11% free 10706K/11944K, paused 20ms, total 20ms
    04-16 10:00:33.115: D/dalvikvm(15019): GC_FOR_ALLOC freed <1K, 10% free 11593K/12832K, paused 11ms, total 11ms
    04-16 10:00:33.200: D/libEGL(15019): loaded /system/lib/egl/libEGL_mali.so
    04-16 10:00:33.200: D/libEGL(15019): loaded /system/lib/egl/libGLESv1_CM_mali.so
    04-16 10:00:33.205: D/libEGL(15019): loaded /system/lib/egl/libGLESv2_mali.so
    04-16 10:00:33.210: E/(15019): Device driver API match
    04-16 10:00:33.210: E/(15019): Device driver API version: 23
    04-16 10:00:33.210: E/(15019): User space API version: 23 
    04-16 10:00:33.210: E/(15019): mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct  9 21:05:57 KST 2013 
    04-16 10:00:33.265: D/OpenGLRenderer(15019): Enabling debug mode 0
    

    是否可以在没有OpenCV管理器的情况下使用OpenCV(可能在我的应用程序中包含他?) 希望有人可以在这里提供帮助。

    谢谢!

1 个答案:

答案 0 :(得分:0)

确保您可以这样做。您只需要在APK中打包特定的OpenCV库即可。拥有一个look at my reply here