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.
Hello, thanks for all the resources you are doing an awesome job.
I have a question please. Here is the situation, I am connecting the Flir Lepton through GPIO pins. I can take pictures with the camera using your code. All I need is to get video output from the flir so that I can do my Opencv with python analysis. I need something like this:
cap = cv2.VideoCapture() I tested with all integers none of them works. Please, help I am stuck.
Thanks a lot