我一直在尝试使用一个非常基本的基于OpenCV的应用程序(此时此刻,它只需要来自摄像头的输入)。但是,我一直遇到这个错误:
E/Camera-JNI﹕ Callback buffer was too small! Expected 1382400 bytes, but got 608256 bytes!
我对这个看似神秘错误的主要抱怨是OpenCV示例在我的手机上工作(Galaxy S3,运行CM10.2(Android 4.3.1)。我的代码几乎是样本中代码的副本
public class MainActivity extends ActionBarActivity implements CameraBridgeViewBase.CvCameraViewListener2, View.OnTouchListener {
private CameraView mCameraView;
private static final String TAG = "com.adilhz.logging";
private BaseLoaderCallback mBaseLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch(status) {
case LoaderCallbackInterface.SUCCESS:
Log.d(TAG,"Loaded OpenCV");
mCameraView.enableView();
mCameraView.setOnTouchListener(MainActivity.this);
break;
default:
Log.d(TAG,"OpenCV"+status);
super.onManagerConnected(status);
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_main);
mCameraView = (CameraView)findViewById(R.id.java_surface_view);
mCameraView.setVisibility(SurfaceView.VISIBLE);
mCameraView.setCvCameraViewListener(this);
}
@Override
public void onResume() {
super.onResume();
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_9, this, mBaseLoaderCallback);
}
有人可以就我出错的地方提供一些指示吗?
谢谢,Adil