configureFutronic method
void
configureFutronic(
{ - int? maxTemplates,
- double far = 0.05,
})
Implementation
void configureFutronic({int? maxTemplates, double far = 0.05}) {
int configureFrameSource = _ftrSetParam(FtrParam.cbFrameSource, 1);
int configureMaxTemplates =
_ftrSetParam(FtrParam.maxModels, maxTemplates ?? 5);
if (configureFrameSource != 0) {
throw FutronicError(FutronicUtils.getErrorMessage(configureFrameSource));
}
if (configureMaxTemplates != 0) {
throw FutronicError(FutronicUtils.getErrorMessage(configureMaxTemplates));
}
Pointer<Int64> frameWidthPTR = calloc<Int64>();
Pointer<Int64> frameHeightPTR = calloc<Int64>();
Pointer<Int64> frameSizePTR = calloc<Int64>();
Pointer<Int64> maxTemplateSize = calloc<Int64>();
int getWidth = _getParam(FtrParam.imageWidth.value, frameWidthPTR);
int getHeight = _getParam(FtrParam.imageHeight.value, frameHeightPTR);
int getSize = _getParam(FtrParam.imageSize.value, frameSizePTR);
double multiplier = pow(2, 31) - 1;
int currFar = (far * multiplier).ceilToDouble().toInt();
_setParam(FtrParam.maxFarRequested.value, currFar);
_imageSize = frameSizePTR.value;
if (getWidth != 0) {
throw FutronicError(FutronicUtils.getErrorMessage(getWidth));
}
if (getHeight != 0) {
throw FutronicError(FutronicUtils.getErrorMessage(getHeight));
}
if (getSize != 0) {
throw FutronicError(FutronicUtils.getErrorMessage(getSize));
}
int setMaxModels = _ftrSetParam(FtrParam.maxModels, 5);
if (setMaxModels != 0) {
throw FutronicError(FutronicUtils.getErrorMessage(setMaxModels));
}
_getParam(FtrParam.maxTemplateSize.value, maxTemplateSize);
_ftrDataBuffer.ref.pData =
calloc<Uint8>(sizeOf<Int64>() * maxTemplateSize.value);
_setCallbackFunc(FtrParam.cbControl.value, Pointer.fromFunction(callback));
}