Expand description
SIMD-accelerated thresholding operations
This module provides high-performance image thresholding and binarization using SIMD instructions. Thresholding is fundamental for segmentation, feature extraction, and image preprocessing.
§Supported Operations
- Binary Thresholding: Simple threshold with two output values
- Adaptive Thresholding: Local threshold based on neighborhood
- Otsu’s Method: Automatic threshold selection
- Multi-level Thresholding: Multiple threshold values
- Range Thresholding: Keep values within a range
- Hysteresis Thresholding: Two-level threshold with connectivity
§Architecture Support
The pointwise thresholds (binary_threshold, threshold_to_zero,
threshold_truncate, threshold_range) use NEON intrinsics
(vcgeq_u8/vcleq_u8/vbslq_u8/vminq_u8) on aarch64, processing 16 pixels
per instruction, with a scalar remainder. The neighborhood/histogram-based
operations (Otsu, adaptive, hysteresis, multi-level) remain scalar. NEON
output is bit-for-bit identical to the scalar fallback (see the parity tests).
§Example
use oxigeo_algorithms::simd::threshold::{binary_threshold, otsu_threshold};
use oxigeo_algorithms::error::Result;
fn example() -> Result<()> {
let data = vec![128u8; 1000];
let mut output = vec![0u8; 1000];
binary_threshold(&data, &mut output, 100, 255, 0)?;
Ok(())
}Functions§
- adaptive_
threshold_ gaussian - Apply adaptive threshold using Gaussian-weighted mean
- adaptive_
threshold_ mean - Apply adaptive threshold using local mean
- binary_
threshold - Binary threshold with custom output values
- hysteresis_
threshold - Hysteresis thresholding (two-level threshold with connectivity)
- multi_
threshold - Multi-level thresholding
- otsu_
threshold - Calculate optimal threshold using Otsu’s method
- threshold_
range - Range threshold - keep values within [low, high]
- threshold_
to_ zero - Binary threshold to zero
- threshold_
truncate - Truncate threshold - cap values at threshold