Sequence Reader Module
Thermal Sequence Reader
Provides a VideoCapture-like interface for reading pre-recorded thermal camera sequences (.tseq files). Compatible with the ThermalSharedMemory interface for seamless integration with detection modules.
- class pythermal.core.sequence_reader.ThermalSequenceReader(file_path: str)[source]
Bases:
objectReader for pre-recorded thermal camera sequences (.tseq files)
Provides the same interface as ThermalSharedMemory, allowing detection modules to work with both live and recorded data without modification.
- __init__(file_path: str)[source]
Initialize thermal sequence reader
- Parameters:
file_path – Path to the .tseq recording file
- get_metadata() FrameMetadata | None[source]
Get current frame metadata
- Returns:
FrameMetadata named tuple, or None if no frame available
- has_new_frame() bool[source]
Check if a new frame is available
- Returns:
True if there are more frames to read, False otherwise
- read() tuple[bool, ndarray | None][source]
Read next frame (VideoCapture-like interface)
- Returns:
Tuple of (success, frame) where frame is BGR image (240x240x3)
- get_yuyv_frame() ndarray | None[source]
Get current YUYV frame (ThermalSharedMemory interface)
- Returns:
YUYV frame array (240x240x2), or None if no frame available
- get_temperature_array() ndarray | None[source]
Get current temperature array (ThermalSharedMemory interface)
- Returns:
Temperature array (96x96) with uint16 values, or None if no frame available
- mark_frame_read()[source]
Mark current frame as read (ThermalSharedMemory interface)
For recorded sequences, this clears the cached frame data so the next call to get_metadata()/get_yuyv_frame()/get_temperature_array() will read the next frame.
- set(prop: int, value: float) bool[source]
Set property (VideoCapture-like interface)
- Parameters:
prop – Property ID (e.g., cv2.CAP_PROP_POS_FRAMES)
value – Property value
- Returns:
True if successful, False otherwise
- get(prop: int) float[source]
Get property (VideoCapture-like interface)
- Parameters:
prop – Property ID (e.g., cv2.CAP_PROP_POS_FRAMES, cv2.CAP_PROP_FRAME_COUNT)
- Returns:
Property value