HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageBufAlgo Namespace Reference

Classes

struct  PixelStats
 
struct  CompareResults
 

Typedefs

typedef parallel_options parallel_image_options
 

Enumerations

enum  TextAlignX { TextAlignX::Left, TextAlignX::Right, TextAlignX::Center }
 
enum  TextAlignY { TextAlignY::Baseline, TextAlignY::Top, TextAlignY::Bottom, TextAlignY::Center }
 
enum  NonFiniteFixMode { NONFINITE_NONE = 0, NONFINITE_BLACK = 1, NONFINITE_BOX3 = 2, NONFINITE_ERROR = 100 }
 
enum  MakeTextureMode {
  MakeTxTexture, MakeTxShadow, MakeTxEnvLatl, MakeTxEnvLatlFromLightProbe,
  MakeTxBumpWithSlopes, _MakeTxLast
}
 
enum  IBAprep_flags {
  IBAprep_DEFAULT = 0, IBAprep_REQUIRE_ALPHA = 1<<0, IBAprep_REQUIRE_Z = 1<<1, IBAprep_REQUIRE_SAME_NCHANNELS = 1<<2,
  IBAprep_NO_COPY_ROI_FULL = 1<<3, IBAprep_NO_SUPPORT_VOLUME = 1<<4, IBAprep_NO_COPY_METADATA = 1<<8, IBAprep_COPY_ALL_METADATA = 1<<9,
  IBAprep_CLAMP_MUTUAL_NCHANNELS = 1<<10, IBAprep_SUPPORT_DEEP = 1<<11, IBAprep_DEEP_MIXED = 1<<12, IBAprep_DST_FLOAT_PIXELS = 1<<13,
  IBAprep_MINIMIZE_NCHANNELS = 1<<14, IBAprep_REQUIRE_MATCHING_CHANNELS = 1<<15, IBAprep_MERGE_METADATA = 1 << 16
}
 

Functions

ImageBuf OIIO_API zero (ROI roi, int nthreads=0)
 
bool OIIO_API zero (ImageBuf &dst, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API fill (cspan< float > values, ROI roi, int nthreads=0)
 
ImageBuf OIIO_API fill (cspan< float > top, cspan< float > bottom, ROI roi, int nthreads=0)
 
ImageBuf OIIO_API fill (cspan< float > topleft, cspan< float > topright, cspan< float > bottomleft, cspan< float > bottomright, ROI roi, int nthreads=0)
 
bool OIIO_API fill (ImageBuf &dst, cspan< float > values, ROI roi={}, int nthreads=0)
 
bool OIIO_API fill (ImageBuf &dst, cspan< float > top, cspan< float > bottom, ROI roi={}, int nthreads=0)
 
bool OIIO_API fill (ImageBuf &dst, cspan< float > topleft, cspan< float > topright, cspan< float > bottomleft, cspan< float > bottomright, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API checker (int width, int height, int depth, cspan< float > color1, cspan< float > color2, int xoffset, int yoffset, int zoffset, ROI roi, int nthreads=0)
 
bool OIIO_API checker (ImageBuf &dst, int width, int height, int depth, cspan< float > color1, cspan< float > color2, int xoffset=0, int yoffset=0, int zoffset=0, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API noise (string_view noisetype, float A=0.0f, float B=0.1f, bool mono=false, int seed=0, ROI roi={}, int nthreads=0)
 
bool OIIO_API noise (ImageBuf &dst, string_view noisetype, float A=0.0f, float B=0.1f, bool mono=false, int seed=0, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
OIIO_API const ImageBufbluenoise_image ()
 
bool OIIO_API render_point (ImageBuf &dst, int x, int y, cspan< float > color=1.0f, ROI roi={}, int nthreads=0)
 
bool OIIO_API render_line (ImageBuf &dst, int x1, int y1, int x2, int y2, cspan< float > color=1.0f, bool skip_first_point=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API render_box (ImageBuf &dst, int x1, int y1, int x2, int y2, cspan< float > color=1.0f, bool fill=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API render_text (ImageBuf &dst, int x, int y, string_view text, int fontsize=16, string_view fontname="", cspan< float > textcolor=1.0f, TextAlignX alignx=TextAlignX::Left, TextAlignY aligny=TextAlignY::Baseline, int shadow=0, ROI roi={}, int nthreads=0)
 
ROI OIIO_API text_size (string_view text, int fontsize=16, string_view fontname="")
 
ImageBuf OIIO_API channels (const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
 
bool OIIO_API channels (ImageBuf &dst, const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API channel_append (const ImageBuf &A, const ImageBuf &B, ROI roi={}, int nthreads=0)
 
bool OIIO_API channel_append (ImageBuf &dst, const ImageBuf &A, const ImageBuf &B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API copy (const ImageBuf &src, TypeDesc convert=TypeUnknown, ROI roi={}, int nthreads=0)
 
bool OIIO_API copy (ImageBuf &dst, const ImageBuf &src, TypeDesc convert=TypeUnknown, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API crop (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API crop (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API cut (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API cut (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
bool OIIO_API paste (ImageBuf &dst, int xbegin, int ybegin, int zbegin, int chbegin, const ImageBuf &src, ROI srcroi={}, int nthreads=0)
 
ImageBuf OIIO_API rotate90 (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API rotate180 (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API rotate270 (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API rotate90 (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API rotate180 (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API rotate270 (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API flip (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API flop (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API transpose (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API flip (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API flop (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API transpose (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API reorient (const ImageBuf &src, int nthreads=0)
 
bool OIIO_API reorient (ImageBuf &dst, const ImageBuf &src, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API circular_shift (const ImageBuf &src, int xshift, int yshift, int zshift=0, ROI roi={}, int nthreads=0)
 
bool OIIO_API circular_shift (ImageBuf &dst, const ImageBuf &src, int xshift, int yshift, int zshift=0, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API rotate (const ImageBuf &src, float angle, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API rotate (const ImageBuf &src, float angle, Filter2D *filter, bool recompute_roi=false, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API rotate (const ImageBuf &src, float angle, float center_x, float center_y, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API rotate (const ImageBuf &src, float angle, float center_x, float center_y, Filter2D *filter, bool recompute_roi=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API rotate (ImageBuf &dst, const ImageBuf &src, float angle, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API rotate (ImageBuf &dst, const ImageBuf &src, float angle, Filter2D *filter, bool recompute_roi=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API rotate (ImageBuf &dst, const ImageBuf &src, float angle, float center_x, float center_y, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API rotate (ImageBuf &dst, const ImageBuf &src, float angle, float center_x, float center_y, Filter2D *filter, bool recompute_roi=false, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API resize (const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API resize (const ImageBuf &src, Filter2D *filter, ROI roi={}, int nthreads=0)
 
bool OIIO_API resize (ImageBuf &dst, const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
 
bool OIIO_API resize (ImageBuf &dst, const ImageBuf &src, Filter2D *filter, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API resample (const ImageBuf &src, bool interpolate=true, ROI roi={}, int nthreads=0)
 
bool OIIO_API resample (ImageBuf &dst, const ImageBuf &src, bool interpolate=true, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API fit (const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, string_view fillmode="letterbox", bool exact=false, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API fit (const ImageBuf &src, Filter2D *filter, string_view fillmode="letterbox", bool exact=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API fit (ImageBuf &dst, const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, string_view fillmode="letterbox", bool exact=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API fit (ImageBuf &dst, const ImageBuf &src, Filter2D *filter, string_view fillmode="letterbox", bool exact=false, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API fit (const ImageBuf &src, string_view filtername, float filterwidth, bool exact, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API fit (const ImageBuf &src, Filter2D *filter, bool exact, ROI roi={}, int nthreads=0)
 
bool OIIO_API fit (ImageBuf &dst, const ImageBuf &src, string_view filtername, float filterwidth, bool exact, ROI roi={}, int nthreads=0)
 
bool OIIO_API fit (ImageBuf &dst, const ImageBuf &src, Filter2D *filter, bool exact, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API warp (const ImageBuf &src, const Imath::M33f &M, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ImageBuf::WrapMode wrap=ImageBuf::WrapDefault, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API warp (const ImageBuf &src, const Imath::M33f &M, const Filter2D *filter, bool recompute_roi=false, ImageBuf::WrapMode wrap=ImageBuf::WrapDefault, ROI roi={}, int nthreads=0)
 
bool OIIO_API warp (ImageBuf &dst, const ImageBuf &src, const Imath::M33f &M, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ImageBuf::WrapMode wrap=ImageBuf::WrapDefault, ROI roi={}, int nthreads=0)
 
bool OIIO_API warp (ImageBuf &dst, const ImageBuf &src, const Imath::M33f &M, const Filter2D *filter, bool recompute_roi=false, ImageBuf::WrapMode wrap=ImageBuf::WrapDefault, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API add (Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 
bool OIIO_API add (ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API sub (Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 
bool OIIO_API sub (ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API absdiff (Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 
bool OIIO_API absdiff (ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API abs (const ImageBuf &A, ROI roi={}, int nthreads=0)
 Compute per-pixel absolute value abs(A), returning the result image. More...
 
bool OIIO_API abs (ImageBuf &dst, const ImageBuf &A, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API mul (Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 
bool OIIO_API mul (ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API div (Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 
bool OIIO_API div (ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API mad (Image_or_Const A, Image_or_Const B, Image_or_Const C, ROI roi={}, int nthreads=0)
 
bool OIIO_API mad (ImageBuf &dst, Image_or_Const A, Image_or_Const B, Image_or_Const C, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API over (const ImageBuf &A, const ImageBuf &B, ROI roi={}, int nthreads=0)
 
bool OIIO_API over (ImageBuf &dst, const ImageBuf &A, const ImageBuf &B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API zover (const ImageBuf &A, const ImageBuf &B, bool z_zeroisinf=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API zover (ImageBuf &dst, const ImageBuf &A, const ImageBuf &B, bool z_zeroisinf=false, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API invert (const ImageBuf &A, ROI roi={}, int nthreads=0)
 
bool OIIO_API invert (ImageBuf &dst, const ImageBuf &A, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API pow (const ImageBuf &A, cspan< float > B, ROI roi={}, int nthreads=0)
 
bool OIIO_API pow (ImageBuf &dst, const ImageBuf &A, cspan< float > B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API channel_sum (const ImageBuf &src, cspan< float > weights=1.0f, ROI roi={}, int nthreads=0)
 
bool OIIO_API channel_sum (ImageBuf &dst, const ImageBuf &src, cspan< float > weights=1.0f, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API max (Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 
bool OIIO_API max (ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API min (Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 
bool OIIO_API min (ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API clamp (const ImageBuf &src, cspan< float > min=-std::numeric_limits< float >::max(), cspan< float > max=std::numeric_limits< float >::max(), bool clampalpha01=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API clamp (ImageBuf &dst, const ImageBuf &src, cspan< float > min=-std::numeric_limits< float >::max(), cspan< float > max=std::numeric_limits< float >::max(), bool clampalpha01=false, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API maxchan (const ImageBuf &A, ROI roi={}, int nthreads=0)
 
bool OIIO_API maxchan (ImageBuf &dst, const ImageBuf &A, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API minchan (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API minchan (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
OIIO_API ImageBuf contrast_remap (const ImageBuf &src, cspan< float > black=0.0f, cspan< float > white=1.0f, cspan< float > min=0.0f, cspan< float > max=1.0f, cspan< float > scontrast=1.0f, cspan< float > sthresh=0.5f, ROI={}, int nthreads=0)
 
OIIO_API bool contrast_remap (ImageBuf &dst, const ImageBuf &src, cspan< float > black=0.0f, cspan< float > white=1.0f, cspan< float > min=0.0f, cspan< float > max=1.0f, cspan< float > scontrast=1.0f, cspan< float > sthresh=0.5f, ROI={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API saturate (const ImageBuf &src, float scale=0.0f, int firstchannel=0, ROI roi={}, int nthreads=0)
 
bool OIIO_API saturate (ImageBuf &dst, const ImageBuf &src, float scale=0.0f, int firstchannel=0, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API color_map (const ImageBuf &src, int srcchannel, int nknots, int channels, cspan< float > knots, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API color_map (const ImageBuf &src, int srcchannel, string_view mapname, ROI roi={}, int nthreads=0)
 
bool OIIO_API color_map (ImageBuf &dst, const ImageBuf &src, int srcchannel, int nknots, int channels, cspan< float > knots, ROI roi={}, int nthreads=0)
 
bool OIIO_API color_map (ImageBuf &dst, const ImageBuf &src, int srcchannel, string_view mapname, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API rangecompress (const ImageBuf &src, bool useluma=false, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API rangeexpand (const ImageBuf &src, bool useluma=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API rangecompress (ImageBuf &dst, const ImageBuf &src, bool useluma=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API rangeexpand (ImageBuf &dst, const ImageBuf &src, bool useluma=false, ROI roi={}, int nthreads=0)
 
PixelStats OIIO_API computePixelStats (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API computePixelStats (PixelStats &stats, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
CompareResults OIIO_API compare (const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, ROI roi={}, int nthreads=0)
 
int OIIO_API compare_Yee (const ImageBuf &A, const ImageBuf &B, CompareResults &result, float luminance=100, float fov=45, ROI roi={}, int nthreads=0)
 
bool OIIO_API compare (const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, CompareResults &result, ROI roi={}, int nthreads=0)
 
OIIO_API bool isConstantColor (const ImageBuf &src, float threshold=0.0f, span< float > color={}, ROI roi={}, int nthreads=0)
 
bool isConstantColor (const ImageBuf &src, span< float > color, ROI roi={}, int nthreads=0)
 
OIIO_API bool isConstantChannel (const ImageBuf &src, int channel, float val, float threshold=0.0f, ROI roi={}, int nthreads=0)
 
bool isConstantChannel (const ImageBuf &src, int channel, float val, ROI roi, int nthreads=0)
 
OIIO_API bool isMonochrome (const ImageBuf &src, float threshold=0.0f, ROI roi={}, int nthreads=0)
 
bool isMonochrome (const ImageBuf &src, ROI roi, int nthreads=0)
 
bool OIIO_API color_count (const ImageBuf &src, imagesize_t *count, int ncolors, cspan< float > color, cspan< float > eps=0.001f, ROI roi={}, int nthreads=0)
 
bool OIIO_API color_range_check (const ImageBuf &src, imagesize_t *lowcount, imagesize_t *highcount, imagesize_t *inrangecount, cspan< float > low, cspan< float > high, ROI roi={}, int nthreads=0)
 
OIIO_API ROI nonzero_region (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
std::string OIIO_API computePixelHashSHA1 (const ImageBuf &src, string_view extrainfo="", ROI roi={}, int blocksize=0, int nthreads=0)
 
OIIO_API std::vector< imagesize_thistogram (const ImageBuf &src, int channel=0, int bins=256, float min=0.0f, float max=1.0f, bool ignore_empty=false, ROI roi={}, int nthreads=0)
 
bool OIIO_API histogram (const ImageBuf &src, int channel, std::vector< imagesize_t > &histogram, int bins=256, float min=0, float max=1, imagesize_t *submin=nullptr, imagesize_t *supermax=nullptr, ROI roi={})
 DEPRECATED(1.9) More...
 
bool OIIO_API histogram_draw (ImageBuf &dst, const std::vector< imagesize_t > &histogram)
 
ImageBuf OIIO_API make_kernel (string_view name, float width, float height, float depth=1.0f, bool normalize=true)
 
bool make_kernel (ImageBuf &dst, string_view name, float width, float height, float depth=1.0f, bool normalize=true)
 
ImageBuf OIIO_API convolve (const ImageBuf &src, const ImageBuf &kernel, bool normalize=true, ROI roi={}, int nthreads=0)
 
bool OIIO_API convolve (ImageBuf &dst, const ImageBuf &src, const ImageBuf &kernel, bool normalize=true, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API laplacian (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API laplacian (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API fft (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API ifft (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API fft (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API ifft (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API complex_to_polar (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API complex_to_polar (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API polar_to_complex (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API polar_to_complex (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API fixNonFinite (const ImageBuf &src, NonFiniteFixMode mode=NONFINITE_BOX3, int *pixelsFixed=nullptr, ROI roi={}, int nthreads=0)
 
bool OIIO_API fixNonFinite (ImageBuf &dst, const ImageBuf &src, NonFiniteFixMode mode=NONFINITE_BOX3, int *pixelsFixed=nullptr, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API fillholes_pushpull (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API fillholes_pushpull (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API median_filter (const ImageBuf &src, int width=3, int height=-1, ROI roi={}, int nthreads=0)
 
bool OIIO_API median_filter (ImageBuf &dst, const ImageBuf &src, int width=3, int height=-1, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API unsharp_mask (const ImageBuf &src, string_view kernel="gaussian", float width=3.0f, float contrast=1.0f, float threshold=0.0f, ROI roi={}, int nthreads=0)
 
bool OIIO_API unsharp_mask (ImageBuf &dst, const ImageBuf &src, string_view kernel="gaussian", float width=3.0f, float contrast=1.0f, float threshold=0.0f, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API dilate (const ImageBuf &src, int width=3, int height=-1, ROI roi={}, int nthreads=0)
 
bool OIIO_API dilate (ImageBuf &dst, const ImageBuf &src, int width=3, int height=-1, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API erode (const ImageBuf &src, int width=3, int height=-1, ROI roi={}, int nthreads=0)
 
bool OIIO_API erode (ImageBuf &dst, const ImageBuf &src, int width=3, int height=-1, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API colorconvert (const ImageBuf &src, string_view fromspace, string_view tospace, bool unpremult=true, string_view context_key="", string_view context_value="", ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 Transform between named color spaces, returning an ImageBuf result. More...
 
ImageBuf OIIO_API colorconvert (const ImageBuf &src, const ColorProcessor *processor, bool unpremult, ROI roi={}, int nthreads=0)
 Transform using a ColorProcessor, returning an ImageBuf result. More...
 
bool OIIO_API colorconvert (ImageBuf &dst, const ImageBuf &src, string_view fromspace, string_view tospace, bool unpremult=true, string_view context_key="", string_view context_value="", ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 Transform between named color spaces, storing reults into an existing ImageBuf. More...
 
bool OIIO_API colorconvert (ImageBuf &dst, const ImageBuf &src, const ColorProcessor *processor, bool unpremult, ROI roi={}, int nthreads=0)
 Transform using a ColorProcessor, storing reults into an existing ImageBuf. More...
 
bool OIIO_API colorconvert (span< float > color, const ColorProcessor *processor, bool unpremult)
 
bool colorconvert (float *color, int nchannels, const ColorProcessor *processor, bool unpremult)
 
ImageBuf OIIO_API colormatrixtransform (const ImageBuf &src, const Imath::M44f &M, bool unpremult=true, ROI roi={}, int nthreads=0)
 
bool OIIO_API colormatrixtransform (ImageBuf &dst, const ImageBuf &src, const Imath::M44f &M, bool unpremult=true, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API ociolook (const ImageBuf &src, string_view looks, string_view fromspace, string_view tospace, bool unpremult=true, bool inverse=false, string_view context_key="", string_view context_value="", ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 
bool OIIO_API ociolook (ImageBuf &dst, const ImageBuf &src, string_view looks, string_view fromspace, string_view tospace, bool unpremult=true, bool inverse=false, string_view context_key="", string_view context_value="", ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API ociodisplay (const ImageBuf &src, string_view display, string_view view, string_view fromspace="", string_view looks="", bool unpremult=true, string_view context_key="", string_view context_value="", ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 
bool OIIO_API ociodisplay (ImageBuf &dst, const ImageBuf &src, string_view display, string_view view, string_view fromspace="", string_view looks="", bool unpremult=true, string_view context_key="", string_view context_value="", ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API ociofiletransform (const ImageBuf &src, string_view name, bool unpremult=true, bool inverse=false, ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 
bool OIIO_API ociofiletransform (ImageBuf &dst, const ImageBuf &src, string_view name, bool unpremult=true, bool inverse=false, ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API unpremult (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API unpremult (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API premult (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API premult (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API repremult (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API repremult (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API make_texture (MakeTextureMode mode, const ImageBuf &input, string_view outputfilename, const ImageSpec &config, std::ostream *outstream=nullptr)
 Version of make_texture that starts with an ImageBuf. More...
 
bool OIIO_API make_texture (MakeTextureMode mode, string_view filename, string_view outputfilename, const ImageSpec &config, std::ostream *outstream=nullptr)
 
bool OIIO_API make_texture (MakeTextureMode mode, const std::vector< std::string > &filenames, string_view outputfilename, const ImageSpec &config, std::ostream *outstream=nullptr)
 
OIIO_API ImageBuf from_OpenCV (const cv::Mat &mat, TypeDesc convert=TypeUnknown, ROI roi={}, int nthreads=0)
 
OIIO_API bool to_OpenCV (cv::Mat &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API capture_image (int cameranum=0, TypeDesc convert=TypeUnknown)
 
bool capture_image (ImageBuf &dst, int cameranum=0, TypeDesc convert=TypeUnknown)
 
ImageBuf OIIO_API deepen (const ImageBuf &src, float zvalue=1.0f, ROI roi={}, int nthreads=0)
 
bool OIIO_API deepen (ImageBuf &dst, const ImageBuf &src, float zvalue=1.0f, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API flatten (const ImageBuf &src, ROI roi={}, int nthreads=0)
 
bool OIIO_API flatten (ImageBuf &dst, const ImageBuf &src, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API deep_merge (const ImageBuf &A, const ImageBuf &B, bool occlusion_cull=true, ROI roi={}, int nthreads=0)
 
bool OIIO_API deep_merge (ImageBuf &dst, const ImageBuf &A, const ImageBuf &B, bool occlusion_cull=true, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
ImageBuf OIIO_API deep_holdout (const ImageBuf &src, const ImageBuf &holdout, ROI roi={}, int nthreads=0)
 
bool OIIO_API deep_holdout (ImageBuf &dst, const ImageBuf &src, const ImageBuf &holdout, ROI roi={}, int nthreads=0)
 Write to an existing image dst (allocating if it is uninitialized). More...
 
bool fill (ImageBuf &dst, const float *values, ROI roi={}, int nthreads=0)
 
bool fill (ImageBuf &dst, const float *top, const float *bottom, ROI roi={}, int nthreads=0)
 
bool fill (ImageBuf &dst, const float *topleft, const float *topright, const float *bottomleft, const float *bottomright, ROI roi={}, int nthreads=0)
 
bool checker (ImageBuf &dst, int width, int height, int depth, const float *color1, const float *color2, int xoffset=0, int yoffset=0, int zoffset=0, ROI roi={}, int nthreads=0)
 
bool add (ImageBuf &dst, const ImageBuf &A, const float *B, ROI roi={}, int nthreads=0)
 
bool sub (ImageBuf &dst, const ImageBuf &A, const float *B, ROI roi={}, int nthreads=0)
 
bool absdiff (ImageBuf &dst, const ImageBuf &A, const float *B, ROI roi={}, int nthreads=0)
 
bool mul (ImageBuf &dst, const ImageBuf &A, const float *B, ROI roi={}, int nthreads=0)
 
bool div (ImageBuf &dst, const ImageBuf &A, const float *B, ROI roi={}, int nthreads=0)
 
bool mad (ImageBuf &dst, const ImageBuf &A, const float *B, const ImageBuf &C, ROI roi={}, int nthreads=0)
 
bool mad (ImageBuf &dst, const ImageBuf &A, const ImageBuf &B, const float *C, ROI roi={}, int nthreads=0)
 
bool mad (ImageBuf &dst, const ImageBuf &A, const float *B, const float *C, ROI roi={}, int nthreads=0)
 
bool pow (ImageBuf &dst, const ImageBuf &A, const float *B, ROI roi={}, int nthreads=0)
 
bool channel_sum (ImageBuf &dst, const ImageBuf &src, const float *weights=nullptr, ROI roi={}, int nthreads=0)
 
bool channels (ImageBuf &dst, const ImageBuf &src, int nchannels, const int *channelorder, const float *channelvalues=nullptr, const std::string *newchannelnames=nullptr, bool shuffle_channel_names=false, int nthreads=0)
 
bool clamp (ImageBuf &dst, const ImageBuf &src, const float *min=nullptr, const float *max=nullptr, bool clampalpha01=false, ROI roi={}, int nthreads=0)
 
bool isConstantColor (const ImageBuf &src, float *color, ROI roi={}, int nthreads=0)
 
bool color_count (const ImageBuf &src, imagesize_t *count, int ncolors, const float *color, const float *eps=nullptr, ROI roi={}, int nthreads=0)
 
bool color_range_check (const ImageBuf &src, imagesize_t *lowcount, imagesize_t *highcount, imagesize_t *inrangecount, const float *low, const float *high, ROI roi={}, int nthreads=0)
 
bool render_text (ImageBuf &dst, int x, int y, string_view text, int fontsize, string_view fontname, const float *textcolor)
 
void parallel_image (ROI roi, parallel_options opt, std::function< void(ROI)> f)
 
void parallel_image (ROI roi, std::function< void(ROI)> f)
 
template<class Func >
void parallel_image (Func f, ROI roi, int nthreads=0, SplitDir splitdir=Split_Y)
 
bool OIIO_API IBAprep (ROI &roi, ImageBuf *dst, const ImageBuf *A=NULL, const ImageBuf *B=NULL, const ImageBuf *C=NULL, ImageSpec *force_spec=NULL, int prepflags=0)
 
bool IBAprep (ROI &roi, ImageBuf *dst, const ImageBuf *A, const ImageBuf *B, ImageSpec *force_spec, int prepflags=0)
 
bool IBAprep (ROI &roi, ImageBuf *dst, const ImageBuf *A, const ImageBuf *B, int prepflags)
 
bool IBAprep (ROI &roi, ImageBuf *dst, const ImageBuf *A, int prepflags)
 
TypeDesc::BASETYPE OIIO_API type_merge (TypeDesc::BASETYPE a, TypeDesc::BASETYPE b)
 
TypeDesc type_merge (TypeDesc a, TypeDesc b)
 
TypeDesc type_merge (TypeDesc a, TypeDesc b, TypeDesc c)
 

Typedef Documentation

Enumeration Type Documentation

Enumerator
IBAprep_DEFAULT 
IBAprep_REQUIRE_ALPHA 
IBAprep_REQUIRE_Z 
IBAprep_REQUIRE_SAME_NCHANNELS 
IBAprep_NO_COPY_ROI_FULL 
IBAprep_NO_SUPPORT_VOLUME 
IBAprep_NO_COPY_METADATA 
IBAprep_COPY_ALL_METADATA 
IBAprep_CLAMP_MUTUAL_NCHANNELS 
IBAprep_SUPPORT_DEEP 
IBAprep_DEEP_MIXED 
IBAprep_DST_FLOAT_PIXELS 
IBAprep_MINIMIZE_NCHANNELS 
IBAprep_REQUIRE_MATCHING_CHANNELS 
IBAprep_MERGE_METADATA 

Definition at line 143 of file imagebufalgo_util.h.

Enumerator
MakeTxTexture 
MakeTxShadow 
MakeTxEnvLatl 
MakeTxEnvLatlFromLightProbe 
MakeTxBumpWithSlopes 
_MakeTxLast 

Definition at line 1991 of file imagebufalgo.h.

Enumerator
NONFINITE_NONE 

Do not alter the pixels (but do count the number of nonfinite pixels in *pixelsFixed, if non-null).

NONFINITE_BLACK 

Replace non-finite values with 0.0.

NONFINITE_BOX3 

Replace non-finite values with the average value of any finite pixels in a 3x3 window.

NONFINITE_ERROR 

EReturn false (error), but don't change any values, if any nonfinite values are found.

Definition at line 1569 of file imagebufalgo.h.

Enumerator
Left 
Right 
Center 

Definition at line 324 of file imagebufalgo.h.

Enumerator
Baseline 
Top 
Bottom 
Center 

Definition at line 325 of file imagebufalgo.h.

Function Documentation

ImageBuf OIIO_API ImageBufAlgo::abs ( const ImageBuf A,
ROI  roi = {},
int  nthreads = 0 
)

Compute per-pixel absolute value abs(A), returning the result image.

bool OIIO_API ImageBufAlgo::abs ( ImageBuf dst,
const ImageBuf A,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::absdiff ( Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Compute per-pixel absolute difference abs(A - B), returning the result image.

A and B may each either be an ImageBuf&, or a cspan<float> giving a per- channel constant, or a single constant used for all channels. (But at least one must be an image.)

bool OIIO_API ImageBufAlgo::absdiff ( ImageBuf dst,
Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::absdiff ( ImageBuf dst,
const ImageBuf A,
const float B,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2398 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::add ( Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Compute per-pixel sum A + B, returning the result image.

A and B may each either be an ImageBuf&, or a cspan<float> giving a per- channel constant, or a single constant used for all channels. (But at least one must be an image.)

Examples:
COP2/COP2_MultiInputWipe.C, and COP2/COP2_MultiInputWipe.h.
bool OIIO_API ImageBufAlgo::add ( ImageBuf dst,
Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::add ( ImageBuf dst,
const ImageBuf A,
const float B,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2390 of file imagebufalgo.h.

OIIO_API const ImageBuf& ImageBufAlgo::bluenoise_image ( )

Return a const reference to a periodic bluenoise texture with float data in 4 channels that are uncorrelated to each other. Note that unlike most other ImageBufAlgo functions, it does not return an ImageBuf by value, but by const reference.

ImageBuf OIIO_API ImageBufAlgo::capture_image ( int  cameranum = 0,
TypeDesc  convert = TypeUnknown 
)

Capture a still image from a designated camera. If able to do so, store the image in dst and return true. If there is no such device, or support for camera capture is not available (such as if OpenCV support was not enabled at compile time), return false and do not alter dst.

bool ImageBufAlgo::capture_image ( ImageBuf dst,
int  cameranum = 0,
TypeDesc  convert = TypeUnknown 
)
inline

Definition at line 2255 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::channel_append ( const ImageBuf A,
const ImageBuf B,
ROI  roi = {},
int  nthreads = 0 
)

Append the channels of A and B together into dst over the region of interest. If the region passed is uninitialized (the default), it will be interpreted as being the union of the pixel windows of A and B (and all channels of both images). If dst is not already initialized, it will be resized to be big enough for the region.

bool OIIO_API ImageBufAlgo::channel_append ( ImageBuf dst,
const ImageBuf A,
const ImageBuf B,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::channel_sum ( const ImageBuf src,
cspan< float weights = 1.0f,
ROI  roi = {},
int  nthreads = 0 
)

Converts a multi-channel image into a one-channel image via a weighted sum of channels:

(channel[0]*weight[0] + channel[1]*weight[1] + ...)

returning the resulting one-channel image. The weights, if not supplied, default to { 1, 1, 1, ... }).

bool OIIO_API ImageBufAlgo::channel_sum ( ImageBuf dst,
const ImageBuf src,
cspan< float weights = 1.0f,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::channel_sum ( ImageBuf dst,
const ImageBuf src,
const float weights = nullptr,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2428 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::channels ( const ImageBuf src,
int  nchannels,
cspan< int channelorder,
cspan< float channelvalues = {},
cspan< std::string newchannelnames = {},
bool  shuffle_channel_names = false,
int  nthreads = 0 
)

Generic channel shuffling: return (or store in dst) a copy of src, but with channels in the order channelorder[0..nchannels-1] (or set to a constant value, designated by channelorder[i] = -1 and having the fill value in channelvalues[i]. In-place operation is allowed (i.e., dst and src the same image, but an extra copy will occur).

Parameters
nchannelsThe total number of channels that will be set up in the dst image.
channelorderFor each channel in dst, the index of he src channel from which to copy. Any channelorder[i] < 0 indicates that the channel i should be filled with constant value channelvalues[i] rather than copy any channel from src. If channelorder itself is empty, the implied channel order will be {0, 1, ..., nchannels-1}, meaning that it's only renaming, truncating, or extending channels, not reordering the channels that are already present.
channelvaluesFill values for color channels in which channelorder[i] < 0. This can be empty if no channels are to be filled with constant values.
newchannelnamesAn array of new channel names. Channels for which this specifies an empty string will have their name taken from the src channel that was copied. If newchannelnames is entirely empty, all channel names will simply be copied from src.
shuffle_channel_namesIf true, the channel names will be taken from the corresponding channels of the source image – be careful with this, shuffling both channel ordering and their names could result in no semantic change at all, if you catch the drift. If false (the default), the resulting dst image will have default channel names in the usual order ("R", "G", etc.).
Examples:
SOP/SOP_BouncyAgent.C.
bool OIIO_API ImageBufAlgo::channels ( ImageBuf dst,
const ImageBuf src,
int  nchannels,
cspan< int channelorder,
cspan< float channelvalues = {},
cspan< std::string newchannelnames = {},
bool  shuffle_channel_names = false,
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::channels ( ImageBuf dst,
const ImageBuf src,
int  nchannels,
const int channelorder,
const float channelvalues = nullptr,
const std::string newchannelnames = nullptr,
bool  shuffle_channel_names = false,
int  nthreads = 0 
)
inline

Definition at line 2435 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::checker ( int  width,
int  height,
int  depth,
cspan< float color1,
cspan< float color2,
int  xoffset,
int  yoffset,
int  zoffset,
ROI  roi,
int  nthreads = 0 
)

Create a checkerboard pattern of size given by roi, with origin given by the offset values, checker size given by the width, height, depth values, and alternating between color1[] and color2[]. The pattern is defined in abstract "image space" independently of the pixel data window of dst or the ROI.

bool OIIO_API ImageBufAlgo::checker ( ImageBuf dst,
int  width,
int  height,
int  depth,
cspan< float color1,
cspan< float color2,
int  xoffset = 0,
int  yoffset = 0,
int  zoffset = 0,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::checker ( ImageBuf dst,
int  width,
int  height,
int  depth,
const float color1,
const float color2,
int  xoffset = 0,
int  yoffset = 0,
int  zoffset = 0,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2381 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::circular_shift ( const ImageBuf src,
int  xshift,
int  yshift,
int  zshift = 0,
ROI  roi = {},
int  nthreads = 0 
)

Return a subregion of src, but circularly shifting by the given amount. To clarify, the circular shift of [0,1,2,3,4,5] by +2 is [4,5,0,1,2,3].

bool OIIO_API ImageBufAlgo::circular_shift ( ImageBuf dst,
const ImageBuf src,
int  xshift,
int  yshift,
int  zshift = 0,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::clamp ( ImageBuf dst,
const ImageBuf src,
const float min = nullptr,
const float max = nullptr,
bool  clampalpha01 = false,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2447 of file imagebufalgo.h.

bool OIIO_API ImageBufAlgo::color_count ( const ImageBuf src,
imagesize_t count,
int  ncolors,
cspan< float color,
cspan< float eps = 0.001f,
ROI  roi = {},
int  nthreads = 0 
)

Count how many pixels in the ROI match a list of colors. The colors to match are in:

colors[0 ... nchans-1]
colors[nchans ... 2*nchans-1]
...
colors[(ncolors-1)*nchans ... (ncolors*nchans)-1]

and so on, a total of ncolors consecutively stored colors of nchans channels each (nchans is the number of channels in the image, itself, it is not passed as a parameter).

eps[0..nchans-1] are the error tolerances for a match, for each channel. Setting eps[c] = numeric_limits<float>max() will effectively make it ignore the channel. The default eps is 0.001 for all channels (this value is chosen because it requires exact matches for 8 bit images, but allows a wee bit of imprecision for float images.

Upon success, return true and store the number of pixels that matched each color count[0..ncolors-1]. If there is an error, returns false and sets an appropriate error message set in src.

bool ImageBufAlgo::color_count ( const ImageBuf src,
imagesize_t count,
int  ncolors,
const float color,
const float eps = nullptr,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2462 of file imagebufalgo.h.

bool OIIO_API ImageBufAlgo::color_range_check ( const ImageBuf src,
imagesize_t lowcount,
imagesize_t highcount,
imagesize_t inrangecount,
cspan< float low,
cspan< float high,
ROI  roi = {},
int  nthreads = 0 
)

Count how many pixels in the image (within the ROI) are outside the value range described by low[roi.chbegin..roi.chend-1] and high[roi.chbegin..roi.chend-1] as the low and high acceptable values for each color channel.

The number of pixels containing values that fall below the lower bound will be stored in *lowcount, the number of pixels containing values that fall above the upper bound will be stored in *highcount, and the number of pixels for which all channels fell within the bounds will be stored in *inrangecount. Any of these may be NULL, which simply means that the counts need not be collected or stored.

bool ImageBufAlgo::color_range_check ( const ImageBuf src,
imagesize_t lowcount,
imagesize_t highcount,
imagesize_t inrangecount,
const float low,
const float high,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2472 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::colormatrixtransform ( const ImageBuf src,
const Imath::M44f M,
bool  unpremult = true,
ROI  roi = {},
int  nthreads = 0 
)

Return a copy of the pixels of src within the ROI, applying a color transform specified by a 4x4 matrix. In-place operations (dst == src) are supported.

The first three channels are presumed to be the color to be transformed, and the fourth channel (if it exists) is presumed to be alpha. Any additional channels will be simply copied unaltered.

Parameters
MA 4x4 matrix. Following Imath conventions, the color is a row vector and the matrix has the "translation" part in elements [12..14] (matching the memory layout of OpenGL or RenderMan), so the math is color * Matrix (NOT M*c).
unpremultIf true, unpremultiply the image (divide the RGB channels by alpha if it exists and is nonzero) before color conversion, then repremult after the after the color conversion. Passing unpremult=false skips this step, which may be desirable if you know that the image is "unassociated alpha" (a.k.a., "not pre-multiplied colors").
Version
2.1+
bool OIIO_API ImageBufAlgo::colormatrixtransform ( ImageBuf dst,
const ImageBuf src,
const Imath::M44f M,
bool  unpremult = true,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

CompareResults OIIO_API ImageBufAlgo::compare ( const ImageBuf A,
const ImageBuf B,
float  failthresh,
float  warnthresh,
ROI  roi = {},
int  nthreads = 0 
)

Numerically compare two images. The difference threshold (for any individual color channel in any pixel) for a "failure" is failthresh, and for a "warning" is warnthresh. The results are stored in result. If roi is defined, pixels will be compared for the pixel and channel range that is specified. If roi is not defined, the comparison will be for all channels, on the union of the defined pixel windows of the two images (for either image, undefined pixels will be assumed to be black).

bool OIIO_API ImageBufAlgo::compare ( const ImageBuf A,
const ImageBuf B,
float  failthresh,
float  warnthresh,
CompareResults &  result,
ROI  roi = {},
int  nthreads = 0 
)
int OIIO_API ImageBufAlgo::compare_Yee ( const ImageBuf A,
const ImageBuf B,
CompareResults &  result,
float  luminance = 100,
float  fov = 45,
ROI  roi = {},
int  nthreads = 0 
)

Compare two images using Hector Yee's perceptual metric, returning the number of pixels that fail the comparison. Only the first three channels (or first three channels specified by roi) are compared. Free parameters are the ambient luminance in the room and the field of view of the image display; our defaults are probably reasonable guesses for an office environment. The 'result' structure will store the maxerror, and the maxx, maxy, maxz of the pixel that failed most severely. (The other fields of the CompareResults are not used for Yee comparison.)

Works for all pixel types. But it's basically meaningless if the first three channels aren't RGB in a linear color space that sort of resembles AdobeRGB.

Return true on success, false on error.

std::string OIIO_API ImageBufAlgo::computePixelHashSHA1 ( const ImageBuf src,
string_view  extrainfo = "",
ROI  roi = {},
int  blocksize = 0,
int  nthreads = 0 
)

Compute the SHA-1 byte hash for all the pixels in the specifed region of the image. If blocksize > 0, the function will compute separate SHA-1 hashes of each blocksize batch of scanlines, then return a hash of the individual hashes. This is just as strong a hash, but will NOT match a single hash of the entire image (blocksize==0). But by breaking up the hash into independent blocks, we can parallelize across multiple threads, given by nthreads (if nthreads is 0, it will use the global OIIO thread count). The extrainfo provides additional text that will be incorporated into the hash.

PixelStats OIIO_API ImageBufAlgo::computePixelStats ( const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)

Compute statistics about the ROI of the src image, returning a PixelStats structure. Upon success, the returned vectors in the result structure will have size == src.nchannels(). If there is a failure, the vector sizes will be 0 and an error will be set in src.

bool OIIO_API ImageBufAlgo::computePixelStats ( PixelStats &  stats,
const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)
OIIO_API ImageBuf ImageBufAlgo::contrast_remap ( const ImageBuf src,
cspan< float black = 0.0f,
cspan< float white = 1.0f,
cspan< float min = 0.0f,
cspan< float max = 1.0f,
cspan< float scontrast = 1.0f,
cspan< float sthresh = 0.5f,
ROI  = {},
int  nthreads = 0 
)

Return pixel values that are a contrast-remap of the corresponding values of the src image, transforming pixel value domain [black, white] to range [min, max], either linearly or with optional application of a smooth sigmoidal remapping (if scontrast != 1.0).

The following steps are performed, in order:

  1. Linearly rescale values [black, white] to [0, 1].
  2. If scontrast != 1, apply a sigmoidal remapping where a larger scontrast value makes a steeper slope, and the steepest part is at value sthresh (relative to the new remapped value after steps 1 & 2; the default is 0.5).
  3. Rescale the range of that result: 0.0 -> min and 1.0 -> max.

Values outside of the [black,white] range will be extrapolated to outside [min,max], so it may be prudent to apply a clamp() to the results.

The black, white, min, max, scontrast, sthresh parameters may each either be a single float value for all channels, or a span giving per-channel values.

You can use this function for a simple linear contrast remapping of [black, white] to [min, max] if you use the default values for sthresh. Or just a simple sigmoidal contrast stretch within the [0,1] range if you leave all other parameters at their defaults, or a combination of these effects. Note that if black == white, the result will be a simple binary thresholding where values < black map to min and values >= black map to max.

OIIO_API bool ImageBufAlgo::contrast_remap ( ImageBuf dst,
const ImageBuf src,
cspan< float black = 0.0f,
cspan< float white = 1.0f,
cspan< float min = 0.0f,
cspan< float max = 1.0f,
cspan< float scontrast = 1.0f,
cspan< float sthresh = 0.5f,
ROI  = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::convolve ( const ImageBuf src,
const ImageBuf kernel,
bool  normalize = true,
ROI  roi = {},
int  nthreads = 0 
)

Return the convolution of src and a kernel. If roi is not defined, it defaults to the full size src. If normalized is true, the kernel will be normalized for the convolution, otherwise the original values will be used.

bool OIIO_API ImageBufAlgo::convolve ( ImageBuf dst,
const ImageBuf src,
const ImageBuf kernel,
bool  normalize = true,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized). If roi is not defined, it defaults to the full size of dst (or src, if dst was uninitialized). If dst is uninitialized, it will be allocated to be the size specified by roi.

ImageBuf OIIO_API ImageBufAlgo::copy ( const ImageBuf src,
TypeDesc  convert = TypeUnknown,
ROI  roi = {},
int  nthreads = 0 
)

Return the specified region of pixels of src as specified by roi (which will default to the whole of src, optionally with the pixel type overridden by convert (if it is not TypeUnknown).

bool OIIO_API ImageBufAlgo::copy ( ImageBuf dst,
const ImageBuf src,
TypeDesc  convert = TypeUnknown,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized). If dst is not already initialized, it will be set to the same size as roi (defaulting to all of src)

ImageBuf OIIO_API ImageBufAlgo::crop ( const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)

Return the specified region of src as an image, without altering its position in the image plane.

Pixels from src which are outside roi will not be copied, and new black pixels will be added for regions of roi which were outside the data window of src.

Note that the crop operation does not actually move the pixels on the image plane or adjust the full/display window; it merely restricts which pixels are copied from src to dst. (Note the difference compared to cut()).

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

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::cut ( const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)

Return the designated region of src, but repositioned to the image origin and with the full/display window set to exactly cover the new pixel data window. (Note the difference compared to crop()).

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

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::deep_holdout ( const ImageBuf src,
const ImageBuf holdout,
ROI  roi = {},
int  nthreads = 0 
)

Return the samples of deep image src that are closer than the opaque frontier of deep image holdout, returning true upon success and false for any failures. Samples of src that are farther than the first opaque sample of holdout (for the corresponding pixel)will not be copied to dst. Image holdout is only used as the depth threshold; no sample values from holdout are themselves copied to dst.

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

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::deep_merge ( const ImageBuf A,
const ImageBuf B,
bool  occlusion_cull = true,
ROI  roi = {},
int  nthreads = 0 
)

Return the deep merge of the samples of deep images A and B, overwriting any existing samples of dst in the ROI. If occlusion_cull is true, any samples occluded by an opaque sample will be deleted.

bool OIIO_API ImageBufAlgo::deep_merge ( ImageBuf dst,
const ImageBuf A,
const ImageBuf B,
bool  occlusion_cull = true,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::deepen ( const ImageBuf src,
float  zvalue = 1.0f,
ROI  roi = {},
int  nthreads = 0 
)

Return the "deep" equivalent of the "flat" input src. Turning a flat image into a deep one means:

  • If the src image has a "Z" channel: if the source pixel's Z channel value is not infinite, the corresponding pixel of dst will get a single depth sample that copies the data from the source pixel; otherwise, dst will get an empty pixel. In other words, infinitely far pixels will not turn into deep samples.
  • If the src image lacks a "Z" channel: if any of the source pixel's channel values are nonzero, the corresponding pixel of dst will get a single depth sample that copies the data from the source pixel and uses the zvalue parameter for the depth; otherwise, if all source channels in that pixel are zero, the destination pixel will get no depth samples.

If src is already a deep image, it will just copy pixel values from src.

bool OIIO_API ImageBufAlgo::deepen ( ImageBuf dst,
const ImageBuf src,
float  zvalue = 1.0f,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::dilate ( const ImageBuf src,
int  width = 3,
int  height = -1,
ROI  roi = {},
int  nthreads = 0 
)

Return a dilated version of the corresponding region of src. Dilation is defined as the maximum value of all pixels under nonzero values of the structuring element (which is taken to be a width x height square). If height is not set, it will default to be the same as width. Dilation makes bright features wider and more prominent, dark features thinner, and removes small isolated dark spots.

bool OIIO_API ImageBufAlgo::dilate ( ImageBuf dst,
const ImageBuf src,
int  width = 3,
int  height = -1,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::div ( Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Compute per-pixel division A / B, returning the result image. Division by zero is defined to result in zero.

A is always an image, and B is either an image or a cspan<float> giving a per-channel constant or a single constant used for all channels.

bool OIIO_API ImageBufAlgo::div ( ImageBuf dst,
Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::div ( ImageBuf dst,
const ImageBuf A,
const float B,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2406 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::erode ( const ImageBuf src,
int  width = 3,
int  height = -1,
ROI  roi = {},
int  nthreads = 0 
)

Return an eroded version of the corresponding region of src. Erosion is defined as the minimum value of all pixels under nonzero values of the structuring element (which is taken to be a width x height square). If height is not set, it will default to be the same as width. Erosion makes dark features wider, bright features thinner, and removes small isolated bright spots.

bool OIIO_API ImageBufAlgo::erode ( ImageBuf dst,
const ImageBuf src,
int  width = 3,
int  height = -1,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::fill ( ImageBuf dst,
const float values,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2363 of file imagebufalgo.h.

bool ImageBufAlgo::fill ( ImageBuf dst,
const float top,
const float bottom,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2368 of file imagebufalgo.h.

bool ImageBufAlgo::fill ( ImageBuf dst,
const float topleft,
const float topright,
const float bottomleft,
const float bottomright,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2373 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::fillholes_pushpull ( const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)

Copy the specified ROI of src and fill any holes (pixels where alpha < 1) with plausible values using a push-pull technique. The src image must have an alpha channel. The dst image will end up with a copy of src, but will have an alpha of 1.0 everywhere within roi, and any place where the alpha of src was < 1, dst will have a pixel color that is a plausible "filling" of the original alpha hole.

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

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::fixNonFinite ( const ImageBuf src,
NonFiniteFixMode  mode = NONFINITE_BOX3,
int pixelsFixed = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

fixNonFinite() returns in image containing the values of src (within the ROI), while repairing any non-finite (NaN/Inf) pixels. If pixelsFixed is not nullptr, store in it the number of pixels that contained non-finite value. It is permissible to operate in-place (with src and dst referring to the same image).

How the non-finite values are repaired is specified by one of the mode parameter, which is an enum of NonFiniteFixMode.

This function works on all pixel data types, though it's just a copy for images with pixel data types that cannot represent NaN or Inf values.

bool OIIO_API ImageBufAlgo::fixNonFinite ( ImageBuf dst,
const ImageBuf src,
NonFiniteFixMode  mode = NONFINITE_BOX3,
int pixelsFixed = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::flatten ( const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)

Return the "flattened" composite of deep image src. That is, it converts a deep image to a simple flat image by front-to- back compositing the samples within each pixel. If src is already a non-deep/flat image, it will just copy pixel values from src to dst. If dst is not already an initialized ImageBuf, it will be sized to match src (but made non-deep).

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

Write to an existing image dst (allocating if it is uninitialized).

OIIO_API ImageBuf ImageBufAlgo::from_OpenCV ( const cv::Mat &  mat,
TypeDesc  convert = TypeUnknown,
ROI  roi = {},
int  nthreads = 0 
)

Convert an OpenCV cv::Mat into an ImageBuf, copying the pixels (optionally converting to the pixel data type specified by convert, if not UNKNOWN, which means to preserve the original data type if possible). Return true if ok, false if it couldn't figure out how to make the conversion from Mat to ImageBuf. If OpenImageIO was compiled without OpenCV support, this function will return an empty image with error message set.

OIIO_API std::vector<imagesize_t> ImageBufAlgo::histogram ( const ImageBuf src,
int  channel = 0,
int  bins = 256,
float  min = 0.0f,
float  max = 1.0f,
bool  ignore_empty = false,
ROI  roi = {},
int  nthreads = 0 
)

Compute a histogram of src, for the given channel and ROI. Return a vector of length bins that contains the counts of how many pixel values were in each of bins equally spaced bins covering the range of values [min,max]. Values < min count for bin 0, values > max count for bin nbins-1. If ignore_empty is true, no counts will be incremented for any pixels whose value is 0 in all channels.

If there was an error, the returned vector will be empty, and an error message will be retrievable from src.geterror().

bool OIIO_API ImageBufAlgo::histogram ( const ImageBuf src,
int  channel,
std::vector< imagesize_t > &  histogram,
int  bins = 256,
float  min = 0,
float  max = 1,
imagesize_t submin = nullptr,
imagesize_t supermax = nullptr,
ROI  roi = {} 
)

DEPRECATED(1.9)

bool OIIO_API ImageBufAlgo::histogram_draw ( ImageBuf dst,
const std::vector< imagesize_t > &  histogram 
)
bool OIIO_API ImageBufAlgo::IBAprep ( ROI roi,
ImageBuf dst,
const ImageBuf A = NULL,
const ImageBuf B = NULL,
const ImageBuf C = NULL,
ImageSpec force_spec = NULL,
int  prepflags = 0 
)

Common preparation for IBA functions: Given an ROI (which may or may not be the default ROI::All()), destination image (which may or may not yet be allocated), and optional input images, adjust roi if necessary and allocate pixels for dst if necessary. If dst is already initialized, it will keep its "full" (aka display) window, otherwise its full/display window will be set to the union of A's and B's full/display windows. If dst is uninitialized and force_spec is not NULL, use *force_spec as dst's new spec rather than using A's. Also, if A or B inputs are specified but not initialized or broken, it's an error so return false. If all is ok, return true. Some additional checks and behaviors may be specified by the 'prepflags', which is a bit field defined by IBAprep_flags.

bool ImageBufAlgo::IBAprep ( ROI roi,
ImageBuf dst,
const ImageBuf A,
const ImageBuf B,
ImageSpec force_spec,
int  prepflags = 0 
)
inline

Definition at line 129 of file imagebufalgo_util.h.

bool ImageBufAlgo::IBAprep ( ROI roi,
ImageBuf dst,
const ImageBuf A,
const ImageBuf B,
int  prepflags 
)
inline

Definition at line 134 of file imagebufalgo_util.h.

bool ImageBufAlgo::IBAprep ( ROI roi,
ImageBuf dst,
const ImageBuf A,
int  prepflags 
)
inline

Definition at line 138 of file imagebufalgo_util.h.

ImageBuf OIIO_API ImageBufAlgo::invert ( const ImageBuf A,
ROI  roi = {},
int  nthreads = 0 
)

Compute per-pixel value inverse 1.0 - A (which you can think of as roughly meaning switching white and black), returning the result image.

Tips for callers: (1) You probably want to set roi to restrict the operation to only the color channels, and not accidentally include alpha, z, or others. (2) There may be situations where you want to unpremult() before the invert, then premult() the result, so that you are computing the inverse of the unmasked color.

bool OIIO_API ImageBufAlgo::invert ( ImageBuf dst,
const ImageBuf A,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

OIIO_API bool ImageBufAlgo::isConstantChannel ( const ImageBuf src,
int  channel,
float  val,
float  threshold = 0.0f,
ROI  roi = {},
int  nthreads = 0 
)

Does the requested channel have a given value (within a tolerance of +/- threshold) for every channel within the ROI? (For this function, the ROI's chbegin/chend are ignored.) Return true if so, otherwise return false. If roi is not defined (the default), it will be understood to be all of the defined pixels and channels of source.

bool ImageBufAlgo::isConstantChannel ( const ImageBuf src,
int  channel,
float  val,
ROI  roi,
int  nthreads = 0 
)
inline

Definition at line 1303 of file imagebufalgo.h.

OIIO_API bool ImageBufAlgo::isConstantColor ( const ImageBuf src,
float  threshold = 0.0f,
span< float color = {},
ROI  roi = {},
int  nthreads = 0 
)

Do all pixels within the ROI have the same values for channels [roi.chbegin..roi.chend-1], within a tolerance of +/- threshold? If so, return true and store that color in color[chbegin...chend-1] (if color is not empty); otherwise return false. If roi is not defined (the default), it will be understood to be all of the defined pixels and channels of source.

bool ImageBufAlgo::isConstantColor ( const ImageBuf src,
span< float color,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 1287 of file imagebufalgo.h.

bool ImageBufAlgo::isConstantColor ( const ImageBuf src,
float color,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2456 of file imagebufalgo.h.

OIIO_API bool ImageBufAlgo::isMonochrome ( const ImageBuf src,
float  threshold = 0.0f,
ROI  roi = {},
int  nthreads = 0 
)

Is the image monochrome within the ROI, i.e., for every pixel within the region, do all channels [roi.chbegin, roi.chend) have the same value (within a tolerance of +/- threshold)? If roi is not defined (the default), it will be understood to be all of the defined pixels and channels of source.

bool ImageBufAlgo::isMonochrome ( const ImageBuf src,
ROI  roi,
int  nthreads = 0 
)
inline

Definition at line 1318 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::laplacian ( const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)

Return the Laplacian of the corresponding region of src. The Laplacian is the generalized second derivative of the image

\[ \frac{\partial^2 s}{\partial x^2} + \frac{\partial^2 s}{\partial y^2} \]

which is approximated by convolving the image with a discrete 3x3 Laplacian kernel,

                [ 0  1  0 ]
                [ 1 -4  1 ]
                [ 0  1  0 ]
bool OIIO_API ImageBufAlgo::laplacian ( ImageBuf dst,
const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::mad ( Image_or_Const  A,
Image_or_Const  B,
Image_or_Const  C,
ROI  roi = {},
int  nthreads = 0 
)

Compute per-pixel multiply-and-add A * B + C, returning the result image.

A, B, and C are each either an image, or a cspan<float> giving a per-channel constant or a single constant used for all channels. (Note: at least one must be an image.)

bool OIIO_API ImageBufAlgo::mad ( ImageBuf dst,
Image_or_Const  A,
Image_or_Const  B,
Image_or_Const  C,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::mad ( ImageBuf dst,
const ImageBuf A,
const float B,
const ImageBuf C,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2410 of file imagebufalgo.h.

bool ImageBufAlgo::mad ( ImageBuf dst,
const ImageBuf A,
const ImageBuf B,
const float C,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2414 of file imagebufalgo.h.

bool ImageBufAlgo::mad ( ImageBuf dst,
const ImageBuf A,
const float B,
const float C,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2418 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::make_kernel ( string_view  name,
float  width,
float  height,
float  depth = 1.0f,
bool  normalize = true 
)

Make a 1-channel float image of the named kernel. The size of the image will be big enough to contain the kernel given its size (width x height) and rounded up to odd resolution so that the center of the kernel can be at the center of the middle pixel. The kernel image will be offset so that its center is at the (0,0) coordinate. If normalize is true, the values will be normalized so that they sum to 1.0. If depth > 1, a volumetric kernel will be created. Use with caution!

Kernel names can be: "gaussian", "sharp-gaussian", "box", "triangle", "blackman-harris", "mitchell", "b-spline", "catmull-rom", "lanczos3", "disk", "binomial", "laplacian".

Note that "catmull-rom" and "lanczos3" are fixed-size kernels that don't scale with the width, and are therefore probably less useful in most cases.

The ImageBuf that is returned indicates if there was an error, in which case return.has_error() will be true and return.geterror() can be used to retrieve an error message.

bool ImageBufAlgo::make_kernel ( ImageBuf dst,
string_view  name,
float  width,
float  height,
float  depth = 1.0f,
bool  normalize = true 
)
inline

Definition at line 1453 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::median_filter ( const ImageBuf src,
int  width = 3,
int  height = -1,
ROI  roi = {},
int  nthreads = 0 
)

Return a median-filtered version of the corresponding region of src. The median filter replaces each pixel with the median value underneath the width x height window surrounding it. If height <= 0, it will be set to width, making a square window.

Median filters are good for removing high-frequency detail smaller than the window size (including noise), without blurring edges that are larger than the window size.

bool OIIO_API ImageBufAlgo::median_filter ( ImageBuf dst,
const ImageBuf src,
int  width = 3,
int  height = -1,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::mul ( Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Compute per-pixel product A * B, returning the result image.

Either both A and B are images, or one is an image and the other is a cspan<float> giving a per-channel constant or a single constant used for all channels.

bool OIIO_API ImageBufAlgo::mul ( ImageBuf dst,
Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::mul ( ImageBuf dst,
const ImageBuf A,
const float B,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2402 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::noise ( string_view  noisetype,
float  A = 0.0f,
float  B = 0.1f,
bool  mono = false,
int  seed = 0,
ROI  roi = {},
int  nthreads = 0 
)

Return an image of "noise" in every pixel and channel specified by the roi. There are several noise types to choose from, and each behaves differently and has a different interpretation of the A and B parameters:

  • "gaussian" adds Gaussian (normal distribution) noise values with mean value A and standard deviation B.
  • "white" adds independent uniformly distributed values on range [A,B).
  • "uniform" (synonym for "white")
  • "blue" adds "blue noise" uniformly distributed on range [A,B) but not independent; rather, they are chosen for good spectral properties for sampling and dither.
  • "salt" changes to value A a portion of pixels given by B.

If the mono flag is true, a single noise value will be applied to all channels specified by roi, but if mono is false, a separate noise value will be computed for each channel in the region.

The random number generator is actually driven by a hash on the "image space" coordinates and channel, independently of the pixel data window of dst or the ROI. Choosing different seed values will result in a different pattern, but for the same seed value, the noise at a given pixel coordinate (x,y,z) channel c will is completely deterministic and repeatable.

Examples:
CVEX/test.vfl.
bool OIIO_API ImageBufAlgo::noise ( ImageBuf dst,
string_view  noisetype,
float  A = 0.0f,
float  B = 0.1f,
bool  mono = false,
int  seed = 0,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

OIIO_API ROI ImageBufAlgo::nonzero_region ( const ImageBuf src,
ROI  roi = {},
int  nthreads = 0 
)

Find the minimal rectangular region within roi (which defaults to the entire pixel data window of src) that consists of nonzero pixel values. In other words, gives the region that is a "shrink-wraps" of src to exclude black border pixels. Note that if the entire image was black, the ROI returned will contain no pixels.

For "deep" images, this function returns the smallest ROI that contains all pixels that contain depth samples, and excludes the border pixels that contain no depth samples at all.

ImageBuf OIIO_API ImageBufAlgo::ociodisplay ( const ImageBuf src,
string_view  display,
string_view  view,
string_view  fromspace = "",
string_view  looks = "",
bool  unpremult = true,
string_view  context_key = "",
string_view  context_value = "",
ColorConfig colorconfig = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

Return the pixels of src within the ROI, applying an OpenColorIO "display" transform to the pixel values. In-place operations (dst == src) are supported.

The first three channels are presumed to be the color to be transformed, and the fourth channel (if it exists) is presumed to be alpha. Any additional channels will be simply copied unaltered.

Parameters
displayThe OCIO "display" to apply. If this is the empty string, the default display will be used.
viewThe OCIO "view" to use. If this is the empty string, the default view for this display will be used.
fromspaceIf fromspace is not supplied, it will assume that the source color space is whatever is indicated by the source image's metadata or filename, and if that cannot be deduced, it will be assumed to be scene linear.
looksThe looks to apply (comma-separated). This may be empty, in which case no "look" is used. Note: this parameter value is not used when building against OpenColorIO 2.x.
unpremultIf true, unpremultiply the image (divide the RGB channels by alpha if it exists and is nonzero) before color conversion, then repremult after the after the color conversion. Passing unpremult=false skips this step, which may be desirable if you know that the image is "unassociated alpha" (a.k.a., "not pre-multiplied colors").
inverseIf true, it will reverse the color transformation and display application.
context_key/context_valueOptional key/value to establish a context (for example, a shot-specific transform).
colorconfigAn optional ColorConfig* specifying an OpenColorIO configuration. If not supplied, the default OpenColorIO color configuration found by examining the $OCIO environment variable will be used instead.
bool OIIO_API ImageBufAlgo::ociodisplay ( ImageBuf dst,
const ImageBuf src,
string_view  display,
string_view  view,
string_view  fromspace = "",
string_view  looks = "",
bool  unpremult = true,
string_view  context_key = "",
string_view  context_value = "",
ColorConfig colorconfig = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::ociofiletransform ( const ImageBuf src,
string_view  name,
bool  unpremult = true,
bool  inverse = false,
ColorConfig colorconfig = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

Return the pixels of src within the ROI, applying an OpenColorIO "file" transform. In-place operations (dst == src) are supported.

The first three channels are presumed to be the color to be transformed, and the fourth channel (if it exists) is presumed to be alpha. Any additional channels will be simply copied unaltered.

Parameters
nameThe name of the file containing the transform information.
unpremultIf true, unpremultiply the image (divide the RGB channels by alpha if it exists and is nonzero) before color conversion, then repremult after the after the color conversion. Passing unpremult=false skips this step, which may be desirable if you know that the image is "unassociated alpha" (a.k.a., "not pre-multiplied colors").
inverseIf true, it will reverse the color transformation.
colorconfigAn optional ColorConfig* specifying an OpenColorIO configuration. If not supplied, the default OpenColorIO color configuration found by examining the $OCIO environment variable will be used instead.
bool OIIO_API ImageBufAlgo::ociofiletransform ( ImageBuf dst,
const ImageBuf src,
string_view  name,
bool  unpremult = true,
bool  inverse = false,
ColorConfig colorconfig = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::ociolook ( const ImageBuf src,
string_view  looks,
string_view  fromspace,
string_view  tospace,
bool  unpremult = true,
bool  inverse = false,
string_view  context_key = "",
string_view  context_value = "",
ColorConfig colorconfig = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

Return a copy of the pixels of src within the ROI, applying an OpenColorIO "look" transform to the pixel values. In-place operations (dst == src) are supported.

The first three channels are presumed to be the color to be transformed, and the fourth channel (if it exists) is presumed to be alpha. Any additional channels will be simply copied unaltered.

Parameters
looksThe looks to apply (comma-separated).
fromspace/tospaceFor the varieties of colorconvert() that use named color spaces, these specify the color spaces by name.
unpremultIf true, unpremultiply the image (divide the RGB channels by alpha if it exists and is nonzero) before color conversion, then repremult after the after the color conversion. Passing unpremult=false skips this step, which may be desirable if you know that the image is "unassociated alpha" (a.k.a., "not pre-multiplied colors").
inverseIf true, it will reverse the color transformation and look application.
context_key/context_valueOptional key/value to establish a context (for example, a shot-specific transform).
colorconfigAn optional ColorConfig* specifying an OpenColorIO configuration. If not supplied, the default OpenColorIO color configuration found by examining the $OCIO environment variable will be used instead.
bool OIIO_API ImageBufAlgo::ociolook ( ImageBuf dst,
const ImageBuf src,
string_view  looks,
string_view  fromspace,
string_view  tospace,
bool  unpremult = true,
bool  inverse = false,
string_view  context_key = "",
string_view  context_value = "",
ColorConfig colorconfig = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::over ( const ImageBuf A,
const ImageBuf B,
ROI  roi = {},
int  nthreads = 0 
)

Return the composite of A over B using the Porter/Duff definition of "over", returning true upon success and false for any of a variety of failures (as described below).

A and B (and dst, if already defined/allocated) must have valid alpha channels identified by their ImageSpec alpha_channel field. If A or B do not have alpha channels (as determined by those rules) or if the number of non-alpha channels do not match between A and B, over() will fail, returning false.

If dst is not already an initialized ImageBuf, it will be sized to encompass the minimal rectangular pixel region containing the union of the defined pixels of A and B, and with a number of channels equal to the number of non-alpha channels of A and B, plus an alpha channel. However, if dst is already initialized, it will not be resized, and the "over" operation will apply to its existing pixel data window. In this case, dst must have an alpha channel designated and must have the same number of non-alpha channels as A and B, otherwise it will fail, returning false.

A, B, and dst need not perfectly overlap in their pixel data windows; pixel values of A or B that are outside their respective pixel data window will be treated as having "zero" (0,0,0...) value.

bool OIIO_API ImageBufAlgo::over ( ImageBuf dst,
const ImageBuf A,
const ImageBuf B,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

void ImageBufAlgo::parallel_image ( ROI  roi,
parallel_options  opt,
std::function< void(ROI)>  f 
)
inline

Helper template for generalized multithreading for image processing functions. Some function/functor f is applied to every pixel the region of interest roi, dividing the region into multiple threads if threads != 1. Note that threads == 0 indicates that the number of threads should be as set by the global OIIO "threads" attribute.

The optional splitdir determines along which axis the split will be made. The default is Split_Y (vertical splits), which generally seems the fastest (due to cache layout issues?), but perhaps there are algorithms where it's better to split in X, Z, or along the longest axis.

Most image operations will require additional arguments, including additional input and output images or other parameters. The parallel_image template can still be used by employing the std::bind. For example, suppose you have an image operation defined as: void my_image_op (ImageBuf &out, const ImageBuf &in, float scale, ROI roi); Then you can parallelize it as follows: ImageBuf R, A; // result, input ROI roi = get_roi (R.spec()); parallel_image (bind(my_image_op,ref(R), cref(A),3.14,_1), roi);

Definition at line 52 of file imagebufalgo_util.h.

void ImageBufAlgo::parallel_image ( ROI  roi,
std::function< void(ROI)>  f 
)
inline

Definition at line 96 of file imagebufalgo_util.h.

template<class Func >
void ImageBufAlgo::parallel_image ( Func  f,
ROI  roi,
int  nthreads = 0,
SplitDir  splitdir = Split_Y 
)

Definition at line 107 of file imagebufalgo_util.h.

bool OIIO_API ImageBufAlgo::paste ( ImageBuf dst,
int  xbegin,
int  ybegin,
int  zbegin,
int  chbegin,
const ImageBuf src,
ROI  srcroi = {},
int  nthreads = 0 
)

Copy src pixels within srcroi into the dst image, offset so that source location (0,0,0) will be copied to destination location (xbegin,ybegin,zbegin). If the srcroi is ROI::All(), the entirety of the data window of src will be used. It will copy into channels[chbegin...], as many channels as are described by srcroi. Pixels or channels of src inside srcroi will replace the corresponding destination pixels entirely, whereas src pixels outside of srcroi will not be copied and the corresponding offset pixels of dst will not be altered.

ImageBuf OIIO_API ImageBufAlgo::pow ( const ImageBuf A,
cspan< float B,
ROI  roi = {},
int  nthreads = 0 
)

Compute per-pixel raise-to-power A ^ B. returning the result image. It is permitted for dst and A to be the same image.

A is always an image, and B is either an image or a cspan<float> giving a per-channel constant or a single constant used for all channels.

Examples:
karma_procedurals/mandelbulb_intersect.vfl.
bool OIIO_API ImageBufAlgo::pow ( ImageBuf dst,
const ImageBuf A,
cspan< float B,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::pow ( ImageBuf dst,
const ImageBuf A,
const float B,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2423 of file imagebufalgo.h.

bool OIIO_API ImageBufAlgo::render_box ( ImageBuf dst,
int  x1,
int  y1,
int  x2,
int  y2,
cspan< float color = 1.0f,
bool  fill = false,
ROI  roi = {},
int  nthreads = 0 
)

Render a filled or unfilled box with corners at pixels (x1,y1) and (x2,y2) into dst, doing an "over" of the color (if it includes an alpha channel) onto the existing data in dst. The color must include as many values as roi.chend-1. The ROI can be used to limit the pixel area or channels that are modified, and default to the entirety of dst. If fill is true, the box will be completely filled in, otherwise only its outlien will be drawn.

bool OIIO_API ImageBufAlgo::render_line ( ImageBuf dst,
int  x1,
int  y1,
int  x2,
int  y2,
cspan< float color = 1.0f,
bool  skip_first_point = false,
ROI  roi = {},
int  nthreads = 0 
)

Render a line from pixel (x1,y1) to (x2,y2) into dst, doing an "over" of the color (if it includes an alpha channel) onto the existing data in dst. The color should include as many values as roi.chend-1. The ROI can be used to limit the pixel area or channels that are modified, and default to the entirety of dst. If skip_first_point is true, the first point (x1, y1) will not be drawn (this can be helpful when drawing poly-lines, to avoid double-rendering of the vertex positions).

bool OIIO_API ImageBufAlgo::render_point ( ImageBuf dst,
int  x,
int  y,
cspan< float color = 1.0f,
ROI  roi = {},
int  nthreads = 0 
)

Render a single point at (x,y) of the given color "over" the existing image dst. If there is no alpha channel, the color will be written unconditionally (as if the alpha is 1.0).

bool OIIO_API ImageBufAlgo::render_text ( ImageBuf dst,
int  x,
int  y,
string_view  text,
int  fontsize = 16,
string_view  fontname = "",
cspan< float textcolor = 1.0f,
TextAlignX  alignx = TextAlignX::Left,
TextAlignY  aligny = TextAlignY::Baseline,
int  shadow = 0,
ROI  roi = {},
int  nthreads = 0 
)

Render a text string (encoded as UTF-8) into image dst. If the dst image is not yet initialized, it will be initialized to be a black background exactly large enough to contain the rasterized text. If dst is already initialized, the text will be rendered into the existing image by essentially doing an "over" of the character into the existing pixel data.

Parameters
dstDestination ImageBuf – text is rendered into this image.
x/yThe position to place the text.
textThe text to draw. Linefeed (\n) characters are respected as indications that the text spans multiple rows.
fontsize/fontnameSize and name of the font. If the name is not a full pathname to a font file, it will search for a matching font, defaulting to some reasonable system font if not supplied at all), and with a nominal height of fontsize (in pixels).
textcolorColor for drawing the text, defaulting to opaque white (1.0,1.0,...) in all channels if not supplied. If provided, it is expected to point to a float array of length at least equal to R.spec().nchannels, or defaults will be chosen for you).
alignx/alignyThe default behavior is to align the left edge of the character baseline to (x,y). Optionally, alignx and aligny can override the alignment behavior, with horizontal alignment choices of TextAlignX::Left, Right, and Center, and vertical alignment choices of Baseline, Top, Bottom, or Center.
shadowIf nonzero, a "drop shadow" of this radius will be used to make the text look more clear by dilating the alpha channel of the composite (makes a black halo around the characters).

Note that any named fonts (if not a full pathname) will search for the fonts in the following places: (a) any directories named in the global "font_searchpath" attribute or the $OPENIMAGEIO_FONTS environment variable; (b) any font-related subdirectories (fonts, Fonts, share/fonts, or Library/Fonts) underneath the directories in environment variables $HOME, $SystemRoot, $OpenImageIO_ROOT; (c) a number of common system font areas, including /usr/share/fonts, /Library/fonts, and C:/Windows/fonts; (d) in fonts directories one level up from the place where the currently running binary lives.

bool ImageBufAlgo::render_text ( ImageBuf dst,
int  x,
int  y,
string_view  text,
int  fontsize,
string_view  fontname,
const float textcolor 
)
inline

Definition at line 2481 of file imagebufalgo.h.

ImageBuf OIIO_API ImageBufAlgo::reorient ( const ImageBuf src,
int  nthreads = 0 
)

Return (or store into dst) a copy of src, but with whatever seties of rotations, flips, or flops are necessary to transform the pixels into the configuration suggested by the "Orientation" metadata of the image (and the "Orientation" metadata is then set to 1, ordinary orientation).

bool OIIO_API ImageBufAlgo::reorient ( ImageBuf dst,
const ImageBuf src,
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::resample ( const ImageBuf src,
bool  interpolate = true,
ROI  roi = {},
int  nthreads = 0 
)

Set dst, over the region of interest, to be a resized version of the corresponding portion of src (mapping such that the "full" image window of each correspond to each other, regardless of resolution). If dst is not yet initialized, it will be sized according to roi.

Unlike ImageBufAlgo::resize(), resample() does not take a filter; it just samples either with a bilinear interpolation (if interpolate is true, the default) or uses the single "closest" pixel (if interpolate is false). This makes it a lot faster than a proper resize(), though obviously with lower quality (aliasing when downsizing, pixel replication when upsizing).

For "deep" images, this function returns copies the closest source pixel needed, rather than attempting to interpolate deep pixels (regardless of the value of interpolate).

bool OIIO_API ImageBufAlgo::resample ( ImageBuf dst,
const ImageBuf src,
bool  interpolate = true,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::sub ( Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Compute per-pixel signed difference A - B, returning the result image.

A and B may each either be an ImageBuf&, or a cspan<float> giving a per-channel constant, or a single constant used for all channels. (But at least one must be an image.)

bool OIIO_API ImageBufAlgo::sub ( ImageBuf dst,
Image_or_Const  A,
Image_or_Const  B,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

bool ImageBufAlgo::sub ( ImageBuf dst,
const ImageBuf A,
const float B,
ROI  roi = {},
int  nthreads = 0 
)
inline

Definition at line 2394 of file imagebufalgo.h.

ROI OIIO_API ImageBufAlgo::text_size ( string_view  text,
int  fontsize = 16,
string_view  fontname = "" 
)

The helper function text_size() merely computes the dimensions of the text, returning it as an ROI relative to the left side of the baseline of the first character. Only the x and y dimensions of the ROI will be used. The x dimension runs from left to right, and y runs from top to bottom (image coordinates). For a failure (such as an invalid font name), the ROI will return false if you call its defined() method. The text may contain linefeed characters to designate multiple lines of text.

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

Construct an OpenCV cv::Mat containing the contents of ImageBuf src, and return true. If it is not possible, or if OpenImageIO was compiled without OpenCV support, then return false. Note that OpenCV only supports up to 4 channels, so >4 channel images will be truncated in the conversion.

TypeDesc::BASETYPE OIIO_API ImageBufAlgo::type_merge ( TypeDesc::BASETYPE  a,
TypeDesc::BASETYPE  b 
)
TypeDesc ImageBufAlgo::type_merge ( TypeDesc  a,
TypeDesc  b 
)
inline

Definition at line 167 of file imagebufalgo_util.h.

TypeDesc ImageBufAlgo::type_merge ( TypeDesc  a,
TypeDesc  b,
TypeDesc  c 
)
inline

Definition at line 172 of file imagebufalgo_util.h.

ImageBuf OIIO_API ImageBufAlgo::unsharp_mask ( const ImageBuf src,
string_view  kernel = "gaussian",
float  width = 3.0f,
float  contrast = 1.0f,
float  threshold = 0.0f,
ROI  roi = {},
int  nthreads = 0 
)

Return a sharpened version of the corresponding region of src using the "unsharp mask" technique. Unsharp masking basically works by first blurring the image (low pass filter), subtracting this from the original image, then adding the residual back to the original to emphasize the edges. Roughly speaking,

 dst = src + contrast * thresh(src - blur(src))

The specific blur can be selected by kernel name and width (for example, "gaussian" is typical). As a special case, "median" is also accepted as the kernel name, in which case a median filter is performed rather than a blurring convolution (Gaussian and other blurs sometimes over-sharpen edges, whereas using the median filter will sharpen compact high-frequency details while not over-sharpening long edges).

The contrast is a multiplier on the overall sharpening effect. The thresholding step causes all differences less than threshold to be squashed to zero, which can be useful for suppressing sharpening of low-contrast details (like noise) but allow sharpening of higher-contrast edges.

bool OIIO_API ImageBufAlgo::unsharp_mask ( ImageBuf dst,
const ImageBuf src,
string_view  kernel = "gaussian",
float  width = 3.0f,
float  contrast = 1.0f,
float  threshold = 0.0f,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::zero ( ROI  roi,
int  nthreads = 0 
)

Create an all-black float image of size and channels as described by the ROI.

Examples:
CVEX/cvexsample.C, field3d/f3d_io.C, RAY/RAY_DemoGT.C, and SIM/SIM_SolverHair.C.
bool OIIO_API ImageBufAlgo::zero ( ImageBuf dst,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).

ImageBuf OIIO_API ImageBufAlgo::zover ( const ImageBuf A,
const ImageBuf B,
bool  z_zeroisinf = false,
ROI  roi = {},
int  nthreads = 0 
)

Just like ImageBufAlgo::over(), but inputs A and B must have designated 'z' channels, and on a pixel-by-pixel basis, the z values will determine which of A or B will be considered the foreground or background (lower z is foreground). If z_zeroisinf is true, then z=0 values will be treated as if they are infinitely far away.

bool OIIO_API ImageBufAlgo::zover ( ImageBuf dst,
const ImageBuf A,
const ImageBuf B,
bool  z_zeroisinf = false,
ROI  roi = {},
int  nthreads = 0 
)

Write to an existing image dst (allocating if it is uninitialized).