keke77 / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Creating a cvMemStorage makes the Android app crash #283

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. make a "public CvMemStorage memory;"
2. in the "onCameraViewStarted" method, we add "memory = 
CvMemStorage.create();" (crashes the application)

What is the expected output? What do you see instead?

The expectation is that when the CameraView is created, Memory Storage is 
allocated.
What actually happens is that the application crashes

What version of the product are you using? On what operating system?

OpenCV-2.4.3 for Android
JavaCV wrapper classes
adt-eclipse-bundle for Android 

Please provide any additional information below.

The main question that we are trying to figure out is that if we need to give a 
permission in the Android Manifest!

Original issue reported on code.google.com by pcshah1...@gmail.com on 21 Feb 2013 at 3:26

GoogleCodeExporter commented 9 years ago
Do the sample FacePreview or RecordActivity work?

Original comment by samuel.a...@gmail.com on 22 Feb 2013 at 1:44

GoogleCodeExporter commented 9 years ago
I just tried creating and running the RecordActivity, and the LogCat outputs 
that there is an AndroidRuntime issue at line 183.
     Line 183 is:
        "yuvIplimage = IplImage.create(imageWidth, imageHeight, IPL_DEPTH_8U, 2);"

It seems that I am getting an error in initializing an IplImage, similar to 
Issue 282.

If it makes any difference, I am developing the my app using is a Nexus S 
running Android 4.0.4

Original comment by pcshah1...@gmail.com on 22 Feb 2013 at 2:46

GoogleCodeExporter commented 9 years ago
What if you call cvCreateImage() instead? And what's the error?

Original comment by samuel.a...@gmail.com on 22 Feb 2013 at 2:47

GoogleCodeExporter commented 9 years ago
When I call:
"yuvIplimage = cvCreateImage(cvSize(imageWidth,imageHeight), IPL_DEPTH_8U, 2);"
I still get the same error from the LogCat. Attached is a screenshot of the 
output from LogCat.

Original comment by pcshah1...@gmail.com on 22 Feb 2013 at 2:56

Attachments:

GoogleCodeExporter commented 9 years ago
Can you attach the rest of the log? Just copy/paste all of it in text form 
please.

Original comment by samuel.a...@gmail.com on 22 Feb 2013 at 3:08

GoogleCodeExporter commented 9 years ago
Sure, sorry for the trouble! Still new to all of this!
02-21 21:58:52.937: E/AndroidRuntime(2083): FATAL EXCEPTION: main
02-21 21:58:52.937: E/AndroidRuntime(2083): 
java.lang.ExceptionInInitializerError
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
com.prateek.test.RecordActivity.initRecorder(RecordActivity.java:183)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
com.prateek.test.RecordActivity.onCreate(RecordActivity.java:89)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
android.app.Activity.performCreate(Activity.java:4465)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
android.app.ActivityThread.access$600(ActivityThread.java:123)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
android.os.Looper.loop(Looper.java:137)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
android.app.ActivityThread.main(ActivityThread.java:4424)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
java.lang.reflect.Method.invokeNative(Native Method)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
java.lang.reflect.Method.invoke(Method.java:511)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
dalvik.system.NativeStart.main(Native Method)
02-21 21:58:52.937: E/AndroidRuntime(2083): Caused by: 
java.lang.UnsatisfiedLinkError: Couldn't load jniopencv_core: findLibrary 
returned null
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
java.lang.Runtime.loadLibrary(Runtime.java:365)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
java.lang.System.loadLibrary(System.java:535)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
com.googlecode.javacpp.Loader.loadLibrary(Loader.java:448)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
com.googlecode.javacpp.Loader.load(Loader.java:372)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
com.googlecode.javacpp.Loader.load(Loader.java:319)
02-21 21:58:52.937: E/AndroidRuntime(2083):     at 
com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:136)
02-21 21:58:52.937: E/AndroidRuntime(2083):     ... 16 more
02-21 21:58:55.004: I/Process(2083): Sending signal. PID: 2083 SIG: 9

Original comment by pcshah1...@gmail.com on 22 Feb 2013 at 3:15

GoogleCodeExporter commented 9 years ago
Hum, looks like you are trying to use another library here:
    http://stackoverflow.com/questions/8821926/android-ndk-library-findlibrary-returned-null
    http://code.google.com/p/javacv/issues/detail?id=199
This can be tricky on Android. Are you trying to use more than one library?

Original comment by samuel.a...@gmail.com on 22 Feb 2013 at 3:20

GoogleCodeExporter commented 9 years ago
That's weird! I didn't even look that far down the log.
What I did was copy the following code into a project (importing the OpenCV 
Library, and adding the jars: "javacpp.jar", "javacv.jar", and 
"javacv-windows-x86_64" to the project):
http://javacv.googlecode.com/git/samples/RecordActivity.java
As i proceed to run it, that was the log that was output.
From what I can tell, I don't believe I'm using any other library other than 
JavaCV (I literally copy/pasted code from the link, to try and figure out this 
issue).

Original comment by pcshah1...@gmail.com on 22 Feb 2013 at 3:27

GoogleCodeExporter commented 9 years ago
Ah, so you didn't add the libjniopencv_core.so file as per the instructions in 
the README.txt file? Then that's the problem here...

Original comment by samuel.a...@gmail.com on 22 Feb 2013 at 3:29