-Added a class to serve up results to atom. A matching client C++ class should follow shortly.
-Generally beautified code
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4148 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/971CV/src/org/frc971/TestImageGetter.java b/971CV/src/org/frc971/TestImageGetter.java
index b0cf9b0..a61ed60 100644
--- a/971CV/src/org/frc971/TestImageGetter.java
+++ b/971CV/src/org/frc971/TestImageGetter.java
@@ -8,8 +8,6 @@
*
*/
-//get debug images for Java camera processor
-
import java.io.File;
import java.io.IOException;
@@ -19,12 +17,16 @@
import edu.wpi.first.wpijavacv.WPIColorImage;
+/** Get debug images for Java camera processor. */
public class TestImageGetter {
private String path_to_images;
private final static Logger LOG = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
+ /** The names of our debugging images, without paths.
+ * The GetNext method should be used to get the first
+ * image, and not GetCurrent. */
final static String[] images = {"45in_DoubleGreen.jpg",
"57inLargeTarget_DoubleGreenBK.jpg",
"FullField_DoubleGreenBK3.jpg",
@@ -49,15 +51,26 @@
private WPIColorImage current_image = null;
+ /** Helper method to concatenate paths, similar to Python's os.path.join(). */
private String cocatenate_paths(String path1, String path2) {
if (path1.charAt(path1.length() - 1) == '/')
return path1 + path2;
else
return path1 + "/" + path2;
}
+
+ /** Constructor
+ *
+ * @param path_to_images is the path to the directory where our images are.
+ */
public TestImageGetter(String path_to_images) {
this.path_to_images = path_to_images;
}
+
+ /** Gets the next debugging image.
+ *
+ * @return Returns a WPIColorImage.
+ */
public WPIColorImage GetNext() {
image_index++;
if (image_index < images.length) {
@@ -75,6 +88,11 @@
image_index--;
return null;
}
+
+ /** Gets the previous debugging image.
+ *
+ * @return Returns a WPIColorImage.
+ */
public WPIColorImage GetPrev() {
image_index--;
if (image_index >= 0) {
@@ -92,6 +110,11 @@
image_index++;
return null;
}
+
+ /** Gets the current debugging image. This is vestigial, it is not longer used.
+ *
+ * @return Returns a WPIColorImage
+ */
public WPIColorImage GetCurrent() {
return current_image;
}