From your test output:
- Dark (50000ns, gain=1): Failed to create capture session - exposure too low
- Normal (200000ns, gain=2): 4.1M file - captured successfully
- Bright (5000000ns, gain=8): 1.8M file - similar brightness to normal
- Very Bright (30000000ns, gain=10): 1.2M file - noticeably brighter
GAIN has more effect on brightness than EXPOSURE for this camera setup.
The camera appears to have auto-exposure active that overrides manual exposure settings, but gain settings are being respected, especially at higher values (8-10).
Since gain works reliably, we should:
- Primary control: Use GAIN (1.0 to 10.625) as the main brightness control
- Secondary control: Keep exposure at a fixed reasonable value (e.g., 200000ns)
- User guidance: Update UI to indicate "Use Gain to control brightness"
Keep both controls but:
- Set exposure range to where it has effect: 5000000 to 30000000 (5ms to 30ms)
- Emphasize gain as the primary control
- Note that low exposure values don't work well
Run the new test to see if we can fully disable auto-exposure:
chmod +x test_ae_lock.sh
./test_ae_lock.shThis tests:
aelock=true- Lock auto-exposureawblock=true- Lock auto white balanceexposurecompensation=0- Disable exposure compensation- Gain-only control (no exposure parameter)
- Save button is enabled for Nvidia CSI cameras
- Config file is updated when settings change
- Service reads config changes
- Gain settings are applied and affect brightness
- Exposure settings are applied but auto-exposure overrides them
- Low exposure values (< 100000ns) cause capture failures
- Mid-range exposure changes (100000 to 5000000) have minimal visible effect
- Gain: 1.0 to 2.0
- Exposure: 200000 (fixed)
- Gain: 2.0 to 5.0
- Exposure: 200000 to 5000000
- Gain: 5.0 to 10.625
- Exposure: 5000000 to 30000000
-
Run the AE lock test:
chmod +x test_ae_lock.sh ./test_ae_lock.sh
-
Check if gain-only control works better: Compare
test_gain_only_low.jpgvstest_gain_only_high.jpg -
If gain-only works well, consider:
- Simplifying UI to focus on gain
- Setting exposure to a fixed optimal value
- Or hiding exposure in "Advanced Settings"
-
Deploy current code - It will work, with gain being the primary brightness control
If manual camera control remains unreliable, we could:
- Capture at fixed camera settings
- Apply brightness/contrast adjustment in software (OpenCV)
- This gives consistent, predictable results
- Trade-off: Slightly more CPU usage, but more reliable
- Changed from 50000 to 100000 (since 50000 fails)
- Updated UI constraint text to note that gain has more effect
- Gain: 1.0 to 10.625 (works reliably)
- Exposure: 100000 to 30000000 (applied but may be overridden by AE)
nvarguscamerasrc sensor_id=0 \
aeantibanding=0 \
wbmode=0 \
exposuretimerange="$EXPOSURE $EXPOSURE" \
gainrange="$GAIN $GAIN"Add to user guide:
Brightness Control for Nvidia CSI Camera
The Nvidia CSI camera uses two parameters to control brightness:
- Gain (1.0 to 10.625): Primary brightness control - has the most visible effect
- Exposure (0.1ms to 30ms): Secondary control - may have limited effect due to auto-exposure
For best results:
- Adjust Gain first to get the desired brightness
- Fine-tune with Exposure if needed
- Higher values = brighter images