From 8aa8cd1aaeebc4e2d2053ef98050d3963db7c2c7 Mon Sep 17 00:00:00 2001 From: Askill Date: Sun, 20 Dec 2020 20:58:56 +0100 Subject: [PATCH] . --- Application/ContourExctractor.py | 9 +++------ main.py | 8 +++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Application/ContourExctractor.py b/Application/ContourExctractor.py index 6042079..309e793 100644 --- a/Application/ContourExctractor.py +++ b/Application/ContourExctractor.py @@ -57,12 +57,12 @@ class ContourExtractor: # start a bunch of frames and let them read from the video reader buffer until the video reader reaches EOF with ThreadPool(self.config["ce_comp_threads"]) as pool: while not videoReader.videoEnded(): - if videoReader.buffer.qsize() == 0: - time.sleep(.1) + if videoReader.buffer.qsize() <= 5: + time.sleep(.5) tmpData = [videoReader.pop() for i in range(0, videoReader.buffer.qsize())] self.computeMovingAverage(tmpData) - pool.map_async(self.getContours, tmpData) + pool.map(self.getContours, tmpData) #for data in tmpData: # self.getContours(data) frameCount = tmpData[-1][0] @@ -88,7 +88,6 @@ class ContourExtractor: #cv2.imshow("changes x", thresh) #cv2.waitKey(10) & 0XFF cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) - self.diff.append(np.count_nonzero(thresh)) cnts = imutils.grab_contours(cnts) contours = [] @@ -104,8 +103,6 @@ class ContourExtractor: # meaning every bit in the mask would take up 8bits, which migth be too much masks.append(np.packbits(np.copy(thresh[y:y+h,x:x+w]), axis=0)) - - if len(contours) != 0 and contours is not None: # this should be thread safe self.extractedContours[frameCount] = contours diff --git a/main.py b/main.py index 948daf7..14ebc48 100644 --- a/main.py +++ b/main.py @@ -14,8 +14,6 @@ import csv def main(v1, v2, v3, v4): - - startTotal = time.time() start = startTotal config = Config() @@ -80,10 +78,10 @@ def main(v1, v2, v3, v4): exit(0) if __name__ == "__main__": - ass = list(range(1, 18, 4)) - bss = list(range(1, 18, 4)) + ass = list(range(4, 18, 4)) + bss = list(range(4, 18, 4)) css = list(range(1, 16, 8)) - dss = list(range(50, 500, 200)) + dss = list(range(100, 500, 200)) params = [ass, bss, css, dss] params = list(product(*params)) counter = 0