Files
obfuscation_platform/project/obfuscation_techniques/obfuscation_engine.py
T
2025-05-09 09:48:00 +02:00

31 lines
1.3 KiB
Python

import os
from obfuscation_techniques.obfuscation_technique import ObfuscationTechnique
def get_image_and_meta_file_paths(sub_dataset_folder):
#TODO: hier die methode schreiben
image_meta_paths = [(os.path.join(sub_dataset_folder, image_path), os.path.join(sub_dataset_folders, (image_path.split(".")[0] + ".json"))) for image_path in os.listdir(sub_dataset_folder)]
class ObfuscationEngine:
def __init__(self, path_to_filtered_dataset):
self.obfuscation_techniques = []
self.path_to_filtered_dataset = path_to_filtered_dataset
def add_obfuscation_technique(self, obfuscation_technique: ObfuscationTechnique):
self.obfuscation_techniques.append(obfuscation_technique)
def obfuscate(self, output_path, draw_images=True):
sub_dataset_folders = [os.path.join(self.path_to_filtered_dataset, sub_dataset_folder) for sub_dataset_folder in os.listdir(self.path_to_filtered_dataset)]
for sub_dataset_folder in sub_dataset_folders:
image_meta_pairs = get_image_and_meta_file_paths(sub_dataset_folder)
for technique in self.obfuscation_techniques:
#TODO: For each technique and For each subdataset and for each image, get the mata data and apply the obfuscation technique to the face
raise NotImplementedError