Exemplo n.º 1
0
  public Mat onCameraFrame(Mat inputFrame) {

    if (takeScanBase) {
      if (scanBase != null) {
        scanBase.release();
      }
      scanBase = new Mat();
      scanningMat = new Mat();

      Imgproc.cvtColor(inputFrame, scanBase, Imgproc.COLOR_RGB2GRAY);
      Imgproc.cvtColor(scanBase, scanningMat, Imgproc.COLOR_GRAY2RGB);
      scanBase.release();

      hasScanBase = true;
      takeScanBase = false;
    }

    if (hasScanBase) {
      Mat ret;

      Point p = findLaser(inputFrame);
      inputFrame.release();

      if (p != null) {
        if (hasThermal) {
          double temp = mThermal.read();
          data[(int) p.y][(int) p.x] = (float) temp;

          Core.circle(scanningMat, p, 3, new Scalar(255, 0, 0), -3);

        } else {
          // Log.v(TAG, "No thermal!");
        }
      }

      return scanningMat;
    } else return inputFrame;
  }