kopia lustrzana https://github.com/projecthorus/wenet
Add full-range autofocus option
rodzic
63f9907f92
commit
012dc0187f
|
@ -118,11 +118,12 @@ sleep 10
|
|||
# Set a fixed lens offset for the PiCam v3, in dioptres. May help with autofocus in cold temperatures.
|
||||
# The PiCam v3 can be offset by a maximum of -3 dioptres before hitting a hard-stop
|
||||
# Set this to -99.0 to set the PiCam v3 to use the entire lens travel range.
|
||||
# The modified focus mapping will be printed out on startup.
|
||||
# e.g. to offset by 1 dioptre:
|
||||
# --afoffset -1.0 \
|
||||
#
|
||||
# Use the Focus Figure-of-merit metadata to select the transmitted image, instead of selecting on file size
|
||||
# Only works for lenses with autofocus (PiCam v3)
|
||||
# Only useful for lenses with autofocus (PiCam v3)
|
||||
# --use_focus_fom
|
||||
|
||||
python3 tx_picamera2_gps.py \
|
||||
|
|
|
@ -152,11 +152,21 @@ class WenetPiCamera2(object):
|
|||
if self.af_offset != 0:
|
||||
tuning = Picamera2.load_tuning_file("imx708.json")
|
||||
map = Picamera2.find_tuning_algo(tuning, "rpi.af")["map"]
|
||||
#print(map)
|
||||
offset_hw = self.af_offset * (map[3]-map[1])/(map[2]-map[0])
|
||||
for i in range(1, len(map), 2):
|
||||
map[i] += offset_hw
|
||||
#print(Picamera2.find_tuning_algo(tuning, "rpi.af")["map"])
|
||||
self.debug_message(f"Default Focus Mapping: {map}")
|
||||
|
||||
if self.af_offset == -99:
|
||||
# Custom map for testing the full extents of the lens range.
|
||||
map[0] = 0.0
|
||||
map[1] = 0.0
|
||||
map[2] = 15.0
|
||||
map[3] = 1024.0
|
||||
else:
|
||||
# Otherwise, apply an offset
|
||||
offset_hw = self.af_offset * (map[3]-map[1])/(map[2]-map[0])
|
||||
for i in range(1, len(map), 2):
|
||||
map[i] += offset_hw
|
||||
|
||||
self.debug_message(f"Modified Focus Mapping: {Picamera2.find_tuning_algo(tuning, 'rpi.af')['map']}")
|
||||
|
||||
self.cam = Picamera2(0, tuning=tuning)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue