Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY. For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Computes the spectrum image from the magnitude of the Fourier Transform of an image. |
last modified: December 15, 2018
USAGE: spectrum [-m] [-s scale] [-g] infile outfile
-m ................ generate magnitude from Fourier Transform PURPOSE: To compute the spectrum image from the magnitude of the Fourier Transform of an image. DESCRIPTION: SPECTRUM computes a spectrum image from the magnitude image generated from the Fourier Transform of an image. The spectrum is basically a scaled log of the magnitude image. See -evaluation log. The log and scaling are provided to emphasize the lower values in the magnitude image relative to the larger values. The input may be the magnitude of the Fourier Transform, if already available. If the -m option is provided, it means that the magnitude of the Fourier Transforms should be computed from the spatial domain input image. ARGUMENTS: -m ... Compute magnitude of the Fourier Transform of the spatial domain image that is the input. The default, when left off, is to assume that the input image is already the magnitude of the Fourier Transform. -s scale ... SCALE is the scaling constant used with the log. Values are integers greater than zero. Values are convert to 10^scale for use with log. Typical values range from 2 to 5. Larger values will bring out more low amplitude detail. But too large a value will bring out excessive noise. The default is to compute a scaling value automatically. -g ... Convert magnitude input to grayscale to produce a grayscale spectrum. As an final step, pure black (graylevel=0) is converted to graylevel 1 on a scale of 0 to 255. This is done so that after the spectrum is masked with pure black to eliminate noise or apply a filter, the result can be thresholded at value=0 (see -threshold 0) to convert it to a binary mask image. REQUIREMENTS: IM IM 6.3.9-1 or higher due to the use of -format "%[min]" and "%[max]". Also requires FFTW delegate library to compute the Fourier Transform. Q8 IM compilation is not generally recommended and may not carry enough precision for the Fourier Transform. See Fourier Transform with ImageMagick, for more details. CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
Input |
Arguments: |
|
||
![]() |
![]() |
|
||
Input |
Arguments: |
|
||
![]() |
![]() |
|
||
convert -size 15x15 xc:white -gravity center \ |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
![]() |
![]() |
![]() |
![]() |
![]() |
convert -size 128x128 xc:black -fill white \ |
Arguments: |
|
||
![]() |
![]() |
|
What the script does is as follows:
This is equivalent to the following IM commands for red-blue gradient
|