Cleanup unused imports
This commit is contained in:
parent
0c57500e30
commit
b491568e6c
|
@ -5,7 +5,6 @@
|
|||
So it won't ultimately be as empty as it might here appear to be :-) -->
|
||||
|
||||
<!-- The package name here determines the package for your R class and your BuildConfig class -->
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest>
|
||||
<application/>
|
||||
</manifest>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.tearabite.ftctearabits.vision;
|
||||
|
||||
import static com.tearabite.ftctearabits.graphics.LinePaint.WHITE;
|
||||
import static com.tearabite.ftctearabits.vision.Detection.PropertyScale.Pixels;
|
||||
import static com.tearabite.ftctearabits.vision.FTCColors.FTC_BLUE_RANGE;
|
||||
import static com.tearabite.ftctearabits.vision.FTCColors.FTC_RED_RANGE_1;
|
||||
import static com.tearabite.ftctearabits.vision.FTCColors.FTC_RED_RANGE_2;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package com.tearabite.ftctearabits.vision;
|
||||
|
||||
import org.opencv.core.Scalar;
|
||||
|
||||
public class Constants {
|
||||
public static Scalar RED = new Scalar(255, 0, 0);
|
||||
public static Scalar GREEN = new Scalar(0, 255, 0);
|
||||
public static Scalar BLUE = new Scalar(0, 0, 255);
|
||||
public static Scalar WHITE = new Scalar(255, 255, 255);
|
||||
public static Scalar GRAY = new Scalar(80, 80, 80);
|
||||
public static Scalar BLACK = new Scalar(0, 0, 0);
|
||||
public static Scalar ORANGE = new Scalar(255, 165, 0);
|
||||
public static Scalar YELLOW = new Scalar(255, 255, 0);
|
||||
public static Scalar PURPLE = new Scalar(128, 0, 128);
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package com.tearabite.ftctearabits.vision;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import org.opencv.core.Scalar;
|
||||
public class FTCColors {
|
||||
public static Scalar FTC_RED_LOWER = new Scalar(165, 80, 80);
|
||||
|
|
|
@ -12,54 +12,43 @@ import org.opencv.imgproc.Moments;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
// CV Helper Functions
|
||||
public class OpenCVUtil {
|
||||
|
||||
public static String telem = "nothing";
|
||||
|
||||
// Draw a point
|
||||
public static void drawPoint(Mat img, Point point, Scalar color) {
|
||||
Imgproc.circle(img, point, 3, color, -1);
|
||||
}
|
||||
|
||||
// Get the center of a contour
|
||||
public static Point getCenterOfContour(MatOfPoint contour) {
|
||||
Moments moments = Imgproc.moments(contour);
|
||||
return new Point(moments.m10 / moments.m00, moments.m01/ moments.m00);
|
||||
}
|
||||
|
||||
// Get the bottom left of a contour
|
||||
public static Point getBottomLeftOfContour(MatOfPoint contour) {
|
||||
Rect boundingRect = Imgproc.boundingRect(contour);
|
||||
return new Point(boundingRect.x, boundingRect.y+boundingRect.height);
|
||||
}
|
||||
|
||||
// Get the bottom right of a contour
|
||||
public static Point getBottomRightOfContour(MatOfPoint contour) {
|
||||
Rect boundingRect = Imgproc.boundingRect(contour);
|
||||
return new Point(boundingRect.x+boundingRect.width, boundingRect.y+boundingRect.height);
|
||||
}
|
||||
|
||||
// Draw a contour
|
||||
public static void drawContour(Mat img, MatOfPoint contour, Scalar color) {
|
||||
Imgproc.drawContours(img, Collections.singletonList(contour), 0, color, 2);
|
||||
}
|
||||
|
||||
// Draw a convex hull around a contour
|
||||
public static void drawConvexHull(Mat img, MatOfPoint contour, Scalar color) {
|
||||
MatOfInt hull = new MatOfInt();
|
||||
Imgproc.convexHull(contour, hull);
|
||||
Imgproc.drawContours(img, Collections.singletonList(convertIndexesToPoints(contour, hull)), 0, color, 2);
|
||||
}
|
||||
|
||||
// Draw a filled in convex hull around a contour
|
||||
public static void fillConvexHull(Mat img, MatOfPoint contour, Scalar color) {
|
||||
MatOfInt hull = new MatOfInt();
|
||||
Imgproc.convexHull(contour, hull);
|
||||
Imgproc.drawContours(img, Collections.singletonList(convertIndexesToPoints(contour, hull)), 0, color, -1);
|
||||
}
|
||||
|
||||
// Convert indexes to points that is used in order to draw the contours
|
||||
public static MatOfPoint convertIndexesToPoints(MatOfPoint contour, MatOfInt indexes) {
|
||||
int[] arrIndex = indexes.toArray();
|
||||
Point[] arrContour = contour.toArray();
|
||||
|
@ -74,7 +63,6 @@ public class OpenCVUtil {
|
|||
return hull;
|
||||
}
|
||||
|
||||
// Get the largest contour out of a list
|
||||
public static MatOfPoint getLargestContour(List<MatOfPoint> contours) {
|
||||
if (contours.size() == 0) {
|
||||
return null;
|
||||
|
@ -82,7 +70,6 @@ public class OpenCVUtil {
|
|||
return getLargestContours(contours, 1).get(0);
|
||||
}
|
||||
|
||||
// Get the top largest contours
|
||||
public static List<MatOfPoint> getLargestContours(List<MatOfPoint> contours, int numContours) {
|
||||
Collections.sort(contours, (a, b) -> (int) Imgproc.contourArea(b) - (int) Imgproc.contourArea(a));
|
||||
return contours.subList(0, Math.min(numContours, contours.size()));
|
||||
|
|
Loading…
Reference in New Issue