HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
(Converting complex to polar and back)

Functions

ImageBuf OIIO_API ImageBufAlgo::complex_to_polar (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API ImageBufAlgo::complex_to_polar (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API ImageBufAlgo::polar_to_complex (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API ImageBufAlgo::polar_to_complex (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 

Detailed Description

Converting complex to polar and back

The polar_to_complex() function transforms a 2-channel image whose channels are interpreted as complex values (real and imaginary components) into the equivalent values expressed in polar form of amplitude and phase (with phase between 0 and $ 2\pi $.

The complex_to_polar() function performs the reverse transformation, converting from polar values (amplitude and phase) to complex (real and imaginary).

In either case, the section of src denoted by roi is transformed, storing the result in dst. If roi is not defined, it will be all of src's pixels. Only the first two channels of src will be transformed.

The transformation between the two representations are:

real = amplitude * cos(phase);
imag = amplitude * sin(phase);

amplitude = hypot (real, imag);
phase = atan2 (imag, real);  

Function Documentation

ImageBuf OIIO_API ImageBufAlgo::complex_to_polar ( const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)
bool OIIO_API ImageBufAlgo::complex_to_polar ( ImageBuf dst,
const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)
ImageBuf OIIO_API ImageBufAlgo::polar_to_complex ( const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)
bool OIIO_API ImageBufAlgo::polar_to_complex ( ImageBuf dst,
const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)