Source code for pylepton and pylepton_capture is available on GitHub and on pypi. To roll your own capture program, grabbing frames is rather straightforward:
import numpy as np
import cv2
from pylepton import Lepton
with Lepton() as l:
a,_ = l.capture()
cv2.normalize(a, a, 0, 65535, cv2.NORM_MINMAX) # extend contrast
np.right_shift(a, 8, a) # fit data into 8 bits
cv2.imwrite("output.jpg", np.uint8(a)) # write it!Note that the image data returned from capture() is 14-bit and non-normalized (it's raw sensor data). You probably want to contrast extend this as demonstrated above, since the signal bandwidth is typically narrow over that range. Subsequently fitting this data into 8 bits is not strictly necessary to save the image with OpenCV but just shown here for demonstration purposes.
The capture() function includes a tuple that includes a pixel sum to be used for identifying unique frames (frames can update at ~27 Hz, but only unique ones are returned at ~9 Hz). Pylepton will be extended in the future to return a real frame ID here once support for frame telemetry is added.
Kurt Kiefer
Les Hall
Dan Macnish
aaronbehman
Zachary Murtishi
Earlier this year I was working on a Pi5-based multispectral camera to combine visible, short IR and UV. I found some useful code online (see https://github.com/khufkens/align_images along with my little bash script at https://gtoal.com/OpenSCAD/prism_holder/align-images ) to align images from different cameras and like you am now looking into overlaying long IR with an old FLIR camera for Android which it turns out can now be streamed live over usb to the Pi5 using https://github.com/joshuapinter/flir (though that wasn't the case many years ago when I bought my first FLIR add-on camera!)