Hi all, I am trying to write a short activity to try out thresholding an image using OpenCV on Android using Eclipse. I used a sample code from Tutorialspoint.com and my aim for this set of code is to read an image from my resource/drawable folder and output another image after performing thresholding onto an imageview. The code is as follows: public class mainactivity extends Activity {
private Mat destination;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat source = Highgui.imread(getResources().getDrawable(R.drawable.splashbackground).toString(),
Highgui.CV_LOAD_IMAGE_COLOR);
destination = new Mat(source.rows(), source.cols(),
source.type());
destination = source;
Imgproc.threshold(source, destination, 127, 255,
Imgproc.THRESH_TOZERO);
Highgui.imwrite("ThreshZero.jpg", destination);
} catch (Exception e) {
System.out.println("error: " + e.getMessage());
}
Bitmap bmp = Bitmap.createBitmap(640, 480, Config.ARGB_8888);
Utils.matToBitmap(destination, bmp);
ImageView photo= (ImageView) findViewById(R.id.imageView1);
photo.setImageBitmap(bmp);
}
}
After running this set of code, the compiler throws the following set of errors:
01-03 16:45:09.963: E/AndroidRuntime(16118): java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.test1-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libopencv_java249.so"
I tried really hard to search for a solution on this but I still don't quite understand how to solve it. I have already imported the relevant OpenCV libraries. Pls help!