Processing Block
Requirements
- Connected Flutter plugin.
Create Processing Blocks
The ProcessingBlock
object is used to detect faces and perform image quality assessment.
Block Type
Modification
Procedure for using the object ProcessingBlock
:
- Create an object
ProcessingBlock
ProcessingBlock processingBlock = service.createProcessingBlock({
"unit_type": "<Block Type>",
"modification": "<Modification>",
"@sdk_path": "<path to Face SDK>"
});
- Get an image and convert it to RGB format
- Create a
Context
object with the following data
final Context data = service.createContext({
"objects": [],
"image": {
"blob": <byte array with image in RGB format>,
"dtype": "uint8_t",
"format": "NDARRAY",
"shape": [<image height in pixels>, <image width in pixels>, 3]
}
});
- Call the
process
method ofProcessingBlock
Context result = processingBlock.process(data);
- Output data is in
result["objects"]
Example of data usageGetting the coordinates of the top left and bottom right points of the bbox
for (int i = 0; i < objects.len(); i++) {
Context object = objects[i];
Context bbox = object["bbox"];
// Top left point of bbox
double x1 = bbox[0].get_value() * imageWidth;
double y1 = bbox[1].get_value() * imageHeight;
// Bottom right point of bbox
double x2 = bbox[2].get_value() * imageWidth;
double y2 = bbox[3].get_value() * imageHeight;
}
1. Creating ProcessingBlock FaceDetector object
FaceDetector
is used to detect faces in an image
ProcessingBlock faceDetector = service.createProcessingBlock({
"unit_type": "FACE_DETECTOR",
"modification": "uld",
"@sdk_path": "<path to Face SDK>",
"min_size": 50
});
2. Creating a ProcessingBlock FaceFitter object
FaceFitter
is used to find key points of faces in an image
Some ProcessingBlocks
require the FaceDetector + FaceFitter bundle to work
ProcessingBlock fitter = service.createProcessingBlock({
"unit_type": "FACE_FITTER",
"modification": "tddfa_faster",
"@sdk_path": "<path to Face SDK>"
});
3. Creating ProcessingBlock QualityAssessment object
QualityAssessment
is used to assess the quality of an image using multiple parameters
It requires FaceFitter
to work
ProcessingBlock qualityAssessment = service.createProcessingBlock({
"unit_type": "QUALITY_ASSESSMENT_ESTIMATOR",
"modification": "assessment",
"config_name": "quality_assessment.xml",
"@sdk_path": "<path to Face SDK>"
});
4. Creating ProcessingBlock QualityEstimator object
The QualityEstimator
is used to evaluate image quality
ProcessingBlock qualityEstimator = service.createProcessingBlock({
"unit_type": "QUALITY_ASSESSMENT_ESTIMATOR",
"modification": "estimation",
"@sdk_path": "<path to Face SDK>"
});