diff --git a/ContourExctractor.py b/ContourExctractor.py index acb3fc9..2299598 100644 --- a/ContourExctractor.py +++ b/ContourExctractor.py @@ -17,7 +17,7 @@ class ContourExtractor: extractedContours = dict() min_area = 200 max_area = 30000 - threashold = 25 + threashold = 35 xDim = 0 yDim = 0 diff --git a/Exporter.py b/Exporter.py index 2b8306a..4936acd 100644 --- a/Exporter.py +++ b/Exporter.py @@ -19,17 +19,22 @@ class Exporter: def exportLayers(self, layers, outputPath): fps = self.fps writer = imageio.get_writer(outputPath, fps=fps) + i=0 for layer in layers: data = layer.data + if len(data) < 10: + continue for frame in data: (x, y, w, h) = frame[1] frame = frame[0] frame1 = np.zeros(shape=[1080, 1920, 3], dtype=np.uint8) frame1 = imutils.resize(frame1, width=512) frame1[y:y+frame.shape[0], x:x+frame.shape[1]] = frame + cv2.putText(frame1, str(i), (30,30), cv2.FONT_HERSHEY_SIMPLEX, 1,(255,255,255), 2) writer.append_data(np.array(frame1)) #cv2.imshow("changes overlayed", frame) #cv2.waitKey(10) & 0XFF + i += 1 writer.close() #cv2.destroyAllWindows() diff --git a/LayerFactory.py b/LayerFactory.py index 50992a9..4369d27 100644 --- a/LayerFactory.py +++ b/LayerFactory.py @@ -3,7 +3,7 @@ from Layer import Layer class LayerFactory: data = {} layers = [] - tolerance = 10 + tolerance = -10 def __init__(self, data=None): print("LayerFactory constructed") self.data = data @@ -40,11 +40,12 @@ class LayerFactory: print("LayerFactory: Layer knew no bounds") continue - if frameNumber - layer.lastFrame <= 1: + if frameNumber - layer.lastFrame <= 20: (x2,y2,w2,h2) = layer.data[-1][1] if self.contoursOverlay((x-tol,y+h+tol), (x+w+tol,y-tol), (x2,y2+h2), (x2+w2,y2)): foundLayer = True layer.add(frameNumber, (contour, (x,y,w,h))) + break layers[i] = layer if not foundLayer: diff --git a/__pycache__/ContourExctractor.cpython-37.pyc b/__pycache__/ContourExctractor.cpython-37.pyc index 2d4c7b6..496f1a7 100644 Binary files a/__pycache__/ContourExctractor.cpython-37.pyc and b/__pycache__/ContourExctractor.cpython-37.pyc differ diff --git a/__pycache__/Exporter.cpython-37.pyc b/__pycache__/Exporter.cpython-37.pyc index 04af32c..bcdfd5e 100644 Binary files a/__pycache__/Exporter.cpython-37.pyc and b/__pycache__/Exporter.cpython-37.pyc differ diff --git a/__pycache__/LayerFactory.cpython-37.pyc b/__pycache__/LayerFactory.cpython-37.pyc index 7b77310..87c4d50 100644 Binary files a/__pycache__/LayerFactory.cpython-37.pyc and b/__pycache__/LayerFactory.cpython-37.pyc differ diff --git a/short.mp4 b/short.mp4 index cd9e5d1..2141bf3 100644 Binary files a/short.mp4 and b/short.mp4 differ