thermography.io package

This package contains the implementation of IO operations needed by thermography.

Submodules

thermography.io.io module

class ImageLoader(image_path: str, mode: thermography.io.modes.Modality = <Modality.RGB: 1>)[source]

Bases: object

Class responsible for loading a single image file into a numpy array.

Initializes and loads the image associated to the file indicated by the path passed as argument.

Parameters:
  • image_path – Absolute path to the image file to be loaded.
  • mode – Modality to be used when loading the image.
image_path

Returns the absolute path to the image loaded by this object.

show_raw(title: str = '', wait: int = 0) → None[source]

Displays the raw image associated with the calling instance.

Parameters:
  • title – Title to be added to the displayed image.
  • wait – Time to wait until displayed windows is closed. If set to 0, then the image does not close.
class VideoLoader(video_path: str, start_frame: int = 0, end_frame: int = None)[source]

Bases: object

Class responsible for laoding a video into a sequence of numpy arrays representing the single video frames.

Loads the frames associated to the video indicated by the path passed as argument.

Parameters:
  • video_path – Absolute path to the video to be loaded.
  • start_frame – Start frame of the video to be considered (inclusive).
  • end_frame – End frame of the video to be considered (non inclusive). If set to None, the video will be loaded until the last frame.
num_frames

Returns the number of frames loaded by this object.

video_path

Returns the absolute path associated to the video loaded by this object.

thermography.io.logger module

setup_logger(console_log_level: thermography.io.modes.LogLevel = 'INFO', file_log_level: thermography.io.modes.LogLevel = 'DEBUG', log_file_name: str = None)[source]

Sets up the simple logger.

Parameters:
  • console_log_level – Log level associated to the streaming log.
  • file_log_level – Log level associated to the file log.
  • log_file_name – If set, then the file log is written to this file. Otherwise a new log file will be created in the log directory returned by get_log_dir.

thermography.io.modes module

class LogLevel[source]

Bases: object

Log levels used for the simple_logger.Logger object.

DEBUG = 'DEBUG'
ERROR = 'ERROR'
FATAL = 'FATAL'
INFO = 'INFO'
WARN = 'WARNING'
WARNING = 'WARNING'
class Modality[source]

Bases: enum.IntEnum

Modalities used to load an image into opencv.

DEFAULT = 1
GRAY_SCALE = 0
RGB = 1