Fix the slider init.
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4134 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/971CV/src/org/frc971/Recognizer2013.java b/971CV/src/org/frc971/Recognizer2013.java
index d2de431..0caf1f1 100644
--- a/971CV/src/org/frc971/Recognizer2013.java
+++ b/971CV/src/org/frc971/Recognizer2013.java
@@ -27,10 +27,6 @@
// --- Constants that need to be tuned.
static final double kRoughlyHorizontalSlope = Math.tan(Math.toRadians(30));
static final double kRoughlyVerticalSlope = Math.tan(Math.toRadians(90 - 30));
- private int min1Hue;
- private int max1Hue;
- private int min1Sat;
- private int min1Val;
static final int kHoleClosingIterations = 2;
static final double kPolygonPercentFit = 12;
@@ -52,6 +48,8 @@
private static final WPIColor candidateColor = WPIColor.BLUE;
private static final WPIColor targetColor = new WPIColor(255, 0, 0);
+ private int min1Hue, max1Hue, min1Sat, min1Val;
+
// Show intermediate images for parameter tuning.
private final DebugCanvas thresholdedCanvas = new DebugCanvas("thresholded");
private final DebugCanvas morphedCanvas = new DebugCanvas("morphed");
@@ -89,9 +87,9 @@
@Override
public int getHueMax() { return max1Hue - 1; }
@Override
- public int getSatMin() { return min1Sat - 1; }
+ public int getSatMin() { return min1Sat + 1; }
@Override
- public int getValMin() { return min1Val - 1; }
+ public int getValMin() { return min1Val + 1; }
@Override
public void showIntermediateStages(boolean enable) {
@@ -136,7 +134,6 @@
// NOTE: Since red is at the end of the cyclic color space, you can OR
// a threshold and an inverted threshold to match red pixels.
- // TODO(jerry): Use tunable constants instead of literals.
opencv_imgproc.cvThreshold(hue, bin, min1Hue, 255, opencv_imgproc.CV_THRESH_BINARY);
opencv_imgproc.cvThreshold(hue, hue, max1Hue, 255, opencv_imgproc.CV_THRESH_BINARY_INV);
opencv_imgproc.cvThreshold(sat, sat, min1Sat, 255, opencv_imgproc.CV_THRESH_BINARY);
@@ -157,11 +154,6 @@
morphedCanvas.showImage(bin);
// Find contours.
- //
- // TODO(jerry): Request contours as a two-level hierarchy (blobs and
- // holes)? The targets have known sizes and their holes have known,
- // smaller sizes. This matters for distance measurement. OTOH it's moot
- // if/when we use the vertical stripes for distance measurement.
WPIBinaryImage binWpi = DaisyExtensions.makeWPIBinaryImage(bin);
WPIContour[] contours = daisyExtensions.findConvexContours(binWpi);