From 21f66c740a8753643cdccb45dcc9b12d974b5ed7 Mon Sep 17 00:00:00 2001 From: Askill Date: Wed, 5 Jan 2022 14:57:29 +0100 Subject: [PATCH] integrated export offset into exporter for overlayed video --- Application/Config.py | 2 +- Application/Exporter.py | 6 +++--- Application/Layer.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Application/Config.py b/Application/Config.py index 044fe01..08587f2 100644 --- a/Application/Config.py +++ b/Application/Config.py @@ -12,7 +12,7 @@ class Config: "tolerance": 20, "maxLength": None, "ttolerance": 60, - "videoBufferLength": 450, + "videoBufferLength": 250, "LayersPerContour": 220, "avgNum":10 } diff --git a/Application/Exporter.py b/Application/Exporter.py index 2971b99..bc1f570 100644 --- a/Application/Exporter.py +++ b/Application/Exporter.py @@ -116,17 +116,17 @@ class Exporter: mask = np.resize(mask, (h, w)) mask = cv2.erode(mask, None, iterations=10) mask *= 255 - frame2 = frames[frameCount - layer.startFrame] + frame2 = frames[frameCount - layer.startFrame + layer.exportOffset] xx = np.copy(cv2.bitwise_and( frame2[y:y+h, x:x+w], frame2[y:y+h, x:x+w], mask=cv2.bitwise_not(mask))) frame2[y:y+h, x:x+w] = cv2.addWeighted(xx, 1, np.copy( cv2.bitwise_and(frame[y:y+h, x:x+w], frame[y:y+h, x:x+w], mask=mask)), 1, 0) - frames[frameCount - layer.startFrame] = np.copy(frame2) + frames[frameCount - layer.startFrame + layer.exportOffset] = np.copy(frame2) #cv2.imshow("changes x", frame2) #cv2.waitKey(10) & 0XFF time = datetime.fromtimestamp( int(frameCount/self.fps) + videoReader.getStartTime()) - cv2.putText(frames[frameCount - layer.startFrame], f"{time.hour}:{time.minute}:{time.second}", (int( + cv2.putText(frames[frameCount - layer.startFrame + layer.exportOffset], f"{time.hour}:{time.minute}:{time.second}", (int( x+w/2), int(y+h/2)), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2) except: continue diff --git a/Application/Layer.py b/Application/Layer.py index c95bbd6..c4b06df 100644 --- a/Application/Layer.py +++ b/Application/Layer.py @@ -77,7 +77,7 @@ class Layer: def getLength(self): - return len(self) + return len(self) + self.exportOffset def __len__(self): self.length = len(self.bounds)