@Override public void onResume() { super.onResume(); Log.i(TAG, "on resume"); if (mOpenCvCameraView != null && !mOpenCvCameraView.isEnabled()) { mOpenCvCameraView.enableView(); } }
public void onDestroy() { super.onDestroy(); Log.i(TAG, "on destory"); if (mOpenCvCameraView != null) { mOpenCvCameraView.disableView(); } xface.destroryFacedetect(); }
@Override public void onPause() { super.onPause(); Log.i(TAG, "on pause and finish!"); if (mOpenCvCameraView != null) { mOpenCvCameraView.disableView(); } xface.destroryFacedetect(); SignupCameraActivity.this.finish(); // }
public void btn_camera_takepic(View view) { Log.i(TAG, "btn_camera_takepic"); filePath = CommonUtil.CAMERAFOLDER.getAbsolutePath() + File.separator + System.currentTimeMillis() + ".jpg"; mOpenCvCameraView.takePicture(filePath); btn_camera_takepic.setText("Take this to replace!"); ToastUtil.showShortToast(getApplicationContext(), filePath + " saved"); bPictaken = true; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signupcamera); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); name = getIntent().getStringExtra("name"); userid = getIntent().getIntExtra("userid", -1); Log.i(TAG, "name = " + name + " && userid = " + userid); btn_camera_ok = (Button) findViewById(R.id.btn_camera_ok); btn_camera_takepic = (Button) findViewById(R.id.btn_camera_takepic); // / face detection! // xface = new XFaceLibrary();// hujiawei xface = CommonUtil.xFaceLibrary; xface.initFacedetect(CommonUtil.LBPCASCADE_FILEPATH, 0); // / face detection! mOpenCvCameraView = (SignupCameraView) findViewById(R.id.cv_camera_signup); mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE); mOpenCvCameraView.setCvCameraViewListener(this); mOpenCvCameraView.enableView(); }