I am testing Sean Burke's FFT routines now under IM 6.4.0-3 Q16-HDRI as we are finding that we can go only so far with examples without HDRI. Some things like deblurring seem to need HDRI and floating point accuracy. In particular the FFT can produce image pairs that are either the real and imaginary components or the magnitude and phase components. The real, imaginary and phase components will have negative values and also very small ranges of values. For example, the phase image will range from -pi to +pi (-3.14 to +3.13). In Q16-HDRI, if I understand correctly, the maximum value will be 65535. So 3 out of 65535 is very small and other values will be even smaller. Furthermore, we have negative values. I am trying to prototype some deblurring processes (remove motion blur or lens defocus) and need to do some complicated mathematical operations which include divides of the fft of the image by the fft of the filter. The real and imaginary and phase components of the FFT have negative values and I do not know what to expect from -fx. Can someone please clarify how -fx handles negatives in a Q16-hdri environment? Normally (non-HDRI) -fx treats the image as ranging from 0 to 1. In a Q16-HDRI environment will it treat the image as ranging from -1 to +1?
Similarly, if I am dividing two FFT components (e.g magnitude of image by magnitude of filter) and the denominator image is very small, the result may be larger than 1. What happens in this case?
Would either of these situations be mitigated by using Q32-hdri?
Thanks.
Fred
How does -fx handle negative values under Q16-HDRI?
Re: How does -fx handle negative values under Q16-HDRI?
HDRI support implies support for values outside the normal [0 .. QuantumRange] range which allows for negative pixel values and values greater than 65535 for Q16. Fx values are normalized by QuantumScale which implies a range of [0 .. 1] except for HDRI which permits Fx values to go negative or greater than 1. If you find a specific algorithm that is not behavin' properly under HDRI, let us know and be sure to associate an example with your post so we can reproduce the problem.
Regarding FFT. It is reasonable to require that FFT support depend on HDRI support. That is, when the routines are ready we can make them conditional on the --enable-hdri configure script command line option. The configure script might have a new option, --enable-fft, that complains if --enable-hdri is not also set.
Regarding FFT. It is reasonable to require that FFT support depend on HDRI support. That is, when the routines are ready we can make them conditional on the --enable-hdri configure script command line option. The configure script might have a new option, --enable-fft, that complains if --enable-hdri is not also set.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How does -fx handle negative values under Q16-HDRI?
Thanks.
But with HDRI are image values still divided by quantum-range or are the values left unchanged when used by -fx?
With regard to FFT, we do not need it to be restricted to HDRI as much of it will work fine without if one used magnitude and phase as both can be made to be restricted to positive values and scaled in a way that can be unscaled during the IFT, i.e. see my testing/examples page. Normal mask filtering and gaussian type filters are fine without HDRI. It is when doing deblurring and normalized cross correlation that it appears that we need both more resolution and negative values as it looks like we have to do the processing using real and imaginary components. If you want to restrict FFT that outputs real and imaginary to HDRI that might be OK. Otherwise, I would probably leave it up to the user and documentation to identify that HDRI would be needed for processing when using real and imaginary and non-HDRI would be fine for processing using magnitude and phase.
We can discuss this later in more detail when I can get deblurring and normalized cross correlation to work or show that I cannot do so with -fx.
But with HDRI are image values still divided by quantum-range or are the values left unchanged when used by -fx?
With regard to FFT, we do not need it to be restricted to HDRI as much of it will work fine without if one used magnitude and phase as both can be made to be restricted to positive values and scaled in a way that can be unscaled during the IFT, i.e. see my testing/examples page. Normal mask filtering and gaussian type filters are fine without HDRI. It is when doing deblurring and normalized cross correlation that it appears that we need both more resolution and negative values as it looks like we have to do the processing using real and imaginary components. If you want to restrict FFT that outputs real and imaginary to HDRI that might be OK. Otherwise, I would probably leave it up to the user and documentation to identify that HDRI would be needed for processing when using real and imaginary and non-HDRI would be fine for processing using magnitude and phase.
We can discuss this later in more detail when I can get deblurring and normalized cross correlation to work or show that I cannot do so with -fx.