lucem_ops::feature
Feature detection and local descriptors: local maxima, multi-scale blobs (LoG, DoG, DoH), Hessian & structure tensors, Canny edges, corner detectors, template matching, LBP, GLCM, and HOG.
pub struct BlobA detected multi-scale blob in a 2-D image.
Fields
y: usizex: usizesigma: f64response: f64
Methods
pub fn radius(&self) -> f64Approximate visual radius $\sqrt{2},\sigma$ of a 2-D isotropic Gaussian blob.
Implements Clone, Copy, Debug, PartialEq.
BlobDetector
Section titled “BlobDetector”pub struct BlobDetectorSettings for multi-scale blob detection (blobs_log, blobs_dog, blobs_doh).
Fields
min_sigma: f64max_sigma: f64num_sigma: usize: Number of scales for LoG / DoH (>= 1).sigma_ratio: f64: Scale ratio $k > 1$ between successive Gaussians inblobs_dog.threshold: f64: Absolute response threshold for scale-space maxima.overlap: f64: Maximum allowed area overlap fraction (0.0..=1.0); blobs overlapping more thanoverlapwith a stronger blob are pruned.log_scale: bool: Use logarithmic scale spacing whentrue, linear spacing whenfalse.exclude_border: usize: Exclude blobs withinexclude_borderpixels of the image boundary.
Implements Clone, Debug, Default, PartialEq.
pub struct CannySettings for the canny edge detector.
Fields
sigma: f64: Standard deviation of the Gaussian pre-smoothing filter (>= 0.0).low_threshold: Option<f64>: Lower hysteresis threshold (Nonedefaults to0.1 * max_grad).high_threshold: Option<f64>: Upper hysteresis threshold (Nonedefaults to0.2 * max_grad).use_quantiles: bool: Whentrue,low_thresholdandhigh_thresholdare interpreted as fractions in0.0..=1.0of the maximum gradient magnitude.mode: PadModecval: f64
Implements Clone, Debug, Default, PartialEq.
Harris
Section titled “Harris”pub struct HarrisSettings for harris.
Fields
method: HarrisMethodk: f64eps: f64sigma: f64
Implements Clone, Debug, Default, PartialEq.
LocalPeaks
Section titled “LocalPeaks”pub struct LocalPeaksSettings for local_peaks.
Fields
min_distance: usize: Minimum Chebyshev/Euclidean distance between returned peaks (>= 1).threshold_abs: Option<f64>: Optional absolute minimum intensity threshold; defaults to the image minimum.threshold_rel: Option<f64>: Optional relative threshold in0.0..=1.0scaled by the image maximum.exclude_border: Option<usize>: Number of border pixels to exclude (Nonedefaults tomin_distance;Some(0)keeps borders).num_peaks: Option<usize>: Maximum number of peaks to return, ordered by descending intensity then raster order.
Implements Clone, Debug, Default, PartialEq.
GlcmProps
Section titled “GlcmProps”pub struct GlcmPropsHaralick summary statistics of a single $(d, \theta)$ slice of a GLCM.
Fields
contrast: f64dissimilarity: f64homogeneity: f64asm: f64energy: f64correlation: f64
Implements Clone, Copy, Debug, PartialEq.
pub struct HogSettings for Histogram of Oriented Gradients (hog).
Fields
orientations: usizepixels_per_cell: (usize, usize)cells_per_block: (usize, usize)
Implements Clone, Debug, Default, PartialEq.
HarrisMethod
Section titled “HarrisMethod”pub enum HarrisMethodHarris corner response variant.
Variants
K: $\det(A) - k,\operatorname{tr}(A)^2$.Noble: Noble’s parameter-free harmonic mean $\frac{2\det(A)}{\operatorname{tr}(A) + \varepsilon}$.
Implements Clone, Copy, Debug, Eq, PartialEq.
LbpMethod
Section titled “LbpMethod”pub enum LbpMethodEncoding variant for circular Local Binary Patterns (lbp).
Variants
Default: Raw $P$-bit unsigned code $\sum_{p=0}^{P-1} s(g_p - g_c) 2^p$.Ror: Rotation-invariant minimum cyclic bit shift.Uniform: Uniform rotation-invariant pattern in0..=P+1($\le 2$ bitwise transitions around the ring).
Implements Clone, Copy, Debug, Eq, PartialEq.
Functions
Section titled “Functions”blobs_log
Section titled “blobs_log”pub fn blobs_log<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, settings: &BlobDetector,) -> OpsResult<Vec<Blob>>Scale-normalized Laplacian of Gaussian ($-\sigma^2 \nabla^2 G_\sigma * I$) blob detector on 2-D bright blobs.
blobs_dog
Section titled “blobs_dog”pub fn blobs_dog<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, settings: &BlobDetector,) -> OpsResult<Vec<Blob>>Difference of Gaussians (DoG) multi-scale blob detector on 2-D bright blobs.
blobs_doh
Section titled “blobs_doh”pub fn blobs_doh<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, settings: &BlobDetector,) -> OpsResult<Vec<Blob>>Scale-normalized Determinant of Hessian ($\sigma^4 \det H_\sigma$) blob detector on 2-D images.
pub fn canny<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, settings: &Canny,) -> OpsResult<DeviceArray<u32>>Runs the 2-D Canny edge detector on image, returning a binary u32 edge map (1 on edges, 0 elsewhere).
harris
Section titled “harris”pub fn harris<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, settings: &Harris,) -> OpsResult<DeviceArray<F>>Computes the 2-D Harris corner response image.
shi_tomasi
Section titled “shi_tomasi”pub fn shi_tomasi<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, sigma: f64,) -> OpsResult<DeviceArray<F>>Computes the 2-D Shi-Tomasi (Kanade-Tomasi) minimum-eigenvalue corner response at scale sigma.
kitchen_rosenfeld
Section titled “kitchen_rosenfeld”pub fn kitchen_rosenfeld<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, mode: PadMode, cval: f64,) -> OpsResult<DeviceArray<F>>Computes the 2-D Kitchen & Rosenfeld gradient-curvature corner response.
foerstner
Section titled “foerstner”pub fn foerstner<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, sigma: f64,) -> OpsResult<(DeviceArray<F>, DeviceArray<F>)>Computes the 2-D Förstner interest operator (w, q) (error ellipse size w and roundness q)
at Gaussian scale sigma.
moravec
Section titled “moravec”pub fn moravec<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, window_radius: usize,) -> OpsResult<DeviceArray<F>>Computes the 2-D Moravec minimum directional SSD corner response over a (2 * window_radius + 1)^2 patch.
pub fn fast<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, n: usize, threshold: f64,) -> OpsResult<DeviceArray<F>>Computes Rosten & Drummond’s FAST corner response on the 16-pixel Bresenham circle of radius 3,
requiring at least n (1..=16, typically 9 or 12) contiguous brighter or darker pixels
exceeding threshold.
corner_subpix
Section titled “corner_subpix”pub fn corner_subpix<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, corners: &[Vec<usize>], window_size: usize, sigma: f64,) -> OpsResult<Vec<[f64; 2]>>Refines integer 2-D corner coordinates &[[y, x]] to subpixel precision (y, x) by fitting a
local 2-D quadratic surface over a (2 * window_size + 1)^2 Gaussian-weighted neighborhood.
local_peaks
Section titled “local_peaks”pub fn local_peaks<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, settings: &LocalPeaks,) -> OpsResult<Vec<Vec<usize>>>Finds local maxima in a 2-D or N-D image separated by at least settings.min_distance, returning
coordinates [row, col, ...] sorted by descending peak intensity (ties broken in raster order).
hessian_matrix
Section titled “hessian_matrix”pub fn hessian_matrix<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, sigma: f64, mode: PadMode, cval: f64,) -> OpsResult<(DeviceArray<F>, DeviceArray<F>, DeviceArray<F>)>Computes the 2-D Gaussian Hessian components (H_rr, H_rc, H_cc) at scale sigma.
hessian_det
Section titled “hessian_det”pub fn hessian_det<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, sigma: f64, mode: PadMode, cval: f64,) -> OpsResult<DeviceArray<F>>Computes the determinant $\det(H_\sigma) = H_{rr} H_{cc} - H_{rc}^2$ of the 2-D Gaussian Hessian.
hessian_eigvals
Section titled “hessian_eigvals”pub fn hessian_eigvals<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, sigma: f64, mode: PadMode, cval: f64,) -> OpsResult<(DeviceArray<F>, DeviceArray<F>)>Computes ordered eigenvalues $(\lambda_1 \ge \lambda_2)$ of the 2-D Gaussian Hessian at scale sigma.
structure_tensor
Section titled “structure_tensor”pub fn structure_tensor<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, sigma: f64, mode: PadMode, cval: f64,) -> OpsResult<(DeviceArray<F>, DeviceArray<F>, DeviceArray<F>)>Computes the 2-D structure tensor (A_rr, A_rc, A_cc) by smoothing outer products of Sobel gradients
with a Gaussian window of scale sigma.
structure_tensor_eigvals
Section titled “structure_tensor_eigvals”pub fn structure_tensor_eigvals<F: ImageFloat>( client: &Client, arr: &DeviceArray<F>, arc: &DeviceArray<F>, acc: &DeviceArray<F>,) -> OpsResult<(DeviceArray<F>, DeviceArray<F>)>Computes ordered eigenvalues $(\lambda_1 \ge \lambda_2)$ of the 2-D structure tensor (arr, arc, acc).
shape_index
Section titled “shape_index”pub fn shape_index<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, sigma: f64, mode: PadMode, cval: f64,) -> OpsResult<DeviceArray<F>>Computes Koenderink & van Doorn’s local 2-D shape index $s \in [-1, 1]$ at scale sigma:
cup (-1.0), rut (-0.5), saddle (0.0), ridge (+0.5), dome/cap (+1.0).
match_template
Section titled “match_template”pub fn match_template<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, template: &DeviceArray<F>, pad_input: bool,) -> OpsResult<DeviceArray<F>>Zero-mean Normalized Cross-Correlation (ZNCC) template matching in 2-D.
When pad_input = false, returns the valid correlation map of shape
[img_h - tpl_h + 1, img_w - tpl_w + 1]; when pad_input = true, returns an array of the same
shape as image centered at (tpl_h / 2, tpl_w / 2).
pub fn lbp<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, num_points: usize, radius: f64, method: LbpMethod,) -> OpsResult<DeviceArray<u32>>Computes circular 2-D Local Binary Patterns (lbp) with num_points (1..=32) at radius > 0.
pub fn glcm<I: ImageInt>( client: &Client, image: &DeviceArray<I>, distances: &[usize], angles: &[f64], levels: usize, symmetric: bool, normed: bool,) -> OpsResult<DeviceArray<f64>>Computes the 4-D Gray-Level Co-occurrence Matrix of shape [levels, levels, distances.len(), angles.len()]
from a 2-D integer image with values in 0..levels.
glcm_props
Section titled “glcm_props”pub fn glcm_props( client: &Client, p_matrix: &DeviceArray<f64>,) -> OpsResult<Vec<Vec<GlcmProps>>>Extracts Haralick texture properties (contrast, dissimilarity, homogeneity, asm, energy,
correlation) for every (distance, angle) slice [d_idx, a_idx] of a 4-D glcm matrix.
multiscale_features
Section titled “multiscale_features”pub fn multiscale_features<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, sigmas: &[f64], include_intensity: bool, include_edges: bool, include_texture: bool,) -> OpsResult<Vec<DeviceArray<F>>>Computes a bank of multi-scale basic features (intensity, gradient magnitude, and Hessian eigenvalues)
across each Gaussian scale in sigmas.
pub fn hog<F: ImageFloat>( client: &Client, image: &DeviceArray<F>, settings: &Hog,) -> OpsResult<Vec<f64>>Computes the L2-Hys normalized Histogram of Oriented Gradients (HOG) feature vector for a 2-D image.