Skip to main content

Fast reader and writer for Telops HCC infrared camera files — no SDK required

Project description

Fast, pure-Python reader and writer for Telops HCC infrared camera files — no SDK or TelopsToolbox required.

fasthcc reads and writes .hcc files produced by Telops FAST-series IR cameras using NumPy arrays. The binary header format (V5–V12) was implemented based on analysis of the file structure and reference documentation shipped with the camera, and validated against real camera data. It has a single dependency (numpy) and is designed as a drop-in replacement for TelopsToolbox’s SequenceReaderP, which is slow and has compatibility bugs with numpy 2.x.

Licensed under the MIT License.

Benchmark

This is the primary motivation for the package. Benchmark results from three examples on real recordings from a Telops FAST M3k camera are presented below. The results show a consistent ~100× speedup for raw reads and ~25× for calibrated reads.

Test #1: 128×132 resolution, 12,000 frames, 2000 Hz, RT calibration, 392.6 MB HCC file

Method

Time

Speedup

fasthcc (raw uint16)

0.22 s

90×

fasthcc (calibrated float32)

0.73 s

27×

TelopsToolbox

19.7 s

1× (baseline)

Test #2: 320×256 resolution, 6,350 frames, 1000 Hz, RT calibration, 999.9 MB HCC file

Method

Time

Speedup

fasthcc (raw uint16)

0.67 s

105×

fasthcc (calibrated float32)

2.79 s

25×

TelopsToolbox

70.9 s

1× (baseline)

Test #3: 320×256 resolution, 10,000 frames, 1000 Hz, RT calibration, 1.53 GB HCC file

Method

Time

Speedup

fasthcc (raw uint16)

0.93 s

100×

fasthcc (calibrated float32)

3.21 s

24×

TelopsToolbox

93.2 s

1× (baseline)

Why fasthcc is faster

TelopsToolbox creates two np.memmap objects per frame (header + pixels) in a Python for-loop. For a 12 000-frame file that means 24 000 memmap instantiations — the loop alone dominates the total read time, regardless of disk speed.

fasthcc memory-maps the entire file once using a single numpy structured dtype, extracting all frames in one np.memmap() call. No Python-level frame loop, and files of any size are handled without loading them entirely into RAM.

Ready-to-use arrays

fasthcc returns properly shaped (N, H, W) numpy arrays directly. TelopsToolbox returns flattened pixel data that requires a separate form_image(header, ir_data) call to reshape.

Correctness

fasthcc produces bit-identical output to TelopsToolbox (raw uint16 exact match, calibrated float32 exact match). Verified on RT-calibrated recordings.

Installation

pip install fasthcc

For development:

git clone https://github.com/ladisk/fasthcc.git
cd fasthcc
pip install -e ".[dev]"

Usage

Python API

from fasthcc import read_hcc, HCCReader

# One-shot read
frames = read_hcc("recording.hcc")  # (n_frames, height, width) uint16

# Calibrated (temperature in Kelvin)
frames = read_hcc("recording.hcc", calibrated=True)  # float32

# Read subset of frames
frames = read_hcc("recording.hcc", frames=slice(0, 100))

# With metadata
frames, meta = read_hcc("recording.hcc", metadata=True)
print(meta[0]["AcquisitionFrameRate"])  # 2000.0

# Class-based access
with HCCReader("recording.hcc") as hcc:
    print(hcc.width, hcc.height, hcc.n_frames)
    print(hcc.frame_rate, hcc.calibration_mode)
    subset = hcc.read_frames(0, 100)
    hcc.to_npy("output.npy")
from fasthcc import write_hcc, HCCWriter

# Write uint16 frames
write_hcc("output.hcc", frames, frame_rate=2000.0)

# Write calibrated float data (inverse-calibrates to uint16)
write_hcc("output.hcc", temps, calibration_mode=2,
          data_offset=273.15, data_exp=-8)

# Round-trip: read, modify, write back
frames, meta = read_hcc("input.hcc", metadata=True)
frames[0] = modify(frames[0])
write_hcc("output.hcc", frames, metadata=meta)

# Streaming writer
with HCCWriter("output.hcc", width=320, height=256) as w:
    for frame in source:
        w.write_frame(frame)

CLI

Print file information:

fasthcc info recording.hcc

Convert to NPY:

fasthcc convert recording.hcc
fasthcc convert recording.hcc --calibrated --dtype float32
fasthcc convert folder/ -r --skip-existing

HCC file format

HCC is a binary format used by Telops infrared cameras. Each file contains a sequence of frames, where each frame consists of a fixed-size header followed by raw pixel data.

  • Signature: The first 2 bytes of each frame header are "TC" (ASCII).

  • Version: Bytes 2–3 encode the minor and major header version numbers. Supported versions range from 5.x through 12.x.

  • Frame layout: Each frame occupies header_size + width * height * 2 bytes, where header_size = 2 * width * 2 bytes (two “header lines” worth of uint16 values).

  • Pixel data: width * height unsigned 16-bit integers, little-endian.

  • Calibration modes: 0 = raw, 1 = NUC (non-uniformity corrected), 2 = RT (radiometric temperature).

  • RT calibration: Temperature in Kelvin is recovered from raw pixel values via pixel * 2^DataExp + DataOffset, where DataExp and DataOffset are stored in the per-frame header.

Limitations

  • Designed for Telops FAST-series cameras. Other Telops camera models may use header versions that require version-specific adjustments.

  • Memory-mapped I/O. Files are memory-mapped, so they can exceed available RAM. However, operations like to_calibrated() or read_frames() that return full numpy arrays will allocate output buffers proportional to the number of requested frames.

  • No calibration blocks. Written files contain valid headers and pixel data but not embedded NUC calibration tables. Telops software can still display the data.

Disclaimer

fasthcc is an independent, community-developed project. It is not affiliated with, endorsed by, or supported by Telops Inc. The HCC file format was implemented based on reference documentation shipped with the camera hardware.

“Telops” and “FAST” are trademarks of Telops Inc. All other trademarks are the property of their respective owners.

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

fasthcc-0.2.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

fasthcc-0.2.1-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file fasthcc-0.2.1.tar.gz.

File metadata

  • Download URL: fasthcc-0.2.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fasthcc-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c6cc27457fa30ed0e6df77965bb6970578cec29dd40418c1b9cd176dde1a2e41
MD5 d7b505d4faeecf2d8e55df2939f000be
BLAKE2b-256 7051d807899d6502bc73b2f0cec77c66f856fe8a44b9d0952cfa4a0aaac9e078

See more details on using hashes here.

File details

Details for the file fasthcc-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: fasthcc-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fasthcc-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8c7e101c33160b6146ccd47a64e425c66ccf23632fbf3d3f989b7a1e8e7900f
MD5 6da3af8e98f0a1c698a0825a83843409
BLAKE2b-256 af98e163e391c16c7e7161f136168241615b8179a65a07ee9515e9065423ce0e

See more details on using hashes here.

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