mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-05 03:21:40 +00:00
[WIP] Polygon and Circle Detection (#100)
* Created FindPolygonPipe and DetectPolygonPipeline * Return CVShape based off approxDP * Added fromSides method to ContourShape * Use enums * Use harris detector * Switch back to approxpolydp * Added colourshape pipeline * Added pipeline test * Finsihed triangle/quad/custom polygon detection * Circle detection * Revert "Circle detection" This reverts commit f6b2fe785d69b16ca1466a13073dce72a0d54570. * Added shape drawings to draw2dcontourspipe * Added circledetection pipe params * apply spotless * Added colourtoscalar outside of loop * Added powercell testing images from ML library * Powercell tracking works * Added gradle to gitnore * Added solvepnp to circles * Reordered pipes and pipe params * Fixed tests * Apply spotless * chmod gradlew * gradle wrapper * Removed commits from gradle * Fix typo in ColoredShapePipeline * Apply Spotless Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
This commit is contained in:
@@ -77,6 +77,41 @@ public class TestUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public enum PolygonTestImages {
|
||||
kPolygons;
|
||||
|
||||
public final Path path;
|
||||
|
||||
Path getPath() {
|
||||
var filename = this.toString().substring(1).toLowerCase();
|
||||
return Path.of("polygons", filename + ".png");
|
||||
}
|
||||
|
||||
PolygonTestImages() {
|
||||
this.path = getPath();
|
||||
}
|
||||
}
|
||||
|
||||
public enum PowercellTestImages {
|
||||
kPowercell_test_1,
|
||||
kPowercell_test_2,
|
||||
kPowercell_test_3,
|
||||
kPowercell_test_4,
|
||||
kPowercell_test_5,
|
||||
kPowercell_test_6;
|
||||
|
||||
public final Path path;
|
||||
|
||||
Path getPath() {
|
||||
var filename = this.toString().substring(1).toLowerCase();
|
||||
return Path.of(filename + ".png");
|
||||
}
|
||||
|
||||
PowercellTestImages() {
|
||||
this.path = getPath();
|
||||
}
|
||||
}
|
||||
|
||||
private static Path getResourcesFolderPath() {
|
||||
return Path.of("src", "test", "resources").toAbsolutePath();
|
||||
}
|
||||
@@ -89,6 +124,10 @@ public class TestUtils {
|
||||
return getResourcesFolderPath().resolve("calibration");
|
||||
}
|
||||
|
||||
public static Path getPowercellPath() {
|
||||
return getTestImagesPath().resolve("polygons").resolve("powercells");
|
||||
}
|
||||
|
||||
public static Path getWPIImagePath(WPI2020Image image) {
|
||||
return getTestImagesPath().resolve(image.path);
|
||||
}
|
||||
@@ -97,6 +136,14 @@ public class TestUtils {
|
||||
return getTestImagesPath().resolve(image.path);
|
||||
}
|
||||
|
||||
public static Path getPolygonImagePath(PolygonTestImages image) {
|
||||
return getTestImagesPath().resolve(image.path);
|
||||
}
|
||||
|
||||
public static Path getPowercellImagePath(PowercellTestImages image) {
|
||||
return getPowercellPath().resolve(image.path);
|
||||
}
|
||||
|
||||
public static void loadLibraries() {
|
||||
try {
|
||||
CameraServerCvJNI.forceLoad();
|
||||
|
||||
Reference in New Issue
Block a user