mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Fixed area filtering of contours
This commit is contained in:
@@ -88,7 +88,7 @@ public class CameraProcess implements Runnable {
|
||||
|
||||
if (FilteredContours.size() > 0) {
|
||||
for (int i = 0; i < FilteredContours.size(); i++) {
|
||||
Imgproc.drawContours(outputMat, FilteredContours, i, contourColor, 3);
|
||||
Imgproc.drawContours(outputMat, FilteredContours, i, contourColor, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@ public class VisionProcess {
|
||||
}
|
||||
|
||||
private List<MatOfPoint> FilteredContours = new ArrayList<MatOfPoint>();
|
||||
List<MatOfPoint> FilterContours(List<MatOfPoint> InputContours, List<Integer> area, List<Integer> ratio, List<Integer> extent, String SortMode, String TargetIntersection, String TargetGrouping){
|
||||
List<MatOfPoint> FilterContours(List<MatOfPoint> InputContours, List<Integer> area, List<Integer> ratio, List<Integer> extent, String SortMode, String TargetIntersection, String TargetGrouping) {
|
||||
for (MatOfPoint Contour : InputContours){
|
||||
try{
|
||||
var contourArea = Imgproc.contourArea(Contour);
|
||||
double targetArea = (contourArea / CamVals.ImageArea) * 100;
|
||||
if (targetArea >= area.get(0) || targetArea <= area.get(1)){
|
||||
if (targetArea <= area.get(0) || targetArea >= area.get(1)){
|
||||
continue;
|
||||
}
|
||||
var rect = Imgproc.minAreaRect(new MatOfPoint2f(Contour.toArray()));
|
||||
|
||||
Reference in New Issue
Block a user