Page 1 of 1

Negative floats

Posted: 2007-10-10T18:14:55-07:00
by seanburke1979
Hey all.
I am working with Fred Weinhaus on the Fourier routines and I have hit another snag. (Fred caught this one...).
A standard Fourier transform will produce positive *and* negative values. I assume that any Float/Double image I create with ConstituteImage will lose its negative values. This is definitely the case for a non-HDRI build. Do any of you HDRI gurus know whether sign is preserved with ConstitueImage? If not, should I scale it and pass back a different structure (eg. one that could hold a "min" and "max" value? The other option is to just return a double array and pass the problem on to the next developer. :)

Any thoughts?

Sean Burke

Re: Negative floats

Posted: 2007-10-10T18:24:47-07:00
by magick
ConstituteImage() accepts doubles and floats and should preserve negative values as long as HDRI is enabled. To keep the negative values when writing to an external format on disk you would need a HDRI format such as EXR, PFM, TIFF, or MIFF to preserve values outside the normal range of [0 .. QuantumRange]. If you are using the ImageMagick MagickCore or MagickWand API's it would be more efficient to call one of the direct pixel methods such as SetImagePixels() rather than calling ConstituteImage().