-gaussian

This command replaces the content of the selected images with an image of a Gaussian distribution. Image values range from zero to unity with the value at the center of the distribution equal to unity and with all other pixel values approaching zero the further pixels range from the center. The shape of the distribution is a Gaussian bell curve, the peak coinciding with the center pixel of the image. The command paints idential images in all channels, so that in an RGB colorspace, the distribution appears in shades of white and gray.

The format of the command is:

-gaussian: sigma1[%],sigma2[%],angle

sigma1: The radius of the standard deviation ellipse along the distribution's local x axis

sigma2: The radius of the standard deviation ellipse along the distribution's local y axis

angle: The rotation, in degrees, of the local axis with respect to the image axis

Sigma1 and sigma2 may be expressed as absolute distances in pixels or as relative percentages with respect to the image dimensions. Defaults are:

  1. _sigma1 = 3
  2. _sigma2 = _sigma1
  3. _angle = 0°

Example:

gmic 300,300,1,1 -gaussian 60,10,57

paints a Gaussian distribution. The arguments specify the size and orientation of an ellipse that encompasses pixels within one sigma of the expected mean average point, coinciding with the center pixel of the image. The first argument specifies the magnitude of sigma along the distribution's local x axis, the second argument specifies a like magnitude for the sigma along the local y axis. The third argument specifies a clockwise rotation of the local axis from the image axis. 

In the illustration on the left, the standard deviation ellipse is in pink.

Application

We often use images produced by this command as spectral filters, that is, multiply Gaussian distributions against the real and imaginary components of the spectral representation of an image produced by -fft. This operation is closely related to -bandpass, in that we are supressing all but a portion of the spectral coefficients, making various kinds of passbands.

Though with this command, spectral filtering is more involved than with -bandpass, a good deal more control may be had over the spectral filter. Eccentric elipses, such as the one depicted here, give rise to images with strong directional character when the -ifft command takes filtered spectral components back into the spatial domain. This approach furnishes an especially rich source of textures when the initial image stems from -noise or -plasma

$gmic 400,400,1,3 -gaussian[-1] 20,5,7 100%,100% -gaussian[-1] 4,3,0 -negative[-1] -mul[-1,-2]
-normalize[-1] 0,1 -shift[-1] -200,-200,0,0,2...

We compose a spectral filter, placing a punctured ellipse on the origin of the spectral plane. We puncture the first ellipse with the second, smaller, distribution by negating the second and multiplying the two. We shift the resulting image to the corners, as that is where the origin of the spectral plane resides. Then we normalize the filter in the range of zero to one, this in anticipation of multiplying this filter with the spectral components of a yet-to-be composed operand image. This punctured ellipse is a bandpass filter. It will admit only a certain number of spectral coefficients in an elliptic ring around the origin of the spectral plane.

...100%,100%,1,3 -noise[-1] 0.1,2 --fft[-1] --mul[0,-2] --mul[0,-2] -ifft[-2,-1]...

For our operand, we fill a new image with very sparse salt-and-pepper noise and transform the image into its spectral form. In this form, "spectral pixels" encoding a sine wave at a particular amplitude, frequency, phase and orientation, are complex quantities. G'MIC realizes this encoding by utilizing two images, one holding the real components of the complex numbers, the other holding the imaginary components. We multiply both spectral images with the punctured ellipse. It is mainly black - i.e., set to zero - and mainly sets coefficients to zero. In particular, the punctured ellipse sets the zero frequency coefficient at the origin to zero and most high frequency components to zero. The gray and white parts of the punctured ellipse retains an elliptical ring of coefficients around the origin. This is a variable passband filter that favors very low frequencies at one orientation and somwhat higher frequencies on another orientation separated from the first by ninety degrees. Taking the image back to the spatial domain gives rise to a largely low-pass filtered image; but the degree of filtration has an angular orientation, in effect, smearing the image.  

-normalize[-1] 0,255 -o[-1]

The inverse fast fourier transform generally produces pixels with complex values; these realized through a pair of image one containing the real components, the other the imaginary components.

The real part illustrates a low-pass filtered, vertically smeared star field. The punctured ellipse, however, is fatter along the x-axis and seems rotated from the orientation of the smearing it is supposed to promote. Recall, however, that by admitting more coefficients along the x-axis, the spectral filter allows higher frequencies along that orientation, translating into sharper edges than those along the vertical orientation. Consequently, "spearing" is mostly manifest in the vertical direction.

The imaginary part can be utilized in its own right - it is, in practical effect, a separate image.

Garry Osgood