Video-Summary/main.py

48 lines
1.4 KiB
Python
Raw Normal View History

2020-09-22 18:25:06 +00:00
import os
import time
2020-10-18 15:36:34 +00:00
from Application.ContourExctractor import ContourExtractor
from Application.Exporter import Exporter
from Application.LayerFactory import LayerFactory
from Application.Analyzer import Analyzer
from Application.Config import Config
from Application.Importer import Importer
from Application.VideoReader import VideoReader
2020-10-23 22:14:43 +00:00
from Application.LayerManager import LayerManager
from Application.Classifiers import *
2020-09-20 20:01:54 +00:00
2020-10-31 19:36:43 +00:00
def main():
2020-09-22 18:25:06 +00:00
start = time.time()
2020-10-11 15:09:49 +00:00
config = Config()
2020-09-24 13:47:49 +00:00
2020-11-05 22:17:05 +00:00
config["inputPath"] = os.path.join(os.path.dirname(__file__), "generate test footage/Merica-1.m4v")
#config["importPath"] = os.path.join(os.path.dirname(__file__), "output/short.txt")
config["outputPath"] = os.path.join(os.path.dirname(__file__), "output/shor.mp4")
2020-10-16 08:36:52 +00:00
2020-10-18 15:36:34 +00:00
vr = VideoReader(config)
config["w"], config["h"] = vr.getWH()
2020-10-16 08:36:52 +00:00
if config["importPath"] is None:
contours = ContourExtractor(config).extractContours()
print("Time consumed extracting: ", time.time() - start)
layerFactory = LayerFactory(config)
2020-10-19 19:35:15 +00:00
2020-10-16 08:36:52 +00:00
layers = layerFactory.extractLayers(contours)
2020-10-31 19:36:43 +00:00
2020-10-16 08:36:52 +00:00
else:
layers = Importer(config).importRawData()
2020-10-31 19:36:43 +00:00
layerManager = LayerManager(config, layers)
layerManager.cleanLayers()
2020-11-05 22:17:05 +00:00
#layerManager.tagLayers()
2020-10-31 19:36:43 +00:00
layers = layerManager.layers
2020-10-16 08:36:52 +00:00
exporter = Exporter(config)
2020-10-31 19:36:43 +00:00
exporter.export(layers, raw=False)
2020-10-16 08:36:52 +00:00
2020-10-03 22:27:36 +00:00
print("Total time: ", time.time() - start)
2020-10-05 20:24:38 +00:00
2020-09-20 20:01:54 +00:00
if __name__ == "__main__":
2020-10-31 19:36:43 +00:00
main()
2020-09-22 18:25:06 +00:00