Update script to control gain and exposure

This commit is contained in:
dchvs 2021-04-05 00:22:44 -06:00
parent 71bc9b31dd
commit 7d7bad60d3
2 changed files with 4 additions and 20 deletions

View File

@ -102,22 +102,6 @@ The AE controls realays in the feedback provided by the Driver's camera sensor t
and the custom DTSIs with the sensor parameters definitions.
As the AE has interdependency with the digital gain. This gain it's and operation on the Driver, and follows this setup:
```bash
/*
* Digital gain equation:
*
* RANGE: 1x, 7.97x
* STEPS: 1/32
*
* SCALE FACTOR = 3
*
* min_gain_val = 102
* max_gain_val = 160
* gain_factor = 3
*
* gain accepts mapping to range 32 - 53
*/
```
MT9M021 sensor datasheet:
* <a href="https://files.niemo.de/aptina_pdfs/MT9M021-M031_Developer_Guide.pdf">MT9M021 Developer Guide</a>

View File

@ -5,7 +5,7 @@ initial_exposure_time=0
while true; do sleep 0.5;
# Read center camera controls
echo `v4l2-ctl -d /dev/video1 --get-ctrl=gain --get-ctrl=exposure` > controls
echo `v4l2-ctl -d /dev/video0 --get-ctrl=gain --get-ctrl=exposure` > controls
awk '{print $2}' controls > get_control
actual_gain=`cat get_control`
awk '{print $4}' controls > get_control
@ -18,10 +18,10 @@ while true; do sleep 0.5;
rm controls get_control
# Set R/L camera controls manually
if [ $actual_gain -ne $initial_gain ]; then
v4l2-ctl -d /dev/video0 --set-ctrl=gain=$actual_gain
v4l2-ctl -d /dev/video1 --set-ctrl=gain=$actual_gain
fi
if [ $actual_exposure_time -ne $initial_exposure_time ]; then
v4l2-ctl -d /dev/video0 --set-ctrl=exposure=$actual_exposure_time
v4l2-ctl -d /dev/video1 --set-ctrl=exposure=$actual_exposure_time
fi
# Define new initial value
initial_gain=$actual_gain