diff --git a/Application/Config.py b/Application/Config.py index 9190513..38a0fae 100644 --- a/Application/Config.py +++ b/Application/Config.py @@ -2,17 +2,19 @@ class Config: c = { "min_area" : 500, - "max_area" : 20000, - "threashold" : 13, + "max_area" : 40000, + "threashold" : 10, "resizeWidth" : 512, "inputPath" : None, "outputPath": None, "maxLayerLength": 900, "minLayerLength": 20, - "tolerance": 10, + "tolerance": 20, "maxLength": None, - "ttolerance": 10, - "videoBufferLength": 1000 + "ttolerance": 60, + "videoBufferLength": 1000, + "noiseThreashold": 0.2, + "noiseSensitivity": 3/4 } def __init__(self): diff --git a/Application/Layer.py b/Application/Layer.py index b4d5d5c..26e8acd 100644 --- a/Application/Layer.py +++ b/Application/Layer.py @@ -61,8 +61,8 @@ class Layer: mapped = [] mapping = [] clusterCount = 1 - noiseSensitivity = 3/4 - noiseThreashold = 0.05 + noiseSensitivity = self.config["noiseSensitivity"] + noiseThreashold = self.config["noiseThreashold"] for i, bounds in enumerate(org): for j, bound in enumerate(bounds): x = (bound[0] + bound[2]/2) / self.config["w"] @@ -123,7 +123,8 @@ class Layer: newContours[x].append(org[x][y]) self.bounds = newContours - print(f"{clusterCount} clusters identified {dists}") + #print(f"{clusterCount} clusters identified {dists}") + #fig, ax = plt.subplots() #x=mapped[:,0] #y=mapped[:,1] diff --git a/Application/LayerFactory.py b/Application/LayerFactory.py index 50e81b8..972e66e 100644 --- a/Application/LayerFactory.py +++ b/Application/LayerFactory.py @@ -40,11 +40,19 @@ class LayerFactory: self.layers = layers - def freeData(self): + def freeMin(self): self.data.clear() layers = [] for l in self.layers: - if l.getLength() < self.maxLayerLength and l.getLength() > self.minLayerLength: + if l.getLength() > self.minLayerLength: + layers.append(l) + self.layers = layers + self.removeStaticLayers() + + def freeMax(self): + layers = [] + for l in self.layers: + if l.getLength() < self.maxLayerLength: layers.append(l) self.layers = layers self.removeStaticLayers() @@ -77,10 +85,11 @@ class LayerFactory: #pool.map_async(self.getLayers, tmp) for x in tmp: self.getLayers(x) - self.freeData() + + self.freeMin() self.sortLayers() self.cleanLayers() - self.freeData() + self.freeMax() return self.layers diff --git a/output/short.txt b/output/short.txt index 796a87a..733af0f 100644 Binary files a/output/short.txt and b/output/short.txt differ