Original Author: Alexis Suero (alexis.esmb@gmail.com).
Enhancements: Philipp Tandler (philipp.tandler@protonmail.ch).
This repository contains a Python script that converts thermal JPEG images captured by DJI drones into TIFF format containing a single layer with temperature values in Celsius. The converted images are saved in the "output_images" folder.
DJI Thermal SDK(not included in repository)exiftool(included in the repository, consider downloading the latest version)- Python 3.11.x or later
- The following Python libraries:
rasteriodji_thermal_sdktqdm
-
Clone the repository:
git clone https://github.com/philipptandler/thermal-image-converter-djiSDK.git cd thermal-image-converter-djiSDK -
Create a virtual environment:
- Create a new environment with Python 3.12.4 or later:
conda create --name thermConv python=3.12.4
-
Install the required Python libraries:
- Install
dji_thermal_sdkpackage:
pip install dji_thermal_sdk
- Install
rasteriopackage:
pip install rasterio
- Install
tqdmpackage:
pip install tqdm
- Install
-
Make sure ExifTool is available to your computer:
- You can download
exiftoolfrom here (recommended) or use the zipped version intools\exiftool-13.40_64as fallback. After download or extraction, it should look like this:
exiftool-version_64/ ├── exiftool_files/ ├── exiftool.exe (you might have to remane it from exiftool(-k).exe to exiftool.exe) └── README.txt-
You can place
exiftooleither in a general location of your computer (recommended) or in the root directory of the repository:-
To run exiftool from a general location, place place the
exiftoolfolder in a location such asC:\Users\username\exiftool-version_64or (if you have admin permissions) in your program filesC:\Program Files\exiftool-version_64. Make sure to add theexiftoolfolder in your path variables (Windows Key -> Edit environment variables -> Path -> Edit, where you add the location, e.g.%USERPROFILE%\exiftool-version_64orC:\Program Files\exiftool-version_64). -
Alternatively, you can place the
exiftool_files/folder and theexiftool.exedirectly in the root directory of the repository. Be aware that this will add roughly 40 MB storage space to your repository. You can avoid this by adjusting the.gitignorefile to excludeexiftool_files/*andexiftool.exe*.
-
-
To test the installation, run from the project root (or anywhere really)
exiftool+Enter, which should display the documentation ofexiftool. Pressqto exit. -
To see where the exiftool is located, use:
where exiftool
- You can download
-
Download
DJI Thermal SDKand place its files indji_thermal_sdkfolder:-
You can download
DJI Thermal SDKfrom here. -
dji_thermal_sdkfolder should look like:dji_thermal_sdk/ ├── dataset/ ├── doc/ ├── sample/ ├── tsdk-core/ ├── utility/ ├── History.txt ├── License.txt └── Readme.mdPlace it in the root directory.
-
-
Check your setup
- Your root directory should look similar to this:
thermal-image-converter-djiSDK/ ├── .git/ ├── dji_thermal_sdk/ ├── (exiftool_files/, if you decide to work with local exiftool) ├── tools/ ├── .gitignore ├── dji_thermal_converter.py ├── (exiftool.exe, if you decide to work with local exiftool) ├── LICENSE ├── Readme.md ├── sort_images.py └── wrapper.py - To test the exiftool installation, run from the project root:
exiftool
- This should display the documentation of
exiftool. Pressqto exit.
- Your root directory should look similar to this:
This is the most basic workflow:
-
Prepare your input images:
- Place all thermal JPEG images (with
_T.JPGsuffix) in theinput_imagesfolder, create if required.
- Place all thermal JPEG images (with
-
Run the script:
python dji_thermal_converter.py
-
Find your converted images:
- The converted TIFF images will be saved in the
output_imagesfolder.
- The converted TIFF images will be saved in the
You can also specify the input directory:
-
Run the script:
python dji_thermal_converter.py your/directory/with/JPEGfiles
-
Find your converted images:
- The converted TIFF images will be saved in the
your/directory/with/JPEGfiles/output_imagesfolder.
- The converted TIFF images will be saved in the
As well as specify an input and output directory:
-
Run the script:
python dji_thermal_converter.py your/directory/with/JPEGfiles your/directory/for/the/outputfiles
-
Find your converted images:
- The converted TIFF images will be saved in the
your/directory/for/the/outputfilesfolder.
- The converted TIFF images will be saved in the
If you have many directories to process, you can use the wrapper.py script and add the directories you want to batch process:
-
Run the script:
python wrapper.py "some/particular/input/directory/with/JPEGfiles" "some/other/input/directory/with/JPEGfiles" "some/third/input/directory/with/JPEGfiles"
-
Find your converted images:
- The converted TIFF images will be saved in the
outputfilesfolder for each speciefied directory.
- The converted TIFF images will be saved in the
The script sort_images.py is useful when you have a folder with hundreds of both Thermal JPG files (*_T.JPG) and Wide angle RGB files (*_W.JPG) and you want to sort them in separate folders:
-
Run the script:
python sort_images.py path\to\folder\you\want\to\sort
Here's an example of how to use the script:
-
Place your thermal JPEG images in the
input_imagesfolder:input_images/ ├── image1_T.JPG ├── image2_T.JPG └── image3_T.JPG -
Run the script:
python dji_thermal_converter.py
-
Check the
output_imagesfolder for the converted TIFF images:output_images/ ├── image1.tif ├── image2.tif └── image3.tif
This project is licensed under the GNU General Public License v3.0.