analyzeLightCondition static method
Analyzes ambient light condition from grayscale frame luminance.
Returns a condition string: 'too_low', 'low', 'normal', 'bright', or 'overexposed'.
Implementation
static String analyzeLightCondition(Uint8List grayBytes) {
if (grayBytes.isEmpty) return 'too_low';
double totalLum = 0;
for (int i = 0; i < grayBytes.length; i++) {
totalLum += grayBytes[i];
}
final avgLum = totalLum / grayBytes.length / 255.0;
if (avgLum < 0.08) return 'too_low';
if (avgLum < 0.20) return 'low';
if (avgLum < 0.70) return 'normal';
if (avgLum < 0.90) return 'bright';
return 'overexposed';
}