Video-Summary/main.py

37 lines
1.1 KiB
Python
Raw Normal View History

2020-09-22 18:25:06 +00:00
import os
import time
from ContourExctractor import ContourExtractor
from Exporter import Exporter
2020-09-24 20:48:04 +00:00
from LayerFactory import LayerFactory
2020-10-03 22:27:36 +00:00
import cv2
2020-09-22 18:25:06 +00:00
#TODO
# finden von relevanten Stellen anhand von zu findenen metriken für vergleichsbilder
2020-09-20 20:01:54 +00:00
def demo():
2020-09-20 20:01:54 +00:00
print("startup")
2020-10-03 22:27:36 +00:00
resizeWidth = 512
2020-10-04 12:51:16 +00:00
maxLayerLength = 1*60*30
2020-09-22 18:25:06 +00:00
start = time.time()
2020-09-24 13:47:49 +00:00
2020-10-05 20:24:38 +00:00
footagePath = os.path.join(os.path.dirname(__file__), "./generate test footage/3.mp4")
2020-10-03 22:27:36 +00:00
contours = ContourExtractor().extractContours(footagePath, resizeWidth)
print("Time consumed in working: ", time.time() - start)
2020-09-28 20:28:23 +00:00
layerFactory = LayerFactory(contours)
2020-10-05 20:24:38 +00:00
print("freeing Data", time.time() - start)
2020-10-03 22:27:36 +00:00
layerFactory.freeData(maxLayerLength)
2020-10-05 20:24:38 +00:00
print("sort Layers")
2020-10-03 22:27:36 +00:00
layerFactory.sortLayers()
2020-10-05 20:24:38 +00:00
print("fill Layers")
2020-10-03 22:27:36 +00:00
layerFactory.fillLayers(footagePath)
underlay = cv2.VideoCapture(footagePath).read()[1]
2020-10-05 20:24:38 +00:00
Exporter().exportOverlayed(underlay, layerFactory.layers, os.path.join(os.path.dirname(__file__), "./short.mp4"), resizeWidth)
2020-10-03 22:27:36 +00:00
print("Total time: ", time.time() - start)
2020-10-05 20:24:38 +00:00
def init():
print("not needed yet")
2020-09-20 20:01:54 +00:00
if __name__ == "__main__":
demo()
2020-09-22 18:25:06 +00:00