Only drop frames when setting min exposure time

This commit is contained in:
jaknapper 2026-03-16 15:01:10 +00:00
parent 3b84c266b4
commit a11d46777f

View file

@ -241,6 +241,9 @@ def _set_minimum_exposure(camera: Picamera2, sensor_info: SensorInfo) -> None:
# to the minimum possible, which is ~8us for PiCamera v2 # to the minimum possible, which is ~8us for PiCamera v2
camera.set_controls({"AeEnable": False, "AnalogueGain": 1, "ExposureTime": 1}) camera.set_controls({"AeEnable": False, "AnalogueGain": 1, "ExposureTime": 1})
time.sleep(sensor_info.long_pause) time.sleep(sensor_info.long_pause)
# Flush stale frames
for _ in range(2):
r = camera.capture_metadata()
def _test_exposure_settings(camera: Picamera2, percentile: float) -> _ExposureTest: def _test_exposure_settings(camera: Picamera2, percentile: float) -> _ExposureTest:
@ -253,11 +256,6 @@ def _test_exposure_settings(camera: Picamera2, percentile: float) -> _ExposureTe
percentile (which will be compared to the target), as well as percentile (which will be compared to the target), as well as
the camera's shutter and gain values. the camera's shutter and gain values.
""" """
# Flush stale frames
for _ in range(2):
r = camera.capture_request()
r.release()
# A single request, to ensure metadata matches frame # A single request, to ensure metadata matches frame
request = camera.capture_request() request = camera.capture_request()
try: try: