I wanted to simply convert a bitmap from Android to a Mat object for OpenCV. This topic is often adressed on Stack Overflow. For example:
convert Mat to Bitmap Opencv fo
You only can do your work with OpenCV after it is initialized. So you need to initialize it like that:
1.Create a Callback:
private BaseLoaderCallback mOpenCVCallBack = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
//DO YOUR WORK/STUFF HERE
break;
default:
super.onManagerConnected(status);
break;
}
}
};
2.You need to initialize the callback in the onResume Method of your Activity:
@Override
protected void onResume() {
super.onResume();
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_8, this,
mOpenCVCallBack);
}
and thats it, i hope it was helpful :D