HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
(Nonlinear range remapping for contrast preservation)

Functions

ImageBuf OIIO_API ImageBufAlgo::rangecompress (const ImageBuf &src, bool useluma=false, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API ImageBufAlgo::rangeexpand (const ImageBuf &src, bool useluma=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API ImageBufAlgo::rangecompress (ImageBuf &dst, const ImageBuf &src, bool useluma=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API ImageBufAlgo::rangeexpand (ImageBuf &dst, const ImageBuf &src, bool useluma=false, ROI roi={}, int nthreads=0)
 

Detailed Description

Nonlinear range remapping for contrast preservation

rangecompress() returns (or copy into dst) all pixels and color channels of src within region roi (defaulting to all the defined pixels of dst), rescaling their range with a logarithmic transformation. Alpha and z channels are not transformed.

rangeexpand() performs the inverse transformation (logarithmic back into linear).

If useluma is true, the luma of channels [roi.chbegin..roi.chbegin+2] (presumed to be R, G, and B) are used to compute a single scale factor for all color channels, rather than scaling all channels individually (which could result in a color shift).

The purpose of these function is as follows: Some image operations (such as resizing with a "good" filter that contains negative lobes) can have objectionable artifacts when applied to images with very high-contrast regions involving extra bright pixels (such as highlights in HDR captured or rendered images). By compressing the range pixel values, then performing the operation, then expanding the range of the result again, the result can be much more pleasing (even if not exactly correct).

Function Documentation

ImageBuf OIIO_API ImageBufAlgo::rangecompress ( const ImageBuf src,
bool  useluma = false,
ROI  roi = {},
int  nthreads = 0 
)
bool OIIO_API ImageBufAlgo::rangecompress ( ImageBuf dst,
const ImageBuf src,
bool  useluma = false,
ROI  roi = {},
int  nthreads = 0 
)
ImageBuf OIIO_API ImageBufAlgo::rangeexpand ( const ImageBuf src,
bool  useluma = false,
ROI  roi = {},
int  nthreads = 0 
)
bool OIIO_API ImageBufAlgo::rangeexpand ( ImageBuf dst,
const ImageBuf src,
bool  useluma = false,
ROI  roi = {},
int  nthreads = 0 
)