mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
More area slider tweaking
This commit is contained in:
@@ -56,11 +56,11 @@ public class CVProcess {
|
||||
List<MatOfPoint> FilterContours(List<MatOfPoint> InputContours, List<Integer> area, List<Double> ratio, List<Integer> extent) {
|
||||
for (MatOfPoint Contour : InputContours) {
|
||||
try {
|
||||
double contourArea = Imgproc.contourArea(Contour); //TODO change scaling
|
||||
double targetArea = contourArea;
|
||||
double minArea = (double) (area.get(0) * CamVals.ImageArea)/ 100;
|
||||
double maxArea = (double) (area.get(1) * CamVals.ImageArea) / 100;
|
||||
if (targetArea <= minArea || targetArea >= maxArea) {
|
||||
double contourArea = Imgproc.contourArea(Contour);
|
||||
double minAreaSlider = Math.log(area.get(0));
|
||||
double minArea = (minAreaSlider * CamVals.ImageArea) / 100;
|
||||
double maxArea = (area.get(1) * CamVals.ImageArea) / 100;
|
||||
if (contourArea <= minArea || contourArea >= maxArea) {
|
||||
continue;
|
||||
}
|
||||
var rect = Imgproc.minAreaRect(new MatOfPoint2f(Contour.toArray()));
|
||||
@@ -68,7 +68,7 @@ public class CVProcess {
|
||||
var targetFullness = contourArea;
|
||||
double minExtent = (double) (extent.get(0) * rect.size.area())/ 100;
|
||||
double maxExtent = (double) (extent.get(1) * rect.size.area()) / 100;
|
||||
if (targetFullness <= minExtent || targetArea >= maxExtent) {
|
||||
if (targetFullness <= minExtent || contourArea >= maxExtent) {
|
||||
continue;
|
||||
}
|
||||
double aspectRatio = rect.size.width / rect.size.height;//TODO i think aspectRatio is inverted
|
||||
|
||||
@@ -146,6 +146,7 @@ public class VisionProcess implements Runnable {
|
||||
GroupedContours = cvProcess.GroupTargets(FilteredContours, currentPipeline.target_intersection, currentPipeline.target_group);
|
||||
if (GroupedContours.size() > 0) {
|
||||
var finalRect = cvProcess.SortTargetsToOne(GroupedContours, currentPipeline.sort_mode);
|
||||
// System.out.printf("Largest Contour Area: %.2f\n", finalRect.size.area());
|
||||
pipelineResult.RawPoint = finalRect;
|
||||
pipelineResult.IsValid = true;
|
||||
if (!currentPipeline.is_calibrated) {
|
||||
|
||||
Reference in New Issue
Block a user