Пример #1
0
  public void toggleMarkerDisplay(View view) {
    if (detector.getMarkerDrawMode() == MarkerDetector.MarkerDrawMode.off) {
      detector.setMarkerDrawMode(MarkerDetector.MarkerDrawMode.outline);
    } else if (detector.getMarkerDrawMode() == MarkerDetector.MarkerDrawMode.outline) {
      detector.setMarkerDrawMode(MarkerDetector.MarkerDrawMode.regions);
    } else {
      detector.setMarkerDrawMode(MarkerDetector.MarkerDrawMode.off);
    }

    updateMenu();
  }
Пример #2
0
  protected void updateMenu() {
    Button flipCameraButton = (Button) findViewById(R.id.flipCameraButton);
    if (camera.getCameraCount() > 1) {
      flipCameraButton.setVisibility(View.VISIBLE);
      if (camera.isFront()) {
        flipCameraButton.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.ic_camera_front_white_24dp, 0, 0, 0);
        flipCameraButton.setText(getString(R.string.camera_front));
      } else {
        flipCameraButton.setCompoundDrawablesWithIntrinsicBounds(
            R.drawable.ic_camera_rear_white_24dp, 0, 0, 0);
        flipCameraButton.setText(getString(R.string.camera_rear));
      }
    } else {
      flipCameraButton.setVisibility(View.GONE);
    }

    Button thresholdDisplayButton = (Button) findViewById(R.id.thresholdDisplayButton);
    if (detector.shouldDrawThreshold()) {
      thresholdDisplayButton.setText(getString(R.string.threshold_on));
      thresholdDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_filter_b_and_w_white_24dp, 0, 0, 0);
    } else {
      thresholdDisplayButton.setText(getString(R.string.threshold_off));
      thresholdDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_filter_b_and_w_off_white_24dp, 0, 0, 0);
    }

    Button markerDisplayButton = (Button) findViewById(R.id.markerDisplayButton);
    if (detector.getMarkerDrawMode() == MarkerDetector.MarkerDrawMode.off) {
      markerDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_border_clear_white_24dp, 0, 0, 0);
      markerDisplayButton.setText(getString(R.string.marker_off));
    } else if (detector.getMarkerDrawMode() == MarkerDetector.MarkerDrawMode.outline) {
      markerDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_border_outer_white_24dp, 0, 0, 0);
      markerDisplayButton.setText(getString(R.string.marker_outline));
    } else {
      markerDisplayButton.setCompoundDrawablesWithIntrinsicBounds(
          R.drawable.ic_border_all_white_24dp, 0, 0, 0);
      markerDisplayButton.setText(getString(R.string.marker_on));
    }

    // private ImageView autoOpenIcon;
    // private TextView autoOpenLabel;
  }
Пример #3
0
  @Override
  public void experienceSelected(Experience experience) {
    Log.i(TAG, "experience updated");

    if (experience != null) {
      detector.start();

      setTitle(experience.getName());
    }
  }
Пример #4
0
 private void startCamera() {
   if (camera != null) {
     try {
       camera.start(holder);
       detector.start();
       layout();
     } catch (Exception e) {
       Log.e(TAG, e.getMessage(), e);
     }
   }
 }
Пример #5
0
 private void stopCamera() {
   if (camera != null) {
     detector.stop();
     camera.release();
   }
 }
Пример #6
0
 public void toggleThresholdDisplay(View view) {
   detector.setDrawThreshold(!detector.shouldDrawThreshold());
   updateMenu();
 }