Example #1
0
        @Override
        public void onPictureTaken(byte[] arg0, Camera arg1) {
          Bitmap bitmapPicture = BitmapFactory.decodeByteArray(arg0, 0, arg0.length);
          mView.saveCurrentFilterSet(); // Store filter for later reference

          // Get current running filter
          if (!mView.curFilterSubset().equals("")) {
            Mat imgMAT = new Mat();
            Utils.bitmapToMat(bitmapPicture, imgMAT);
            // If the image is empty
            if (imgMAT.empty()) return; // Ignore
            // Apply filters
            mView.applyCurrentFilters(imgMAT);
            Utils.matToBitmap(imgMAT, bitmapPicture);
          } else {
            // Log.i(TAG, "no filter");
          }

          startImageEdit(bitmapPicture);
        }
Example #2
0
  @Override
  public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
    ArrayList<Prediction> predictions = gestureLib.recognize(gesture);
    String sTheme;
    // Log.i(TAG, "predictions: "+predictions.toString());
    TextView sliderText = (TextView) findViewById(R.id.verticalSeekbarText);
    for (Prediction prediction : predictions) {
      if (prediction.score > 1.0) {
        //                    Toast.makeText(this, prediction.name, Toast.LENGTH_SHORT)
        //                      .show();
        if (prediction.name.contains("right")) {
          sTheme = mView.nextFilterSubset();
          // Process frame to show results
          mView.process(1);

          if (sTheme != null) {
            movementCounter++;
            sliderText.setText("Next Theme: " + sTheme);
            /*Toast.makeText(ICSeeRealtimeActivity.this, "Next Theme: " + sTheme,
            Toast.LENGTH_SHORT).show();*/
            mView.saveCurrentFilterSet(); // Store filter for later reference
            SoundPlayer.playSound(this.getApplicationContext(), SoundPlayer.S2);
            try {
              Thread.sleep(500);
            } catch (InterruptedException e) {
              e.printStackTrace();
            }
            if (!movementTutorial) {
              if (icSeeTutorial.getTutorialState(mContext) == 1) {
                movementTutorial = true;
              }
              // icSeeTutorial.playSound(this.getApplicationContext(), 2);
              ICSeeTutorial.playChangedFilter(mContext);
            } else if (movementCounter == 4) {
              ICSeeTutorial.playAutoFocus(mContext);
              movementCounter = 0;
            }
          } else {
            mView.initFilterSubsets();
            sliderText.setText("No theme applicable");
            /*Toast.makeText(ICSeeRealtimeActivity.this, "No theme applicable",
            Toast.LENGTH_SHORT).show();*/
            SoundPlayer.playSound(this.getApplicationContext(), SoundPlayer.S1);
            // icSeeTutorial.playSound(this.getApplicationContext(), 5);
            ICSeeTutorial.playNoFiltersLeft(mContext);
          }
        } else if (prediction.name.contains("left")) {
          sTheme = mView.previousFilterSubset();
          // Process frame to show results
          mView.process(1);

          if (sTheme != null) {
            movementCounter++;
            sliderText.setText("Previous Theme: " + sTheme);
            /*Toast.makeText(ICSeeRealtimeActivity.this, "Previous Theme: " + sTheme,
            Toast.LENGTH_SHORT).show();*/
            mView.saveCurrentFilterSet(); // Store filter for later reference
            SoundPlayer.playSound(this.getApplicationContext(), SoundPlayer.S3);
            try {
              Thread.sleep(500);
            } catch (InterruptedException e) {
              e.printStackTrace();
            }
            if (!movementTutorial) {
              if (icSeeTutorial.getTutorialState(mContext) == 1) {
                movementTutorial = true;
              }
              // icSeeTutorial.playSound(this.getApplicationContext(), 2);
              ICSeeTutorial.playChangedFilter(mContext);
            } else if (movementCounter == 4) {
              ICSeeTutorial.playAutoFocus(mContext);
              movementCounter = 0;
            }
          } else {
            mView.initFilterSubsets();
            sliderText.setText("No theme applicable");
            /*Toast.makeText(ICSeeRealtimeActivity.this, "No theme applicable",
            Toast.LENGTH_SHORT).show();*/
            SoundPlayer.playSound(this.getApplicationContext(), SoundPlayer.S1);
            // icSeeTutorial.playSound(this.getApplicationContext(), 5);
            ICSeeTutorial.playNoFiltersRight(mContext);
          }
        } else if (prediction.name.contains("omicron")
            || prediction.name.contains("omicron1")
            || prediction.name.contains("omicron2")
            || prediction.name.contains("omicron3")
            || prediction.name.contains("omicron4")) {
          // if tutorial state is off
          if (icSeeTutorial.getTutorialState(mContext) == 0) {
            icSeeTutorial.tutorialOn();
            ICSeeTutorial.playTutorialOn(mContext);
            movementTutorial = false;
            icSeeTutorial.getTutorialState(mContext);
          } else {
            icSeeTutorial.tutorialOff();
            icSeeTutorial.stopSound();
            ICSeeTutorial.playTutorialOff(mContext);
            icSeeTutorial.getTutorialState(mContext);
          }
        }
      }
    }
  }