Exemplo n.º 1
0
 @Override
 public void onResume() {
   super.onResume();
   Log.i(TAG, "on resume");
   if (mOpenCvCameraView != null && !mOpenCvCameraView.isEnabled()) {
     mOpenCvCameraView.enableView();
   }
 }
Exemplo n.º 2
0
 public void onDestroy() {
   super.onDestroy();
   Log.i(TAG, "on destory");
   if (mOpenCvCameraView != null) {
     mOpenCvCameraView.disableView();
   }
   xface.destroryFacedetect();
 }
Exemplo n.º 3
0
 @Override
 public void onPause() {
   super.onPause();
   Log.i(TAG, "on pause and finish!");
   if (mOpenCvCameraView != null) {
     mOpenCvCameraView.disableView();
   }
   xface.destroryFacedetect();
   SignupCameraActivity.this.finish(); //
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
  @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();
  }