Esempio n. 1
0
  private void buscarLatas() {
    mCanDetector.process(mRgba);
    // si veo latas
    if (mCanDetector.getNumContours() > 0) {
      Blob can = mCanDetector.getNearestObject(mRgba, RECTANGLE_COLOR, -1);
      Point center = can.center;
      center.y = mCanDetector.getLowestPointSea(mRgba);
      char pos = getPos(center);
      System.out.print("Posicion de la lata: " + pos);
      // Enviar informacion al arduino
      try {
        sendData(pos);
      } catch (IOException e) {
        // bla
      }
      if (pos == 'q') {
        mIsColorSelected = false;
      }

      // si no veo latas
    } else {
      try {
        sendData('d');
      } catch (IOException e) {
        // bla
      }
    }
  }