Imgproc.cvtColor(matOriginal, matHSV, Imgproc.COLOR_BGR2HSV);
Core.inRange(matHSV, LOWER_BOUNDS, UPPER_BOUNDS, matThresh);
- // Imgcodecs.imwrite("output.png", matThresh);
+ Imgcodecs.imwrite("output.png", matThresh);
Imgproc.findContours(matThresh, contours, matHeirarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
Point center = new Point(rec.br().x - rec.width / 2 - 15, rec.br().y - rec.height / 2);
Point centerw = new Point(rec.br().x - rec.width / 2 - 15, rec.br().y - rec.height / 2 - 20);
- // Imgproc.putText(matOriginal, "hello" + (int) distance,
- // center,
- // Core.FONT_HERSHEY_PLAIN, 20, BLACK);
- // Imgproc.putText(matOriginal, "hello2" + (int) azimuth,
- // centerw,
- // Core.FONT_HERSHEY_PLAIN, 20, BLACK);
+ Imgproc.putText(matOriginal, "hello" + (int) distance, center, Core.FONT_HERSHEY_PLAIN, 20, BLACK);
+ Imgproc.putText(matOriginal, "hello2" + (int) azimuth, centerw, Core.FONT_HERSHEY_PLAIN, 20, BLACK);
System.out.println(distance + "m, " + azimuth + " degrees " + center.x + ", " + center.y);
}
FrameCount++;
- Imgcodecs.imwrite("output.png", matThresh);
+ // Imgcodecs.imwrite("output.png", matThresh);
}
shouldRun = false;
}