Skip to main content

A Python library for interacting with the Topdon TC001 thermal camera.

Project description

pythermalcamera - Topdon TC001 Thermal Camera Library

A Python library for interacting with the Topdon TC001 thermal camera. This library simplifies device discovery, provides a live interactive preview with temperature analysis, and supports capturing full-resolution thermal images with associated JSON metadata.

Features

  • Auto-Detection: Automatically finds the correct video device ID for the TC001 by scanning /dev/video*.
  • Live Preview: Interactive window showing the thermal heatmap with a center crosshair, HUD, and real-time statistics (Min/Max/Avg).
  • Area of Interest (ROI): Interactively select a region in the preview to focus temperature analysis (statistics will only reflect the chosen box).
  • High-Quality Captures: Save colorized heatmaps as PNG and full temperature metadata as JSON.
  • Marker Overlays: Toggleable hotspot and coldspot markers on both the preview and captured images.
  • Background Threading: Optionally run the preview in a non-blocking background thread while performing other tasks in the main script.
  • Extensive Metadata: Captures include timestamps, raw temperature stats, ROI coordinates, and all rendering settings (colormap, alpha, blur, etc.).

Prerequisites

  • Hardware: Topdon TC001 Thermal Camera.
  • Operating System: Linux (developed and tested on Linux with V4L2).
  • Dependencies:
    • opencv-python
    • numpy

Installation

Ensure you have the dependencies installed:

pip install opencv-python numpy

Then, include the pythermalcamera package in your project.

Usage

Quick Start (Demo Script)

Run the included demo to see the library in action:

# Auto-detect camera and start interactive preview
python3 demo_library.py

# Run preview in background and take a manual capture after 5 seconds
python3 demo_library.py --preview

# Enable markers on the manual capture
python3 demo_library.py --markers

Basic Library API

from pythermalcamera import ThermalCamera
import cv2

# Initialize with auto-detection and non-blocking preview
with ThermalCamera(include_preview=True) as cam:
    # Do something else while the preview runs...
    import time
    time.sleep(5)
    
    # Take a manual snapshot with specific settings
    result = cam.capture(
        filename_prefix="Snapshot",
        colormap=cv2.COLORMAP_MAGMA,
        include_markers=True
    )
    
    if result:
        print(f"Captured {result['image']}")
        print(f"Max Temp: {result['metadata']['max_temp']}°C")

Interactive Controls (Preview Window)

When the preview window is active, use the following keyboard shortcuts:

Key Action
q Quit preview
p Take snapshot (saves PNG + JSON)
r Reset/Clear ROI (Area of Interest)
m Cycle through available colormaps
h Toggle HUD (On-screen statistics)
k Toggle markers (hotspot/coldspot) for snapshots
a/z Increase / Decrease Blur
s/x Increase / Decrease Marker Threshold
d/c Increase / Decrease Display Scale
f/v Increase / Decrease Contrast (Alpha)

Mouse Controls:

  • Left-Click & Drag: Select an Region of Interest (ROI) box on the preview.

Metadata Format

Snapshots generate a .json file containing:

  • timestamp: Unix timestamp of the capture.
  • center_temp, max_temp, min_temp, avg_temp: Temperature readings in Celsius.
  • max_pos, min_pos: Pixel coordinates of the hotspot and coldspot.
  • roi: Coordinates of the active ROI at the time of capture.
  • settings: All rendering parameters used to generate the PNG (colormap, scale, blur, etc.).

Credits and Attribution

This library is inspired by and based on the work of:

License

This project is licensed under the MIT License - see the LICENSE file for details (if provided).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythermalcamera-0.1.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythermalcamera-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file pythermalcamera-0.1.0.tar.gz.

File metadata

  • Download URL: pythermalcamera-0.1.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pythermalcamera-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7fc792acb768d87d307de74a5287328d398f38024cabe7e6d56486b038cc2cb7
MD5 6a914732ebbb8af1a1f14f3a72a7b7cb
BLAKE2b-256 607a3e07debf60371d5868767b59bb3ebb961fc1528e8b55018b9256cc254a12

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythermalcamera-0.1.0.tar.gz:

Publisher: publish.yml on matt-wood-ct/PyThermalCamera

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pythermalcamera-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pythermalcamera-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01195031fd15f6801cca11901981c6d0fbc067ffce66e049ed012705c316e215
MD5 32f37a24b388930b57ae978be1aa7b56
BLAKE2b-256 0514f3a5e3e0c70c6a19c28f0566745f59443344c275db47e689fb329344edf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythermalcamera-0.1.0-py3-none-any.whl:

Publisher: publish.yml on matt-wood-ct/PyThermalCamera

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page