This commit is contained in:
Omer
2019-09-16 18:50:30 +03:00
4 changed files with 13 additions and 4 deletions

View File

@@ -11,6 +11,9 @@ public class MemoryManager {
this.collectionThreshold = collectionThreshold;
}
public void setCollectionThreshold(int collectionThreshold) {
this.collectionThreshold = collectionThreshold;
}
public static long getUsedMemory() {
return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();

View File

@@ -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);
}
}

View File

@@ -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()));

View File

@@ -37,7 +37,13 @@ public class Server {
// System.out.println(SettingsManager.getInstance().GetCurrentPipeline().);
broadcastMessage(ctx, ctx.message());
JSONObject jsonObject = new JSONObject(ctx.message());
String key = jsonObject.keySet().toArray()[0].toString();
String key = null;
try {
key = jsonObject.keySet().toArray()[0].toString();
} catch (Exception ex) {
ex.printStackTrace();
}
if (key == null) return;
Object value = jsonObject.get(key);
if (!setField(SettingsManager.getInstance().GetCurrentPipeline(), key, value)) {
//If field not in pipeline