When I call Highgui.imread command, I get Unexpected Exception on my mobile phone.
I want to load an Image from SDCard to a MAT variable.
File imgFile = new File("/sdcard/image1.jpg");
if(imgFile.exists())
{
Mat pic1 = Highgui.imread(imgFile.getAbsolutePath());
}
I am using Galaxy Tab 10.1 + Android OS: 3.2 kernel ver: 2.6.36.3
The Error on Device:
“The application project1 (process prj.project) has stopped unexpectedly. Please try again.“
Thank you for your help in advance.
Regards,
Ali
LogCat:
02-06 11:08:23.620: W/dalvikvm(5853): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/opencv/highgui/Highgui;
02-06 11:08:23.620: D/AndroidRuntime(5853): Shutting down VM
02-06 11:08:23.620: W/dalvikvm(5853): threadid=1: thread exiting with uncaught exception (group=0x400fc760)
02-06 11:08:23.620: E/AndroidRuntime(5853): FATAL EXCEPTION: main
02-06 11:08:23.620: E/AndroidRuntime(5853): java.lang.ExceptionInInitializerError
02-06 11:08:23.620: E/AndroidRuntime(5853): at photo.klu.PhotoKLUActivity$1.onClick(PhotoKLUActivity.java:89)
02-06 11:08:23.620: E/AndroidRuntime(5853): at android.view.View.performClick(View.java:3127)
02-06 11:08:23.620: E/AndroidRuntime(5853): at android.view.View$PerformClick.run(View.java:12025)
02-06 11:08:23.620: E/AndroidRuntime(5853): at android.os.Handler.handleCallback(Handler.java:587)
02-06 11:08:23.620: E/AndroidRuntime(5853): at android.os.Handler.dispatchMessage(Handler.java:92)
02-06 11:08:23.620: E/AndroidRuntime(5853): at android.os.Looper.loop(Looper.java:132)
02-06 11:08:23.620: E/AndroidRuntime(5853): at android.app.ActivityThread.main(ActivityThread.java:4126)
02-06 11:08:23.620: E/AndroidRuntime(5853): at java.lang.reflect.Method.invokeNative(Native Method)
02-06 11:08:23.620: E/AndroidRuntime(5853): at java.lang.reflect.Method.invoke(Method.java:491)
02-06 11:08:23.620: E/AndroidRuntime(5853): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
02-06 11:08:23.620: E/AndroidRuntime(5853): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
02-06 11:08:23.620: E/AndroidRuntime(5853): at dalvik.system.NativeStart.main(Native Method)
02-06 11:08:23.620: E/AndroidRuntime(5853): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load opencv_java: findLibrary returned null
02-06 11:08:23.620: E/AndroidRuntime(5853): at java.lang.Runtime.loadLibrary(Runtime.java:425)
02-06 11:08:23.620: E/AndroidRuntime(5853): at java.lang.System.loadLibrary(System.java:554)
02-06 11:08:23.620: E/AndroidRuntime(5853): at org.opencv.highgui.Highgui.<clinit>(Highgui.java:313)
02-06 11:08:23.620: E/AndroidRuntime(5853): ... 12 more
02-06 11:08:25.640: I/dalvikvm(5853): threadid=4: reacting to signal 3
02-06 11:08:25.640: I/dalvikvm(5853): Wrote stack traces to '/data/anr/traces.txt'
The openCV library is not attached to your application.
Please do the following (i assume that the openCV library is imported to your workspace).
On Package Explorer > Right click on the application project > properties > under Library click Add > select openCV
Be sure that on Java Build Path you don’t have anything related to openCV