Skip to content

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InfiRay P2 Pro Python Capture

Python port of the thermal camera viewer by atomic14 with a PySide6 desktop UI.

Features

  • Live thermal stream from USB camera via OpenCV (cv2.VideoCapture)
  • Colormap rendering: Turbo, Inferno, Jet, Hot, Black-Hot, White-Hot, Rainbow, Rainbow-High-Contrast, Parula, Viridis, Plasma, Coolwarm, Magma, Twilight, Autumn, Spring, Winter, HSV, Cubehelix, Cividis, Bone
  • Temperature stats: Min, Max, Average, Center
  • Optional temperature grid overlay
  • Optional min/max markers with smart labels
  • Preview scaling with aspect ratio lock and selectable interpolation (Nearest/Linear/Cubic Low CPU, Lanczos Medium CPU, Sharp High CPU)
  • Optional Sharp preview/export upscaling via ESPCN x4 (opencv-contrib dnn_superres; display-only)
  • Histogram with active colormap scale
  • 1 minute temperature history chart (Max/Min/Ave/Center)
  • Manual temperature range (optional)
  • Camera temperature range switch (Low (-20~150°C) / High (100~600°C))
  • High-range measurement smoothing for more stable values (Min/Max/Average/Center, grid, min/max markers)
  • Orientation controls (rotate/flip)
  • PNG snapshot export
  • MP4 recording export
  • Shared export directory for PNG and MP4 (persisted)
  • Keyboard shortcuts: p (save PNG instantly), r (start/stop recording instantly)
  • Persistent UI state (camera selection, colormap, controls, window size)

Screenshot

screenshot

Requirements

  • macOS, Linux, or Windows (OpenCV camera backend)
  • Python 3.11+

For camera temperature range switching, pyusb also requires a working libusb backend on the system.

Setup

From the repository root:

python3 -m venv .venv
source .venv/bin/activate
pip install -e .

For development and test tooling, use pip install -e ".[dev]".

USB backend setup (for temperature range switching)

  • macOS:
    • brew install libusb
  • Linux:
    • install libusb-1.0 via your package manager (distribution-specific package name)
    • ensure user/device permissions allow USB control access
  • Windows:
    • Install libusb-1.0.dll and ensure it is on PATH (for example C:\Tools\libusb).
    • For temperature-range control and live video at the same time, install a libusb-win32 upper filter with Zadig (do not replace the UVC camera driver):
      1. Options → List All Devices
      2. Select USB Camera (Interface 0) for VID_0BDA / PID_5830
      3. Choose libusb-win32
      4. Open the arrow next to Replace Driver and choose Install Filter Driver
      5. Confirm Windows still shows a normal USB Video Device / Camera entry
    • IrProPyCapture uses the libusb0 pyusb backend on Windows to talk to that filter.
    • Start the camera stream in IrProPyCapture before switching temperature range.
    • Replacing Interface 0 with WinUSB/libusb (instead of a filter) removes the webcam from Windows/OBS and breaks capture.

Run

From the repository root:

source .venv/bin/activate
python -m irpropycapture.main

Usage

  1. Click Refresh Cameras.
  2. Select the desired thermal camera.
  3. Click Start Camera.
  4. Adjust colormap, orientation, grid, manual range, and marker options.
  5. Use Save PNG for snapshots and Start/Stop Recording for MP4.
    • These buttons keep the save dialog and update the shared export directory.
  6. Use keyboard shortcuts for quick actions (without save dialog):
    • p saves a PNG immediately in the shared export directory.
    • r starts/stops MP4 recording immediately in the shared export directory.

Acknowledgements

This Python port is based on the awesome original Swift/macOS project by atomic14. https://github.com/atomic14/InfiRayCapture Many thanks to the original author for the groundwork and implementation details. Range selection was made possible thanks to hints from the project by LeoDJ https://github.com/LeoDJ/P2Pro-Viewer

Notes

  • On first run, the OS may request camera permission.
  • UI state is stored in ~/.irpropycapture_state.json.
  • PNG and MP4 share one persisted export directory.
  • If no image appears, verify camera access permissions and that the camera is not used by another application.
  • Optional performance logs can be enabled with IRPRO_PY_CAPTURE_PERF=1.

Platform Notes

  • macOS:

    • Current thermal-camera path prefers AVFoundation via OpenCV FFMPEG input source (USB-Kamera:none) for the known USB device.
    • If the thermal stream is not found, verify camera permissions in System Settings and close other apps using the device.
  • Linux:

    • Capture uses OpenCV V4L2 backend and probes camera indices for raw-compatible formats (Y16/YUYV/UYVY).
    • Ensure your user can access /dev/video* devices (udev/group permissions).
    • For temperature range switching, also ensure USB access permissions for the thermal device (libusb path).
  • Windows:

    • Capture uses OpenCV MSMF backend first, then DirectShow fallback for broader USB camera compatibility.
    • If no stream opens, verify camera privacy settings and close software that may lock the camera.
    • Temperature range switching needs libusb-1.0.dll on PATH plus a libusb-win32 filter on Interface 0 (see USB backend setup above). A plain UVC binding is enough for video, but vendor control transfers then fail with Entity not found.

About

Python port of the InfiRayCapture Swift thermal camera viewer with a PySide6 desktop UI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages