Video-Summary/Application/Importer.py

25 lines
667 B
Python
Raw Normal View History

2020-10-16 08:36:52 +00:00
import pickle
2022-09-11 09:25:36 +00:00
import os.path
2022-01-09 19:25:44 +00:00
2020-10-16 08:36:52 +00:00
class Importer:
def __init__(self, config):
self.path = config["importPath"]
2022-09-11 09:25:36 +00:00
def import_raw_data(self):
2020-11-08 15:28:47 +00:00
print("Loading previous results")
2022-09-11 09:25:36 +00:00
layers = self.load_if_present(self.path + "_layers")
contours = self.load_if_present(self.path + "_contours")
masks = self.load_if_present(self.path + "_masks")
return layers, contours, masks
def load_if_present(self, path):
var = None
if os.path.isfile(path):
with open(path, "rb") as file:
var = pickle.load(file)
else:
print(path, "file not found")
return var