No description
Find a file
2025-02-05 20:30:43 +01:00
src Bump version to v1.5.0 2025-02-05 20:30:43 +01:00
.gitignore Initial commit 2023-12-18 14:22:45 +01:00
example.irg Initial commit 2023-12-18 14:22:45 +01:00
example.py Add P200 model support 2024-10-21 16:47:21 +02:00
LICENSE Initial commit 2023-12-18 14:22:45 +01:00
pyproject.toml Bump version to v1.5.0 2025-02-05 20:30:43 +01:00
README.md Update README and pyproject.toml for v1.2 2024-10-21 16:51:35 +02:00
run_tests.py Fix offset issues. 2025-02-05 20:27:59 +01:00

Infiray IRG file format parser

This python module contains a simple parser for the "IRG" file format that the Infiray C200 series thermal cameras, P200 series and others use to dump their raw data. The files contain three things: A thermal image with 8 bit resolution with contrast scaled to fit the 0...255 range, a thermal image with 16 bit resolution containing absolute temperature values with 1/16 K resolution, and for some models a JPEG with the image from the low-res visual camera.

Requirements

pillow and numpy

API

Call infiray_irg.load(data) with a bytes object containing the IRG file's contents. It will return a tuple (coarse, fine, vis) of the coarse and fine images as numpy arrays, followed by the visual image as a pillow image. The coarse image has dtype uint8 and contains values from 0 to 255, where 0 is the coldest pixel in the image, and 255 is the hottest. The fine image has dtype float and contains absolute degree Celsius values.

Example

from matplotlib import pyplot as plt
from pathlib import Path

import infiray_irg

coarse, fine, vis = infiray_irg.load(Path('example.irg').read_bytes())

fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(15, 18))

ax1.imshow(coarse)
ax1.set_title('Coarse contrast-maximized')

fine_plt = ax2.imshow(fine)
ax2.set_title('Fine absolute temperatures')
fig.colorbar(fine_plt, ax=ax2, location='right', label='degrees Celsius')

ax3.imshow(vis)
ax3.set_title('Visual')

ax4.hist(fine.flatten(), bins=100)
ax4.set_title('Temperature histogram')
ax4.set_xlabel('degrees Celsius')

fig.tight_layout()
fig.savefig('plot.png')

print('Coldest pixel:', fine.min(), 'C', 'Hottest pixel:', fine.max(), 'C')

Bugs

If you find a bug, or find a file that this library can't load, please send me an email at code@jaseg.de. If your thermal camera isn't supported, please send me an email with one or more example pictures. Please make sure there's something of high contrast visible on these pictures, such as a hot cup of tea.

License

This module is licensed under the MIT license.