ok 12-17 08:13:10.461: W/dalvikvm(540): No implementation found for native Lorg/opencv/core/Mat;.n_Mat ()J
http://www.itstrike.cn/Question/5d7e055b-42ed-469a-ad8b-fb722a2dca2d.html
哦,你不能使用任何 opencv-相关的代码,直到管理器完成加载;)
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
if (status == LoaderCallbackInterface.SUCCESS ) {
// now we can call opencv code !
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.cmc7);
Mat myMat = new Mat();
Utils.bitmapToMat(mBitmap, myMat);
} else {
super.onManagerConnected(status);
}
}
};
@Override
public void onResume() {;
super.onResume();
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_5,this, mLoaderCallback);
// you may be tempted, to do something here, but it's *async*, and may take some time,
// so any opencv call here will lead to unresolved native errors.
}