setup things, not really sure what happened. oh yeah fix opencv
[3501/OpenCVShowImage] / GoalTracker.java
index ec627d0da9235c9f6190243137ed87acfa7e8e9c..bab65e8aff6a77344f998616377a80d0b2a82b8d 100644 (file)
@@ -78,8 +78,11 @@ public class GoalTracker {
 
        /**
         *
-        * 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>();
@@ -89,7 +92,7 @@ public class GoalTracker {
 
                while (FrameCount < 1) {
                        contours.clear();
-                       matOriginal = Imgcodecs.imread("goal.jpg");
+                       matOriginal = Imgcodecs.imread("imgs/test.png");
 
                        Imgproc.cvtColor(matOriginal, matHSV, Imgproc.COLOR_BGR2HSV);
 
@@ -128,18 +131,14 @@ public class GoalTracker {
                                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;
        }