coconut_tools.magnetogram.local_weigh_filter

Local Weighted Smoothing Filter

Performs nonlinear weighted averaging of each pixel’s neighborhood using Gaussian-like spatial and radiometric terms. Uses parallel processing for efficiency.

Author: Jose Murteira Cleaned and modularized by: Luis

Functions

Th(u, i, j, Rn, h, dx, dy)

filter3(image, dx, dy, alpha, Rn[, image_seq])

Apply local nonlinear averaging filter based on spatial and intensity similarity.

main_loop_integration(u, i, j, Rn, h, dx, dy)

coconut_tools.magnetogram.local_weigh_filter.Th(u, i, j, Rn, h, dx, dy)[source]
coconut_tools.magnetogram.local_weigh_filter.filter3(image, dx, dy, alpha, Rn, image_seq=None)[source]

Apply local nonlinear averaging filter based on spatial and intensity similarity.

Parameters:
  • image (np.ndarray) – Input 2D image.

  • dx (float) – Spatial resolution in x-direction.

  • dy (float) – Spatial resolution in y-direction.

  • alpha (float) – Exponent controlling the kernel width (h = Rn^alpha).

  • Rn (float) – Radius of influence (neighborhood size).

  • image_seq (list, optional) – If provided, intermediate outputs are saved.

Returns:

Smoothed image.

Return type:

np.ndarray

coconut_tools.magnetogram.local_weigh_filter.main_loop_integration(u, i, j, Rn, h, dx, dy)[source]