{"id":16556247,"url":"https://github.com/nathancy/flir_lepton_sensor","last_synced_at":"2026-05-28T13:04:38.838Z","repository":{"id":139600100,"uuid":"145486186","full_name":"nathancy/flir_lepton_sensor","owner":"nathancy","description":"Capture thermal images from the Flir Lepton 3 integrated with GPS coordinate mapping and CSV logging","archived":false,"fork":false,"pushed_at":"2018-09-13T02:23:06.000Z","size":48,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T22:19:41.599Z","etag":null,"topics":["lepton","pyqt4","python","thermal-camera"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nathancy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-21T00:50:42.000Z","updated_at":"2024-03-12T01:06:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b95693e-0878-4bc7-a256-58f51d99103b","html_url":"https://github.com/nathancy/flir_lepton_sensor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nathancy/flir_lepton_sensor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathancy%2Fflir_lepton_sensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathancy%2Fflir_lepton_sensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathancy%2Fflir_lepton_sensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathancy%2Fflir_lepton_sensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathancy","download_url":"https://codeload.github.com/nathancy/flir_lepton_sensor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathancy%2Fflir_lepton_sensor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33609257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lepton","pyqt4","python","thermal-camera"],"created_at":"2024-10-11T20:03:57.375Z","updated_at":"2026-05-28T13:04:38.822Z","avatar_url":"https://github.com/nathancy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flir_lepton_sensor\n\nPython module for capturing images from the Lepton over SPI (for example, on a Raspberry PI). Uses the Pylepton library for thermal image capture. Integrates GPS coordinates with corresponding thermal image and CSV logging. Contains scripts to convert CSV data into KML to be used with Google Earth image processing. Also contains GUI for accessing functions.\n\n## Installation and Dependencies\n#### Thermal Imaging\nThe thermal imaging module requires `cv2` and `numpy` modules. To install:\n```\nsudo apt-get install python-opencv python-numpy\n```\n\nNext, to install into site-packages for distribution through a distutils setup:\n```\ncd library\nsudo python setup.py install\n```\n\n#### KML generation\nRequires pyKML and lxml. To install:\n```\nsudo apt-get install libxml2-dev libxslt-dev python-dev\nsudo apt-get install python-lxml\nsudo pip install pykml\n```\n\n#### GUI  \nRequires PyQt4. To install:\n```\nsudo apt-get install python-qt4\n```\n\n#### Cron reboot scheduler\n\nTo install Raspberry Pi onboot script startup using Cron:\n```\nsudo apt-get install gnome-schedule\n```\n\n## Example Usage\n\nCapture a single frame\n\n```\nimport numpy as np\nimport cv2\nfrom pylepton.Lepton3 import Lepton3\n\nwith Lepton3() as l:\n  a,_ = l.capture()\ncv2.normalize(a, a, 0, 65535, cv2.NORM_MINMAX)  # Extend contrast\nnp.right_shift(a, 8, a)                         # Fit data into 8 bits\ncv2.imwrite(\"output.jpg\", np.uint8(a))          # Write it\n```\n\nImage data from `capture()` is 12-bit, non-normalized (raw sensor data). Here we contrast extend it since the bandwidth tends to be narrow.\n\n`capture()` returns a tuple that includes a unique frame ID, as lepton frames can update at ~27 Hz, but only unique ones are returned at ~9 Hz. Currently, this is just a simple sum, but ideally this will turn into a real frame ID from telemetry once this feature is implemented.\n\nNote also that the Lepton contructor can take as an optional argument the SPI device on which to find the Lepton. If in your system that device is `/dev/spidev0.1`, you can instantiate lepton as such:\n\n```\nwith Lepton(\"/dev/spidev0.1\") as l:\n```\n\n## Scripts\n\n### GPS.py and sensor.py\n\nThis program will constantly capture thermal images and log the current GPS coordinates in a CSV file with the corresponding location where the image was taken. These are two separate programs that run independently. Run `GPS.py` then `sensor.py` in two separate terminals. Or run `main.py` which will run the two scripts in the background.\n```\npython main.py\n```\nTo kill the two background processes, you may need to kill the individual processes. To check background processes:\n```\nps aux | grep python\nsudo kill \u003cPID\u003e\n```\n\nThe program obtains the timestamp from the GPS module so it does not require internet access to run the logger. \nImage output is placed into the `photos` directory where sessions are separated by timestamp. These two scripts are run on bootup on the Raspberry Pi using Cron.\n\nTo edit crontab:\n```\ncrontab -e\n```\n\nPlace these two lines inside to start the script on reboot or power cycle\n```\n@reboot python /home/pi/flir_lepton_sensor/scripts/GPS.py \u0026\n@reboot python /home/pi/flir_lepton_sensor/scripts/sensor.py \u0026\n```\n\n### capture.py\n\nThis program will output any image format that opencv knows about, just specify the output file format extension (e.g. `output.jpg` or `output.png`)\n\nTo capture a png file named `output.png`:\n```\npython capture.py output.png\n```\n\nTo view additional options/settings:\n```\npython capture.py --help\n```\n\nAdditional settings are:\n```\nUsage: pylepton_capture [options] output_file[.format]\n\nOptions:\n  -h, --help           show this help message and exit\n  -f, --flip-vertical  flip the output image vertically\n```\n\n### overlay.py\n\nRequires `python-picamera`, a Raspberry PI, and compatible camera.\n```\nsudo apt-get install python-picamera\n```\n\nTo get a 100% lepton overlay (note camera installation still required):\n```\npython overlay -a 255\n```\n\nTo view additional options/settings:\n```\npython overlay.py --help\n```\n\nAdditional settings are:\n```\nUsage: pylepton_overlay [options]\n\nOptions:\n  -h, --help               show this help message and exit\n  -f, --flip-vertical      flip the output images vertically\n  -a ALPHA, --alpha=ALPHA  set lepton overlay opacity\n```\n\n### KML_generator_latest.py\n\nThis script will convert CSV data into KML for usage with Google Earth image processing. Resolution/Placemark density can be set by giving the script an argument. The default resolution is create a Placement for every line in the CSV file (with each line equivalent to 1 sample a second). Ex: Resolution = 10 means one Placemark point for every 10 lines in the CSV file.\n\nTo convert CSV data into KML file:\n```\npython KML_generator_latest.py [resolution]\n```\n\nExample: To generate a Placemark every 10 seconds\n```\npython KML_generator_latest.py 10\n```\n\n### GUI_window.py\nThis script will open a GUI that has the functionality of all these other scripts. Enables image capture and KML generation.\n\n```\npython GUI_window.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathancy%2Fflir_lepton_sensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathancy%2Fflir_lepton_sensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathancy%2Fflir_lepton_sensor/lists"}