johnson-pkt / javacv

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

error in FacePreview.java with code Loader.load(opencv_objdetect.class) #183

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
Follow the instructions on this page: 
http://developer.android.com/resources/tutorials/hello-world.html
Go to File > New > Folder, select your project as parent folder, type 
"libs/armeabi" as Folder name, and click Finish.
Copy javacpp.jar and javacv.jar in the newly created "libs" folder.
Extract directly all the *.so files from javacv-android-arm.jar as well as the 
ones from OpenCV-2.3.1-android-arm.zip and ffmpeg-0.7.11-android-arm.zip in the 
newly created "libs/armeabi" folder, without creating any new subdirectories.
Navigate to Project > Properties > Java Build Path > Libraries and click "Add 
JARs..."
Select both javacpp.jar and javacv.jar from the newly created "libs" folder.

2.in android 2.2.2 SamSung I809 And HTC G14 and HTC G18 compile 
FacePreview.java activity
3.System is ubuntu 11.04 64bit.

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

the code will show the camera video data.
but after install the apk in my phone,it disappears.
the error in Loader.load(opencv_objdetect.class).

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

Phone is SamSung I809,HTC G14 and HTC G18. The same error.
Android edition is 2.2.2 and 2.3.4.
The compile system is ubuntu 11.04 64 bit.

Please provide any additional information below.

That's all, Thanks.

Original issue reported on code.google.com by huzhangy...@gmail.com on 9 Apr 2012 at 1:38

GoogleCodeExporter commented 8 years ago
Could you let me know what actually is "the error in 
Loader.load(opencv_objdetect.class)"? Thank you

Original comment by samuel.a...@gmail.com on 9 Apr 2012 at 1:44

GoogleCodeExporter commented 8 years ago
first thanks samuel.
After I install and run the apk,It disappears immediately.
I add some trace code as follows:

Log.v("FaceView", "1111111111111111111111111111");
        // Preload the opencv_objdetect module to work around a known bug.
        Loader.load(opencv_objdetect.class);
Log.v("FaceView", "22222222222");
        classifier = new CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath()));

the first Log can show,and the second cann't. then the app collapses.

Thanks for your reply.

Original comment by huzhangy...@gmail.com on 9 Apr 2012 at 1:50

GoogleCodeExporter commented 8 years ago
And what error do you get in the log after "1111111111111111111111111111"?

Original comment by samuel.a...@gmail.com on 9 Apr 2012 at 1:53

GoogleCodeExporter commented 8 years ago
Now I am in windows, I will go to ubuntu and show it to you.
thanks.

Original comment by huzhangy...@gmail.com on 9 Apr 2012 at 1:55

GoogleCodeExporter commented 8 years ago
samuel,I am so sorry.
my low level error.
I forget to add 
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus"/>
to the manifest file.

and the error is 

04-09 22:03:55.748: E/AndroidRuntime(4089): FATAL EXCEPTION: main
04-09 22:03:55.748: E/AndroidRuntime(4089): java.lang.RuntimeException: Fail to 
connect to camera service
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.hardware.Camera.native_setup(Native Method)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.hardware.Camera.<init>(Camera.java:185)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.hardware.Camera.open(Camera.java:165)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
com.jouhu.opencvffmpeg.Preview.surfaceCreated(FacePreview.java:225)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.SurfaceView.updateWindow(SurfaceView.java:536)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.SurfaceView.dispatchDraw(SurfaceView.java:339)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.View.draw(View.java:6832)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.widget.FrameLayout.draw(FrameLayout.java:352)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.View.draw(View.java:6832)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.widget.FrameLayout.draw(FrameLayout.java:352)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:189
5)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.ViewRoot.draw(ViewRoot.java:1407)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.os.Looper.loop(Looper.java:123)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
android.app.ActivityThread.main(ActivityThread.java:4627)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
java.lang.reflect.Method.invokeNative(Native Method)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
java.lang.reflect.Method.invoke(Method.java:521)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-09 22:03:55.748: E/AndroidRuntime(4089):     at 
dalvik.system.NativeStart.main(Native Method)

anyway, samuel,thanks for your kindly help.

Original comment by huzhangy...@gmail.com on 9 Apr 2012 at 2:05

GoogleCodeExporter commented 8 years ago
Ok, so you got it working? Good! Please ask your questions on the mailing list 
next time if possible, thanks

Original comment by samuel.a...@gmail.com on 10 Apr 2012 at 6:01

GoogleCodeExporter commented 8 years ago
Thanks for your kindly help.

�� 2012��4��10�� ����2:02�� <javacv@googlecode.com>���

Original comment by huzhangy...@gmail.com on 11 Apr 2012 at 10:37