Jump to content

AI Based Object Redaction/Examples/Library Examples: Difference between revisions

Line 82: Line 82:
== Redaction Algorithm ==
== Redaction Algorithm ==


The Object Redaction library its compound by the stages: convert, detect, track (optional) and redact. This stages can be perform in a single step using the apply method or in a step-by-step process.
The Object Redaction library comprises the following stages: detect, track (optional), and redact. These stages can be performed in a single step using the '''apply''' method or in a step-by-step process.


The Object Redaction library use a vector of a structure Rectangle to save the detected and tracked faces coordinates in a images for the redaction algorithm to modify the output buffer. This vector must be initialize before performing the detect stage.
The Object Redaction library uses a vector of a structure Rectangle to save the detected and tracked faces coordinates in an image for the redaction algorithm to modify the output buffer. This vector must be initialized before performing the detect stage.


<syntaxhighlight lang=cpp>
<syntaxhighlight lang=cpp>
Line 92: Line 92:
=== Step-by-step ===
=== Step-by-step ===


* First step is to preprocess the input image to be accepted by the AI model.
* The first step is to detect the faces in the input image and save the coordinates in the vector of rectangles.


<syntaxhighlight lang=cpp>
<syntaxhighlight lang=cpp>
algorithm->convert(input_gpu, input_convert);
algorithm->detect(model, input_gpu, &faces);
</syntaxhighlight>
</syntaxhighlight>


* Second step is to detect the faces in the preprocess image and save the coordinates in the vector of rectangles.
'''NOTE:''' Since the detection model usually works with a fixed resolution and format, an internal conversion to the resolution and format expected by the model. This is transparent so the user doesn't have to worry about any conversion, however, a convert method is also available in case the user wants to do this conversion before calling the detect method.


<syntaxhighlight lang=cpp>
<syntaxhighlight lang=cpp>
algorithm->detect(model, input_convert, &faces);
algorithm->convert(input_gpu, input_convert);
</syntaxhighlight>
</syntaxhighlight>
* The second and optional step would be to perform tracking (this is a work in progress)


* The final step is to redact the detected faces in the given coordinates.
* The final step is to redact the detected faces in the given coordinates.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.