Module imagery.analysis.primitives
Common image-processing operations.
Use these functions to soften images, find edges, create masks and compare bands. Provide the width and height and a destination with the same number of samples.
Example
float[] input = [0, 0.2, 0.8, 1];
float[] softened = new float[](input .length);
gaussianBlur(input, 2, 2, 1.0f, softened);
Functions
| Name | Description |
|---|---|
bilateralFilter(src, width, height, spatialSigma, rangeSigma, dst)
|
Edge-preserving bilateral filter for scalar planes. |
canny(src, w, h, low, high, edges)
|
Compact Canny-style binary edge mask (gradient threshold + hysteresis).
Creates a one-byte edge mask. low and high control weak and strong edges.
|
cannyFromGradient(gx, gy, magnitude, w, h, low, high, edges)
|
Second, deterministic Canny phase from precomputed gradients/magnitude. |
cannyFromGradientFrontier(gx, gy, magnitude, w, h, low, high, edges)
|
Frontier-compatible entry point. It preserves the reference FIFO result while giving tiled executors a stable seam for replacing connectivity propagation without changing gradient/NMS contracts. |
cannyFrontierFromState(state, w, h, edges)
|
Propagates strong Canny seeds through weak candidates in wavefronts. State values are 0 (background), 1 (weak), and 2 (strong seed). This is the tile-connectivity primitive; NMS remains a separate producer. |
cannyGradient(src, w, h, gx, gy, magnitude)
|
First, parallelizable Canny phase: computes gradient components and magnitude. The result may be partitioned by row/tile with a one-pixel halo. |
cannyGradientParallel(src, w, h, gx, gy, magnitude, workerLimit, minimumChunk)
|
Bounded parallel variant of cannyGradient. Workers write disjoint rows. |
cannyParallel(src, w, h, low, high, edges, workers, chunk)
|
Parallel staged Canny: gradient, NMS/state classification and serial frontier propagation. The final propagation is deterministic. |
cannyPreview(src, w, h, threshold, edges, workers, chunk)
|
Four-connected flood fill using an absolute scalar tolerance.
Fast interactive edge preview: parallel gradients plus NMS, without
hysteresis propagation. Use canny for a final connected edge map.
|
cannyPreviewUbyte(src, w, h, threshold, edges, workers, chunk)
|
8-bit preview variant that avoids float input conversion. |
connectedComponents(mask, w, h, labels)
|
Connected components of a binary mask; returns component labels and count. |
dilate(src, w, h, radius, dst)
|
Binary morphology with a square radius. Open = erode then dilate; close = reverse. |
gaussianBlur(src, width, height, sigma, dst)
|
Separable Gaussian blur with edge replication.
Softens an image. Larger sigma values create a stronger blur.
|
gaussianBlurParallel(src, w, h, sigma, dst, workers, chunk)
|
Bounded parallel Gaussian blur using separate horizontal and vertical passes. |
gradientMagnitude(src, w, h, magnitude, direction)
|
Gradient magnitude and direction, the first Canny pipeline stage. |
guidedFilter(src, guide, width, height, radius, epsilon, dst)
|
One-pass guided filter using a local mean/variance estimate. |
laplacian(src, width, height, dst)
|
Laplacian response and Difference-of-Gaussians. |
medianBlur(src, width, height, dst)
|
3x3 median filter. Removes isolated bright or dark pixels while preserving broad edges. |
normalizedDifference(a, b, epsilon, dst)
|
Normalized difference index (e.g. NDVI = (NIR-Red)/(NIR+Red)). |
normalizedDifferenceValid(a, b, validity, alpha, epsilon, dst)
|
Normalized difference with explicit validity and alpha planes. Invalid outputs are set to NaN so consumers cannot mistake them for zero. |
slic(src, w, h, spacing, labels)
|
Deterministic grid SLIC-like superpixel assignment (compact baseline). |
sobel(src, width, height, gx, gy)
|
Sobel horizontal/vertical gradients. Returns horizontal and vertical brightness changes for an image. |
sobelParallel(src, w, h, gx, gy, workers, chunk)
|
Bounded parallel Sobel gradients. |
sobelUbyte(src, w, h, gx, gy)
|
Sobel gradients for 8-bit preview images. Outputs remain float so callers can feed them directly into the Canny stages. |
watershed(src, w, h, labels)
|
Priority-flood watershed approximation. Labels local minima basins and marks competing fronts as zero (watershed lines). |
Aliases
| Name | Type | Description |
|---|---|---|
laplace
|
laplacian
|
Compatibility spelling retained for direct module users. |
medianFilter
|
medianBlur
|
Compatibility spelling retained for direct module users. |
open
|
opening
|
Compatibility spellings retained for direct module users. |