Removed debug and adjusted EV spread.

This commit is contained in:
BKLronin 2023-03-24 16:51:40 +01:00
parent 810297ac46
commit 5863820b69

View File

@ -11,6 +11,8 @@ config = picam2.create_still_configuration()
picam2.configure(config) picam2.configure(config)
picam2.set_controls({"AwbEnable": 1}) picam2.set_controls({"AwbEnable": 1})
picam2.set_controls({"AeEnable": 1}) picam2.set_controls({"AeEnable": 1})
picam2.set_controls({"AfMode": controls.AfModeEnum.Manual })
picam2.set_controls({"LensPosition": 0.0 })
#picam2.set_controls({"AnalogueGain": 1.0}) #picam2.set_controls({"AnalogueGain": 1.0})
picam2.start() picam2.start()
time.sleep(1) time.sleep(1)
@ -20,44 +22,42 @@ start = picam2.capture_metadata()
exposure_start = start["ExposureTime"] exposure_start = start["ExposureTime"]
gain_start = start["AnalogueGain"] gain_start = start["AnalogueGain"]
ev1 = picam2.capture_array()
print("Picture one is done")
picam2.set_controls({"AeEnable": 0}) picam2.set_controls({"AeEnable": 0})
confirmed = picam2.capture_metadata()["AeLocked"] confirmed = picam2.capture_metadata()["AeLocked"]
while confirmed != True: while confirmed != True:
confimed = picam2.capture_metadata()["AeLocked"] confimed = picam2.capture_metadata()["AeLocked"]
time.sleep(.1) time.sleep(.1)
picam2.set_controls({"AnalogueGain": gain_start}) picam2.set_controls({"AnalogueGain": gain_start})
confirmed = picam2.capture_metadata()["AnalogueGain"] confirmed = picam2.capture_metadata()["AnalogueGain"]
while confirmed != gain_start in range(gain_start -0.1, gain_start +0.1): while confirmed != gain_start in range(gain_start -0.1, gain_start +0.1):
confimed = picam2.capture_metadata()["AnalogueGain"] confimed = picam2.capture_metadata()["AnalogueGain"]
time.sleep(.1) time.sleep(.1)
ev_low = int(exposure_start / 4) ev1 = picam2.capture_array()
#print("Picture one is done")
ev_low = int(exposure_start / 2)
picam2.set_controls({"ExposureTime": ev_low}) picam2.set_controls({"ExposureTime": ev_low})
confirmed = picam2.capture_metadata()["ExposureTime"] confirmed = picam2.capture_metadata()["ExposureTime"]
while confirmed not in range(ev_low -100, ev_low + 100 ): while confirmed not in range(ev_low -100, ev_low + 100 ):
confirmed = picam2.capture_metadata()["ExposureTime"] confirmed = picam2.capture_metadata()["ExposureTime"]
time.sleep(.01) time.sleep(.01)
print("2",confirmed) #print("2",confirmed)
ev2 = picam2.capture_array() ev2 = picam2.capture_array()
print("Picture 2 is captured to array") #print("Picture 2 is captured to array")
ev_high = int(exposure_start * 4) ev_high = int(exposure_start * 2)
picam2.set_controls({"ExposureTime": ev_high}) picam2.set_controls({"ExposureTime": ev_high})
confirmed = picam2.capture_metadata()["ExposureTime"] confirmed = picam2.capture_metadata()["ExposureTime"]
while confirmed not in range(ev_high -100, ev_high + 100 ): while confirmed not in range(ev_high -100, ev_high + 100 ):
confirmed = picam2.capture_metadata()["ExposureTime"] confirmed = picam2.capture_metadata()["ExposureTime"]
time.sleep(.01) time.sleep(.01)
print("3",confirmed) #print("3",confirmed)
ev3 = picam2.capture_array() ev3 = picam2.capture_array()
print("Picture 3 is captured") #print("Picture 3 is captured")
print("Saving..") print("Saving..")
image = Image.fromarray(ev1) image = Image.fromarray(ev1)