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.
- _detect_black_pixels(current_frame: ndarray) tuple[bool, ndarray]¶
Detect black-out noise by checking for consecutive black pixels per row.
Uses vectorized numpy (cumulative sum sliding window) instead of pixel-by-pixel Python loops for ~100x speedup.
- Returns:
A boolean indicating if the frame is corrupted and noise mask.
- Return type:
Tuple[bool, np.ndarray]
- class mio.process.frame_helper.Detectors¶
Map between shortnames and detector class instances
- 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: FrequencyMaskingConfig)¶
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.