I am using Java openCV, and i try to load a photo and run the template matching over it. The template matching method deals with Mat objects, so i need to load the images and convert them into Mat.
The way i do it is:
Bitmap i = BitmapFactory.decodeFile("/sdcard/TVguide/Detection/detected.jpg");
image = Utils.bitmapToMat(i);
This way i load a photo from my android SD card, and try to convert it into Mat object using the openCV method bitmapToMat. The problem is that on the conversion, the application crashes.
Here is the LogCat:
03-14 15:15:57.636: W/dalvikvm(1059): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/opencv/android/Utils;
03-14 15:15:57.636: D/AndroidRuntime(1059): Shutting down VM
03-14 15:15:57.636: W/dalvikvm(1059): threadid=1: thread exiting with uncaught exception (group=0x40015578)
03-14 15:15:57.640: E/AndroidRuntime(1059): FATAL EXCEPTION: main
03-14 15:15:57.640: E/AndroidRuntime(1059): java.lang.ExceptionInInitializerError
03-14 15:15:57.640: E/AndroidRuntime(1059): at com.marakana.Preview$3.onPictureTaken(Preview.java:191)
03-14 15:15:57.640: E/AndroidRuntime(1059): at android.hardware.Camera$EventHandler.handleMessage(Camera.java:565)
03-14 15:15:57.640: E/AndroidRuntime(1059): at android.os.Handler.dispatchMessage(Handler.java:99)
03-14 15:15:57.640: E/AndroidRuntime(1059): at android.os.Looper.loop(Looper.java:123)
03-14 15:15:57.640: E/AndroidRuntime(1059): at android.app.ActivityThread.main(ActivityThread.java:3687)
03-14 15:15:57.640: E/AndroidRuntime(1059): at java.lang.reflect.Method.invokeNative(Native Method)
03-14 15:15:57.640: E/AndroidRuntime(1059): at java.lang.reflect.Method.invoke(Method.java:507)
03-14 15:15:57.640: E/AndroidRuntime(1059): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
03-14 15:15:57.640: E/AndroidRuntime(1059): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-14 15:15:57.640: E/AndroidRuntime(1059): at dalvik.system.NativeStart.main(Native Method)
03-14 15:15:57.640: E/AndroidRuntime(1059): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load opencv_java: findLibrary returned null
03-14 15:15:57.640: E/AndroidRuntime(1059): at java.lang.Runtime.loadLibrary(Runtime.java:429)
03-14 15:15:57.640: E/AndroidRuntime(1059): at java.lang.System.loadLibrary(System.java:554)
03-14 15:15:57.640: E/AndroidRuntime(1059): at org.opencv.android.Utils.<clinit>(Utils.java:86)
03-14 15:15:57.640: E/AndroidRuntime(1059): ... 10 more
03-14 15:16:03.472: I/Process(1059): Sending signal. PID: 1059 SIG: 9
I can't understand if i am doing something wrong or it is just a buggy openCV.
Thanks Eyal