Skip to main content

morphology_gpu

Function morphology_gpu 

Source
pub fn morphology_gpu(
    runtime: &WgpuRuntime,
    source: &GpuImage,
    kernel_width: u32,
    kernel_height: u32,
    operation: GpuMorphology,
) -> SpatialResult<GpuImage>
Expand description

Applies rectangular erosion or dilation without leaving device memory.

Odd kernels in 1..=31 use replicate borders. Boxes with area at least 81 and at least 1,048,576 pixel/sample visits use two exact extrema passes and four scratch bytes per group of up to four row pixels. One-column images retain four bytes per pixel; smaller workloads use the original single pass.