30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
import os
|
|
|
|
import numpy as np
|
|
import cv2
|
|
from obfuscation.base_obfuscation_technique import ObfuscationTechnique
|
|
import requests
|
|
|
|
|
|
class Epic(ObfuscationTechnique):
|
|
"""
|
|
Replace face with generated face
|
|
"""
|
|
def __init__(self):
|
|
self.image_processing_path = "C:/Users/bijan/Desktop/obfuscation_platform/project/models/epic/image_cache/"
|
|
resp = requests.get(f"http://127.0.0.1:8000/init", timeout=5)
|
|
resp.raise_for_status()
|
|
|
|
|
|
def obfuscate(self, face_roi_img_bgr: np.ndarray) -> np.ndarray:
|
|
cv2.imwrite(os.path.join(self.image_processing_path, "face.jpg"), face_roi_img_bgr)
|
|
resp = requests.get(f"http://127.0.0.1:8000/obfuscate", timeout=5)
|
|
resp.raise_for_status()
|
|
obfuscated_face = cv2.imread(os.path.join(self.image_processing_path, "obfuscated_face.jpg"))
|
|
exit() #TODO Entfernen
|
|
#TODO: Das bild ggf zu RGB bei face_obfuscator.py und dann wieder zurück
|
|
#TODO bei epic noch cloning, schauen wie das war
|
|
return obfuscated_face
|
|
|
|
def name(self):
|
|
return "EPIC" |