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. |
Creates the cepstrums to depict the type, amount and orientation of camera type blurring in an image. |
last modified: December 15, 2018
USAGE: cepstrum [-s size] [-o overlap] [-r rolloff] [-c constant] [-G] infile outfile
-s ... size ........ percent size of original image to use for the PURPOSE: To create the cepstrum to depict the type, amount and orientation of camera type blurring in an image. DESCRIPTION: CEPSTRUM creates the cepstrum of an image to detect its blurring type, amount and orientation. The cepstrum is generate by first computing a running average of the magnitude of the Fourier Transform from a complete set of subsections of the image each of which is windowed using typically about a 40% cosine-bell rolloff to black. The windowing is done to help assure that each subsection conforms to the Fourier Transform assumption that the image is periodic. The negative log is applied to this running average, which is then stretched to span the full dynamic range. Finally, this result is treated as the real component and combined with a black image for the imaginary component and inverse transformed back to the spatial domain. The name cepstrum is derived from the word spectrum, but with the first four letters reversed. It is in some sense a spectrum formed backwards. Any alpha channel on the image will be removed automatically before processing. For lens defocus, the cepstrum should produce a white ring in a generally dark background. The diameter of the white ring is equivalent to twice the diameter of the defocus amount. For motion blur, the cepstrum should produce an array of dots on a line oriented at the angle of the motion blur. The distance between the two dots closest and on each side of the center of the cepstrum image is equivalent to twice the amount of motion blur. ARGUMENTS: -s size ... SIZE of sub-regions used to generate the cepstrum expressed as percent of original image dimensions. Values are integers such that 0<size<100. The default=25 -o overlap ... OVERLAP is the percent overlap of the sub-regions used to generate the cepstrum. Values are integers such that 0<=overlap<100. Zero indicates that the sub-regions do not overlap. The default=50. The number of regions processed will be approximately ((100/overlap)*(100/size)-1)^2. With size=25 and overlap=50, this amounts to approximate 49 regions. -r rolloff ... ROLLOFF is the cosine-bell shaped windowing fuction rolloff in percent of the image dimensions used to taper the sub-regions from full image intensities to black near its edges. Values are integers such that 0<rolloff<100. The default=40. -c constant ... CONSTANT is the multiplier value used in the log enhancement. Smaller values attenuate noise more than larger values. Values are integers>0. The default=10000 -G ... Creates GRAYSCALE cepstrum by converting the input image to grayscale before processing. REQUIREMENTS: IM version 6.5.4-7 or higher, but compiled with HDRI enabled in any quantum level of Q8, Q16 or Q32. Also requires the FFTW delegate library. 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. |
15 pixel Lens Defocus |
||
Blurred Input |
Arguments: |
Red Circle Overlaid |
15 Pixel Motion Blur At -45 Degree Angle to Horizontal |
||
Blurred Input |
Arguments: |
Red Line Overlaid |
What the script does is as follows:
See the script for actual code details. |