BlurItem
Blur a particular item in the image.
This module provides an pipeline element to blur a particular item in the image. There are arguments to specify the item to blur and the shape of the blur. Note that bluring the item will only apply to images extracted by JPEG.
<e-shape>
supported:
circle
box
Examples:
REST API:
WIP
Configuration File:
short-from : blur-item:<s-item>:<e-shape>
Blur all faces (circle):
source:
- address: https://youtu.be/jY86pXeTOLw
- type: youtube
pipeline:
- yolov5s-face:a:0.3:0.3
- blur-item:face:circle
- image-encoder
BlurItem Objects
class BlurItem(Element)
Blur a particular item in the image.
Attributes:
name
str - The name of the element.item
str - The item to blur.shape
str - The shape of the blur.
Examples:
Face (circle):
ele = BlurItem("face", "circle")
Person (box):
ele = BlurItem("person", "box")
extract_params
@staticmethod
def extract_params(model_params)
Extract the parameters for this element.
Arguments:
model_params
List[str] - The parameters for this element.
Returns:
item
str - The item to blur.shape
str - The shape of the blur.
Raises:
ExtractParameterException
- If the parameters are not valid.
Examples:
Face (circle):
params = BlurItem.extract_params(["face", "circle"])
ele = BlurItem(*params)
Person (box):
params = BlurItem.extract_params(["person", "box"])
ele = BlurItem(*params)
process
def process(meta)
Blur the item in the image with a particular shape.
This is the main function for this element. It will take the image and blur the item in the image with a particular shape.
Arguments:
meta
dict - The metadata to process.
Returns:
meta
dict - The processed metadata.
Examples:
params = BlurItem.extract_params(["person", "box"])
ele = BlurItem(*params)
meta = ele.process(meta)