Add exposure compensation options

snh/testing-container-images
Mark Jessop 2024-11-10 10:23:50 +10:30
rodzic ad4c939929
commit 7c99c0d380
3 zmienionych plików z 13 dodań i 3 usunięć

Wyświetl plik

@ -33,6 +33,11 @@ TX_IMAGE_SCALING=0.5
# Allowed Values: Auto, Daylight, Cloudy, Incandescent, Tungesten, Fluorescent, Indoor
WHITEBALANCE=Auto
# Exposure compensation
# Allowed values: -8.0 to 8.0
# You may wish to adjust this to bump up the exposure a little.
EXPOSURE=0.0
# Refer near the end of this file for image flipping and overlay options
# Baud Rate
@ -122,5 +127,5 @@ python3 tx_picamera2_gps.py \
--gps $GPSPORT \
--resize $TX_IMAGE_SCALING \
--whitebalance $WHITEBALANCE \
--vflip --hflip \
--exposure $EXPOSURE \
$MYCALL

Wyświetl plik

@ -55,6 +55,7 @@ class WenetPiCamera2(object):
lens_position = -1,
af_window = None,
af_offset = 0,
exposure_value = 0.0,
temp_filename_prefix = 'picam_temp',
debug_ptr = None,
init_retries = 10
@ -106,6 +107,7 @@ class WenetPiCamera2(object):
self.lens_position = lens_position
self.af_window = af_window
self.af_offset = af_offset
self.exposure_value = exposure_value
self.af_window_rectangle = None # Calculated during init
self.autofocus_mode = False
@ -201,7 +203,8 @@ class WenetPiCamera2(object):
self.cam.set_controls(
{'AwbMode': self.whitebalance,
'AeMeteringMode': controls.AeMeteringModeEnum.Matrix
'AeMeteringMode': controls.AeMeteringModeEnum.Matrix,
'ExposureValue': self.exposure_value
#'NoiseReductionMode': controls.draft.NoiseReductionModeEnum.Off
}
)
@ -267,7 +270,8 @@ class WenetPiCamera2(object):
# TODO - Maybe expose some of these settings?
self.cam.set_controls(
{'AwbMode': self.whitebalance,
'AeMeteringMode': controls.AeMeteringModeEnum.Matrix
'AeMeteringMode': controls.AeMeteringModeEnum.Matrix,
'ExposureValue': self.exposure_value
#'NoiseReductionMode': controls.draft.NoiseReductionModeEnum.Off
}
)

Wyświetl plik

@ -35,6 +35,7 @@ parser.add_argument("--whitebalance", type=str, default='daylight', help="White
parser.add_argument("--lensposition", type=float, default=-1.0, help="For PiCam v3, set the lens position. Default: -1 = Continuous Autofocus")
parser.add_argument("--afwindow", type=str, default=None, help="For PiCam v3 Autofocus mode, set the AutoFocus window, x,y,w,h , in fractions of frame size. (Default: None = default)")
parser.add_argument("--afoffset", type=float, default=0.0, help="For PiCam v3 Autofocus mode, offset the lens by this many dioptres (Default: 0 = No offset)")
parser.add_argument("--exposure", type=float, default=0.0, help="Exposure compensation. -8.0 to 8.0. Sets the ExposureValue control. (Default: 0.0)")
parser.add_argument("-v", "--verbose", action='store_true', default=False, help="Show additional debug info.")
args = parser.parse_args()