remove_background#

de_ebsd.index.preprocess.remove_background(patterns, static_bg=None, dynamic=True, operation='subtract', sigma=None, truncate=4.0, device=None, dtype=torch.float32)[source]#

Full EBSD preprocessing: static then dynamic background removal, on the GPU.

Convenience wrapper that runs remove_static_background() (when static_bg is given) followed by remove_dynamic_background() (when dynamic), the usual pre-indexing pipeline, all on device in one pass over the scan.

Parameters:
patterns

The raw scan, (H, W) / (N, H, W) / (rows, cols, H, W), numpy or torch.

static_bg

The static background image (H, W); if None, the static step is skipped.

dynamic

Whether to also remove the dynamic (per-pattern Gaussian) background (default True).

operation, sigma, truncate, device, dtype

Passed through to the two steps (see those functions).

Returns:
torch.Tensor

The cleaned patterns, same leading shape as the input, rescaled to [0, 1], ready to hand to index().