20 lines
507 B
Python
20 lines
507 B
Python
import numpy as np
|
|
|
|
from obfuscation.base_obfuscation_technique import ObfuscationTechnique
|
|
|
|
|
|
class Blackening(ObfuscationTechnique):
|
|
"""
|
|
Simply fill the face ROI with a constant colour (black).
|
|
"""
|
|
def __init__(self):
|
|
# Normalise to 3-tuple BGR
|
|
self.colour=(0, 0, 0)
|
|
|
|
def obfuscate(self, face_roi_img_bgr: np.ndarray) -> np.ndarray:
|
|
obf = np.empty_like(face_roi_img_bgr)
|
|
obf[:] = self.colour
|
|
return obf
|
|
|
|
def name(self):
|
|
return "Black" |