import numpy as np from obfuscation.base_obfuscation_technique import ObfuscationTechnique import random class Randoming(ObfuscationTechnique): """ Simply fill the face ROI with a random colour (random). """ def obfuscate(self, face_roi_img_bgr: np.ndarray) -> np.ndarray: obf = np.empty_like(face_roi_img_bgr) #random color generation for each pixel for i in range(face_roi_img_bgr.shape[0]): for j in range(face_roi_img_bgr.shape[1]): obf[i, j] = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) return obf def name(self): return "Random"