Help more with memory usage in speckle reject and draw pipes

This commit is contained in:
Matt
2020-01-03 09:28:41 -08:00
parent 6920f2e1a4
commit 423cf2daf9
2 changed files with 5 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ public class Draw2dContoursPipe implements Pipe<Pair<Mat, List<StandardCVPipelin
drawnContours.forEach(Mat::release);
drawnContours.clear();
drawnContours = new ArrayList<>();
r.points(vertices);
contour.fromArray(vertices);

View File

@@ -2,7 +2,9 @@ package com.chameleonvision.vision.pipeline.pipes;
import com.chameleonvision.vision.pipeline.Pipe;
import org.apache.commons.lang3.tuple.Pair;
import org.opencv.core.Mat;
import org.opencv.core.MatOfPoint;
import org.opencv.core.MatOfPoint2f;
import org.opencv.imgproc.Imgproc;
import java.util.ArrayList;
@@ -26,7 +28,9 @@ public class SpeckleRejectPipe implements Pipe<List<MatOfPoint>, List<MatOfPoint
public Pair<List<MatOfPoint>, Long> run(List<MatOfPoint> input) {
long processStartNanos = System.nanoTime();
despeckledContours.forEach(MatOfPoint::release);
despeckledContours.clear();
despeckledContours = new ArrayList<>();
if (input.size() > 0) {
double averageArea = 0.0;