Hello OpenCV is not working
I am new guy to android OpenCv, so i started with referring to this tutorial given OpenCV doc in this link i have followed steps same as given in the description but the app does't work it and end up with "Unfortunately, Helloworld has stopped" and here is my code of Mainactivity class generated by eclipse with fixing errors
public class MainActivity extends Activity {
private static final String TAG = "OCVSample::Activity";
private CameraBridgeViewBase mOpenCvCameraView;
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "called onCreate");
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_main);
mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.HelloOpenCvView);
mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
mOpenCvCameraView.setCvCameraViewListener((CvCameraViewListener2) this);
}
@Override
public void onPause() {
super.onPause();
if (mOpenCvCameraView != null)
mOpenCvCameraView.disableView();
}
public void onDestroy() {
super.onDestroy();
if (mOpenCvCameraView != null)
mOpenCvCameraView.disableView();
}
public void onCameraViewStarted(int width, int height) {
}
public void onCameraViewStopped() {
}
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
return inputFrame.rgba();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public BaseLoaderCallback getMloadBaseLoaderCallback() {
return mloadBaseLoaderCallback;
}
public void setMloadBaseLoaderCallback(
BaseLoaderCallback mloadBaseLoaderCallback) {
this.mloadBaseLoaderCallback = mloadBaseLoaderCallback;
}
private BaseLoaderCallback mloadBaseLoaderCallback = new BaseLoaderCallback(
this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS: {
Log.i(TAG, "OpenCV loaded successfully");
mOpenCvCameraView.enableView();
}
break;
default: {
super.onManagerConnected(status);
}
break;
}
}
};
@Override
public void onResume() {
super.onResume();
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_5, this,
getMloadBaseLoaderCallback());
}
}