This is a fork of the now-outdated (June 2023) Python script to display the temperature details of the TopDon TC001 thermal camera and similar cameras. See my EEVGBlog post.
No commands are sent to the camera. Instead, we take the raw video feed, do some OpenCV processing, and display a nice heatmap along with relevant temperature points highlighted.
I am currently in the process of reverse engineering the commands sent to the camera through USB.
Due to updates to OpenCV, NumPy, and Python, the original script breaks on Windows. I am testing using a TS001 on Windows, so this fork is tailored majorly towards that.
I have attempted to flesh out/refactor the program and finish what Les Wright started, making it compatable with Windows systems as well as applying more polished coding practices (proper documentation, no hard-coding, strong-typing, OOP practices, etc.). It started small, but has turned into a full rewrite.
The majority of the thermal data configuration work was done by the original repo author (Les Wright) and through the help of others online like LeoDJ. If you'd like to support to Les, you can donate via this PayPal link or see his YouTube channel and his video on the TC001.
LeoDJ was responsible for reverse engineering the image format for these types of cameras (InfiRay P2 Pro). If possible, you should read the EEVBlog post/thread and check out Leo's GitHub repo.
NOTE: Seemingly there are bugs in the compiled version of OpenCV that ships with the Pi, so workarounds have been implemented.
The following features have been implemented:
- Temperature reading from device
- Average Scene Temperature.
- Center of scene temperature monitoring (crosshair).
- Floating Maximum and Minimum temperature values within the scene, with variable threshold.
- Temperature unit conversions
- Data-driven device configuration
- Pre-configured JSON files for common devices, including:
- TC001
- TS001
- Pre-configured JSON files for common devices, including:
- Data capture
- Video recording is implemented (saved as AVI in the working directory).
- Snapshot images are implemented (saved as PNG in the working directory).
- Full set of colormaps
- False coloring of the video image. Available colormaps are listed on the right.
- Colors can also be inverted, essentially doubling the amount of colormaps!
- Post-processing options
- Scaling
- Bicubic interpolation to scale the small 256*192 image to something more presentable! Available scaling multiplier range from 1-5.
- Note: This will not auto change the window size on the Pi (OpenCV needs recompiling), however you can manually resize.
- Blur
- Contrast
- Scaling
- Fullscreen/windowed modes
- Note: going back to windowed from fullscreen does not seem to work on the Pi! OpenCV probably needs recompiling.
- Detailed logging system
- Full CLI help pages
- Additional debug features
- Reversing the image data
- A Picture-in-Picture (PiP) mode for previewing raw thermal data with image data
- Windows 11 Pro
- Raspbian (Trixie, Bookworm)
- x64
- Raspberry Pi 5
- Raspberry Pi 4b
- TOPDON TS001
- TOPDON TC001
🛑MAJOR NOTE🛑: If you have previously installed the official drivers/application from Topdon's website, UNINSTALL THEM COMPLETELY. If you do not, your system will no longer recognize your camera as UVC-compatible.
Before running the program, please check that you have the following:
- You have connected your camera to your system properly
- You have the correct drivers installed (or just that the camera shows up as a video device)
- You have Python in your
PATH
If that is in order, the following commands can be used to initialize your environment for multiple platforms:
Linux:
cd $REPO_ROOT
python -m venv .venv
source ./.venv/bin/activateWindows (CMD):
cd %REPO_ROOT%
python -m venv .venv
.venv\Scripts\activate.batWindows (Powershell):
cd $env:REPO_ROOT
python -m venv .venv
.venv\Scripts\Activate.ps1Then, to install all dependencies inside your virtual environment:
python -m pip install -r REQUIREMENTS.txtGenerally to run the program, all you need to run is the following:
python main.py device $DEVICE_CONFIG_JSON -i $VIDEO_INDEXWhere:
DEVICE_CONFIG_JSONis the path to the configuration json (i.e.devices/TC001.json,devices/TS001.json, etc.)VIDEO_INDEXis the video index for the thermal camera device (i.e. 0 for/dev/video0, 1 for/dev/video1, etc.).- This is based on OpenCV's implementation. It's easier on Linux systems when you can use
v4l2.
- This is based on OpenCV's implementation. It's easier on Linux systems when you can use
There are also optional flags/arguments that you can pass to help you choose different devices or models. To see them all and details, run the program with the --help flag.
Tests are coming soon. Currently, they are hit or miss.
The app can also be built into an executable on Windows. This can be done by using the ptc.spec file and pyinstaller.
pyinstaller ptc.specThese keybindings can be changed easily in the defaults/keybinds.py file.
- a z: Increase/Decrease Blur
- s x: Floating High and Low Temp Label Threshold'
- d c: Change Interpolated scale.(Note: This will not change the window size on the Pi!)
- f v: Contrast
- e w: Fullscreen Windowed. (Note: Going back to windowed does not seem to work on the Pi!)
- r t: Record and Stop
- m : Cycle through colormaps
- i : Invert the colormap
- h : Toggle HUD
- u : Toggle Celsius/Fahrenheit
- o : Toggle output mode (image data vs temperature data)
- u : Cycle temperature unit
- b : Toggle PiP raw data view
- q : Quit the program
- Error checking
- Threading, especially on low speed (but multicore) architectures like the Pi!
- Add graphing
- Ability to arbitrarily measure points.

