/**
*
- * reads an image from a live image capture and outputs information to the
- * SmartDashboard or a file
+ * reads an image from a live image capture and outputs information to the a
+ * file. It currently spits out an image that has contours of white objects,
+ * or filters white objects to be brighter.
+ *
+ * MatThresh = contours, MatOriginal = white filter.
*/
public static void processImage() {
ArrayList<MatOfPoint> contours = new ArrayList<MatOfPoint>();
while (FrameCount < 1) {
contours.clear();
- matOriginal = Imgcodecs.imread("goal.jpg");
+ matOriginal = Imgcodecs.imread("imgs/test.png");
Imgproc.cvtColor(matOriginal, matHSV, Imgproc.COLOR_BGR2HSV);
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", matOriginal);
+ // Imgcodecs.imwrite("output.png", matThresh);
}
shouldRun = false;
}