fft not working in IM 6.6.2.2 HDRI
Posted: 2010-06-05T16:24:20-07:00
IM 6.6.2.2 Q16 HDRI Mac OSX Tiger.
I was just notified that several of my scripts for processing images with FFT are not working. I don't know how many releases this has been a problem since I have not tested FFT (either in HDRI or non-HDRI in a while). I am not sure if these are related to recent changes in HDRI to do clipping or changes in the way you do rounding (recent topics in the forum).
There are several issues
1) output image types that do not support multi-images, such as pfm (png), no longer create the second image automatically from either -fft or +fft without adding +adjoin. This was not the case earlier. However, I can modify my scripts to deal with that if it is something hard to put back. Let me know.
2) A simple round trip (using either -fft -ift or +fft +ift) with no stored intermediate images seems to work fine.
input: square31.png
convert square31.png -fft -ift square31_fftmp_rt.png
compare -metric rmse square31.png square31_fftmp_rt.png null:
0 (0)
convert square31.png +fft +ift square31_fftri_rt.png
compare -metric rmse square31.png square31_fftri_rt.png null:
0 (0)
3) However when saving an output image with -fft and looking at the results there are issues:
convert square31.png -fft +adjoin square31_fft_mp.png
convert square31_fft_mp-0.png -evaluate log 10000 square31_fft_mp_spec10000.png
The phase image (-1) looks like this:
and it should look like this:
The spectrum generated from the magnitude (log processed as the magnitude is too dark) looks like this:
but it should look more like this:
4) When doing a round trip with -fft -ift (for magnitude and phase) and saving the intermediate results as pfm or miff, the result seems fine, EVEN THOUGH THERE SEEMS TO BE A PROBLEM WITH MAG/PHASE AS DESCRIBED IN 3) above. Don't understand this.
convert square31.png -fft +adjoin square31_fft_mp.pfm
convert square31_fft_mp-0.pfm square31_fft_mp-1.pfm -ift square31_fft_mp_rt_pfm.png
compare -metric rmse square31.png square31_fft_mp_rt_pfm.png null:
0 (0)
likewise with miff
convert square31.png -fft square31_fft_mp.miff
convert square31_fft_mp.miff -ift square31_fft_mp_rt_miff.png
compare -metric rmse square31.png square31_fft_mp_rt_miff.png null:
0 (0)
5) But it fails terribly when using +fft +ift (for real and imaginary)
convert square31.png +fft +adjoin square31_fft_ri.pfm
convert square31_fft_ri-0.pfm square31_fft_ri-1.pfm -ift square31_fft_ri_rt_pfm.png
compare -metric rmse square31.png square31_fft_ri_rt_pfm.png null:
8230.5 (0.125589)
likewise with miff
convert square31.png +fft square31_fft_ri.miff
convert square31_fft_ri.miff -ift square31_fft_ri_rt_miff.png
compare -metric rmse square31.png square31_fft_ri_rt_miff.png null:
8230.5 (0.125589)
Let me know what I can do to help track this down further or test any fixes.
Fred
I was just notified that several of my scripts for processing images with FFT are not working. I don't know how many releases this has been a problem since I have not tested FFT (either in HDRI or non-HDRI in a while). I am not sure if these are related to recent changes in HDRI to do clipping or changes in the way you do rounding (recent topics in the forum).
There are several issues
1) output image types that do not support multi-images, such as pfm (png), no longer create the second image automatically from either -fft or +fft without adding +adjoin. This was not the case earlier. However, I can modify my scripts to deal with that if it is something hard to put back. Let me know.
2) A simple round trip (using either -fft -ift or +fft +ift) with no stored intermediate images seems to work fine.
input: square31.png
convert square31.png -fft -ift square31_fftmp_rt.png
compare -metric rmse square31.png square31_fftmp_rt.png null:
0 (0)
convert square31.png +fft +ift square31_fftri_rt.png
compare -metric rmse square31.png square31_fftri_rt.png null:
0 (0)
3) However when saving an output image with -fft and looking at the results there are issues:
convert square31.png -fft +adjoin square31_fft_mp.png
convert square31_fft_mp-0.png -evaluate log 10000 square31_fft_mp_spec10000.png
The phase image (-1) looks like this:
and it should look like this:
The spectrum generated from the magnitude (log processed as the magnitude is too dark) looks like this:
but it should look more like this:
4) When doing a round trip with -fft -ift (for magnitude and phase) and saving the intermediate results as pfm or miff, the result seems fine, EVEN THOUGH THERE SEEMS TO BE A PROBLEM WITH MAG/PHASE AS DESCRIBED IN 3) above. Don't understand this.
convert square31.png -fft +adjoin square31_fft_mp.pfm
convert square31_fft_mp-0.pfm square31_fft_mp-1.pfm -ift square31_fft_mp_rt_pfm.png
compare -metric rmse square31.png square31_fft_mp_rt_pfm.png null:
0 (0)
likewise with miff
convert square31.png -fft square31_fft_mp.miff
convert square31_fft_mp.miff -ift square31_fft_mp_rt_miff.png
compare -metric rmse square31.png square31_fft_mp_rt_miff.png null:
0 (0)
5) But it fails terribly when using +fft +ift (for real and imaginary)
convert square31.png +fft +adjoin square31_fft_ri.pfm
convert square31_fft_ri-0.pfm square31_fft_ri-1.pfm -ift square31_fft_ri_rt_pfm.png
compare -metric rmse square31.png square31_fft_ri_rt_pfm.png null:
8230.5 (0.125589)
likewise with miff
convert square31.png +fft square31_fft_ri.miff
convert square31_fft_ri.miff -ift square31_fft_ri_rt_miff.png
compare -metric rmse square31.png square31_fft_ri_rt_miff.png null:
8230.5 (0.125589)
Let me know what I can do to help track this down further or test any fixes.
Fred