Page 1 of 1
fft syntax
Posted: 2016-06-22T03:02:01-07:00
by geoland
I'm attempting to reproduce the notch filtering demo on the fft page and playing with mask creation ATM - the twig image example.
How should I write the last line as a one-liner?
Code: Select all
convert LOGO.png -fft +delete -colorspace gray -auto-level -evaluate log 100000 logo_spectrum.png
convert logo_spectrum_mask.png logo_spectrum.png -compose difference -composite -threshold 0 -negate logo_spectrum_mask1.png
convert LOGO.png -fft \
\( -clone 0 logo_spectrum_mask1.png -compose multiply -composite \) \
-swap 0 +delete -ift logo_filtered.png
Re: fft syntax
Posted: 2016-06-22T09:51:56-07:00
by fmw42
I do not understand what you want to do. You talk about the twig image, but your code says LOGO.png? This is confusing. Also you say you want to write the last line (presumably of your code example) as a one-liner, but it is already one line. Please clarify your question in more detail. I do not see where you create the mask image and I do not see where you have saved the phase image.
Re: fft syntax
Posted: 2016-06-22T15:05:48-07:00
by geoland
Thanks fwm42.
I am following the procedure from the fft notch filtering example. In my previous post twigs was replaced with logo - my test image.
All I want to do is remove \ from the syntax and put each expression on a single line and avoid newlines - this was simple enough with the first two convert commands, but produced errors with the third.
Eventually, this process will be included in a bash script. The manual masking will be performed using IMs display. Once the masking is complete the script will continue. Early days yet, but I would like to avoid newlines if I can. I think the third expression is correct but when running in a terminal complains about the first (
"Lets try this on an another example. This time on a "Twigs" image found on the RoboRealm website, which contains an irregular pattern of horizontal and vertical stripes."
"Again we extract a grey-scale spectrum image, just as we did before."
Code: Select all
convert twigs_spectrum_edited.png twigs_spectrum.png -compose difference -composite -threshold 0 -negate twigs_spectrum_mask.png
"Again we mask out the parts using a image editor, this time using a 'blue' color (it really doesn't matter which color is used)..." the manual masking
Code: Select all
convert twigs_spectrum_edited.png twigs_spectrum.png -compose difference -composite -threshold 0 -negate twigs_spectrum_mask.png
"Now we again multiply the mask with the FFT magnitude image, and reconstruct the image"
Code: Select all
convert twigs.jpg -fft \( -clone 0 twigs_spectrum_mask.png -compose multiply -composite \) -swap 0 +delete -ift twigs_filtered.png
Re: fft syntax
Posted: 2016-06-22T15:12:49-07:00
by fmw42
You should be able to remove newline slashes without a change in the result.
Re: fft syntax
Posted: 2016-06-22T16:18:43-07:00
by fmw42
On IM 6.9.4.9 Q16 Mac OSX, I get exactly the same results from:
Code: Select all
convert twigs.jpg -fft \
\( -clone 0 twigs_spectrum_mask.png -compose multiply -composite \) \
-swap 0 +delete -ift twigs_filtered1.png
Code: Select all
convert twigs.jpg -fft \( -clone 0 twigs_spectrum_mask.png -compose multiply -composite \) -swap 0 +delete -ift twigs_filtered2.png
Code: Select all
compare -metric rmse twigs_filtered1.png twigs_filtered2.png null:
0 (0)
Re: fft syntax
Posted: 2016-06-22T21:10:41-07:00
by geoland
Thanks. I'll take another look.