Skip to main content

Module threshold

Module threshold 

Source
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

§Performance

Expected speedup over scalar: 6-12x for thresholding operations

§Example

use oxigdal_algorithms::simd::threshold::{binary_threshold, otsu_threshold};
use oxigdal_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