Frame helpers¶
This module contains a helper class for frame operations.
- class mio.process.frame_helper.BaseSingleFrameHelper¶
Base class for single frame operations.
- class mio.process.frame_helper.BlackAreaDetector(config: BlackAreaDetectorConfig)¶
Helper class for black area detection.
- class mio.process.frame_helper.FrameSplitter¶
Helper class for splitting frames into buffers. Currently only for getting the buffer shape from pixel count.
- class mio.process.frame_helper.FrequencyMaskHelper(height: int, width: int, freq_mask_config: FreqencyMaskingConfig)¶
Helper class for frequency masking operations.
- _gen_freq_mask() ndarray¶
Generate a mask to filter out horizontal and vertical frequencies. A central circular region can be removed to allow low frequencies to pass.
- freq_domain(img: ndarray) ndarray¶
Compute the frequency spectrum of an image.
- Parameters:
img (np.ndarray) – The image to process.
- Returns:
The frequency spectrum of the image.
- Return type:
np.ndarray
- property freq_mask: ndarray¶
Get the frequency mask.
- Returns:
The frequency mask.
- Return type:
np.ndarray
- process_frame(img: ndarray) ndarray¶
Perform FFT/IFFT to remove horizontal stripes from a single frame.
- Parameters:
img (np.ndarray) – The image to process.
cast_f32 (bool) – Cast the image to float32 before processing.
- Returns:
The filtered image
- Return type:
np.ndarray
Todo
Confirm if the option for casting to float32 is necessary. See issue #104.
- class mio.process.frame_helper.GradientNoiseDetector(config: GradientDetectorConfig)¶
Helper class for gradient noise detection.
- class mio.process.frame_helper.InvalidFrameDetector(noise_patch_config: NoisePatchConfig)¶
Helper class for combined invalid frame detection.
- class mio.process.frame_helper.MSENoiseDetector(config: MSEDetectorConfig)¶
Helper class for mean squared error noise detection.
- _detect_with_mean_error(current_frame: ndarray) Tuple[bool, ndarray]¶
Detect noise using mean error between current and previous frames.
- Returns:
A boolean indicating if the frame is noisy and the noise mask.
- Return type:
Tuple[bool, np.ndarray]
- mio.process.frame_helper.mean_intensity(frame: ndarray) float¶
Calculate the mean pixel intensity for a frame.
- Parameters:
frame (np.ndarray) – The frame whose mean intensity is to be calculated on filtered data (broken frames replaced, spatial mask filter).
- Returns:
The mean intensity of the frame.
- Return type: