toBinaryMask method
Create a simple binary mask from confidence values.
Threshold: pixels with confidence > threshold become 255 (person)
Implementation
Uint8List toBinaryMask({double threshold = 0.5}) {
final mask = Uint8List(length);
final thresholdByte = (threshold * 255).round();
for (int i = 0; i < length; i++) {
mask[i] = this[i] > thresholdByte ? 255 : 0;
}
return mask;
}