more docs

TODO: layermerge still not fixed
This commit is contained in:
Askill 2020-12-19 14:00:58 +01:00
parent 7baa75dc19
commit 79eb3cefa3
5 changed files with 5 additions and 9 deletions

View File

@ -43,7 +43,6 @@ class ContourExtractor:
self.xDim = 0
self.yDim = 0
self.config = config
self.diff = []
self.lastFrames = None
self.averages = dict()
@ -97,11 +96,12 @@ class ContourExtractor:
for c in cnts:
ca = cv2.contourArea(c)
(x, y, w, h) = cv2.boundingRect(c)
#ca = (x+w)*(y+h)
if ca < self.min_area or ca > self.max_area:
continue
contours.append((x, y, w, h))
# the mask has to be packed like this, since np doesn't have a bit array,
# 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))
@ -121,7 +121,6 @@ class ContourExtractor:
avg = []
averageFrames = self.config["avgNum"]
nth = int(averageFrames/3) # only take /x x frames to average
if frames[0][0] < averageFrames:
frame = frames[0][1]
frame = self.prepareFrame(frame)

View File

@ -35,12 +35,12 @@ class Layer:
def add(self, frameNumber, bound, mask):
'''Adds a bound to the Layer at the layer index which corresponds to the given framenumber'''
index = frameNumber - self.startFrame
if index < 0:
return
if frameNumber > self.lastFrame:
for i in range(frameNumber - self.lastFrame):
self.bounds.append([bound])
self.masks.append([mask])
self.lastFrame = frameNumber
if bound not in self.bounds[index]:

View File

@ -72,7 +72,7 @@ class LayerFactory:
lastBounds = [bound for bounds in layer.bounds[-lastXframes:]
for bound in bounds]
for j, bounds in enumerate(lastBounds[::-1]):
for j, bounds in enumerate(sorted(lastBounds, reverse=True)):
if bounds is None:
break
(x2, y2, w2, h2) = bounds

Binary file not shown.

View File

@ -10,9 +10,6 @@ from Application.VideoReader import VideoReader
from Application.LayerManager import LayerManager
from Application.Classifiers import *
def main():
startTotal = time.time()
start = startTotal