mgn¶
- sunkit_image.enhance.mgn(data, sigma=[1.25, 2.5, 5, 10, 20, 40], k=0.7, gamma=3.2, h=0.7, weights=None, truncate=3, clip=True, gamma_min=None, gamma_max=None)[source]¶
Multi-scale Gaussian normalization.
This function can be used to visualize information over a wide range of spatial scales. It works by normalizing the image by calculating local mean and standard deviation over many spatial scales by convolving with Gaussian kernels of different standard deviations. All the normalized images are then arctan transformed (similar to a gamma transform). Then all the images are combined by adding all of them after multiplying with suitable weights. This method can be used to reveal information and structures at various spatial scales.
Note
In practice, the weights and h may be adjusted according to the desired output, and also according to the type of input image (e.g. wavelength or channel). For most purposes, the weights can be set equal for all scales.
We don’t deal with nan (Not A Number) in this implementation.
- Parameters:
data (
numpy.ndarray
) – Image to be transformed.sigma (
list
, optional) – Range of Gaussian widths (i.e. the standard deviation of the Gaussian kernel) to transform over. Defaults to[1.25, 2.5, 5, 10, 20, 40]
.k (
float
, optional) – Controls the severity of the arctan transformation. The scaling factor multiplied with each Gaussian transformed image before applying the arctan transformation. Defaults to 0.7.gamma (
float
, optional) – The value used to calculate the global gamma-transformed image. Ideally should be between 2.5 to 4 according to the paper. Defaults to 3.2.gamma_min (
float
, optional) – Minimum input to the gamma transform. Defaults to minimum value ofdata
gamma_max (
float
, optional) – Maximum input to the gamma transform. Defaults to maximum value ofdata
h (
float
, optional) – Weight of global filter to Gaussian filters. Defaults to 0.7.weights (
list
, optional) – Used to weight all the transformed images during the calculation of the final image. If not specified, all weights are one.truncate (
int
, optional) – The number of sigmas (defaults to 3) to truncate the kernel.clip (
bool
, optional) – If set toTrue
it will clip all the non-positive values in the image to a very small positive value. Defaults toTrue
.
- Returns:
numpy.ndarray
– Normalized image.
References
Huw Morgan and Miloslav Druckmüller. “Multi-scale Gaussian normalization for solar image processing.” arXiv preprint arXiv:1403.6613 (2014). Ref: Sol Phys (2014) 289: 2945. doi:10.1007/s11207-014-0523-9