[ Main ] [ News] [ Download ] [ Screenshots ] [ FAQ ] [ Tutorial ] [ Documentation ] [ Forum ] [ Chat ] [ Links ]

CImg Struct Template Reference

Class representing an image (up to 4 dimensions wide), each pixel being of type T. More...

List of all members.

Image Informations

unsigned long size () const
 Return the total number of pixel values in an image.
int dimx () const
 Return the number of columns of the instance image (size along the X-axis, i.e image width).
int dimy () const
 Return the number of rows of the instance image (size along the Y-axis, i.e image height).
int dimz () const
 Return the number of slices of the instance image (size along the Z-axis).
int dimv () const
 Return the number of vector channels of the instance image (size along the V-axis).
template<typename t>
bool is_sameX (const CImg< t > &img) const
 Return true if images (*this) and img have same width.
bool is_sameX (const CImgDisplay &disp) const
 Return true if images (*this) and the display disp have same width.
template<typename t>
bool is_sameY (const CImg< t > &img) const
 Return true if images (*this) and img have same height.
bool is_sameY (const CImgDisplay &disp) const
 Return true if images (*this) and the display disp have same height.
template<typename t>
bool is_sameZ (const CImg< t > &img) const
 Return true if images (*this) and img have same depth.
template<typename t>
bool is_sameV (const CImg< t > &img) const
 Return true if images (*this) and img have same dim.
template<typename t>
bool is_sameXY (const CImg< t > &img) const
 Return true if images have same width and same height.
bool is_sameXY (const CImgDisplay &disp) const
 Return true if image (*this) and the display disp have same width and same height.
template<typename t>
bool is_sameXZ (const CImg< t > &img) const
 Return true if images have same width and same depth.
template<typename t>
bool is_sameXV (const CImg< t > &img) const
 Return true if images have same width and same number of channels.
template<typename t>
bool is_sameYZ (const CImg< t > &img) const
 Return true if images have same height and same depth.
template<typename t>
bool is_sameYV (const CImg< t > &img) const
 Return true if images have same height and same number of channels.
template<typename t>
bool is_sameZV (const CImg< t > &img) const
 Return true if images have same depth and same number of channels.
template<typename t>
bool is_sameXYZ (const CImg< t > &img) const
 Return true if images have same width, same height and same depth.
template<typename t>
bool is_sameXYV (const CImg< t > &img) const
 Return true if images have same width, same height and same number of channels.
template<typename t>
bool is_sameXZV (const CImg< t > &img) const
 Return true if images have same width, same depth and same number of channels.
template<typename t>
bool is_sameYZV (const CImg< t > &img) const
 Return true if images have same heigth, same depth and same number of channels.
template<typename t>
bool is_sameXYZV (const CImg< t > &img) const
 Return true if images (*this) and img have same width, same height, same depth and same number of channels.
bool containsXYZV (const int x, const int y=0, const int z=0, const int v=0) const
 Return true if pixel (x,y,z,v) is inside image boundaries.
template<typename t>
bool contains (const T &pixel, t &x, t &y, t &z, t &v) const
 Return true if specified pixel is inside image boundaries. If true, returns pixel coordinates in (x,y,z,v).
template<typename t>
bool contains (const T &pixel, t &x, t &y, t &z) const
 Return true if specified pixel is inside image boundaries. If true, returns pixel coordinates in (x,y,z).
template<typename t>
bool contains (const T &pixel, t &x, t &y) const
 Return true if specified pixel is inside image boundaries. If true, returns pixel coordinates in (x,y).
template<typename t>
bool contains (const T &pixel, t &x) const
 Return true if specified pixel is inside image boundaries. If true, returns pixel coordinates in (x).
bool contains (const T &pixel) const
 Return true if pixel is inside the image boundaries.
template<typename t>
bool is_overlapping (const CImg< t > &img) const
 Return true if the memory buffers of the two images overlaps.
bool is_empty () const
 Return true if current image is empty.
 operator bool () const
 Return true if image is not empty.
long offset (const int x, const int y, const int z, const int v) const
 Return the offset of the pixel coordinates (x,y,z,v) with respect to the data pointer data.
long offset (const int x, const int y, const int z) const
long offset (const int x, const int y) const
long offset (const int x) const
T * ptr (const unsigned int x, const unsigned int y, const unsigned int z, const unsigned int v)
 Return a pointer to the pixel value located at (x,y,z,v).
const T * ptr (const unsigned int x, const unsigned int y, const unsigned int z, const unsigned int v) const
T * ptr (const unsigned int x, const unsigned int y, const unsigned int z)
const T * ptr (const unsigned int x, const unsigned int y, const unsigned int z) const
T * ptr (const unsigned int x, const unsigned int y)
const T * ptr (const unsigned int x, const unsigned int y) const
T * ptr (const unsigned int x)
const T * ptr (const unsigned int x) const
T * ptr ()
const T * ptr () const
iterator begin ()
 Return an iterator to the first image pixel.
const_iterator begin () const
iterator end ()
 Return an iterator to the last image pixel.
const_iterator end () const
T & operator() (const unsigned int x, const unsigned int y, const unsigned int z, const unsigned int v)
 Fast access to pixel value for reading or writing.
const T & operator() (const unsigned int x, const unsigned int y, const unsigned int z, const unsigned int v) const
T & operator() (const unsigned int x, const unsigned int y, const unsigned int z)
const T & operator() (const unsigned int x, const unsigned int y, const unsigned int z) const
T & operator() (const unsigned int x, const unsigned int y)
const T & operator() (const unsigned int x, const unsigned int y) const
T & operator() (const unsigned int x)
const T & operator() (const unsigned int x) const
T & operator[] (const unsigned long off)
 Fast access to pixel value for reading or writing, using an offset to the image pixel.
const T & operator[] (const unsigned long off) const
T & back ()
 Return a reference to the last image value.
const T & back () const
T & front ()
 Return a reference to the first image value.
const T & front () const
at (const int x, const int y, const int z, const int v, const T out_val) const
 Read a pixel value with Dirichlet boundary conditions.
T & at (const int x, const int y=0, const int z=0, const int v=0)
 Read a pixel value with Neumann boundary conditions.
const T & at (const int x, const int y=0, const int z=0, const int v=0) const
at4 (const int x, const int y, const int z, const int v, const T out_val) const
 Read a pixel value with Dirichlet boundary conditions.
T & at4 (const int x, const int y=0, const int z=0, const int v=0)
 Read a pixel value with Neumann boundary conditions.
const T & at4 (const int x, const int y=0, const int z=0, const int v=0) const
at3 (const int x, const int y, const int z, const int v, const T out_val) const
 Read a pixel value with Dirichlet boundary conditions for the three first coordinates (x,y,z).
T & at3 (const int x, const int y, const int z, const int v=0)
 Read a pixel value with Neumann boundary conditions for the three first coordinates (x,y,z).
const T & at3 (const int x, const int y, const int z, const int v=0) const
at2 (const int x, const int y, const int z, const int v, const T out_val) const
 Read a pixel value with Dirichlet boundary conditions for the two first coordinates (x,y).
T & at2 (const int x, const int y, const int z=0, const int v=0)
 Read a pixel value with Neumann boundary conditions for the two first coordinates (x,y).
const T & at2 (const int x, const int y, const int z=0, const int v=0) const
at1 (const int x, const int y, const int z, const int v, const T out_val) const
 Read a pixel value with Dirichlet boundary conditions for the first coordinates (x).
T & at1 (const int x, const int y=0, const int z=0, const int v=0)
 Read a pixel value with Neumann boundary conditions for the first coordinates (x).
const T & at1 (const int x, const int y=0, const int z=0, const int v=0) const
Tfloat linear_at (const float fx, const float fy, const float fz, const float fv, const T out_val) const
 Read a pixel value using linear interpolation and Dirichlet boundary conditions.
Tfloat linear_at (const float fx, const float fy=0, const float fz=0, const float fv=0) const
 Read a pixel value using linear interpolation and Neumann boundary conditions.
Tfloat linear_at4 (const float fx, const float fy, const float fz, const float fv, const T out_val) const
 Read a pixel value using linear interpolation and Dirichlet boundary conditions.
Tfloat linear_at4 (const float fx, const float fy=0, const float fz=0, const float fv=0) const
 Read a pixel value using linear interpolation and Neumann boundary conditions.
Tfloat linear_at3 (const float fx, const float fy, const float fz, const int v, const T out_val) const
 Read a pixel value using linear interpolation and Dirichlet boundary conditions (first three coordinates).
Tfloat linear_at3 (const float fx, const float fy=0, const float fz=0, const int v=0) const
 Read a pixel value using linear interpolation and Neumann boundary conditions (first three coordinates).
Tfloat linear_at2 (const float fx, const float fy, const int z, const int v, const T out_val) const
 Read a pixel value using linear interpolation and Dirichlet boundary conditions (first two coordinates).
Tfloat linear_at2 (const float fx, const float fy, const int z=0, const int v=0) const
 Read a pixel value using linear interpolation and Neumann boundary conditions (first two coordinates).
Tfloat linear_at1 (const float fx, const int y, const int z, const int v, const T out_val) const
 Read a pixel value using linear interpolation and Dirichlet boundary conditions (first coordinate).
Tfloat linear_at1 (const float fx, const int y=0, const int z=0, const int v=0) const
 Read a pixel value using linear interpolation and Neumann boundary conditions (first coordinate).
Tfloat cubic_at (const float fx, const float fy, const int z, const int v, const T out_val) const
 Read a pixel value using cubic interpolation and Dirichlet boundary conditions.
Tfloat cubic_at (const float fx, const float fy, const int z=0, const int v=0) const
 Read a pixel value using cubic interpolation and Neumann boundary conditions.
Tfloat cubic_at2 (const float fx, const float fy, const int z, const int v, const T out_val) const
 Read a pixel value using cubic interpolation and Dirichlet boundary conditions.
Tfloat cubic_at2 (const float fx, const float fy, const int z=0, const int v=0) const
 Read a pixel value using cubic interpolation and Neumann boundary conditions.
Tfloat cubic_at1 (const float fx, const int y, const int z, const int v, const T out_val) const
 Read a pixel value using cubic interpolation and Dirichlet boundary conditions (first coordinates).
Tfloat cubic_at1 (const float fx, const int y=0, const int z=0, const int v=0) const
 Read a pixel value using cubic interpolation and Neumann boundary conditions (first coordinates).
const T & max () const
 Return a reference to the maximum pixel value of the instance image.
T & max ()
 Return a reference to the maximum pixel value of the instance image.
const T & min () const
 Return a reference to the minimum pixel value of the instance image.
T & min ()
 Return a reference to the minimum pixel value of the instance image.
template<typename t>
const T & minmax (t &max_val) const
 Return a reference to the minimum pixel value and return also the maximum pixel value.
template<typename t>
T & minmax (t &max_val)
 Return a reference to the minimum pixel value and return also the maximum pixel value.
template<typename t>
const T & maxmin (t &min_val) const
 Return a reference to the maximum pixel value and return also the minimum pixel value.
template<typename t>
T & maxmin (t &min_val)
 Return a reference to the maximum pixel value and return also the minimum pixel value.
double mean () const
 Return the mean pixel value of the instance image.
template<typename t>
double variancemean (const unsigned int variance_method, t &mean) const
 Return the variance and the mean of the image.
double variance (const unsigned int variance_method=0) const
 Return the variance and the mean of the image.
template<typename t>
double MSE (const CImg< t > &img) const
 Compute the MSE (Mean-Squared Error) between two images.
template<typename t>
double PSNR (const CImg< t > &img, const double valmax=255.0) const
 Compute the PSNR between two images.
double trace () const
 Return the trace of the current matrix.
median () const
 Return the median of the image.
template<typename t>
double dot (const CImg< t > &img) const
 Return the dot product of the current vector/matrix with the vector/matrix img.
double det () const
 Return the determinant of the current matrix.
double norm (const int norm_type=2) const
 Return the norm of the current vector/matrix. ntype = norm type (0=L2, 1=L1, -1=Linf).
double sum () const
 Return the sum of all the pixel values in an image.
const T kth_smallest (const unsigned int k) const
 Return the kth smallest element of the image.
const CImg< T > & print (const char *title=0, const bool display_stats=true) const
 Display informations about the image on the standard error output.
static const char * pixel_type ()
 Return the type of the pixel values.

Usual Image Transformations

CImg< T > get_fill (const T val) const
 Fill an image by a value val.
CImg< T > & fill (const T val)
 Fill an image by a value val (in-place).
CImg< T > get_fill (const T val0, const T val1) const
 Fill sequentially all pixel values with values val0 and val1 respectively.
CImg< T > & fill (const T val0, const T val1)
 Fill sequentially all pixel values with values val0 and val1 respectively (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2) const
 Fill sequentially all pixel values with values val0 and val1 and val2.
CImg< T > & fill (const T val0, const T val1, const T val2)
 Fill sequentially all pixel values with values val0 and val1 and val2 (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3) const
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3)
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4) const
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 and val4.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4)
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 and val4 (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5) const
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 and val4 and val5.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5)
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 and val4 and val5 (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13, const T val14) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13, const T val14)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13, const T val14, const T val15) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13, const T val14, const T val15)
 Fill sequentially pixel values (in-place).
template<int N>
CImg< T > get_fill (const int val0,...) const
 Fill sequentially pixel values.
template<int N>
CImg< T > & fill (const int val0,...)
 Fill sequentially pixel values (in-place).
template<int N>
CImg< T > get_fill (const double val0,...) const
 Fill sequentially pixel values.
template<int N>
CImg< T > & fill (const double val0,...)
 Fill sequentially pixel values (in-place).
template<int N, typename t>
CImg< T > & _fill (const t val0, va_list &ap)
CImg< T > get_fill (const char *const values, const bool repeat_pattern) const
 Fill image values according to the values found in the specified string.
CImg< T > & fill (const char *const values, const bool repeat_pattern)
 Fill image values according to the values found in the specified string (in-place).
CImg< T > & fillV (const unsigned int x, const unsigned int y, const unsigned int z, const int a0,...)
 Fill image values along the V-axis at the specified pixel position (x,y,z) (int version).
CImg< T > & fillV (const unsigned int x, const unsigned int y, const unsigned int z, const double a0,...)
 Fill image values along the V-axis at the specified pixel position (x,y,z) (double version).
CImg< T > & fillZV (const unsigned int x, const unsigned int y, const int a0,...)
 Fill image values along the ZV-axes at the specified pixel position (x,y) (int version).
CImg< T > & fillZV (const unsigned int x, const unsigned int y, const double a0,...)
 Fill image values along the ZV-axes at the specified pixel position (x,y) (double version).
CImg< T > & fillYZV (const unsigned int x, const int a0,...)
 Fill image values along the YZV-axes at the specified pixel position x (int version).
CImg< T > & fillYZV (const unsigned int x, const double a0,...)
 Fill image values along the YZV-axes at the specified pixel position x (double version).
CImg< T > get_normalize (const T a, const T b) const
 Linear normalization of the pixel values between a and b.
CImg< T > & normalize (const T a, const T b)
 Linear normalization of the pixel values between a and b (in-place).
CImg< T > get_cut (const T a, const T b) const
 Cut pixel values between a and b.
CImg< T > & cut (const T a, const T b)
 Cut pixel values between a and b (in-place).
CImg< T > get_quantize (const unsigned int n=256, const bool keep_range=true) const
 Quantize pixel values into
levels.
CImg< T > & quantize (const unsigned int n=256, const bool keep_range=true)
 Quantize pixel values into
levels (in-place).
CImg< typename cimg::last< T,
bool >::type > 
get_threshold (const T thres, const bool strict=false) const
 Threshold the image.
CImg< T > & threshold (const T thres, const bool strict=false)
 Threshold the image (in-place).
CImg< T > get_rotate (const float angle, const unsigned int cond=3) const
 Rotate an image.
CImg< T > & rotate (const float angle, const unsigned int cond=3)
 Rotate an image (in-place version).
CImg< T > get_rotate (const float angle, const float cx, const float cy, const float zoom=1, const unsigned int cond=3) const
 Rotate an image around a center point (cx,cy).
CImg< T > & rotate (const float angle, const float cx, const float cy, const float zoom=1, const unsigned int cond=3)
 Rotate an image around a center point (cx,cy) (in-place).
CImg< T > get_resize (const int pdx=-100, const int pdy=-100, const int pdz=-100, const int pdv=-100, const int interpolation_type=1, const int border_condition=-1, const bool center=false) const
 Resize an image.
CImg< T > & resize (const int pdx=-100, const int pdy=-100, const int pdz=-100, const int pdv=-100, const int interpolation_type=1, const int border_condition=-1, const bool center=false)
 Resize an image (in-place).
template<typename t>
CImg< T > get_resize (const CImg< t > &src, const int interpolation_type=1, const int border_condition=-1, const bool center=false) const
 Resize an image.
template<typename t>
CImg< T > & resize (const CImg< t > &src, const int interpolation_type=1, const int border_condition=-1, const bool center=false)
 Resize an image (in-place).
CImg< T > get_resize (const CImgDisplay &disp, const int interpolation_type=1, const int border_condition=-1, const bool center=false) const
 Resize an image.
CImg< T > & resize (const CImgDisplay &disp, const int interpolation_type=1, const int border_condition=-1, const bool center=false)
 Resize an image (in-place).
CImg< T > get_resize_halfXY () const
 Half-resize an image, using a special optimized filter.
CImg< T > & resize_halfXY ()
 Half-resize an image, using a special optimized filter (in-place).
CImg< T > get_resize_doubleXY () const
 Upscale an image by a factor 2x.
CImg< T > & resize_doubleXY ()
 Upscale an image by a factor 2x (in-place).
CImg< T > get_resize_tripleXY () const
 Upscale an image by a factor 3x.
CImg< T > & resize_tripleXY ()
 Upscale an image by a factor 3x (in-place).
template<typename t>
CImg< t > get_permute_axes (const char *permut, const t &) const
CImg< T > get_permute_axes (const char *permut="vxyz") const
 Permute axes order.
CImg< T > & permute_axes (const char *order="vxyz")
 Permute axes order (in-place).
CImg< T > get_mirror (const char axe='x') const
 Mirror an image along the specified axis.
CImg< T > & mirror (const char axe='x')
 Mirror an image along the specified axis (in-place).
CImg< T > get_translate (const int deltax, const int deltay=0, const int deltaz=0, const int deltav=0, const int border_condition=0) const
 Translate the image.
CImg< T > & translate (const int deltax, const int deltay=0, const int deltaz=0, const int deltav=0, const int border_condition=0)
 Translate the image (in-place).
CImg< T > get_crop (const int x0, const int y0, const int z0, const int v0, const int x1, const int y1, const int z1, const int v1, const bool border_condition=false) const
 Get a square region of the image.
CImg< T > & crop (const int x0, const int y0, const int z0, const int v0, const int x1, const int y1, const int z1, const int v1, const bool border_condition=false)
 Get a rectangular part of the instance image (in-place).
CImg< T > get_crop (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const bool border_condition=false) const
 Get a rectangular part of the instance image.
CImg< T > & crop (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const bool border_condition=false)
 Get a rectangular part of the instance image (in-place).
CImg< T > get_crop (const int x0, const int y0, const int x1, const int y1, const bool border_condition=false) const
 Get a rectangular part of the instance image.
CImg< T > & crop (const int x0, const int y0, const int x1, const int y1, const bool border_condition=false)
 Get a rectangular part of the instance image (in-place).
CImg< T > get_crop (const int x0, const int x1, const bool border_condition=false) const
 Get a rectangular part of the instance image.
CImg< T > & crop (const int x0, const int x1, const bool border_condition=false)
 Get a rectangular part of the instance image (in-place).
CImg< T > get_columns (const unsigned int x0, const unsigned int x1) const
 Get a set of columns.
CImg< T > & columns (const unsigned int x0, const unsigned int x1)
 Get a set of columns (in-place).
CImg< T > get_column (const unsigned int x0) const
 Get one column.
CImg< T > & column (const unsigned int x0)
 Get one column (in-place).
CImg< T > get_lines (const unsigned int y0, const unsigned int y1) const
 Get a set of lines.
CImg< T > & lines (const unsigned int y0, const unsigned int y1)
 Get a set of lines (in-place).
CImg< T > get_line (const unsigned int y0) const
 Get a line.
CImg< T > & line (const unsigned int y0)
 Get a line (in-place).
CImg< T > get_slices (const unsigned int z0, const unsigned int z1) const
 Get a set of slices.
CImg< T > & slices (const unsigned int z0, const unsigned int z1)
 Get a set of slices (in-place).
CImg< T > get_slice (const unsigned int z0) const
 Get a slice.
CImg< T > & slice (const unsigned int z0)
 Get a slice (in-place).
CImg< T > get_channels (const unsigned int v0, const unsigned int v1) const
 Get a set of channels.
CImg< T > & channels (const unsigned int v0, const unsigned int v1)
 Get a set of channels (in-place).
CImg< T > get_channel (const unsigned int v0) const
 Get a channel.
CImg< T > & channel (const unsigned int v0)
 Get a channel (in-place).
CImg< T > get_shared_points (const unsigned int x0, const unsigned int x1, const unsigned int y0=0, const unsigned int z0=0, const unsigned int v0=0)
 Get a shared-memory image referencing a set of points of the instance image.
const CImg< T > get_shared_points (const unsigned int x0, const unsigned int x1, const unsigned int y0=0, const unsigned int z0=0, const unsigned int v0=0) const
CImg< T > get_shared_lines (const unsigned int y0, const unsigned int y1, const unsigned int z0=0, const unsigned int v0=0)
 Return a shared-memory image referencing a set of lines of the instance image.
const CImg< T > get_shared_lines (const unsigned int y0, const unsigned int y1, const unsigned int z0=0, const unsigned int v0=0) const
CImg< T > get_shared_line (const unsigned int y0, const unsigned int z0=0, const unsigned int v0=0)
 Return a shared-memory image referencing one particular line (y0,z0,v0) of the instance image.
const CImg< T > get_shared_line (const unsigned int y0, const unsigned int z0=0, const unsigned int v0=0) const
CImg< T > get_shared_planes (const unsigned int z0, const unsigned int z1, const unsigned int v0=0)
 Return a shared memory image referencing a set of planes (z0->z1,v0) of the instance image.
const CImg< T > get_shared_planes (const unsigned int z0, const unsigned int z1, const unsigned int v0=0) const
CImg< T > get_shared_plane (const unsigned int z0, const unsigned int v0=0)
 Return a shared-memory image referencing one plane (z0,v0) of the instance image.
const CImg< T > get_shared_plane (const unsigned int z0, const unsigned int v0=0) const
CImg< T > get_shared_channels (const unsigned int v0, const unsigned int v1)
 Return a shared-memory image referencing a set of channels (v0->v1) of the instance image.
const CImg< T > get_shared_channels (const unsigned int v0, const unsigned int v1) const
CImg< T > get_shared_channel (const unsigned int v0)
 Return a shared-memory image referencing one channel v0 of the instance image.
const CImg< T > get_shared_channel (const unsigned int v0) const
CImg< T > get_shared ()
 Return a shared version of the instance image.
const CImg< T > get_shared () const
CImg< T > get_projections2d (const unsigned int x0, const unsigned int y0, const unsigned int z0, const int dx=-100, const int dy=-100, const int dz=-100) const
 Return a 2D representation of a 3D image, with three slices.
CImg< T > & projections2d (const unsigned int x0, const unsigned int y0, const unsigned int z0, const int dx=-100, const int dy=-100, const int dz=-100)
 Return a 2D representation of a 3D image, with three slices (in-place).
CImg< typename cimg::last< T,
float >::type > 
get_histogram (const unsigned int nblevels=256, const T val_min=(T) 0, const T val_max=(T) 0) const
 Compute the image histogram.
CImg< T > & histogram (const unsigned int nblevels=256, const T val_min=(T) 0, const T val_max=(T) 0)
 Compute the image histogram (in-place).
CImg< T > get_equalize_histogram (const unsigned int nblevels=256, const T val_min=(T) 0, const T val_max=(T) 0) const
 Compute the histogram-equalized version of the instance image.
CImg< T > & equalize_histogram (const unsigned int nblevels=256, const T val_min=(T) 0, const T val_max=(T) 0)
 Compute the histogram-equalized version of the instance image (in-place).
CImg< typename cimg::last< T,
unsigned int >::type > 
get_label_regions () const
 Get a label map of disconnected regions with same intensities.
CImg< T > & label_regions ()
 Get a label map of disconnected regions with same intensities (in-place).
CImg< Tfloat > get_norm_pointwise (int norm_type=2) const
 Compute the scalar image of vector norms.
CImg< T > & norm_pointwise (int norm_type=2)
 Compute the scalar image of vector norms (in-place).
CImg< Tfloat > get_orientation_pointwise () const
 Compute the image of normalized vectors.
CImg< T > & orientation_pointwise ()
 Compute the image of normalized vectors (in-place).
CImgList< T > get_split (const char axe='x', const unsigned int nb=0) const
 Split image into a list.
CImg< T > get_append (const CImg< T > &img, const char axis='x', const char align='c') const
 Append an image to another one.
CImg< T > & append (const CImg< T > &img, const char axis='x', const char align='c')
 Append an image to another one (in-place).
CImgList< Tfloat > get_gradientXY (const int scheme=0) const
 Compute the list of images, corresponding to the XY-gradients of an image.
CImgList< Tfloat > get_gradientXYZ (const int scheme=0) const
 Compute a list of images, corresponding to the XYZ-gradients of an image.
CImg< Tfloat > get_structure_tensorXY (const int scheme=1) const
 Compute the 2D structure tensor field of an image.
CImg< T > & structure_tensorXY (const int scheme=1)
 Compute the 2D structure tensor field of an image (in-place).
CImg< Tfloat > get_structure_tensorXYZ (const int scheme=1) const
 Compute the 3D structure tensor field of an image.
CImg< T > & structure_tensorXYZ (const int scheme=1)
 Compute the 3D structure tensor field of an image (in-place).
CImgList< Tfloat > get_hessianXY ()
 Get components of the 2D Hessian matrix of an image.
CImgList< Tfloat > get_hessianXYZ ()
 Get components of the 3D Hessian matrix of an image.
CImg< Tfloat > get_distance_function (const unsigned int nb_iter=100, const float band_size=0.0f, const float precision=0.5f) const
 Compute distance function from 0-valued isophotes by the application of the eikonal equation.
CImg< T > & distance_function (const unsigned int nb_iter=100, const float band_size=0.0f, const float precision=0.5f)
 Compute distance function from 0-valued isophotes by the application of the eikonal equation (in-place).
template<typename t>
CImg< T > get_dijkstra (const unsigned int starting_node, const unsigned int ending_node, CImg< t > &previous) const
 Return minimal path in a graph, using the Dijkstra algorithm.
template<typename t>
CImg< T > & dijkstra (const unsigned int starting_node, const unsigned int ending_node, CImg< t > &previous)
 Return minimal path in a graph, using the Dijkstra algorithm (in-place).
CImg< Tfloat > get_dijkstra (const unsigned int starting_node, const unsigned int ending_node=~0U) const
 Return minimal path in a graph, using the Dijkstra algorithm.
CImg< T > & dijkstra (const unsigned int starting_node, const unsigned int ending_node=~0U)
 Return minimal path in a graph, using the Dijkstra algorithm (in-place).
template<typename tf, typename t>
static CImg< T > get_dijkstra (const tf &distance, const unsigned int nb_nodes, const unsigned int starting_node, const unsigned int ending_node, CImg< t > &previous)
 Compute minimal path in a graph, using the Dijkstra algorithm.
template<typename tf, typename t>
static CImg< T > get_dijkstra (const tf &distance, const unsigned int nb_nodes, const unsigned int starting_node, const unsigned int ending_node=~0U)
 Return minimal path in a graph, using the Dijkstra algorithm.

Meshes and Triangulations

template<typename tp, typename tf>
const CImg< T > & marching_squares (const float isovalue, CImgList< tp > &points, CImgList< tf > &primitives) const
 Compute a vectorization of an implicit function defined by the instance image.
template<typename tp, typename tf>
const CImg< T > & marching_squares (const float isovalue, const float resx, const float resy, CImgList< tp > &points, CImgList< tf > &primitives) const
 Compute a vectorization of an implicit function defined by the instance image.
template<typename tp, typename tf>
const CImg< T > & marching_cubes (const float isovalue, CImgList< tp > &points, CImgList< tf > &primitives, const bool invert_faces=false) const
 Compute a triangulation of an implicit function defined by the instance image.
template<typename tp, typename tf>
const CImg< T > & marching_cubes (const float isovalue, const float resx, const float resy, const float resz, CImgList< tp > &points, CImgList< tf > &primitives, const bool invert_faces=false) const
 Compute a triangulation of an implicit function defined by the instance image.
CImg< Tfloat > get_translate_object3d (const float tx, const float ty=0, const float tz=0) const
 Translate a 3D object.
CImg< T > & translate_object3d (const float tx, const float ty=0, const float tz=0)
 Translate a 3D object (in-place).
CImg< Tfloat > get_translate_object3d () const
 Translate a 3D object so that it becomes centered.
CImg< T > & translate_object3d ()
 Translate a 3D object so that it becomes centered (in-place).
CImg< Tfloat > get_resize_object3d (const float sx, const float sy=-100, const float sz=-100) const
 Resize a 3D object.
CImg< T > & resize_object3d (const float sx, const float sy=-100, const float sz=-100)
 Resize a 3D object (in-place).
template<typename tf, typename tp, typename tff>
CImg< T > & append_object3d (CImgList< tf > &primitives, const CImg< tp > &obj_points, const CImgList< tff > &obj_primitives)
 Append a 3D object to another one.
template<typename tf>
static CImg< typename
cimg::last< T, float >::type > 
cube3d (CImgList< tf > &primitives, const float size=100)
 Return a 3D centered cube.
template<typename tf>
static CImg< typename
cimg::last< T, float >::type > 
cuboid3d (CImgList< tf > &primitives, const float sizex=200, const float sizey=100, const float sizez=100)
 Return a 3D centered cuboid.
template<typename tf>
static CImg< typename
cimg::last< T, float >::type > 
cone3d (CImgList< tf > &primitives, const float radius=50, const float height=100, const unsigned int subdivisions=24, const bool symetrize=false)
 Return a 3D centered cone.
template<typename tf>
static CImg< typename
cimg::last< T, float >::type > 
cylinder3d (CImgList< tf > &primitives, const float radius=50, const float height=100, const unsigned int subdivisions=24)
 Return a 3D centered cylinder.
template<typename tf>
static CImg< typename
cimg::last< T, float >::type > 
torus3d (CImgList< tf > &primitives, const float radius1=100, const float radius2=30, const unsigned int subdivisions1=24, const unsigned int subdivisions2=12)
 Return a 3D centered torus.
template<typename tf>
static CImg< typename
cimg::last< T, float >::type > 
plane3d (CImgList< tf > &primitives, const float sizex=100, const float sizey=100, const unsigned int subdivisionsx=3, const unsigned int subdivisionsy=3, const bool double_sided=false)
 Return a 3D centered XY plane.
template<typename tf>
static CImg< typename
cimg::last< T, float >::type > 
sphere3d (CImgList< tf > &primitives, const float radius=50, const unsigned int subdivisions=3)
 Return a 3D centered sphere.
template<typename tf, typename t>
static CImg< typename
cimg::last< T, float >::type > 
ellipsoid3d (CImgList< tf > &primitives, const CImg< t > &tensor, const unsigned int subdivisions=3)
 Return a 3D centered ellipsoid.

Color bases

template<typename t>
CImg< t > get_RGBtoLUT (const CImg< t > &palette, const bool dithering=true, const bool indexing=false) const
 Convert (R,G,B) color image to indexed color image.
template<typename t>
CImg< T > & RGBtoLUT (const CImg< t > &palette, const bool dithering=true, const bool indexing=false)
 Convert color pixels from (R,G,B) colors to match a specified palette (in-place).
CImg< Tuchar > get_RGBtoLUT (const bool dithering=true, const bool indexing=false) const
 Convert color pixels from (R,G,B) to match the default palette.
CImg< T > & RGBtoLUT (const bool dithering=true, const bool indexing=false)
 Convert color pixels from (R,G,B) to match the default palette (in-place).
template<typename t>
CImg< t > get_LUTtoRGB (const CImg< t > &palette) const
 Convert an indexed image to a (R,G,B) image using the specified color palette.
CImg< T > & LUTtoRGB (const CImg< T > &palette)
 Convert an indexed image to a (R,G,B) image using the specified color palette (in-place).
CImg< Tuchar > get_LUTtoRGB () const
 Convert an indexed image (with the default palette) to a (R,G,B) image.
CImg< T > & LUTtoRGB ()
 Convert an indexed image (with the default palette) to a (R,G,B) image (in-place).
CImg< Tfloat > get_RGBtoHSV () const
 Convert color pixels from (R,G,B) to (H,S,V).
CImg< T > & RGBtoHSV ()
 Convert color pixels from (R,G,B) to (H,S,V) (in-place).
CImg< Tuchar > get_HSVtoRGB () const
 Convert color pixels from (H,S,V) to (R,G,B).
CImg< T > & HSVtoRGB ()
 Convert color pixels from (H,S,V) to (R,G,B) (in-place).
CImg< Tfloat > get_RGBtoHSL () const
 Convert color pixels from (R,G,B) to (H,S,L).
CImg< T > & RGBtoHSL ()
 Convert color pixels from (R,G,B) to (H,S,L) (in-place).
CImg< Tuchar > get_HSLtoRGB () const
 Convert color pixels from (H,S,L) to (R,G,B).
CImg< T > & HSLtoRGB ()
 Convert color pixels from (H,S,L) to (R,G,B) (in-place).
CImg< Tfloat > get_RGBtoHSI () const
 Convert color pixels from (R,G,B) to (H,S,I). Reference: "Digital Image Processing, 2nd. edition", R. Gonzalez and R. Woods. Prentice Hall, 2002.
CImg< T > & RGBtoHSI ()
 Convert color pixels from (R,G,B) to (H,S,I) (in-place).
CImg< Tfloat > get_HSItoRGB () const
 Convert color pixels from (H,S,I) to (R,G,B).
CImg< T > & HSItoRGB ()
 Convert color pixels from (H,S,I) to (R,G,B) (in-place).
CImg< Tuchar > get_RGBtoYCbCr () const
 Convert color pixels from (R,G,B) to (Y,Cb,Cr)_8.
CImg< T > & RGBtoYCbCr ()
 Convert color pixels from (R,G,B) to (Y,Cb,Cr)_8 (in-place).
CImg< Tuchar > get_YCbCrtoRGB () const
 Convert color pixels from (R,G,B) to (Y,Cb,Cr)_8.
CImg< T > & YCbCrtoRGB ()
 Convert color pixels from (R,G,B) to (Y,Cb,Cr)_8 (in-place).
CImg< Tfloat > get_RGBtoYUV () const
 Convert color pixels from (R,G,B) to (Y,U,V).
CImg< T > & RGBtoYUV ()
 Convert color pixels from (R,G,B) to (Y,U,V) (in-place).
CImg< Tuchar > get_YUVtoRGB () const
 Convert color pixels from (Y,U,V) to (R,G,B).
CImg< T > & YUVtoRGB ()
 Convert color pixels from (Y,U,V) to (R,G,B) (in-place).
CImg< Tfloat > get_RGBtoCMY () const
 Convert color pixels from (R,G,B) to (C,M,Y).
CImg< T > & RGBtoCMY ()
 Convert color pixels from (R,G,B) to (C,M,Y) (in-place).
CImg< Tfloat > get_CMYtoCMYK () const
 Convert color pixels from (C,M,Y) to (C,M,Y,K).
CImg< T > & CMYtoCMYK ()
 Convert color pixels from (C,M,Y) to (C,M,Y,K) (in-place).
CImg< Tuchar > get_CMYtoRGB () const
 Convert (C,M,Y) pixels of a color image into the (R,G,B) color space.
CImg< T > & CMYtoRGB ()
 Convert (C,M,Y) pixels of a color image into the (R,G,B) color space (in-place).
CImg< Tfloat > get_CMYKtoCMY () const
 Convert (C,M,Y,K) pixels of a color image into the (C,M,Y) color space.
CImg< T > & CMYKtoCMY ()
 Convert (C,M,Y,K) pixels of a color image into the (C,M,Y) color space (in-place).
CImg< Tfloat > get_RGBtoXYZ () const
 Convert color pixels from (R,G,B) to (X,Y,Z)_709.
CImg< T > & RGBtoXYZ ()
 Convert color pixels from (R,G,B) to (X,Y,Z)_709 (in-place).
CImg< Tuchar > get_XYZtoRGB () const
 Convert (X,Y,Z)_709 pixels of a color image into the (R,G,B) color space.
CImg< T > & XYZtoRGB ()
 Convert (X,Y,Z)_709 pixels of a color image into the (R,G,B) color space (in-place).
CImg< Tfloat > get_XYZtoLab () const
 Convert (X,Y,Z)_709 pixels of a color image into the (L*,a*,b*) color space.
CImg< T > & XYZtoLab ()
 Convert (X,Y,Z)_709 pixels of a color image into the (L*,a*,b*) color space (in-place).
CImg< Tfloat > get_LabtoXYZ () const
 Convert (L,a,b) pixels of a color image into the (X,Y,Z) color space.
CImg< T > & LabtoXYZ ()
 Convert (L,a,b) pixels of a color image into the (X,Y,Z) color space (in-place).
CImg< Tfloat > get_XYZtoxyY () const
 Convert (X,Y,Z)_709 pixels of a color image into the (x,y,Y) color space.
CImg< T > & XYZtoxyY ()
 Convert (X,Y,Z)_709 pixels of a color image into the (x,y,Y) color space (in-place).
CImg< Tfloat > get_xyYtoXYZ () const
 Convert (x,y,Y) pixels of a color image into the (X,Y,Z)_709 color space.
CImg< T > & xyYtoXYZ ()
 Convert (x,y,Y) pixels of a color image into the (X,Y,Z)_709 color space (in-place).
CImg< Tfloat > get_RGBtoLab () const
 Convert a (R,G,B) image to a (L,a,b) one.
CImg< T > & RGBtoLab ()
 Convert a (R,G,B) image to a (L,a,b) one (in-place).
CImg< Tuchar > get_LabtoRGB () const
 Convert a (L,a,b) image to a (R,G,B) one.
CImg< T > & LabtoRGB ()
 Convert a (L,a,b) image to a (R,G,B) one (in-place).
CImg< Tfloat > get_RGBtoxyY () const
 Convert a (R,G,B) image to a (x,y,Y) one.
CImg< T > & RGBtoxyY ()
 Convert a (R,G,B) image to a (x,y,Y) one (in-place).
CImg< Tuchar > get_xyYtoRGB () const
 Convert a (x,y,Y) image to a (R,G,B) one.
CImg< T > & xyYtoRGB ()
 Convert a (x,y,Y) image to a (R,G,B) one (in-place).
CImg< Tfloat > get_RGBtoCMYK () const
 Convert a (R,G,B) image to a (C,M,Y,K) one.
CImg< T > & RGBtoCMYK ()
 Convert a (R,G,B) image to a (C,M,Y,K) one (in-place).
CImg< Tuchar > get_CMYKtoRGB () const
 Convert a (R,G,B) image to a (C,M,Y,K) one.
CImg< T > & CMYKtoRGB ()
 Convert a (R,G,B) image to a (C,M,Y,K) one (in-place).
CImg< T > get_RGBtoBayer () const
 Convert a (R,G,B) image to a Bayer-coded representation.
CImg< T > & RGBtoBayer ()
 Convert a (R,G,B) image to a Bayer-coded representation (in-place).
CImg< T > get_BayertoRGB (const unsigned int interpolation_type=3) const
 Convert a Bayer-coded image to a (R,G,B) color image.
CImg< T > & BayertoRGB (const unsigned int interpolation_type=3)
 Convert a Bayer-coded image to a (R,G,B) color image (in-place).
static CImg< Tuchar > get_default_LUT8 ()
 Return a default indexed color palette with 256 (R,G,B) entries.
static CImg< Tuchar > get_rainbow_LUT8 ()
 Return a rainbow color palette with 256 (R,G,B) entries.
static CImg< Tuchar > get_contrast_LUT8 ()
 Return a contrasted color palette with 256 (R,G,B) entries.

Matrix and Vectors

CImg< T > get_vector_at (const unsigned int x=0, const unsigned int y=0, const unsigned int z=0) const
 Return a new image corresponding to the vector located at (x,y,z) of the current vector-valued image.
template<typename t>
CImg< T > & set_vector_at (const CImg< t > &vec, const unsigned int x=0, const unsigned int y=0, const unsigned int z=0)
 Set the image vec as the vector valued pixel located at (x,y,z) of the current vector-valued image.
CImg< T > get_matrix_at (const unsigned int x=0, const unsigned int y=0, const unsigned int z=0) const
 Return a new image corresponding to the square matrix located at (x,y,z) of the current vector-valued image.
template<typename t>
CImg< T > & set_matrix_at (const CImg< t > &mat, const unsigned int x=0, const unsigned int y=0, const unsigned int z=0)
 Set the image vec as the square matrix-valued pixel located at (x,y,z) of the current vector-valued image.
CImg< T > get_tensor_at (const unsigned int x=0, const unsigned int y=0, const unsigned int z=0) const
 Return a new image corresponding to the diffusion tensor located at (x,y,z) of the current vector-valued image.
template<typename t>
CImg< T > & set_tensor_at (const CImg< t > &ten, const unsigned int x=0, const unsigned int y=0, const unsigned int z=0)
 Set the image vec as the tensor valued pixel located at (x,y,z) of the current vector-valued image.
CImg< T > get_vector () const
 Unroll all images values into a one-column vector.
CImg< T > & vector ()
 Unroll all images values into a one-column vector (in-place).
CImg< T > get_matrix () const
 Realign pixel values of the instance image as a square matrix.
CImg< T > & matrix ()
 Realign pixel values of the instance image as a square matrix (in-place).
CImg< T > get_tensor () const
 Realign pixel values of the instance image as a symmetric tensor.
CImg< T > & tensor ()
 Realign pixel values of the instance image as a symmetric tensor (in-place).
CImg< T > get_unroll (const char axe='x') const
 Unroll all images values into specified axis.
CImg< T > & unroll (const char axe='x')
 Unroll all images values into specified axis (in-place).
CImg< T > get_diagonal () const
 Get a diagonal matrix, whose diagonal coefficients are the coefficients of the input image.
CImg< T > & diagonal ()
 Get a diagonal matrix, whose diagonal coefficients are the coefficients of the input image (in-place).
CImg< T > get_identity_matrix () const
 Get an identity matrix having same dimension than instance image.
CImg< T > & identity_matrix ()
 Get an identity matrix having same dimension than instance image (in-place).
CImg< T > get_sequence (const T a0, const T a1) const
 Return a N-numbered sequence vector from a0 to a1.
CImg< T > & sequence (const T a0, const T a1)
 Return a N-numbered sequence vector from a0 to a1 (in-place).
CImg< T > get_transpose () const
 Transpose the current matrix.
CImg< T > & transpose ()
 Transpose the current matrix (in-place).
CImg< Tfloat > get_invert (const bool use_LU=true) const
 Invert the current matrix.
CImg< T > & invert (const bool use_LU=true)
 Invert the current matrix (in-place).
CImg< Tfloat > get_pseudoinvert () const
 Compute the pseudo-inverse (Moore-Penrose) of the matrix.
CImg< T > & pseudoinvert ()
 Compute the pseudo-inverse (Moore-Penrose) of the matrix (in-place).
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
get_cross (const CImg< t > &img) const
 Compute the cross product between two 3d vectors.
template<typename t>
CImg< T > & cross (const CImg< t > &img)
 Compute the cross product between two 3d vectors (in-place).
template<typename t>
CImg< typename cimg::superset2
< T, t, float >::type > 
get_solve (const CImg< t > &A) const
 Solve a linear system AX=B where B=*this.
template<typename t>
CImg< T > & solve (const CImg< t > &A)
 Solve a linear system AX=B where B=*this (in-place).
template<typename t, typename ti>
CImg< T > & _solve (const CImg< t > &A, const CImg< ti > &indx)
template<typename t>
CImg< T > get_sort (CImg< t > &permutations, const bool increasing=true) const
 Sort values of a vector and get permutations.
template<typename t>
CImg< T > & sort (CImg< t > &permutations, const bool increasing=true)
 Sort values of a vector and get permutations (in-place).
CImg< T > get_sort (const bool increasing=true) const
CImg< T > & sort (const bool increasing=true)
template<typename t>
CImg< T > & _quicksort (const int min, const int max, CImg< t > &permutations, const bool increasing)
template<typename t>
CImg< T > get_permute (const CImg< t > &permutation) const
 Get a permutation of the pixels.
template<typename t>
CImg< T > & permute (const CImg< t > &permutation)
 Get a permutation of the pixels (in-place).
template<typename t>
const CImg< T > & SVD (CImg< t > &U, CImg< t > &S, CImg< t > &V, const bool sorting=true, const unsigned int max_iter=40, const float lambda=0) const
 Compute the SVD of a general matrix.
template<typename t>
const CImg< T > & SVD (CImgList< t > &USV) const
 Compute the SVD of a general matrix.
CImgList< Tfloat > get_SVD (const bool sorting=true) const
 Compute the SVD of a general matrix.
template<typename t>
CImg< T > & _LU (CImg< t > &indx, bool &d)
CImgList< Tfloat > get_eigen () const
 Compute the eigenvalues and eigenvectors of a matrix.
template<typename t>
const CImg< T > & eigen (CImg< t > &val, CImg< t > &vec) const
 Compute the eigenvalues and eigenvectors of a matrix.
CImgList< Tfloat > get_symmetric_eigen () const
 Compute the eigenvalues and eigenvectors of a symmetric matrix.
template<typename t>
const CImg< T > & symmetric_eigen (CImg< t > &val, CImg< t > &vec) const
 Compute the eigenvalues and eigenvectors of a symmetric matrix.
static CImg< T > vector (const T &a0)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9, const T &a10)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9, const T &a10, const T &a11)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9, const T &a10, const T &a11, const T &a12)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9, const T &a10, const T &a11, const T &a12, const T &a13)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9, const T &a10, const T &a11, const T &a12, const T &a13, const T &a14)
 Return a vector with specified coefficients.
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9, const T &a10, const T &a11, const T &a12, const T &a13, const T &a14, const T &a15)
 Return a vector with specified coefficients.
template<int N>
static CImg< T > vector (const int a0, const int a1,...)
 Return a vector with specified coefficients.
template<int N>
static CImg< T > vector (const double a0, const double a1,...)
 Return a vector with specified coefficients.
static CImg< T > matrix (const T &a0)
 Return a 1x1 square matrix with specified coefficients.
static CImg< T > matrix (const T &a0, const T &a1, const T &a2, const T &a3)
 Return a 2x2 square matrix with specified coefficients.
static CImg< T > matrix (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8)
 Return a 3x3 square matrix with specified coefficients.
static CImg< T > matrix (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9, const T &a10, const T &a11, const T &a12, const T &a13, const T &a14, const T &a15)
 Return a 4x4 square matrix with specified coefficients.
static CImg< T > matrix (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6, const T &a7, const T &a8, const T &a9, const T &a10, const T &a11, const T &a12, const T &a13, const T &a14, const T &a15, const T &a16, const T &a17, const T &a18, const T &a19, const T &a20, const T &a21, const T &a22, const T &a23, const T &a24)
 Return a 5x5 square matrix with specified coefficients.
template<int M, int N>
static CImg< T > matrix (const int a0, const int a1,...)
 Return a MxN square matrix with specified coefficients.
template<int M, int N>
static CImg< T > matrix (const double a0, const double a1,...)
 Return a NxN square matrix with specified coefficients.
static CImg< T > tensor (const T &a1)
 Return a 1x1 symmetric matrix with specified coefficients.
static CImg< T > tensor (const T &a1, const T &a2, const T &a3)
 Return a 2x2 symmetric matrix tensor with specified coefficients.
static CImg< T > tensor (const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6)
 Return a 3x3 symmetric matrix with specified coefficients.
static CImg< T > diagonal (const T &a0)
 Return a 1x1 diagonal matrix with specified coefficients.
static CImg< T > diagonal (const T &a0, const T &a1)
 Return a 2x2 diagonal matrix with specified coefficients.
static CImg< T > diagonal (const T &a0, const T &a1, const T &a2)
 Return a 3x3 diagonal matrix with specified coefficients.
static CImg< T > diagonal (const T &a0, const T &a1, const T &a2, const T &a3)
 Return a 4x4 diagonal matrix with specified coefficients.
static CImg< T > diagonal (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4)
 Return a 5x5 diagonal matrix with specified coefficients.
template<int N>
static CImg< T > diagonal (const int a0,...)
 Return a NxN diagonal matrix with specified coefficients.
template<int N>
static CImg< T > diagonal (const double a0,...)
 Return a NxN diagonal matrix with specified coefficients.
static CImg< T > identity_matrix (const unsigned int N)
 Return a NxN identity matrix.
static CImg< T > sequence (const unsigned int N, const T a0, const T a1)
 Return a N-numbered sequence vector from a0 to a1.
static CImg< T > rotation_matrix (const float x, const float y, const float z, const float w, const bool quaternion_data=false)
 Return a 3x3 rotation matrix along the (x,y,z)-axis with an angle w.

Image File Loading

CImg< T > & load (const char *const filename)
 Load an image from a file (in-place version).
CImg< T > & _load_ascii (std::FILE *const file, const char *const filename)
CImg< T > & load_ascii (const char *const filename)
 Load an image from an ASCII file (in-place).
CImg< T > & load_ascii (std::FILE *const file)
 Load an image from an ASCII file (in-place).
CImg< T > & _load_dlm (std::FILE *const file, const char *const filename)
CImg< T > & load_dlm (const char *const filename)
 Load an image from a DLM file (in-place).
CImg< T > & load_dlm (std::FILE *const file)
 Load an image from a DLM file (in-place).
CImg< T > & _load_bmp (std::FILE *const file, const char *const filename)
CImg< T > & load_bmp (const char *const filename)
 Load an image from a BMP file (in-place).
CImg< T > & load_bmp (std::FILE *const file)
 Load an image from a BMP file (in-place).
CImg< T > & _load_jpeg (std::FILE *const file, const char *const filename)
CImg< T > & load_jpeg (const char *const filename)
 Load an image from a JPEG file (in-place).
CImg< T > & load_jpeg (std::FILE *const file)
 Load an image from a JPEG file (in-place).
CImg< T > & load_magick (const char *const filename)
 Load an image from a file, using Magick++ library.
CImg< T > & _load_png (std::FILE *const file, const char *const filename)
CImg< T > & load_png (const char *const filename)
 Load an image from a PNG file (in-place).
CImg< T > & load_png (std::FILE *const file)
 Load an image from a PNG file (in-place).
CImg< T > & _load_pnm (std::FILE *const file, const char *const filename)
CImg< T > & load_pnm (const char *const filename)
 Load an image from a PNM file (in-place).
CImg< T > & load_pnm (std::FILE *const file)
 Load an image from a PNM file (in-place).
CImg< T > & _load_rgb (std::FILE *const file, const char *const filename, const unsigned int dimw, const unsigned int dimh)
CImg< T > & load_rgb (const char *const filename, const unsigned int dimw, const unsigned int dimh=1)
 Load an image from a RGB file (in-place).
CImg< T > & load_rgb (std::FILE *const file, const unsigned int dimw, const unsigned int dimh=1)
 Load an image from a RGB file (in-place).
CImg< T > & _load_rgba (std::FILE *const file, const char *const filename, const unsigned int dimw, const unsigned int dimh)
CImg< T > & load_rgba (const char *const filename, const unsigned int dimw, const unsigned int dimh=1)
 Load an image from a RGBA file (in-place).
CImg< T > & load_rgba (std::FILE *const file, const unsigned int dimw, const unsigned int dimh=1)
 Load an image from a RGBA file (in-place).
CImg< T > & load_tiff (const char *const filename, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1)
 Load an image from a TIFF file (in-place).
CImg< T > & load_analyze (const char *const filename, float *const voxsize=0)
 Load an image from an ANALYZE7.5/NIFTI file (in-place).
CImg< T > & load_cimg (const char *const filename, const char axis='z', const char align='p')
 Load an image (list) from a .cimg file (in-place).
CImg< T > & load_cimg (std::FILE *const file, const char axis='z', const char align='p')
 Load an image (list) from a .cimg file (in-place).
CImg< T > & load_cimg (const char *const filename, const unsigned int n0, const unsigned int n1, const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int v0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int v1, const char axis='z', const char align='p')
 Load a sub-image (list) from a non-compressed .cimg file (in-place).
CImg< T > & load_cimg (std::FILE *const file, const unsigned int n0, const unsigned int n1, const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int v0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int v1, const char axis='z', const char align='p')
 Load a sub-image (list) from a non-compressed .cimg file (in-place).
CImg< T > & _load_inr (std::FILE *const file, const char *const filename, float *const voxsize)
CImg< T > & load_inr (const char *const filename, float *const voxsize=0)
 Load an image from an INRIMAGE-4 file (in-place).
CImg< T > & load_inr (std::FILE *const file, float *const voxsize=0)
 Load an image from an INRIMAGE-4 file (in-place).
CImg< T > & _load_pandore (std::FILE *const file, const char *const filename)
CImg< T > & load_pandore (const char *const filename)
 Load an image from a PANDORE file (in-place).
CImg< T > & load_pandore (std::FILE *const file)
 Load an image from a PANDORE file (in-place).
CImg< T > & load_parrec (const char *const filename, const char axis='v', const char align='p')
 Load an image from a PAR-REC (Philips) file (in-place).
CImg< T > & _load_raw (std::FILE *const file, const char *const filename, const unsigned int sizex, const unsigned int sizey, const unsigned int sizez, const unsigned int sizev, const bool multiplexed, const bool invert_endianness)
CImg< T > & load_raw (const char *const filename, const unsigned int sizex, const unsigned int sizey=1, const unsigned int sizez=1, const unsigned int sizev=1, const bool multiplexed=false, const bool invert_endianness=false)
 Load an image from a .RAW file (in-place).
CImg< T > & load_raw (std::FILE *const file, const unsigned int sizex, const unsigned int sizey=1, const unsigned int sizez=1, const unsigned int sizev=1, const bool multiplexed=false, const bool invert_endianness=false)
 Load an image from a .RAW file (in-place).
CImg< T > & load_ffmpeg (const char *const filename, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1, const bool pixel_format=true, const bool resume=false, const char axis='z', const char align='p')
 Load a video sequence using FFMPEG av's libraries (in-place).
CImg< T > & load_yuv (const char *const filename, const unsigned int sizex, const unsigned int sizey=1, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1, const bool yuv2rgb=true, const char axis='z', const char align='p')
 Load an image sequence from a YUV file (in-place).
CImg< T > & load_yuv (std::FILE *const file, const unsigned int sizex, const unsigned int sizey=1, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1, const bool yuv2rgb=true, const char axis='z', const char align='p')
 Load an image sequence from a YUV file (in-place).
template<typename tf, typename tc>
CImg< T > & _load_off (std::FILE *const file, const char *const filename, CImgList< tf > &primitives, CImgList< tc > &colors, const bool invert_faces)
 Load a 3D object from a .OFF file (internal).
template<typename tf, typename tc>
CImg< T > & load_off (const char *const filename, CImgList< tf > &primitives, CImgList< tc > &colors, const bool invert_faces=false)
 Load a 3D object from a .OFF file (in-place).
template<typename tf, typename tc>
CImg< T > & load_off (std::FILE *const file, CImgList< tf > &primitives, CImgList< tc > &colors, const bool invert_faces=false)
 Load a 3D object from a .OFF file (in-place).
CImg< T > & load_ffmpeg_external (const char *const filename, const char axis='z', const char align='p')
 Load a video sequence using FFMPEG's external tool 'ffmpeg (in-place).
CImg< T > & load_graphicsmagick_external (const char *const filename)
 Load an image using GraphicsMagick's external tool 'gm' (in-place).
CImg< T > & load_gzip_external (const char *const filename)
 Load a gzipped image file, using external tool 'gunzip' (in-place).
CImg< T > & load_imagemagick_external (const char *const filename)
 Load an image using ImageMagick's external tool 'convert' (in-place).
CImg< T > & load_medcon_external (const char *const filename)
 Load a DICOM image file, using XMedcon's external tool 'medcon' (in-place).
CImg< T > & load_other (const char *const filename)
 Load an image using ImageMagick's or GraphicsMagick's executables (in-place).
static CImg< T > get_load (const char *const filename)
 Load an image from a file.
static CImg< T > get_load_ascii (const char *const filename)
 Load an image from an ASCII file.
static CImg< T > get_load_ascii (std::FILE *const file)
 Load an image from an ASCII file.
static CImg< T > get_load_dlm (const char *const filename)
 Load an image from a DLM file.
static CImg< T > get_load_dlm (std::FILE *const file)
 Load an image from a DLM file.
static CImg< T > get_load_bmp (const char *const filename)
 Load an image from a BMP file.
static CImg< T > get_load_bmp (std::FILE *const file)
 Load an image from a BMP file.
static CImg< T > get_load_jpeg (const char *const filename)
 Load an image from a JPEG file.
static CImg< T > get_load_jpeg (std::FILE *const file)
 Load an image from a JPEG file.
static CImg< T > get_load_magick (const char *const filename)
static CImg< T > get_load_png (const char *const filename)
 Load an image from a PNG file.
static CImg< T > get_load_png (std::FILE *const file)
 Load an image from a PNG file.
static CImg< T > get_load_pnm (const char *const filename)
 Load an image from a PNM file.
static CImg< T > get_load_pnm (std::FILE *const file)
 Load an image from a PNM file.
static CImg< T > get_load_rgb (const char *const filename, const unsigned int dimw, const unsigned int dimh=1)
 Load an image from a RGB file.
static CImg< T > get_load_rgb (std::FILE *const file, const unsigned int dimw, const unsigned int dimh=1)
 Load an image from a RGB file.
static CImg< T > get_load_rgba (const char *const filename, const unsigned int dimw, const unsigned int dimh=1)
 Load an image from a RGBA file.
static CImg< T > get_load_rgba (std::FILE *const file, const unsigned int dimw, const unsigned int dimh=1)
 Load an image from a RGBA file.
static CImg< T > get_load_tiff (const char *const filename, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1)
 Load an image from a TIFF file.
static CImg< T > get_load_analyze (const char *const filename, float *const voxsize=0)
 Load an image from an ANALYZE7.5/NIFTI file.
static CImg< T > get_load_cimg (const char *const filename, const char axis='z', const char align='p')
 Load an image (list) from a .cimg file.
static CImg< T > get_load_cimg (std::FILE *const file, const char axis='z', const char align='p')
 Load an image (list) from a .cimg file.
static CImg< T > get_load_cimg (const char *const filename, const unsigned int n0, const unsigned int n1, const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int v0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int v1, const char axis='z', const char align='p')
 Load a sub-image (list) from a .cimg file.
static CImg< T > get_load_cimg (std::FILE *const file, const unsigned int n0, const unsigned int n1, const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int v0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int v1, const char axis='z', const char align='p')
 Load a sub-image (list) from a non-compressed .cimg file.
static void _load_inr_header (std::FILE *file, int out[8], float *const voxsize)
static CImg< T > get_load_inr (const char *const filename, float *const voxsize=0)
 Load an image from an INRIMAGE-4 file.
static CImg< T > get_load_inr (std::FILE *const file, float *voxsize=0)
 Load an image from an INRIMAGE-4 file.
static CImg< T > get_load_pandore (const char *const filename)
 Load an image from a PANDORE file.
static CImg< T > get_load_pandore (std::FILE *const file)
 Load an image from a PANDORE file.
static CImg< T > get_load_parrec (const char *const filename, const char axis='v', const char align='p')
 Load an image from a PAR-REC (Philips) file.
static CImg< T > get_load_raw (const char *const filename, const unsigned int sizex, const unsigned int sizey=1, const unsigned int sizez=1, const unsigned int sizev=1, const bool multiplexed=false, const bool invert_endianness=false)
 Load an image from a .RAW file.
static CImg< T > get_load_raw (std::FILE *const file, const unsigned int sizex, const unsigned int sizey=1, const unsigned int sizez=1, const unsigned int sizev=1, const bool multiplexed=false, const bool invert_endianness=false)
 Load an image from a .RAW file.
static CImg< T > get_load_ffmpeg (const char *const filename, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1, const bool pixel_format=true, const bool resume=false, const char axis='z', const char align='p')
 Load a video sequence using FFMPEG av's libraries.
static CImg< T > get_load_yuv (const char *const filename, const unsigned int sizex, const unsigned int sizey=1, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1, const bool yuv2rgb=true, const char axis='z', const char align='p')
 Load an image sequence from a YUV file.
static CImg< T > get_load_yuv (std::FILE *const file, const unsigned int sizex, const unsigned int sizey=1, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1, const bool yuv2rgb=true, const char axis='z', const char align='p')
 Load an image sequence from a YUV file.
template<typename tf, typename tc>
static CImg< T > get_load_off (const char *const filename, CImgList< tf > &primitives, CImgList< tc > &colors, const bool invert_faces=false)
 Load a 3D object from a .OFF file.
template<typename tf, typename tc>
static CImg< T > get_load_off (std::FILE *const file, CImgList< tf > &primitives, CImgList< tc > &colors, const bool invert_faces=false)
 Load a 3D object from a .OFF file.
static CImg< T > get_load_ffmpeg_external (const char *const filename, const char axis='z', const char align='p')
 Load a video sequence using FFMPEG's external tool 'ffmpeg'.
static CImg< T > get_load_graphicsmagick_external (const char *const filename)
 Load an image using GraphicsMagick's external tool 'gm'.
static CImg< T > get_load_gzip_external (const char *const filename)
 Load a gzipped image file, using external tool 'gunzip'.
static CImg< T > get_load_imagemagick_external (const char *const filename)
 Load an image using ImageMagick's external tool 'convert'.
static CImg< T > get_load_medcon_external (const char *const filename)
 Load a DICOM image file, using XMedcon's external tool 'medcon'.
static CImg< T > get_load_other (const char *const filename)
 Load an image using ImageMagick's or GraphicsMagick's executables.

Image File Saving

const CImg< T > & save (const char *const filename, const int number=-1) const
 Save the image as a file.
const CImg< T > & _save_ascii (std::FILE *const file, const char *const filename) const
const CImg< T > & save_ascii (const char *const filename) const
 Save the image as an ASCII file (ASCII Raw + simple header).
const CImg< T > & save_ascii (std::FILE *const file) const
 Save the image as an ASCII file (ASCII Raw + simple header).
const CImg< T > & _save_cpp (std::FILE *const file, const char *const filename) const
const CImg< T > & save_cpp (const char *const filename) const
 Save the image as a CPP source file.
const CImg< T > & save_cpp (std::FILE *const file) const
 Save the image as a CPP source file.
const CImg< T > & _save_dlm (std::FILE *const file, const char *const filename) const
const CImg< T > & save_dlm (const char *const filename) const
 Save the image as a DLM file.
const CImg< T > & save_dlm (std::FILE *const file) const
 Save the image as a DLM file.
const CImg< T > & _save_bmp (std::FILE *const file, const char *const filename) const
const CImg< T > & save_bmp (const char *const filename) const
 Save the image as a BMP file.
const CImg< T > & save_bmp (std::FILE *const file) const
 Save the image as a BMP file.
const CImg< T > & _save_jpeg (std::FILE *const file, const char *const filename, const unsigned int quality) const
const CImg< T > & save_jpeg (const char *const filename, const unsigned int quality=100) const
 Save a file in JPEG format.
const CImg< T > & save_jpeg (std::FILE *const file, const unsigned int quality=100) const
 Save a file in JPEG format.
const CImg< T > & save_magick (const char *const filename) const
 Save the image using built-in ImageMagick++ library.
const CImg< T > & _save_png (std::FILE *const file, const char *const filename) const
const CImg< T > & save_png (const char *const filename) const
 Save a file in PNG format.
const CImg< T > & save_png (std::FILE *const file) const
 Save a file in PNG format.
const CImg< T > & _save_pnm (std::FILE *const file, const char *const filename) const
const CImg< T > & save_pnm (const char *const filename) const
 Save the image as a PNM file.
const CImg< T > & save_pnm (std::FILE *const file) const
 Save the image as a PNM file.
const CImg< T > & _save_rgb (std::FILE *const file, const char *const filename) const
const CImg< T > & save_rgb (const char *const filename) const
 Save the image as a RGB file.
const CImg< T > & save_rgb (std::FILE *const file) const
 Save the image as a RGB file.
const CImg< T > & _save_rgba (std::FILE *const file, const char *const filename) const
const CImg< T > & save_rgba (const char *const filename) const
 Save the image as a RGBA file.
const CImg< T > & save_rgba (std::FILE *const file) const
 Save the image as a RGBA file.
const CImg< T > & save_tiff (const char *const filename) const
 Save a file in TIFF format.
const CImg< T > & save_analyze (const char *const filename, const float *const voxsize=0) const
 Save the image as an ANALYZE7.5 or NIFTI file.
const CImg< T > & save_cimg (const char *const filename, const bool compress=false) const
 Save the image as a .cimg file.
const CImg< T > & save_cimg (std::FILE *const file, const bool compress=false) const
const CImg< T > & save_cimg (const char *const filename, const unsigned int n0, const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int v0) const
 Insert the image into an existing .cimg file, at specified coordinates.
const CImg< T > & save_cimg (std::FILE *const file, const unsigned int n0, const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int v0) const
 Insert the image into an existing .cimg file, at specified coordinates.
const CImg< T > & _save_inr (std::FILE *const file, const char *const filename, const float *const voxsize) const
const CImg< T > & save_inr (const char *const filename, const float *const voxsize=0) const
 Save the image as an INRIMAGE-4 file.
const CImg< T > & save_inr (std::FILE *const file, const float *const voxsize=0) const
 Save the image as an INRIMAGE-4 file.
unsigned int _save_pandore_header_length (unsigned int id, unsigned int *dims, const unsigned int colorspace) const
const CImg< T > & _save_pandore (std::FILE *const file, const char *const filename, const unsigned int colorspace) const
const CImg< T > & save_pandore (const char *const filename, const unsigned int colorspace=0) const
 Save the image as a PANDORE-5 file.
const CImg< T > & save_pandore (std::FILE *const file, const unsigned int colorspace=0) const
 Save the image as a PANDORE-5 file.
const CImg< T > & _save_raw (std::FILE *const file, const char *const filename, const bool multiplexed) const
const CImg< T > & save_raw (const char *const filename, const bool multiplexed=false) const
 Save the image as a RAW file.
const CImg< T > & save_raw (std::FILE *const file, const bool multiplexed=false) const
 Save the image as a RAW file.
const CImg< T > & save_yuv (const char *const filename, const bool rgb2yuv=true) const
 Save the image as a YUV video sequence file.
const CImg< T > & save_yuv (std::FILE *const file, const bool rgb2yuv=true) const
 Save the image as a YUV video sequence file.
template<typename tf, typename tc>
const CImg< T > & _save_off (std::FILE *const file, const char *const filename, const CImgList< tf > &primitives, const CImgList< tc > &colors, const bool invert_faces) const
template<typename tf, typename tc>
const CImg< T > & save_off (const char *const filename, const CImgList< tf > &primitives, const CImgList< tc > &colors, const bool invert_faces=false) const
 Save OFF files.
template<typename tf, typename tc>
const CImg< T > & save_off (std::FILE *const file, const CImgList< tf > &primitives, const CImgList< tc > &colors, const bool invert_faces=false) const
 Save OFF files.
const CImg< T > & save_ffmpeg_external (const char *const filename, const char *const codec="mpeg2video") const
 Save the image as a video sequence file, using the external tool 'ffmpeg'.
const CImg< T > & save_graphicsmagick_external (const char *const filename, const unsigned int quality=100) const
 Save the image using GraphicsMagick's gm.
const CImg< T > & save_gzip_external (const char *const filename) const
 Save an image as a gzipped file, using external tool 'gzip'.
const CImg< T > & save_imagemagick_external (const char *const filename, const unsigned int quality=100) const
 Save the image using ImageMagick's convert.
const CImg< T > & save_medcon_external (const char *const filename) const
 Save an image as a Dicom file (need '(X)Medcon' : http://xmedcon.sourceforge.net ).
const CImg< T > & save_other (const char *const filename, const unsigned int quality=100) const
static void save_empty_cimg (const char *const filename, const unsigned int dx, const unsigned int dy=1, const unsigned int dz=1, const unsigned int dv=1)
 Save an empty .cimg file with specified dimensions.
static void save_empty_cimg (std::FILE *const file, const unsigned int dx, const unsigned int dy=1, const unsigned int dz=1, const unsigned int dv=1)
 Save an empty .cimg file with specified dimensions.
static CImg< T > get_logo40x38 ()

Public Types

typedef T * iterator
 Iterator type for CImg<T>.
typedef const T * const_iterator
 Const iterator type for CImg<T>.
typedef T value_type
 Get value type.

Public Member Functions

Constructors-Destructor-Copy
 ~CImg ()
 Destructor.
 CImg ()
 Default constructor.
 CImg (const unsigned int dx, const unsigned int dy=1, const unsigned int dz=1, const unsigned int dv=1)
 Constructs a new image with given size (dx,dy,dz,dv).
 CImg (const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const T val)
 Construct an image with given size (dx,dy,dz,dv) and with pixel having a default value val.
 CImg (const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const int val0, const int val1,...)
 Construct an image with given size (dx,dy,dz,dv) and with specified pixel values (int version).
 CImg (const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const double val0, const double val1,...)
 Construct an image with given size (dx,dy,dz,dv) and with specified pixel values (double version).
 CImg (const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const char *const values, const bool repeat_pattern)
 Construct an image with given size and with specified values given in a string.
template<typename t>
 CImg (const t *const data_buffer, const unsigned int dx, const unsigned int dy=1, const unsigned int dz=1, const unsigned int dv=1, const bool shared=false)
 Construct an image from a raw memory buffer.
 CImg (const T *const data_buffer, const unsigned int dx, const unsigned int dy=1, const unsigned int dz=1, const unsigned int dv=1, const bool shared=false)
template<typename t>
 CImg (const CImg< t > &img)
 Default copy constructor.
 CImg (const CImg< T > &img)
template<typename t>
 CImg (const CImg< t > &img, const bool shared)
 Advanced copy constructor.
 CImg (const CImg< T > &img, const bool shared)
template<typename t>
 CImg (const CImg< t > &img, const char *const dimensions)
 Construct an image using dimensions of another image.
template<typename t>
 CImg (const CImg< t > &img, const char *const dimensions, const T val)
 Construct an image using dimensions of another image, and fill it with a default value.
 CImg (const char *const filename)
 Construct an image from an image file.
 CImg (const CImgDisplay &disp)
 Construct an image from the content of a CImgDisplay instance.
CImg< T > & assign ()
 In-place version of the default constructor/destructor.
CImg< T > & clear ()
 In-place version of the default constructor.
CImg< T > & assign (const unsigned int dx, const unsigned int dy=1, const unsigned int dz=1, const unsigned int dv=1)
 In-place version of the previous constructor.
CImg< T > & assign (const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const T val)
 In-place version of the previous constructor.
CImg< T > & assign (const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const int val0, const int val1,...)
 In-place version of the previous constructor.
CImg< T > & assign (const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const double val0, const double val1,...)
 In-place version of the previous constructor.
template<typename t>
CImg< T > & assign (const t *const data_buffer, const unsigned int dx, const unsigned int dy=1, const unsigned int dz=1, const unsigned int dv=1)
 In-place version of the previous constructor.
CImg< T > & assign (const T *const data_buffer, const unsigned int dx, const unsigned int dy=1, const unsigned int dz=1, const unsigned int dv=1)
template<typename t>
CImg< T > & assign (const t *const data_buffer, const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const bool shared)
 In-place version of the previous constructor, allowing to force the shared state of the instance image.
CImg< T > & assign (const T *const data_buffer, const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const bool shared)
template<typename t>
CImg< T > & assign (const CImg< t > &img)
 In-place version of the default copy constructor.
template<typename t>
CImg< T > & assign (const CImg< t > &img, const bool shared)
 In-place version of the advanced constructor.
template<typename t>
CImg< T > & assign (const CImg< t > &img, const char *const dimensions)
 In-place version of the previous constructor.
template<typename t>
CImg< T > & assign (const CImg< t > &img, const char *const dimensions, const T val)
 In-place version of the previous constructor.
CImg< T > & assign (const char *const filename)
 In-place version of the previous constructor.
CImg< T > & assign (const CImgDisplay &disp)
 In-place version of the previous constructor.
template<typename t>
CImg< t > & transfer_to (CImg< t > &img)
 Transfer the content of the instance image into another one in a way that memory copies are avoided if possible.
CImg< T > & transfer_to (CImg< T > &img)
CImg< T > & swap (CImg< T > &img)
 Swap all fields of two images. Use with care !
Arithmetic and Boolean Operators
template<typename t>
CImg< T > & operator= (const CImg< t > &img)
 Assignment operator.
CImg< T > & operator= (const CImg< T > &img)
CImg< T > & operator= (const T *buf)
 Assign values of a C-array to the instance image.
CImg< T > & operator= (const T val)
 Assign a value to each image pixel of the instance image.
CImg< T > operator+ () const
 Operator+.
template<typename t>
CImg< T > & operator+= (const t val)
 Operator+=;.
template<typename t>
CImg< T > & operator+= (const CImg< t > &img)
 Operator+=.
CImg< T > & operator++ ()
 Operator++ (prefix).
CImg< T > operator++ (int)
 Operator++ (postfix).
CImg< T > operator- () const
 Operator-.
template<typename t>
CImg< T > & operator-= (const t val)
 Operator-=.
template<typename t>
CImg< T > & operator-= (const CImg< t > &img)
 Operator-=.
CImg< T > & operator-- ()
 Operator-- (prefix).
CImg< T > operator-- (int)
 Operator-- (postfix).
template<typename t>
CImg< T > & operator*= (const t val)
 Operator*=.
template<typename t>
CImg< T > & operator*= (const CImg< t > &img)
 Operator*=.
template<typename t>
CImg< T > & operator/= (const t val)
 Operator/=.
template<typename t>
CImg< T > & operator/= (const CImg< t > &img)
 Operator/=.
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
operator% (const CImg< t > &img) const
 Modulo.
CImg< T > operator% (const T val) const
 Modulo.
CImg< T > & operator%= (const T val)
 In-place modulo.
template<typename t>
CImg< T > & operator%= (const CImg< t > &img)
 In-place modulo.
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
operator & (const CImg< t > &img) const
 Bitwise AND.
CImg< T > operator & (const T val) const
 Bitwise AND.
template<typename t>
CImg< T > & operator &= (const CImg< t > &img)
 In-place bitwise AND.
CImg< T > & operator &= (const T val)
 In-place bitwise AND.
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
operator| (const CImg< t > &img) const
 Bitwise OR.
CImg< T > operator| (const T val) const
 Bitwise OR.
template<typename t>
CImg< T > & operator|= (const CImg< t > &img)
 In-place bitwise OR.
CImg< T > & operator|= (const T val)
 In-place bitwise OR.
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
operator^ (const CImg< t > &img) const
 Bitwise XOR.
CImg< T > operator^ (const T val) const
 Bitwise XOR.
template<typename t>
CImg< T > & operator^= (const CImg< t > &img)
 In-place bitwise XOR.
CImg< T > & operator^= (const T val)
 In-place bitwise XOR.
CImg< T > operator~ () const
 Bitwise NOT.
CImg< T > & operator<<= (const int n)
 Bitwise left shift.
CImg< T > operator<< (const int n) const
 Bitwise left shift.
CImg< T > & operator>>= (const int n)
 Bitwise right shift.
CImg< T > operator>> (const int n) const
 Bitwise right shift.
template<typename t>
bool operator== (const CImg< t > &img) const
 Boolean equality.
template<typename t>
bool operator!= (const CImg< t > &img) const
 Boolean difference.
template<typename t>
CImgList< typename
cimg::superset< T, t >::type > 
operator<< (const CImg< t > &img) const
 Return a list of two images { *this, img }.
template<typename t>
CImgList< typename
cimg::superset< T, t >::type > 
operator<< (const CImgList< t > &list) const
 Return a copy of list, where image *this has been inserted at first position.
template<typename t>
CImgList< typename
cimg::superset< T, t >::type > 
operator>> (const CImg< t > &img) const
 Return a list of two images { *this, img }.
template<typename t>
CImgList< t > & operator>> (const CImgList< t > &list) const
 Insert an image into the begining of an image list.
const CImg< T > & operator>> (CImgDisplay &disp) const
 Display an image into a CImgDisplay.
Usual Mathematics Functions
template<typename t>
CImg< T > get_apply (t &func) const
 Apply a R->R function on all pixel values.
template<typename t>
CImg< T > & apply (t &func)
 Apply a R->R function on all pixel values (in-place).
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
get_mul (const CImg< t > &img) const
 Pointwise multiplication between two images.
template<typename t>
CImg< T > & mul (const CImg< t > &img)
 Pointwise multiplication between two images (in-place).
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
get_div (const CImg< t > &img) const
 Pointwise division between two images.
template<typename t>
CImg< T > & div (const CImg< t > &img)
 Pointwise division between two images (in-place).
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
get_max (const CImg< t > &img) const
 Pointwise max operator between two images.
template<typename t>
CImg< T > & max (const CImg< t > &img)
 Pointwise max operator between two images (in-place).
CImg< T > get_max (const T val) const
 Pointwise max operator between an image and a value.
CImg< T > & max (const T val)
 Pointwise max operator between an image and a value (in-place).
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
get_min (const CImg< t > &img) const
 Pointwise min operator between two images.
template<typename t>
CImg< T > & min (const CImg< t > &img)
 Pointwise min operator between two images (in-place).
CImg< T > get_min (const T val) const
 Pointwise min operator between an image and a value.
CImg< T > & min (const T val)
 Pointwise min operator between an image and a value (in-place).
CImg< Tdouble > get_stats () const
 Compute a statistics vector (min,max,mean,variance,offmin,offmax).
CImg< T > & stats ()
 Compute a statistics vector (min,max,mean,variance,offmin,offmax) (in-place).
CImg< Tfloat > get_sqr () const
 Compute the square of each pixel value.
CImg< T > & sqr ()
 Compute the square of each pixel value (in-place).
CImg< Tfloat > get_sqrt () const
 Compute the square root of each pixel value.
CImg< T > & sqrt ()
 Compute the square root of each pixel value (in-place).
CImg< Tfloat > get_exp () const
 Compute the exponential of each pixel value.
CImg< T > & exp ()
 Compute the exponential of each pixel value (in-place).
CImg< Tfloat > get_log () const
 Compute the log of each each pixel value.
CImg< T > & log ()
 Compute the log of each each pixel value (in-place).
CImg< Tfloat > get_log10 () const
 Compute the log10 of each each pixel value.
CImg< T > & log10 ()
 Compute the log10 of each each pixel value (in-place).
CImg< Tfloat > get_pow (const double p) const
 Compute the power by p of each pixel value.
CImg< T > & pow (const double p)
 Compute the power by p of each pixel value (in-place).
template<typename t>
CImg< Tfloat > get_pow (const CImg< t > &img) const
 Compute the power of each pixel value.
template<typename t>
CImg< T > & pow (const CImg< t > &img)
 Compute the power of each pixel value (in-place).
CImg< Tfloat > get_abs () const
 Compute the absolute value of each pixel value.
CImg< T > & abs ()
 Compute the absolute value of each pixel value (in-place).
CImg< Tfloat > get_cos () const
 Compute the cosinus of each pixel value.
CImg< T > & cos ()
 Compute the cosinus of each pixel value (in-place).
CImg< Tfloat > get_sin () const
 Compute the sinus of each pixel value.
CImg< T > & sin ()
 Compute the sinus of each pixel value (in-place).
CImg< Tfloat > get_tan () const
 Compute the tangent of each pixel.
CImg< T > & tan ()
 Compute the tangent of each pixel (in-place).
CImg< Tfloat > get_acos () const
 Compute the arc-cosine of each pixel value.
CImg< T > & acos ()
 Compute the arc-cosine of each pixel value (in-place).
CImg< Tfloat > get_asin () const
 Compute the arc-sinus of each pixel value.
CImg< T > & asin ()
 Compute the arc-sinus of each pixel value (in-place).
CImg< Tfloat > get_atan () const
 Compute the arc-tangent of each pixel.
CImg< T > & atan ()
 Compute the arc-tangent of each pixel (in-place).
CImg< T > get_round (const float x, const unsigned int round_type=0) const
 Compute image with rounded pixel values.
CImg< T > & round (const float x, const unsigned int round_type=0)
 Compute image with rounded pixel values (in-place).
CImg< T > get_rand (const T val_min, const T val_max) const
 Compute an image filled with random values between specified range.
CImg< T > & rand (const T val_min, const T val_max)
 Return an image filled with random values between specified range (in-place).
Drawing
template<typename tc>
CImg< T > & _draw_scanline (const int x0, const int x1, const int y, const tc *const color, const float opacity=1.0f, const float brightness=1.0f, const bool init=false)
template<typename tc>
CImg< T > & _draw_scanline (const tc *const color, const float opacity=1.0f)
template<typename tc>
CImg< T > & draw_point (const int x0, const int y0, const tc *const color, const float opacity=1.0f)
 Draw a colored point (pixel) in the instance image.
template<typename tc>
CImg< T > & draw_point (const int x0, const int y0, const CImg< tc > &color, const float opacity=1.0f)
 Draw a colored point (pixel) in the instance image.
template<typename tc>
CImg< T > & draw_point (const int x0, const int y0, const int z0, const tc *const color, const float opacity=1.0f)
 Draw a colored point (pixel) in the instance image (for volumetric images).
template<typename tc>
CImg< T > & draw_point (const int x0, const int y0, const int z0, const CImg< tc > &color, const float opacity=1.0f)
 Draw a colored point (pixel) in the instance image (for volumetric images).
template<typename t, typename tc>
CImg< T > & _draw_point (const t &points, const tc *const color, const float opacity, const unsigned int W, const unsigned int H)
template<typename t, typename tc>
CImg< T > & draw_point (const CImgList< t > &points, const tc *const color, const float opacity=1.0f)
 Draw a cloud of colored points in the instance image.
template<typename t, typename tc>
CImg< T > & draw_point (const CImgList< t > &points, const CImg< tc > &color, const float opacity=1.0f)
 Draw a cloud of colored points in the instance image.
template<typename t, typename tc>
CImg< T > & draw_point (const CImg< t > &points, const tc *const color, const float opacity=1.0f)
 Draw a cloud of points in the instance image.
template<typename t, typename tc>
CImg< T > & draw_point (const CImg< t > &points, const CImg< tc > &color, const float opacity=1.0f)
 Draw a cloud of points in the instance image.
template<typename tc>
CImg< T > & draw_line (const int x0, const int y0, const int x1, const int y1, const tc *const color, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a colored line in the instance image.
template<typename tc>
CImg< T > & draw_line (const int x0, const int y0, const int x1, const int y1, const CImg< tc > &color, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a colored line in the instance image.
template<typename tc>
CImg< T > & draw_line (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const tc *const color, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a colored line in the instance image (for volumetric images).
template<typename tc>
CImg< T > & draw_line (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const CImg< tc > &color, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a colored line in the instance image (for volumetric images).
template<typename t>
CImg< T > & draw_line (const int x0, const int y0, const int x1, const int y1, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a textured line in the instance image.
template<typename t>
CImg< T > & draw_line (const int x0, const int y0, const float z0, const int x1, const int y1, const float z1, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a textured line in the instance image, with perspective correction.
template<typename t, typename tc>
CImg< T > & _draw_line (const t &points, const tc *const color, const float opacity, const unsigned int pattern, const bool init_hatch, const unsigned int W, const unsigned int H)
template<typename t, typename tc>
CImg< T > & draw_line (const CImgList< t > &points, const tc *const color, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored lines in the instance image.
template<typename t, typename tc>
CImg< T > & draw_line (const CImgList< t > &points, const CImg< tc > &color, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored lines in the instance image.
template<typename t, typename tc>
CImg< T > & draw_line (const CImg< t > &points, const tc *const color, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored lines in the instance image.
template<typename t, typename tc>
CImg< T > & draw_line (const CImg< t > &points, const CImg< tc > &color, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored lines in the instance image.
template<typename t, typename tc>
CImg< T > & _draw_polygon (const t &points, const tc *const color, const float opacity, const unsigned int N)
template<typename t, typename tc>
CImg< T > & draw_polygon (const CImgList< t > &points, const tc *const color, const float opacity=1.0f)
 Draw a filled polygon in the instance image.
template<typename t, typename tc>
CImg< T > & draw_polygon (const CImgList< t > &points, const CImg< tc > &color, const float opacity=1.0f)
 Draw a filled polygon in the instance image.
template<typename t, typename tc>
CImg< T > & draw_polygon (const CImg< t > &points, const tc *const color, const float opacity=1.0f)
 Draw a filled polygon in the instance image.
template<typename t, typename tc>
CImg< T > & draw_polygon (const CImg< t > &points, const CImg< tc > &color, const float opacity=1.0f)
 Draw a filled polygon in the instance image.
template<typename t, typename tc>
CImg< T > & _draw_polygon (const t &points, const tc *const color, const float opacity, const unsigned int pattern, const unsigned int W, const unsigned int H)
template<typename t, typename tc>
CImg< T > & draw_polygon (const CImgList< t > &points, const tc *const color, const float opacity, const unsigned int pattern)
 Draw a polygon outline.
template<typename t, typename tc>
CImg< T > & draw_polygon (const CImgList< t > &points, const CImg< tc > &color, const float opacity, const unsigned int pattern)
 Draw a polygon outline.
template<typename t, typename tc>
CImg< T > & draw_polygon (const CImg< t > &points, const tc *const color, const float opacity, const unsigned int pattern)
 Draw a polygon outline.
template<typename t, typename tc>
CImg< T > & draw_polygon (const CImg< t > &points, const CImg< tc > &color, const float opacity, const unsigned int pattern)
 Draw a polygon outline.
template<typename tc>
CImg< T > & draw_spline (const int x0, const int y0, const float u0, const float v0, const int x1, const int y1, const float u1, const float v1, const tc *const color, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a cubic spline curve in the instance image.
template<typename tc>
CImg< T > & draw_spline (const int x0, const int y0, const float u0, const float v0, const int x1, const int y1, const float u1, const float v1, const CImg< tc > &color, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a cubic spline curve in the instance image.
template<typename tc>
CImg< T > & draw_spline (const int x0, const int y0, const int z0, const float u0, const float v0, const float w0, const int x1, const int y1, const int z1, const float u1, const float v1, const float w1, const tc *const color, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a cubic spline curve in the instance image (for volumetric images).
template<typename tc>
CImg< T > & draw_spline (const int x0, const int y0, const int z0, const float u0, const float v0, const float w0, const int x1, const int y1, const int z1, const float u1, const float v1, const float w1, const CImg< tc > &color, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a cubic spline curve in the instance image (for volumetric images).
template<typename t>
CImg< T > & draw_spline (const int x0, const int y0, const float u0, const float v0, const int x1, const int y1, const float u1, const float v1, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a cubic spline curve in the instance image.
template<typename tp, typename tt, typename tc>
CImg< T > & _draw_spline (const tp &points, const tt &tangents, const tc *const color, const bool close_set, const float precision, const float opacity, const unsigned int pattern, const bool init_hatch, const unsigned int W, const unsigned int H)
template<typename tp, typename tc>
CImg< T > & _draw_spline (const tp &points, const tc *const color, const bool close_set, const float precision, const float opacity, const unsigned int pattern, const bool init_hatch, const unsigned int W, const unsigned int H)
template<typename tp, typename tt, typename tc>
CImg< T > & draw_spline (const CImgList< tp > &points, const CImgList< tt > &tangents, const tc *const color, const bool close_set=false, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored splines in the instance image.
template<typename tp, typename tt, typename tc>
CImg< T > & draw_spline (const CImgList< tp > &points, const CImgList< tt > &tangents, const CImg< tc > &color, const bool close_set=false, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored splines in the instance image.
template<typename tp, typename tt, typename tc>
CImg< T > & draw_spline (const CImg< tp > &points, const CImg< tt > &tangents, const tc *const color, const bool close_set=false, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored splines in the instance image.
template<typename tp, typename tt, typename tc>
CImg< T > & draw_spline (const CImg< tp > &points, const CImg< tt > &tangents, const CImg< tc > &color, const bool close_set=false, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored splines in the instance image.
template<typename t, typename tc>
CImg< T > & draw_spline (const CImgList< t > &points, const tc *const color, const bool close_set=false, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored splines in the instance image.
template<typename t, typename tc>
CImg< T > & draw_spline (const CImgList< t > &points, CImg< tc > &color, const bool close_set=false, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored splines in the instance image.
template<typename t, typename tc>
CImg< T > & draw_spline (const CImg< t > &points, const tc *const color, const bool close_set=false, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored lines in the instance image.
template<typename t, typename tc>
CImg< T > & draw_spline (const CImg< t > &points, const CImg< tc > &color, const bool close_set=false, const float precision=4.0f, const float opacity=1.0f, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive colored lines in the instance image.
template<typename tc>
CImg< T > & draw_arrow (const int x0, const int y0, const int x1, const int y1, const tc *const color, const float angle=30, const float length=-10, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a colored arrow in the instance image.
template<typename tc>
CImg< T > & draw_arrow (const int x0, const int y0, const int x1, const int y1, const CImg< tc > &color, const float angle=30, const float length=-10, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a colored arrow in the instance image.
template<typename t>
CImg< T > & draw_image (const CImg< t > &sprite, const int x0, const int y0=0, const int z0=0, const int v0=0, const float opacity=1.0f)
 Draw a sprite image in the instance image.
CImg< T > & draw_image (const CImg< T > &sprite, const int x0, const int y0=0, const int z0=0, const int v0=0, const float opacity=1.0f)
template<typename ti, typename tm>
CImg< T > & draw_image (const CImg< ti > &sprite, const CImg< tm > &mask, const int x0, const int y0=0, const int z0=0, const int v0=0, const float mask_valmax=1.0f, const float opacity=1.0f)
 Draw a sprite image in the instance image (masked version).
CImg< T > & draw_rectangle (const int x0, const int y0, const int z0, const int v0, const int x1, const int y1, const int z1, const int v1, const T val, const float opacity=1.0f)
 Draw a 4D filled rectangle in the instance image, at coordinates (x0,y0,z0,v0)-(x1,y1,z1,v1).
template<typename tc>
CImg< T > & draw_rectangle (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const tc *const color, const float opacity=1.0f)
 Draw a 3D filled colored rectangle in the instance image, at coordinates (x0,y0,z0)-(x1,y1,z1).
template<typename tc>
CImg< T > & draw_rectangle (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const CImg< tc > &color, const float opacity=1.0f)
 Draw a 3D filled colored rectangle in the instance image, at coordinates (x0,y0,z0)-(x1,y1,z1).
template<typename tc>
CImg< T > & draw_rectangle (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const tc *const color, const float opacity, const unsigned int pattern)
 Draw a 3D outlined colored rectangle in the instance image.
template<typename tc>
CImg< T > & draw_rectangle (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const CImg< tc > &color, const float opacity, const unsigned int pattern)
 Draw a 3D outlined colored rectangle in the instance image.
template<typename tc>
CImg< T > & draw_rectangle (const int x0, const int y0, const int x1, const int y1, const tc *const color, const float opacity=1.0f)
 Draw a 2D filled colored rectangle in the instance image, at coordinates (x0,y0)-(x1,y1).
template<typename tc>
CImg< T > & draw_rectangle (const int x0, const int y0, const int x1, const int y1, const CImg< tc > &color, const float opacity=1.0f)
 Draw a 2D filled colored rectangle in the instance image, at coordinates (x0,y0)-(x1,y1).
template<typename tc>
CImg< T > & draw_rectangle (const int x0, const int y0, const int x1, const int y1, const tc *const color, const float opacity, const unsigned int pattern)
 Draw a 2D outlined colored rectangle.
template<typename tc>
CImg< T > & draw_rectangle (const int x0, const int y0, const int x1, const int y1, const CImg< tc > &color, const float opacity, const unsigned int pattern)
 Draw a 2D outlined colored rectangle.
template<typename tc>
CImg< T > & _draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const tc *const color, const float opacity, const float brightness)
template<typename tc>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const tc *const color, const float opacity=1.0f)
 Draw a 2D filled colored triangle in the instance image.
template<typename tc>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const CImg< tc > &color, const float opacity=1.0f)
 Draw a 2D filled colored triangle in the instance image.
template<typename tc>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const tc *const color, const float opacity, const unsigned int pattern)
 Draw a 2D outlined colored triangle.
template<typename tc>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const CImg< tc > &color, const float opacity, const unsigned int pattern)
 Draw a 2D outlined colored triangle.
template<typename tc>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const tc *const color, const float brightness0, const float brightness1, const float brightness2, const float opacity=1.0f)
 Draw a 2D Gouraud-filled triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).
template<typename tc>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const CImg< tc > &color, const float brightness0, const float brightness1, const float brightness2, const float opacity=1.0f)
 Draw a 2D Gouraud-filled triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).
template<typename t>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const float opacity=1.0f, const float brightness=1.0f)
 Draw a 2D textured triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).
template<typename t>
CImg< T > & draw_triangle (const int x0, const int y0, const float z0, const int x1, const int y1, const float z1, const int x2, const int y2, const float z2, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const float opacity=1.0f, const float brightness=1.0f)
 Draw a textured triangle with perspective correction.
template<typename tc, typename t>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const tc *const color, const CImg< t > &light, const int lx0, const int ly0, const int lx1, const int ly1, const int lx2, const int ly2, const float opacity=1.0f)
 Draw a 2D phong-shaded triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).
template<typename tc, typename t>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const CImg< tc > &color, const CImg< t > &light, const int lx0, const int ly0, const int lx1, const int ly1, const int lx2, const int ly2, const float opacity=1.0f)
 Draw a 2D phong-shaded triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).
template<typename t>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const float brightness0, const float brightness1, const float brightness2, const float opacity=1)
 Draw a 2D textured triangle with Gouraud-Shading in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).
template<typename t>
CImg< T > & draw_triangle (const int x0, const int y0, const float z0, const int x1, const int y1, const float z1, const int x2, const int y2, const float z2, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const float c0, const float c1, const float c2, const float opacity=1.0f)
 Draw a gouraud + textured triangle with perspective correction.
template<typename t, typename tl>
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const CImg< tl > &light, const int lx0, const int ly0, const int lx1, const int ly1, const int lx2, const int ly2, const float opacity=1.0f)
 Draw a phong-shaded 2D textured triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).
template<typename t, typename tl>
CImg< T > & draw_triangle (const int x0, const int y0, const float z0, const int x1, const int y1, const float z1, const int x2, const int y2, const float z2, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const CImg< tl > &light, const int lx0, const int ly0, const int lx1, const int ly1, const int lx2, const int ly2, const float opacity=1.0f)
 Draw a phong + textured triangle with perspective correction.
template<typename tc>
CImg< T > & _draw_ellipse (const int x0, const int y0, const float r1, const float r2, const float ru, const float rv, const tc *const color, const float opacity, const unsigned int pattern)
template<typename tc>
CImg< T > & draw_ellipse (const int x0, const int y0, const float r1, const float r2, const float ru, const float rv, const tc *const color, const float opacity=1.0f)
 Draw a filled ellipse.
template<typename tc>
CImg< T > & draw_ellipse (const int x0, const int y0, const float r1, const float r2, const float ru, const float rv, const CImg< tc > &color, const float opacity=1.0f)
 Draw a filled ellipse.
template<typename t, typename tc>
CImg< T > & draw_ellipse (const int x0, const int y0, const CImg< t > &tensor, const tc *const color, const float opacity=1.0f)
 Draw a filled ellipse.
template<typename t, typename tc>
CImg< T > & draw_ellipse (const int x0, const int y0, const CImg< t > &tensor, const CImg< tc > &color, const float opacity=1.0f)
 Draw a filled ellipse.
template<typename tc>
CImg< T > & draw_ellipse (const int x0, const int y0, const float r1, const float r2, const float ru, const float rv, const tc *const color, const float opacity, const unsigned int pattern)
 Draw an outlined ellipse.
template<typename tc>
CImg< T > & draw_ellipse (const int x0, const int y0, const float r1, const float r2, const float ru, const float rv, const CImg< tc > &color, const float opacity, const unsigned int pattern)
 Draw an outlined ellipse.
template<typename t, typename tc>
CImg< T > & draw_ellipse (const int x0, const int y0, const CImg< t > &tensor, const tc *const color, const float opacity, const unsigned int pattern)
 Draw an outlined ellipse.
template<typename t, typename tc>
CImg< T > & draw_ellipse (const int x0, const int y0, const CImg< t > &tensor, const CImg< tc > &color, const float opacity, const unsigned int pattern)
 Draw an outlined ellipse.
template<typename tc>
CImg< T > & draw_circle (const int x0, const int y0, int radius, const tc *const color, const float opacity=1.0f)
 Draw a filled circle.
template<typename tc>
CImg< T > & draw_circle (const int x0, const int y0, int radius, const CImg< tc > &color, const float opacity=1.0f)
 Draw a filled circle.
template<typename tc>
CImg< T > & draw_circle (const int x0, const int y0, int radius, const tc *const color, const float opacity, const unsigned int)
 Draw an outlined circle.
template<typename tc>
CImg< T > & draw_circle (const int x0, const int y0, int radius, const CImg< tc > &color, const float opacity, const unsigned int foo)
 Draw an outlined circle.
template<typename tc1, typename tc2, typename t>
CImg< T > & draw_text (const char *const text, const int x0, const int y0, const tc1 *const foreground_color, const tc2 *const background_color, const CImgList< t > &font, const float opacity=1.0f)
 Draw a text.
template<typename tc1, typename tc2, typename t>
CImg< T > & draw_text (const char *const text, const int x0, const int y0, const CImg< tc1 > &foreground_color, const CImg< tc2 > &background_color, const CImgList< t > &font, const float opacity=1.0f)
 Draw a text.
template<typename tc, typename t>
CImg< T > & draw_text (const char *const text, const int x0, const int y0, const tc *const foreground_color, const int background_color, const CImgList< t > &font, const float opacity=1.0f)
 Draw a text.
template<typename tc, typename t>
CImg< T > & draw_text (const char *const text, const int x0, const int y0, const int foreground_color, const tc *const background_color, const CImgList< t > &font, const float opacity=1.0f)
 Draw a text.
template<typename tc1, typename tc2>
CImg< T > & draw_text (const char *const text, const int x0, const int y0, const tc1 *const foreground_color, const tc2 *const background_color=0, const unsigned int font_size=11, const float opacity=1.0f)
 Draw a text.
template<typename tc1, typename tc2>
CImg< T > & draw_text (const char *const text, const int x0, const int y0, const CImg< tc1 > &foreground_color, const CImg< tc2 > &background_color, const unsigned int font_size=11, const float opacity=1.0f)
 Draw a text.
template<typename tc>
CImg< T > & draw_text (const char *const text, const int x0, const int y0, const tc *const foreground_color, int background_color=0, const unsigned int font_size=11, const float opacity=1.0f)
 Draw a text.
template<typename tc>
CImg< T > & draw_text (const char *const text, const int x0, const int y0, const int foreground_color, const tc *const background_color=0, const unsigned int font_size=11, const float opacity=1.0f)
 Draw a text.
template<typename tc1, typename tc2>
CImg< T > & draw_text (const int x0, const int y0, const tc1 *const foreground_color, const tc2 *const background_color, const unsigned int font_size, const float opacity, const char *format,...)
 Draw a text.
template<typename tc1, typename tc2>
CImg< T > & draw_text (const int x0, const int y0, const CImg< tc1 > &foreground_color, const CImg< tc2 > &background_color, const unsigned int font_size, const float opacity, const char *format,...)
 Draw a text.
template<typename tc>
CImg< T > & draw_text (const int x0, const int y0, const tc *const foreground_color, const int background_color, const unsigned int font_size, const float opacity, const char *format,...)
 Draw a text.
template<typename tc>
CImg< T > & draw_text (const int x0, const int y0, const int foreground_color, const tc *const background_color, const unsigned int font_size, const float opacity, const char *format,...)
 Draw a text.
template<typename tc1, typename tc2, typename t>
CImg< T > & draw_text (const int x0, const int y0, const tc1 *const foreground_color, const tc2 *const background_color, const CImgList< t > &font, const float opacity, const char *format,...)
 Draw a text.
template<typename tc1, typename tc2, typename t>
CImg< T > & draw_text (const int x0, const int y0, const CImg< tc1 > &foreground_color, const CImg< tc2 > &background_color, const CImgList< t > &font, const float opacity, const char *format,...)
 Draw a text.
template<typename tc, typename t>
CImg< T > & draw_text (const int x0, const int y0, const tc *const foreground_color, const int background_color, const CImgList< t > &font, const float opacity, const char *format,...)
 Draw a text.
template<typename tc, typename t>
CImg< T > & draw_text (const int x0, const int y0, const int foreground_color, const tc *const background_color, const CImgList< t > &font, const float opacity, const char *format,...)
 Draw a text.
template<typename t1, typename t2>
CImg< T > & draw_quiver (const CImg< t1 > &flow, const t2 *const color, const unsigned int sampling=25, const float factor=-20, const int quiver_type=0, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a vector field in the instance image, using a colormap.
template<typename t1, typename t2>
CImg< T > & draw_quiver (const CImg< t1 > &flow, const CImg< t2 > &color, const unsigned int sampling=25, const float factor=-20, const int quiver_type=0, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a vector field in the instance image, using a colormap.
template<typename t, typename tc>
CImg< T > & draw_graph (const CImg< t > &data, const tc *const color, const unsigned int gtype=1, const double ymin=0, const double ymax=0, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a 1D graph on the instance image.
template<typename t, typename tc>
CImg< T > & draw_graph (const CImg< t > &data, const CImg< tc > &color, const unsigned int gtype=1, const double ymin=0, const double ymax=0, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a 1D graph on the instance image.
template<typename t, typename tc>
CImg< T > & draw_axis (const CImg< t > &xvalues, const int y, const tc *const color, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a labeled horizontal axis on the instance image.
template<typename t, typename tc>
CImg< T > & draw_axis (const CImg< t > &xvalues, const int y, const CImg< tc > &color, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a labeled horizontal axis on the instance image.
template<typename t, typename tc>
CImg< T > & draw_axis (const int x, const CImg< t > &yvalues, const tc *const color, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a labeled vertical axis on the instance image.
template<typename t, typename tc>
CImg< T > & draw_axis (const int x, const CImg< t > &yvalues, const CImg< tc > &color, const float opacity=1.0f, const unsigned int pattern=~0U)
 Draw a labeled vertical axis on the instance image.
template<typename tx, typename ty, typename tc>
CImg< T > & draw_axis (const CImg< tx > &xvalues, const CImg< ty > &yvalues, const tc *const color, const float opacity=1.0f, const unsigned int patternx=~0U, const unsigned int patterny=~0U)
 Draw a labeled horizontal+vertical axis on the instance image.
template<typename tx, typename ty, typename tc>
CImg< T > & draw_axis (const CImg< tx > &xvalues, const CImg< ty > &yvalues, const CImg< tc > &color, const float opacity=1.0f, const unsigned int patternx=~0U, const unsigned int patterny=~0U)
 Draw a labeled horizontal+vertical axis on the instance image.
template<typename tc>
CImg< T > & draw_axis (const float x0, const float x1, const float y0, const float y1, const tc *const color, const int subdivisionx=-60, const int subdivisiony=-60, const float precisionx=0, const float precisiony=0, const float opacity=1.0f, const unsigned int patternx=~0U, const unsigned int patterny=~0U)
 Draw a labeled horizontal+vertical axis on the instance image.
template<typename tc>
CImg< T > & draw_axis (const float x0, const float x1, const float y0, const float y1, const CImg< tc > &color, const int subdivisionx=-60, const int subdivisiony=-60, const float precisionx=0, const float precisiony=0, const float opacity=1.0f, const unsigned int patternx=~0U, const unsigned int patterny=~0U)
 Draw a labeled horizontal+vertical axis on the instance image.
template<typename tx, typename ty, typename tc>
CImg< T > & draw_grid (const CImg< tx > &xvalues, const CImg< ty > &yvalues, const tc *const color, const float opacity=1.0f, const unsigned int patternx=~0U, const unsigned int patterny=~0U)
 Draw grid.
template<typename tx, typename ty, typename tc>
CImg< T > & draw_grid (const CImg< tx > &xvalues, const CImg< ty > &yvalues, const CImg< tc > &color, const float opacity=1.0f, const unsigned int patternx=~0U, const unsigned int patterny=~0U)
 Draw grid.
template<typename tc>
CImg< T > & draw_grid (const float deltax, const float deltay, const float offsetx, const float offsety, const bool invertx, const bool inverty, const tc *const color, const float opacity=1.0f, const unsigned int patternx=~0U, const unsigned int patterny=~0U)
 Draw grid.
template<typename tc>
CImg< T > & draw_grid (const float deltax, const float deltay, const float offsetx, const float offsety, const bool invertx, const bool inverty, const CImg< tc > &color, const float opacity=1.0f, const unsigned int patternx=~0U, const unsigned int patterny=~0U)
 Draw grid.
template<typename tc, typename t>
CImg< T > & draw_fill (const int x, const int y, const int z, const tc *const color, CImg< t > &region, const float sigma=0, const float opacity=1.0f, const bool high_connexity=false)
 Draw a 3D filled region starting from a point (x,y,\ z) in the instance image.
template<typename tc, typename t>
CImg< T > & draw_fill (const int x, const int y, const int z, const CImg< tc > &color, CImg< t > &region, const float sigma=0, const float opacity=1.0f, const bool high_connexity=false)
 Draw a 3D filled region starting from a point (x,y,\ z) in the instance image.
template<typename tc>
CImg< T > & draw_fill (const int x, const int y, const int z, const tc *const color, const float sigma=0, const float opacity=1.0f, const bool high_connexity=false)
 Draw a 3D filled region starting from a point (x,y,\ z) in the instance image.
template<typename tc>
CImg< T > & draw_fill (const int x, const int y, const int z, const CImg< tc > &color, const float sigma=0, const float opacity=1.0f, const bool high_connexity=false)
 Draw a 3D filled region starting from a point (x,y,\ z) in the instance image.
template<typename tc>
CImg< T > & draw_fill (const int x, const int y, const tc *const color, const float sigma=0, const float opacity=1.0f, const bool high_connexity=false)
 Draw a 2D filled region starting from a point (x,y) in the instance image.
template<typename tc>
CImg< T > & draw_fill (const int x, const int y, const CImg< tc > &color, const float sigma=0, const float opacity=1.0f, const bool high_connexity=false)
 Draw a 2D filled region starting from a point (x,y) in the instance image.
CImg< T > & draw_plasma (const int x0, const int y0, const int x1, const int y1, const double alpha=1.0, const double beta=1.0, const float opacity=1.0f)
 Draw a plasma random texture.
CImg< T > & draw_plasma (const double alpha=1.0, const double beta=1.0, const float opacity=1.0f)
 Draw a plasma random texture.
template<typename tc>
CImg< T > & draw_mandelbrot (const int x0, const int y0, const int x1, const int y1, const CImg< tc > &color_palette, const double z0r=-2, const double z0i=-2, const double z1r=2, const double z1i=2, const unsigned int itermax=255, const bool normalized_iteration=false, const bool julia_set=false, const double paramr=0, const double parami=0, const float opacity=1.0f)
 Draw a quadratic Mandelbrot or Julia fractal set, computed using the Escape Time Algorithm.
template<typename tc>
CImg< T > & draw_mandelbrot (const CImg< tc > &color_palette, const double z0r=-2, const double z0i=-2, const double z1r=2, const double z1i=2, const unsigned int itermax=255, const bool normalized_iteration=false, const bool julia_set=false, const double paramr=0, const double parami=0, const float opacity=1.0f)
 Draw a quadratic Mandelbrot or Julia fractal set, computed using the Escape Time Algorithm.
template<typename tc>
CImg< T > & draw_gaussian (const float xc, const double sigma, const tc *const color, const float opacity=1.0f)
 Draw a 1D gaussian function in the instance image.
template<typename tc>
CImg< T > & draw_gaussian (const float xc, const double sigma, const CImg< tc > &color, const float opacity=1.0f)
 Draw a 1D gaussian function in the instance image.
template<typename t, typename tc>
CImg< T > & draw_gaussian (const float xc, const float yc, const CImg< t > &tensor, const tc *const color, const float opacity=1.0f)
 Draw an anisotropic 2D gaussian function.
template<typename t, typename tc>
CImg< T > & draw_gaussian (const float xc, const float yc, const CImg< t > &tensor, const CImg< tc > &color, const float opacity=1.0f)
 Draw an anisotropic 2D gaussian function.
template<typename tc>
CImg< T > & draw_gaussian (const float xc, const float yc, const float sigma, const tc *const color, const float opacity=1.0f)
 Draw an isotropic 2D gaussian function.
template<typename tc>
CImg< T > & draw_gaussian (const float xc, const float yc, const float sigma, const CImg< tc > &color, const float opacity=1.0f)
 Draw an isotropic 2D gaussian function.
template<typename t, typename tc>
CImg< T > & draw_gaussian (const float xc, const float yc, const float zc, const CImg< t > &tensor, const tc *const color, const float opacity=1.0f)
 Draw an anisotropic 3D gaussian function.
template<typename t, typename tc>
CImg< T > & draw_gaussian (const float xc, const float yc, const float zc, const CImg< t > &tensor, const CImg< tc > &color, const float opacity=1.0f)
 Draw an anisotropic 3D gaussian function.
template<typename tc>
CImg< T > & draw_gaussian (const float xc, const float yc, const float zc, const double sigma, const tc *const color, const float opacity=1.0f)
 Draw an isotropic 3D gaussian function.
template<typename tc>
CImg< T > & draw_gaussian (const float xc, const float yc, const float zc, const double sigma, const CImg< tc > &color, const float opacity=1.0f)
 Draw an isotropic 3D gaussian function.
template<typename tp, typename tf, typename tc, typename to>
CImg< T > & draw_object3d (const float X, const float Y, const float Z, const CImg< tp > &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImgList< to > &opacities, const unsigned int render_type=4, const bool double_sided=false, const float focale=500, const float lightx=0, const float lighty=0, const float lightz=-5000, const float specular_light=0.2f, const float specular_shine=0.1f)
 Draw a 3D object.
template<typename tp, typename tf, typename tc, typename to>
CImg< T > & draw_object3d (const float X, const float Y, const float Z, const CImgList< tp > &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImgList< to > &opacities, const unsigned int render_type=4, const bool double_sided=false, const float focale=500, const float lightx=0, const float lighty=0, const float lightz=-5000, const float specular_light=0.2f, const float specular_shine=0.1f)
 Draw a 3D object.
template<typename tp, typename tf, typename tc, typename to>
CImg< T > & draw_object3d (const float X, const float Y, const float Z, const CImg< tp > &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImg< to > &opacities, const unsigned int render_type=4, const bool double_sided=false, const float focale=500, const float lightx=0, const float lighty=0, const float lightz=-5000, const float specular_light=0.2f, const float specular_shine=0.1f)
 Draw a 3D object.
template<typename tp, typename tf, typename tc, typename to>
CImg< T > & draw_object3d (const float X, const float Y, const float Z, const CImgList< tp > &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImg< to > &opacities, const unsigned int render_type=4, const bool double_sided=false, const float focale=500, const float lightx=0, const float lighty=0, const float lightz=-5000, const float specular_light=0.2f, const float specular_shine=0.1f)
 Draw a 3D object.
template<typename tp, typename tf, typename tc>
CImg< T > & draw_object3d (const float X, const float Y, const float Z, const tp &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const unsigned int render_type=4, const bool double_sided=false, const float focale=500, const float lightx=0, const float lighty=0, const float lightz=-5000, const float specular_light=0.2f, const float specular_shine=0.1f, const float opacity=1.0f)
 Draw a 3D object.
Image Filtering
template<typename t>
CImg< typename cimg::superset2
< T, t, float >::type > 
get_correlate (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_correl=false) const
 Compute the correlation of the instance image by a mask.
template<typename t>
CImg< T > & correlate (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_correl=false)
 Compute the correlation of the instance image by a mask (in-place).
template<typename t>
CImg< typename cimg::superset2
< T, t, float >::type > 
get_convolve (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_convol=false) const
 Compute the convolution of the image by a mask.
template<typename t>
CImg< T > & convolve (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_convol=false)
 Compute the convolution of the image by a mask (in-place).
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
get_erode (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_erosion=false) const
 Return the erosion of the image by a structuring element.
template<typename t>
CImg< T > & erode (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_erosion=false)
 Return the erosion of the image by a structuring element (in-place).
CImg< T > get_erode (const unsigned int n, const unsigned int cond=1) const
 Erode the image by a square structuring element of size n.
CImg< T > & erode (const unsigned int n, const unsigned int cond=1)
 Erode the image by a square structuring element of size n (in-place).
template<typename t>
CImg< typename cimg::superset
< T, t >::type > 
get_dilate (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_dilatation=false) const
 Dilate the image by a structuring element.
template<typename t>
CImg< T > & dilate (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_dilatation=false)
 Dilate the image by a structuring element (in-place).
CImg< T > get_dilate (const unsigned int n, const unsigned int cond=1) const
 Dilate the image by a square structuring element of size n.
CImg< T > & dilate (const unsigned int n, const unsigned int cond=1)
 Dilate the image by a square structuring element of size n (in-place).
CImg< T > get_noise (const double sigma=-20, const unsigned int ntype=0) const
 Add noise to the image.
CImg< T > & noise (const double sigma=-20, const unsigned int ntype=0)
 Add noise to the image (in-place).
CImg< Tfloat > get_deriche (const float sigma, const int order=0, const char axe='x', const bool cond=true) const
 Compute the result of the Deriche filter.
CImg< T > & deriche (const float sigma, const int order=0, const char axe='x', const bool cond=true)
 Compute the result of the Deriche filter (in-place).
CImg< Tfloat > get_blur (const float sigmax, const float sigmay, const float sigmaz, const bool cond=true) const
 Return a blurred version of the image, using a Canny-Deriche filter.
CImg< T > & blur (const float sigmax, const float sigmay, const float sigmaz, const bool cond=true)
 Return a blurred version of the image, using a Canny-Deriche filter (in-place).
CImg< Tfloat > get_blur (const float sigma, const bool cond=true) const
 Return a blurred version of the image, using a Canny-Deriche filter.
CImg< T > & blur (const float sigma, const bool cond=true)
 Return a blurred version of the image, using a Canny-Deriche filter (in-place).
template<typename t>
CImg< T > get_blur_anisotropic (const CImg< t > &G, const float amplitude=60.0f, const float dl=0.8f, const float da=30.0f, const float gauss_prec=2.0f, const unsigned int interpolation_type=0, const bool fast_approx=true) const
 Blur the image anisotropically following a field of diffusion tensors.
template<typename t>
CImg< T > & blur_anisotropic (const CImg< t > &G, const float amplitude=60.0f, const float dl=0.8f, const float da=30.0f, const float gauss_prec=2.0f, const unsigned int interpolation_type=0, const bool fast_approx=true)
 Blur the image anisotropically following a field of diffusion tensors (in-place).
template<typename tm>
CImg< T > get_blur_anisotropic (const CImg< tm > &mask, const float amplitude, const float sharpness=0.7f, const float anisotropy=0.3f, const float alpha=0.6f, const float sigma=1.1f, const float dl=0.8f, const float da=30.0f, const float gauss_prec=2.0f, const unsigned int interpolation_type=0, const bool fast_approx=true, const float geom_factor=1.0f) const
 Blur an image in an anisotropic way.
template<typename tm>
CImg< T > & blur_anisotropic (const CImg< tm > &mask, const float amplitude, const float sharpness=0.7f, const float anisotropy=0.3f, const float alpha=0.6f, const float sigma=1.1f, const float dl=0.8f, const float da=30.0f, const float gauss_prec=2.0f, const unsigned int interpolation_type=0, const bool fast_approx=true, const float geom_factor=1.0f)
 Blur an image in an anisotropic way (in-place).
CImg< T > get_blur_anisotropic (const float amplitude, const float sharpness=0.7f, const float anisotropy=0.3f, const float alpha=0.6f, const float sigma=1.1f, const float dl=0.8f, const float da=30.0f, const float gauss_prec=2.0f, const unsigned int interpolation_type=0, const bool fast_approx=true, const float geom_factor=1.0f) const
 Blur an image following in an anisotropic way.
CImg< T > & blur_anisotropic (const float amplitude, const float sharpness=0.7f, const float anisotropy=0.3f, const float alpha=0.6f, const float sigma=1.1f, const float dl=0.8f, const float da=30.0f, const float gauss_prec=2.0f, const unsigned int interpolation_type=0, const bool fast_approx=true, const float geom_factor=1.0f)
 Blur an image following in an anisotropic way (in-place).
CImg< T > get_blur_bilateral (const float sigmax, const float sigmay, const float sigmaz, const float sigmar, const int bgridx, const int bgridy, const int bgridz, const int bgridr, const bool interpolation_type=true) const
 Blur an image using the bilateral filter.
CImg< T > & blur_bilateral (const float sigmax, const float sigmay, const float sigmaz, const float sigmar, const int bgridx, const int bgridy, const int bgridz, const int bgridr, const bool interpolation_type=true)
 Blur an image using the bilateral filter (in-place).
CImg< T > get_blur_bilateral (const float sigmas, const float sigmar, const int bgrids=-33, const int bgridr=32, const bool interpolation_type=true) const
 Blur an image using the bilateral filter.
CImg< T > & blur_bilateral (const float sigmas, const float sigmar, const int bgrids=-33, const int bgridr=32, const bool interpolation_type=true)
 Blur an image using the bilateral filter (in-place).
CImg< T > get_blur_patch (const unsigned int patch_size=3, const float sigma_p=10.0f, const float sigma_s=10.0f, const unsigned int lookup_size=4, const bool fast_approx=true) const
 Blur an image in its patch-based space.
CImg< T > & blur_patch (const unsigned int patch_size=3, const float sigma_p=10.0f, const float sigma_s=10.0f, const unsigned int lookup_size=4, const bool fast_approx=true)
 Blur an image in its patch-based space (in-place).
CImgList< Tfloat > get_FFT (const char axe, const bool invert=false) const
 Compute the Fast Fourier Transform of an image (along a specified axis).
CImgList< Tfloat > get_FFT (const bool invert=false) const
 Compute the Fast Fourier Transform on an image.
CImg< T > get_blur_median (const unsigned int n=3)
 Apply a median filter.
CImg< T > & blur_median (const unsigned int n=3)
 Apply a median filter (in-place).
CImg< T > get_sharpen (const float amplitude=50.0f, const float edge=1.0f, const float alpha=0.0f, const float sigma=0.0f) const
 Sharpen image using anisotropic shock filters.
CImg< T > & sharpen (const float amplitude=50.0f, const float edge=1.0f, const float alpha=0.0f, const float sigma=0.0f)
 Sharpen image using anisotropic shock filters (in-place).
CImg< Tfloat > get_haar (const char axis, const bool invert=false, const unsigned int nb_scales=1) const
 Compute the Haar multiscale wavelet transform (monodimensional version).
CImg< T > & haar (const char axis, const bool invert=false, const unsigned int nb_scales=1)
 Compute the Haar multiscale wavelet transform (monodimensional version) (in-place).
CImg< Tfloat > get_haar (const bool invert=false, const unsigned int nb_scales=1) const
 Compute the Haar multiscale wavelet transform.
CImg< T > & haar (const bool invert=false, const unsigned int nb_scales=1)
 Compute the Haar multiscale wavelet transform (in-place).
CImg< Tfloat > get_displacement_field (const CImg< T > &target, const float smoothness=0.1f, const float precision=0.1f, const unsigned int nb_scales=0, const unsigned int itermax=10000) const
 Estimate a displacement field between instance image and given target image.
CImg< T > & displacement_field (const CImg< T > &target, const float smooth=0.1f, const float precision=0.1f, const unsigned int nb_scales=0, const unsigned int itermax=10000)
 Estimate a displacement field between instance image and given target image (in-place).
Display
const CImg< T > & display (CImgDisplay &disp) const
 Display an image into a CImgDisplay window.
const CImg< T > & display (const char *const title=0, const unsigned int normalization_type=1, const bool display_info=true) const
 Display an image in a window with a title title, and wait a 'is_closed' or 'keyboard' event.
.
CImg< typename cimg::last< T,
int >::type > 
get_coordinates (const int coords_type, CImgDisplay &disp, unsigned int *const XYZ=0, const unsigned char *const color=0) const
 Simple interface to select shaped from an image.
CImg< typename cimg::last< T,
int >::type > 
get_coordinates (const int coords_type=0, unsigned int *const XYZ=0, const unsigned char *const color=0) const
 High-level interface to select features in images.
CImg< T > & coordinates (const int coords_type=0, unsigned int *const XYZ=0, const unsigned char *const color=0)
template<typename tp, typename tf, typename tc, typename to>
const CImg< T > & display_object3d (const CImg< tp > &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImgList< to > &opacities, CImgDisplay &disp, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float specular_light=0.2f, const float specular_shine=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 High-level interface for displaying a 3d object.
template<typename tp, typename tf, typename tc, typename to>
const CImg< T > & display_object3d (const CImgList< tp > &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImgList< to > &opacities, CImgDisplay &disp, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float specular_light=0.2f, const float specular_shine=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 High-level interface for displaying a 3d object.
template<typename tp, typename tf, typename tc, typename to>
const CImg< T > & display_object3d (const CImg< tp > &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImg< to > &opacities, CImgDisplay &disp, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float specular_light=0.2f, const float specular_shine=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 High-level interface for displaying a 3d object.
template<typename tp, typename tf, typename tc, typename to>
const CImg< T > & display_object3d (const CImgList< tp > &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImg< to > &opacities, CImgDisplay &disp, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float specular_light=0.2f, const float specular_shine=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 High-level interface for displaying a 3d object.
template<typename tp, typename tf, typename tc, typename to>
const CImg< T > & display_object3d (const tp &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const to &opacities, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float specular_light=0.2f, const float specular_shine=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 High-level interface for displaying a 3d object.
template<typename tp, typename tf, typename tc>
const CImg< T > & display_object3d (const tp &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float specular_light=0.2f, const float specular_shine=0.1f, const bool display_axes=true, float *const pose_matrix=0, const float opacity=1.0f) const
 High-level interface for displaying a 3d object.
template<typename tp, typename tf>
const CImg< T > & display_object3d (const tp &points, const CImgList< tf > &primitives, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float specular_light=0.2f, const float specular_shine=0.1f, const bool display_axes=true, float *const pose_matrix=0, const float opacity=1.0f) const
 High-level interface for displaying a 3d object.
template<typename tp, typename tf, typename tc>
const CImg< T > & display_object3d (const tp &points, const CImgList< tf > &primitives, const CImgList< tc > &colors, CImgDisplay &disp, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float specular_light=0.2f, const float specular_shine=0.1f, const bool display_axes=true, float *const pose_matrix=0, const float opacity=1.0f) const
 High-level interface for displaying a 3d object.
template<typename tp, typename tf, typename tc>
const CImg< T > & display_object3d (const tp &points, const CImgList< tf > &primitives, CImgDisplay &disp, const bool centering=true, const int render_static=4, const int render_motion=1, const bool double_sided=false, const float focale=500.0f, const float specular_light=0.2f, const float specular_shine=0.1f, const bool display_axes=true, float *const pose_matrix=0, const float opacity=1.0f) const
 High-level interface for displaying a 3d object.

Public Attributes

unsigned int width
 Variable representing the width of the instance image (i.e. dimensions along the X-axis).
unsigned int height
 Variable representing the height of the instance image (i.e. dimensions along the Y-axis).
unsigned int depth
 Variable representing the depth of the instance image (i.e. dimensions along the Z-axis).
unsigned int dim
 Variable representing the number of channels of the instance image (i.e. dimensions along the V-axis).
bool is_shared
 Variable telling if pixel buffer of the instance image is shared with another one.
T * data
 Pointer to the first pixel of the pixel buffer.


Detailed Description

template<typename T>
struct cimg_library::CImg< T >

Class representing an image (up to 4 dimensions wide), each pixel being of type T.

This is the main class of the CImg Library. It declares and constructs an image, allows access to its pixel values, and is able to perform various image operations.

Image representation
A CImg image is defined as an instance of the container CImg<T>, which contains a regular grid of pixels, each pixel value being of type T. The image grid can have up to 4 dimensions : width, height, depth and number of channels. Usually, the three first dimensions are used to describe spatial coordinates (x,y,z), while the number of channels is rather used as a vector-valued dimension (it may describe the R,G,B color channels for instance). If you need a fifth dimension, you can use image lists CImgList<T> rather than simple images CImg<T>.

Thus, the CImg<T> class is able to represent volumetric images of vector-valued pixels, as well as images with less dimensions (1D scalar signal, 2D color images, ...). Most member functions of the class CImg<T> are designed to handle this maximum case of (3+1) dimensions.

Concerning the pixel value type T : fully supported template types are the basic C++ types : unsigned char, char, short, unsigned int, int, unsigned long, long, float, double, ... . Typically, fast image display can be done using CImg<unsigned char> images, while complex image processing algorithms may be rather coded using CImg<float> or CImg<double> images that have floating-point pixel values. The default value for the template T is float. Using your own template types may be possible. However, you will certainly have to define the complete set of arithmetic and logical operators for your class.

Image structure
The CImg<T> structure contains six fields :

You can access these fields publicly although it is recommended to use the dedicated functions dimx(), dimy(), dimz(), dimv() and ptr() to do so. Image dimensions are not limited to a specific range (as long as you got enough available memory). A value of 1 usually means that the corresponding dimension is flat. If one of the dimensions is 0, or if the data pointer is null, the image is considered as empty. Empty images should not contain any pixel data and thus, will not be processed by CImg member functions (a CImgInstanceException will be thrown instead). Pixel data are stored in memory, in a non interlaced mode (See How pixel data are stored with CImg.).

Image declaration and construction
Declaring an image can be done by using one of the several available constructors. Here is a list of the most used :

The complete list of constructors can be found here.

Most useful functions
The CImg<T> class contains a lot of functions that operates on images. Some of the most useful are :


Member Typedef Documentation

typedef T* iterator

Iterator type for CImg<T>.

Remarks:
  • An iterator is a T* pointer (address of a pixel value in the pixel buffer).
  • Iterators are not directly used in CImg functions, they have been introduced for compatibility with the STL.

typedef const T* const_iterator

Const iterator type for CImg<T>.

Remarks:
  • A const_iterator is a const T* pointer (address of a pixel value in the pixel buffer).
  • Iterators are not directly used in CImg functions, they have been introduced for compatibility with the STL.


Constructor & Destructor Documentation

~CImg (  ) 

Destructor.

The destructor destroys the instance image.

Remarks:
  • Destructing an empty or shared image does nothing.
  • Otherwise, all memory used to store the pixel data of the instance image is freed.
  • When destroying a non-shared image, be sure that every shared instances of the same image are also destroyed to avoid further access to desallocated memory buffers.

CImg (  ) 

Default constructor.

The default constructor creates an empty instance image.

Remarks:
  • An empty image does not contain any data and has all of its dimensions width, height, depth, dim set to 0 as well as its pointer to the pixel buffer data.
  • An empty image is non-shared.

CImg ( const unsigned int  dx,
const unsigned int  dy = 1,
const unsigned int  dz = 1,
const unsigned int  dv = 1 
) [explicit]

Constructs a new image with given size (dx,dy,dz,dv).

This constructors create an instance image of size (dx,dy,dz,dv) with pixels of type T.

Parameters:
dx Desired size along the X-axis, i.e. the width of the image.
dy Desired size along the Y-axis, i.e. the height of the image.
dz Desired size along the Z-axis, i.e. the depth of the image.
dv Desired size along the V-axis, i.e. the number of image channels dim.
Remarks:
  • If one of the input dimension dx,dy,dz or dv is set to 0, the created image is empty and all has its dimensions set to 0. No memory for pixel data is then allocated.
  • This constructor creates only non-shared images.
  • Image pixels allocated by this constructor are not initialized. Use the constructor CImg(const unsigned int,const unsigned int,const unsigned int,const unsigned int,const T) to get an image of desired size with pixels set to a particular value.

CImg ( const unsigned int  dx,
const unsigned int  dy,
const unsigned int  dz,
const unsigned int  dv,
const T  val 
)

Construct an image with given size (dx,dy,dz,dv) and with pixel having a default value val.

This constructor creates an instance image of size (dx,dy,dz,dv) with pixels of type T and sets all pixel values of the created instance image to val.

Parameters:
dx Desired size along the X-axis, i.e. the width of the image.
dy Desired size along the Y-axis, i.e. the height of the image.
dz Desired size along the Z-axis, i.e. the depth of the image.
dv Desired size along the V-axis, i.e. the number of image channels dim.
val Default value for image pixels.
Remarks:

CImg ( const t *const   data_buffer,
const unsigned int  dx,
const unsigned int  dy = 1,
const unsigned int  dz = 1,
const unsigned int  dv = 1,
const bool  shared = false 
)

Construct an image from a raw memory buffer.

This constructor creates an instance image of size (dx,dy,dz,dv) and fill its pixel buffer by copying data values from the input raw pixel buffer data_buffer.

CImg ( const CImg< t > &  img  ) 

Default copy constructor.

The default copy constructor creates a new instance image having same dimensions (width, height, depth, dim) and same pixel values as the input image img.

Parameters:
img The input image to copy.
Remarks:
  • If the input image img is non-shared or have a different template type t != T, the default copy constructor allocates a new pixel buffer and copy the pixel data of img into it. In this case, the pointers data to the pixel buffers of the two images are different and the resulting instance image is non-shared.
  • If the input image img is shared and has the same template type t == T, the default copy constructor does not allocate a new pixel buffer and the resulting instance image shares its pixel buffer with the input image img, which means that modifying pixels of img also modifies the created instance image.
  • Copying an image having a different template type t != T performs a crude static cast conversion of each pixel value from type t to type T.
  • Copying an image having the same template type t == T is significantly faster.

CImg ( const CImg< t > &  img,
const bool  shared 
)

Advanced copy constructor.

The advanced copy constructor - as the default constructor CImg(const CImg< t >&) - creates a new instance image having same dimensions width, height, depth, dim and same pixel values as the input image img. But it also decides if the created instance image shares its memory with the input image img (if the input parameter shared is set to true) or not (if the input parameter shared is set to false).

Parameters:
img The input image to copy.
shared Boolean flag that decides if the copy is shared on non-shared.
Remarks:
  • It is not possible to create a shared copy if the input image img is empty or has a different pixel type t != T.
  • If a non-shared copy of the input image img is created, a new memory buffer is allocated for pixel data.
  • If a shared copy of the input image img is created, no extra memory is allocated and the pixel buffer of the instance image is the same as the one used by the input image img.

CImg ( const char *const   filename  ) 

Construct an image from an image file.

This constructor creates an instance image by reading it from a file.

Parameters:
filename Filename of the image file.
Remarks:
  • The image format is deduced from the filename only by looking for the filename extension i.e. without analyzing the file itself.
  • Recognized image formats depend on the tools installed on your system or the external libraries you use to link your code with. More informations on this topic can be found in cimg_files_io.
  • If the filename is not found, a CImgIOException is thrown by this constructor.


Member Function Documentation

CImg<T>& assign (  ) 

In-place version of the default constructor/destructor.

This function replaces the instance image by an empty image.

Remarks:
  • Memory used by the previous content of the instance image is freed if necessary.
  • If the instance image was initially shared, it is replaced by a (non-shared) empty image.
  • This function is useful to free memory used by an image that is not of use, but which has been created in the current code scope (i.e. not destroyed yet).

CImg<T>& clear (  ) 

In-place version of the default constructor.

This function is strictly equivalent to assign() and has been introduced for having a STL-compliant function name.

CImg<T>& assign ( const unsigned int  dx,
const unsigned int  dy = 1,
const unsigned int  dz = 1,
const unsigned int  dv = 1 
)

In-place version of the previous constructor.

This function replaces the instance image by a new image of size (dx,dy,dz,dv) with pixels of type T.

Parameters:
dx Desired size along the X-axis, i.e. the width of the image.
dy Desired size along the Y-axis, i.e. the height of the image.
dz Desired size along the Z-axis, i.e. the depth of the image.
dv Desired size along the V-axis, i.e. the number of image channels dim.
  • If one of the input dimension dx,dy,dz or dv is set to 0, the instance image becomes empty and all has its dimensions set to 0. No memory for pixel data is then allocated.
  • Memory buffer used to store previous pixel values is freed if necessary.
  • If the instance image is shared, this constructor actually does nothing more than verifying that new and old image dimensions fit.
  • Image pixels allocated by this function are not initialized. Use the function assign(const unsigned int,const unsigned int,const unsigned int,const unsigned int,const T) to assign an image of desired size with pixels set to a particular value.

CImg<T>& assign ( const unsigned int  dx,
const unsigned int  dy,
const unsigned int  dz,
const unsigned int  dv,
const T  val 
)

In-place version of the previous constructor.

This function replaces the instance image by a new image of size (dx,dy,dz,dv) with pixels of type T and sets all pixel values of the instance image to val.

Parameters:
dx Desired size along the X-axis, i.e. the width of the image.
dy Desired size along the Y-axis, i.e. the height of the image.
dz Desired size along the Z-axis, i.e. the depth of the image.
dv Desired size along the V-axis, i.e. the number of image channels dim.
val Default value for image pixels.
Remarks:

CImg<T>& assign ( const CImg< t > &  img  ) 

In-place version of the default copy constructor.

This function assigns a copy of the input image img to the current instance image.

Parameters:
img The input image to copy.
Remarks:
  • If the instance image is not shared, the content of the input image img is copied into a new buffer becoming the new pixel buffer of the instance image, while the old pixel buffer is freed if necessary.
  • If the instance image is shared, the content of the input image img is copied into the current (shared) pixel buffer of the instance image, modifying then the image referenced by the shared instance image. The instance image still remains shared.

CImg<T>& assign ( const CImg< t > &  img,
const bool  shared 
)

In-place version of the advanced constructor.

This function - as the simpler function assign(const CImg< t >&) - assigns a copy of the input image img to the current instance image. But it also decides if the copy is shared (if the input parameter shared is set to true) or non-shared (if the input parameter shared is set to false).

Parameters:
img The input image to copy.
shared Boolean flag that decides if the copy is shared or non-shared.
Remarks:
  • It is not possible to assign a shared copy if the input image img is empty or has a different pixel type t != T.
  • If a non-shared copy of the input image img is assigned, a new memory buffer is allocated for pixel data.
  • If a shared copy of the input image img is assigned, no extra memory is allocated and the pixel buffer of the instance image is the same as the one used by the input image img.

CImg<T>& assign ( const char *const   filename  ) 

In-place version of the previous constructor.

This function replaces the instance image by the one that have been read from the given file.

Parameters:
filename Filename of the image file.
  • The image format is deduced from the filename only by looking for the filename extension i.e. without analyzing the file itself.
  • Recognized image formats depend on the tools installed on your system or the external libraries you use to link your code with. More informations on this topic can be found in cimg_files_io.
  • If the filename is not found, a CImgIOException is thrown by this constructor.

CImg<t>& transfer_to ( CImg< t > &  img  ) 

Transfer the content of the instance image into another one in a way that memory copies are avoided if possible.

The instance image is always empty after a call to this function.

static const char* pixel_type (  )  [static]

Return the type of the pixel values.

Returns:
a string describing the type of the image pixels (template parameter T).
  • The string returned may contains spaces ("unsigned char").
  • If the template parameter T does not correspond to a registered type, the string "unknown" is returned.

unsigned long size (  )  const

Return the total number of pixel values in an image.

example:
       CImg<> img(100,100,1,3);
       if (img.size()==100*100*3) std::fprintf(stderr,"This statement is true");

bool is_overlapping ( const CImg< t > &  img  )  const

Return true if the memory buffers of the two images overlaps.

May happen when using shared images.

long offset ( const int  x,
const int  y,
const int  z,
const int  v 
) const

Return the offset of the pixel coordinates (x,y,z,v) with respect to the data pointer data.

Parameters:
x X-coordinate of the pixel.
y Y-coordinate of the pixel.
z Z-coordinate of the pixel.
v V-coordinate of the pixel.
  • No checking is done on the validity of the given coordinates.

Example:
       CImg<float> img(100,100,1,3,0);         // Define a 100x100 color image with float-valued black pixels.
       long off = img.offset(10,10,0,2);       // Get the offset of the blue value of the pixel located at (10,10).
       float val = img[off];                   // Get the blue value of the pixel.

T* ptr ( const unsigned int  x,
const unsigned int  y,
const unsigned int  z,
const unsigned int  v 
)

Return a pointer to the pixel value located at (x,y,z,v).

Parameters:
x X-coordinate of the pixel.
y Y-coordinate of the pixel.
z Z-coordinate of the pixel.
v V-coordinate of the pixel.
  • When called without parameters, ptr() returns a pointer to the begining of the pixel buffer.
  • If the macro 'cimg_debug'>=3, boundary checking is performed and warning messages may appear if given coordinates are outside the image range (but function performances decrease).

example:
       CImg<float> img(100,100,1,1,0);   // Define a 100x100 greyscale image with float-valued pixels.
       float *ptr = ptr(10,10);          // Get a pointer to the pixel located at (10,10).
       float val = *ptr;                 // Get the pixel value.

T& operator() ( const unsigned int  x,
const unsigned int  y,
const unsigned int  z,
const unsigned int  v 
)

Fast access to pixel value for reading or writing.

Parameters:
x X-coordinate of the pixel.
y Y-coordinate of the pixel.
z Z-coordinate of the pixel.
v V-coordinate of the pixel.
  • If one image dimension is equal to 1, it can be omitted in the coordinate list (see example below).
  • If the macro 'cimg_debug'>=3, boundary checking is performed and warning messages may appear (but function performances decrease).

example:
       CImg<float> img(100,100,1,3,0);                       // Define a 100x100 color image with float-valued black pixels.
       const float valR = img(10,10,0,0);                    // Read the red component at coordinates (10,10).
       const float valG = img(10,10,0,1);                    // Read the green component at coordinates (10,10)
       const float valB = img(10,10,2);                      // Read the blue component at coordinates (10,10) (Z-coordinate omitted here).
       const float avg = (valR + valG + valB)/3;             // Compute average pixel value.
       img(10,10,0) = img(10,10,1) = img(10,10,2) = avg;     // Replace the pixel (10,10) by the average grey value.

T& operator[] ( const unsigned long  off  ) 

Fast access to pixel value for reading or writing, using an offset to the image pixel.

Parameters:
off Offset of the pixel according to the begining of the pixel buffer, given by ptr().
  • If the macro 'cimg_debug'>=3, boundary checking is performed and warning messages may appear (but function performances decrease).
  • As pixel values are aligned in memory, this operator can sometime useful to access values easier than with operator()() (see example below).

example:
       CImg<float> vec(1,10);        // Define a vector of float values (10 lines, 1 row).
       const float val1 = vec(0,4);  // Get the fifth element using operator()().
       const float val2 = vec[4];    // Get the fifth element using operator[]. Here, val2==val1.

const CImg<T>& print ( const char *  title = 0,
const bool  display_stats = true 
) const

Display informations about the image on the standard error output.

Parameters:
title Name for the considered image (optional).
display_stats Compute and display image statistics (optional).

CImg<T>& operator= ( const CImg< t > &  img  ) 

Assignment operator.

This operator assigns a copy of the input image img to the current instance image.

Parameters:
img The input image to copy.
Remarks:

CImg<T>& operator= ( const T *  buf  ) 

Assign values of a C-array to the instance image.

Parameters:
buf Pointer to a C-style array having a size of (at least) this->size().
  • Replace pixel values by the content of the array buf.
  • Warning : the value types in the array and in the image must be the same.

example:
       float tab[4*4] = { 1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16 };  // Define a 4x4 matrix in C-style.
       CImg<float> matrice(4,4);                                        // Define a 4x4 greyscale image.
       matrice = tab;                                                   // Fill the image by the values in tab.

CImg<T> operator+ (  )  const

Operator+.

Remarks:
  • This operator can be used to get a non-shared copy of an image.

CImg<T> get_round ( const float  x,
const unsigned int  round_type = 0 
) const

Compute image with rounded pixel values.

Parameters:
x Rounding precision.
round_type Roundin type, can be 0 (nearest), 1 (forward), 2 (backward).

CImg<T> get_fill ( const T  val  )  const

Fill an image by a value val.

Parameters:
val = fill value
Note:
All pixel values of the instance image will be initialized by val.

CImg<T> get_rotate ( const float  angle,
const unsigned int  cond = 3 
) const

Rotate an image.

Parameters:
angle = rotation angle (in degrees).
cond = rotation type. can be :
  • 0 = zero-value at borders
  • 1 = repeat image at borders
  • 2 = zero-value at borders and linear interpolation
Note:
Returned image will probably have a different size than the instance image *this.

CImg<T> get_rotate ( const float  angle,
const float  cx,
const float  cy,
const float  zoom = 1,
const unsigned int  cond = 3 
) const

Rotate an image around a center point (cx,cy).

Parameters:
angle = rotation angle (in degrees).
cx = X-coordinate of the rotation center.
cy = Y-coordinate of the rotation center.
zoom = zoom.
cond = rotation type. can be :
  • 0 = zero-value at borders
  • 1 = repeat image at borders
  • 2 = zero-value at borders and linear interpolation

CImg<T> get_resize ( const int  pdx = -100,
const int  pdy = -100,
const int  pdz = -100,
const int  pdv = -100,
const int  interpolation_type = 1,
const int  border_condition = -1,
const bool  center = false 
) const

Resize an image.

Parameters:
pdx Number of columns (new size along the X-axis).
pdy Number of rows (new size along the Y-axis).
pdz Number of slices (new size along the Z-axis).
pdv Number of vector-channels (new size along the V-axis).
interpolation_type Method of interpolation :
  • -1 = no interpolation : raw memory resizing.
  • 0 = no interpolation : additional space is filled according to border_condition.
  • 1 = bloc interpolation (nearest point).
  • 2 = moving average interpolation.
  • 3 = linear interpolation.
  • 4 = grid interpolation.
  • 5 = bi-cubic interpolation.
border_condition Border condition type.
center Set centering type (only if interpolation_type=0).
Note:
If pd[x,y,z,v]<0, it corresponds to a percentage of the original size (the default value is -100).

CImg<T> get_resize ( const CImg< t > &  src,
const int  interpolation_type = 1,
const int  border_condition = -1,
const bool  center = false 
) const

Resize an image.

Parameters:
src Image giving the geometry of the resize.
interpolation_type Interpolation method :
  • 1 = raw memory
  • 0 = no interpolation : additional space is filled with 0.
  • 1 = bloc interpolation (nearest point).
  • 2 = mosaic : image is repeated if necessary.
  • 3 = linear interpolation.
  • 4 = grid interpolation.
  • 5 = bi-cubic interpolation.
border_condition Border condition type.
Note:
If pd[x,y,z,v]<0, it corresponds to a percentage of the original size (the default value is -100).

CImg<T> get_resize ( const CImgDisplay disp,
const int  interpolation_type = 1,
const int  border_condition = -1,
const bool  center = false 
) const

Resize an image.

Parameters:
disp = Display giving the geometry of the resize.
interpolation_type = Resizing type :
  • 0 = no interpolation : additional space is filled with 0.
  • 1 = bloc interpolation (nearest point).
  • 2 = mosaic : image is repeated if necessary.
  • 3 = linear interpolation.
  • 4 = grid interpolation.
  • 5 = bi-cubic interpolation.
  • 6 = moving average (best quality for photographs)
border_condition Border condition type.
Note:
If pd[x,y,z,v]<0, it corresponds to a percentage of the original size (the default value is -100).

CImg<T> get_resize_doubleXY (  )  const

Upscale an image by a factor 2x.

Use anisotropic upscaling algorithm described at http://scale2x.sourceforge.net/algorithm.html

CImg<T> get_resize_tripleXY (  )  const

Upscale an image by a factor 3x.

Use anisotropic upscaling algorithm described at http://scale2x.sourceforge.net/algorithm.html

CImg<T> get_permute_axes ( const char *  permut = "vxyz"  )  const

Permute axes order.

This function permutes image axes.

Parameters:
permut = String describing the permutation (4 characters).

CImg<T> get_translate ( const int  deltax,
const int  deltay = 0,
const int  deltaz = 0,
const int  deltav = 0,
const int  border_condition = 0 
) const

Translate the image.

Parameters:
deltax Amount of displacement along the X-axis.
deltay Amount of displacement along the Y-axis.
deltaz Amount of displacement along the Z-axis.
deltav Amount of displacement along the V-axis.
border_condition Border condition.
  • border_condition can be :
    • 0 : Zero border condition (Dirichlet).
    • 1 : Nearest neighbors (Neumann).
    • 2 : Repeat Pattern (Fourier style).

CImg<T> get_crop ( const int  x0,
const int  y0,
const int  z0,
const int  v0,
const int  x1,
const int  y1,
const int  z1,
const int  v1,
const bool  border_condition = false 
) const

Get a square region of the image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
y0 = Y-coordinate of the upper-left crop rectangle corner.
z0 = Z-coordinate of the upper-left crop rectangle corner.
v0 = V-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
y1 = Y-coordinate of the lower-right crop rectangle corner.
z1 = Z-coordinate of the lower-right crop rectangle corner.
v1 = V-coordinate of the lower-right crop rectangle corner.
border_condition = Dirichlet (false) or Neumann border conditions.

CImg<T> get_crop ( const int  x0,
const int  y0,
const int  z0,
const int  x1,
const int  y1,
const int  z1,
const bool  border_condition = false 
) const

Get a rectangular part of the instance image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
y0 = Y-coordinate of the upper-left crop rectangle corner.
z0 = Z-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
y1 = Y-coordinate of the lower-right crop rectangle corner.
z1 = Z-coordinate of the lower-right crop rectangle corner.
border_condition = determine the type of border condition if some of the desired region is outside the image.

CImg<T> get_crop ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const bool  border_condition = false 
) const

Get a rectangular part of the instance image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
y0 = Y-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
y1 = Y-coordinate of the lower-right crop rectangle corner.
border_condition = determine the type of border condition if some of the desired region is outside the image.

CImg<T> get_crop ( const int  x0,
const int  x1,
const bool  border_condition = false 
) const

Get a rectangular part of the instance image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
border_condition = determine the type of border condition if some of the desired region is outside the image.

CImg<typename cimg::last<T,float>::type> get_histogram ( const unsigned int  nblevels = 256,
const T  val_min = (T)0,
const T  val_max = (T)0 
) const

Compute the image histogram.

The histogram H of an image I is a 1D-function where H(x) is the number of occurences of the value x in I.

Parameters:
nblevels = Number of different levels of the computed histogram. For classical images, this value is 256 (default value). You should specify more levels if you are working with CImg<float> or images with high range of pixel values.
val_min = Minimum value considered for the histogram computation. All pixel values lower than val_min won't be counted.
val_max = Maximum value considered for the histogram computation. All pixel values higher than val_max won't be counted.
Note:
If val_min==val_max==0 (default values), the function first estimates the minimum and maximum pixel values of the current image, then uses these values for the histogram computation.
Returns:
The histogram is returned as a 1D CImg<float> image H, having a size of (nblevels,1,1,1) such that H(0) and H(nblevels-1) are respectively equal to the number of occurences of the values val_min and val_max in I.
Note:
Histogram computation always returns a 1D function. Histogram of multi-valued (such as color) images are not multi-dimensional.

CImg<T> get_equalize_histogram ( const unsigned int  nblevels = 256,
const T  val_min = (T)0,
const T  val_max = (T)0 
) const

Compute the histogram-equalized version of the instance image.

The histogram equalization is a classical image processing algorithm that enhances the image contrast by expanding its histogram.

Parameters:
nblevels = Number of different levels of the computed histogram. For classical images, this value is 256 (default value). You should specify more levels if you are working with CImg<float> or images with high range of pixel values.
val_min = Minimum value considered for the histogram computation. All pixel values lower than val_min won't be changed.
val_max = Maximum value considered for the histogram computation. All pixel values higher than val_max won't be changed.
Note:
If val_min==val_max==0 (default values), the function acts on all pixel values of the image.
Returns:
A new image with same size is returned, where pixels have been equalized.

CImg<Tfloat> get_norm_pointwise ( int  norm_type = 2  )  const

Compute the scalar image of vector norms.

When dealing with vector-valued images (i.e images with dimv()>1), this function computes the L1,L2 or Linf norm of each vector-valued pixel.

Parameters:
norm_type = Type of the norm being computed (1 = L1, 2 = L2, -1 = Linf).
Returns:
A scalar-valued image CImg<float> with size (dimx(),dimy(),dimz(),1), where each pixel is the norm of the corresponding pixels in the original vector-valued image.

CImg<Tfloat> get_orientation_pointwise (  )  const

Compute the image of normalized vectors.

When dealing with vector-valued images (i.e images with dimv()>1), this function return the image of normalized vectors (unit vectors). Null vectors are unchanged. The L2-norm is computed for the normalization.

Returns:
A new vector-valued image with same size, where each vector-valued pixels have been normalized.

CImgList<Tfloat> get_gradientXY ( const int  scheme = 0  )  const

Compute the list of images, corresponding to the XY-gradients of an image.

Parameters:
scheme = Numerical scheme used for the gradient computation :
  • -1 = Backward finite differences
  • 0 = Centered finite differences
  • 1 = Forward finite differences
  • 2 = Using Sobel masks
  • 3 = Using rotation invariant masks
  • 4 = Using Deriche recusrsive filter.

CImgList<Tfloat> get_hessianXY (  ) 

Get components of the 2D Hessian matrix of an image.

Components are ordered as : Ixx, Ixy, Iyy

CImgList<Tfloat> get_hessianXYZ (  ) 

Get components of the 3D Hessian matrix of an image.

Components are ordered as : Ixx, Ixy, Ixz, Iyy, Iyz, Izz.

static CImg<T> get_dijkstra ( const tf &  distance,
const unsigned int  nb_nodes,
const unsigned int  starting_node,
const unsigned int  ending_node,
CImg< t > &  previous 
) [static]

Compute minimal path in a graph, using the Dijkstra algorithm.

Parameters:
distance An object having operator()(unsigned int i, unsigned int j) which returns distance between two nodes (i,j).
nb_nodes Number of graph nodes.
starting_node Indice of the starting node.
ending_node Indice of the ending node (set to ~0U to ignore ending node).
previous Array that gives the previous node indice in the path to the starting node (optional parameter).
Returns:
Array of distances of each node to the starting node.

CImg<T> get_dijkstra ( const unsigned int  starting_node,
const unsigned int  ending_node,
CImg< t > &  previous 
) const

Return minimal path in a graph, using the Dijkstra algorithm.

Instance image corresponds to the adjacency matrix of the graph.

Parameters:
starting_node Indice of the starting node.
previous Array that gives the previous node indice in the path to the starting node (optional parameter).
Returns:
Array of distances of each node to the starting node.

const CImg<T>& marching_squares ( const float  isovalue,
const float  resx,
const float  resy,
CImgList< tp > &  points,
CImgList< tf > &  primitives 
) const

Compute a vectorization of an implicit function defined by the instance image.

This version allows to specify the marching squares resolution along x,y, and z.

const CImg<T>& marching_cubes ( const float  isovalue,
const float  resx,
const float  resy,
const float  resz,
CImgList< tp > &  points,
CImgList< tf > &  primitives,
const bool  invert_faces = false 
) const

Compute a triangulation of an implicit function defined by the instance image.

This version allows to specify the marching cube resolution along x,y and z.

static CImg<Tuchar> get_default_LUT8 (  )  [static]

Return a default indexed color palette with 256 (R,G,B) entries.

The default color palette is used by CImg when displaying images on 256 colors displays. It consists in the quantification of the (R,G,B) color space using 3:3:2 bits for color coding (i.e 8 levels for the Red and Green and 4 levels for the Blue).

Returns:
a 1x256x1x3 color image defining the palette entries.

CImg<T> get_RGBtoBayer (  )  const

Convert a (R,G,B) image to a Bayer-coded representation.

Note:
First (upper-left) pixel if the red component of the pixel color.

CImg<T>& draw_point ( const int  x0,
const int  y0,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a colored point (pixel) in the instance image.

Parameters:
x0 X-coordinate of the point.
y0 Y-coordinate of the point.
color Pointer to (or image of) dimv() consecutive values, defining the color channels.
opacity Drawing opacity (optional).
Note:
  • Clipping is supported.
  • To set pixel values without clipping needs, you should use the faster CImg::operator()() function.
Example:
       CImg<unsigned char> img(100,100,1,3,0);
       const unsigned char color[] = { 255,128,64 };
       img.draw_point(50,50,color);

CImg<T>& draw_point ( const int  x0,
const int  y0,
const int  z0,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a colored point (pixel) in the instance image (for volumetric images).

Note:

CImg<T>& draw_point ( const CImgList< t > &  points,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a cloud of colored points in the instance image.

Parameters:
points Coordinates of vertices, stored as a list of vectors.
color Pointer to dimv() consecutive values of type T, defining the drawing color.
opacity Drawing opacity (optional).
Note:
  • This function uses several call to the single CImg::draw_point() procedure, depending on the vectors size in points.
Example:
       CImg<unsigned char> img(100,100,1,3,0);
       const unsigned char color[] = { 255,128,64 };
       CImgList<int> points;
       points.insert(CImg<int>::vector(0,0)).
             .insert(CImg<int>::vector(70,10)).
             .insert(CImg<int>::vector(80,60)).
             .insert(CImg<int>::vector(10,90));
       img.draw_point(points,color);

CImg<T>& draw_point ( const CImg< t > &  points,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a cloud of points in the instance image.

Note:
  • Similar to the previous function, where the N vertex coordinates are stored as a Nx2 or Nx3 image (sequence of vectors aligned along the x-axis).

CImg<T>& draw_line ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const tc *const   color,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U,
const bool  init_hatch = true 
)

Draw a colored line in the instance image.

Parameters:
x0 X-coordinate of the starting line point.
y0 Y-coordinate of the starting line point.
x1 X-coordinate of the ending line point.
y1 Y-coordinate of the ending line point.
color Pointer to dimv() consecutive values of type T, defining the drawing color.
opacity Drawing opacity (optional).
pattern An integer whose bits describe the line pattern (optional).
init_hatch Flag telling if a reinitialization of the hash state must be done (optional).
Note:
  • Clipping is supported.
  • Line routine uses Bresenham's algorithm.
  • Set init_hatch = false to draw consecutive hatched segments without breaking the line pattern.
Example:
       CImg<unsigned char> img(100,100,1,3,0);
       const unsigned char color[] = { 255,128,64 };
        img.draw_line(40,40,80,70,color);

CImg<T>& draw_line ( const int  x0,
const int  y0,
const int  z0,
const int  x1,
const int  y1,
const int  z1,
const tc *const   color,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U,
const bool  init_hatch = true 
)

Draw a colored line in the instance image (for volumetric images).

Note:

CImg<T>& draw_line ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const CImg< t > &  texture,
const int  tx0,
const int  ty0,
const int  tx1,
const int  ty1,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U,
const bool  init_hatch = true 
)

Draw a textured line in the instance image.

Parameters:
x0 X-coordinate of the starting line point.
y0 Y-coordinate of the starting line point.
x1 X-coordinate of the ending line point.
y1 Y-coordinate of the ending line point.
texture Texture image defining the pixel colors.
tx0 X-coordinate of the starting texture point.
ty0 Y-coordinate of the starting texture point.
tx1 X-coordinate of the ending texture point.
ty1 Y-coordinate of the ending texture point.
opacity Drawing opacity (optional).
pattern An integer whose bits describe the line pattern (optional).
init_hatch Flag telling if the hash variable must be reinitialized (optional).
Note:
  • Clipping is supported but not for texture coordinates.
  • Line routine uses the well known Bresenham's algorithm.
Example:
       CImg<unsigned char> img(100,100,1,3,0), texture("texture256x256.ppm");
       const unsigned char color[] = { 255,128,64 };
       img.draw_line(40,40,80,70,texture,0,0,255,255);

CImg<T>& draw_line ( const CImgList< t > &  points,
const tc *const   color,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U,
const bool  init_hatch = true 
)

Draw a set of consecutive colored lines in the instance image.

Parameters:
points Coordinates of vertices, stored as a list of vectors.
color Pointer to dimv() consecutive values of type T, defining the drawing color.
opacity Drawing opacity (optional).
pattern An integer whose bits describe the line pattern (optional).
init_hatch If set to true, init hatch motif.
Note:
  • This function uses several call to the single CImg::draw_line() procedure, depending on the vectors size in points.
Example:
       CImg<unsigned char> img(100,100,1,3,0);
       const unsigned char color[] = { 255,128,64 };
       CImgList<int> points;
       points.insert(CImg<int>::vector(0,0)).
             .insert(CImg<int>::vector(70,10)).
             .insert(CImg<int>::vector(80,60)).
             .insert(CImg<int>::vector(10,90));
       img.draw_line(points,color);

CImg<T>& draw_line ( const CImg< t > &  points,
const tc *const   color,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U,
const bool  init_hatch = true 
)

Draw a set of consecutive colored lines in the instance image.

Note:
  • Similar to the previous function, where the N vertex coordinates are stored as a Nx2 or Nx3 image (sequence of vectors aligned along the x-axis).

CImg<T>& draw_spline ( const int  x0,
const int  y0,
const float  u0,
const float  v0,
const int  x1,
const int  y1,
const float  u1,
const float  v1,
const tc *const   color,
const float  precision = 4.0f,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U,
const bool  init_hatch = true 
)

Draw a cubic spline curve in the instance image.

Parameters:
x0 X-coordinate of the starting curve point
y0 Y-coordinate of the starting curve point
u0 X-coordinate of the starting velocity
v0 Y-coordinate of the starting velocity
x1 X-coordinate of the ending curve point
y1 Y-coordinate of the ending curve point
u1 X-coordinate of the ending velocity
v1 Y-coordinate of the ending velocity
color Pointer to dimv() consecutive values of type T, defining the drawing color.
precision Curve drawing precision (optional).
opacity Drawing opacity (optional).
pattern An integer whose bits describe the line pattern (optional).
init_hatch If true, init hatch motif.
Note:
  • The curve is a 2D cubic Bezier spline, from the set of specified starting/ending points and corresponding velocity vectors.
  • The spline is drawn as a serie of connected segments. The precision parameter sets the average number of pixels in each drawn segment.
  • A cubic Bezier curve is sometimes defined by a set of 4 points { (x0,y0), (xa,ya), (xb,yb), (x1,y1) } where (x0,y0) is the starting point, (x1,y1) is the ending point and (xa,ya), (xb,yb) are two control points. The starting and ending velocities (u0,v0) and (u1,v1) can be deduced easily from the control points as u0 = (xa - x0), v0 = (ya - y0), u1 = (x1 - xb) and v1 = (y1 - yb).
Example:
       CImg<unsigned char> img(100,100,1,3,0);
       const unsigned char color[] = { 255,255,255 };
       img.draw_spline(30,30,0,100,90,40,0,-100,color);

CImg<T>& draw_spline ( const int  x0,
const int  y0,
const int  z0,
const float  u0,
const float  v0,
const float  w0,
const int  x1,
const int  y1,
const int  z1,
const float  u1,
const float  v1,
const float  w1,
const tc *const   color,
const float  precision = 4.0f,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U,
const bool  init_hatch = true 
)

Draw a cubic spline curve in the instance image (for volumetric images).

Note:

CImg<T>& draw_spline ( const int  x0,
const int  y0,
const float  u0,
const float  v0,
const int  x1,
const int  y1,
const float  u1,
const float  v1,
const CImg< t > &  texture,
const int  tx0,
const int  ty0,
const int  tx1,
const int  ty1,
const float  precision = 4.0f,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U,
const bool  init_hatch = true 
)

Draw a cubic spline curve in the instance image.

Parameters:
x0 X-coordinate of the starting curve point
y0 Y-coordinate of the starting curve point
u0 X-coordinate of the starting velocity
v0 Y-coordinate of the starting velocity
x1 X-coordinate of the ending curve point
y1 Y-coordinate of the ending curve point
u1 X-coordinate of the ending velocity
v1 Y-coordinate of the ending velocity
texture Texture image defining line pixel colors.
tx0 X-coordinate of the starting texture point.
ty0 Y-coordinate of the starting texture point.
tx1 X-coordinate of the ending texture point.
ty1 Y-coordinate of the ending texture point.
precision Curve drawing precision (optional).
opacity Drawing opacity (optional).
pattern An integer whose bits describe the line pattern (optional).
init_hatch if true, reinit hatch motif.

CImg<T>& draw_arrow ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const tc *const   color,
const float  angle = 30,
const float  length = -10,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U 
)

Draw a colored arrow in the instance image.

Parameters:
x0 X-coordinate of the starting arrow point (tail).
y0 Y-coordinate of the starting arrow point (tail).
x1 X-coordinate of the ending arrow point (head).
y1 Y-coordinate of the ending arrow point (head).
color Pointer to dimv() consecutive values of type T, defining the drawing color.
angle Aperture angle of the arrow head (optional).
length Length of the arrow head. If negative, describes a percentage of the arrow length (optional).
opacity Drawing opacity (optional).
pattern An integer whose bits describe the line pattern (optional).
Note:
  • Clipping is supported.

CImg<T>& draw_image ( const CImg< t > &  sprite,
const int  x0,
const int  y0 = 0,
const int  z0 = 0,
const int  v0 = 0,
const float  opacity = 1.0f 
)

Draw a sprite image in the instance image.

Parameters:
sprite Sprite image.
x0 X-coordinate of the sprite position.
y0 Y-coordinate of the sprite position.
z0 Z-coordinate of the sprite position.
v0 V-coordinate of the sprite position.
opacity Drawing opacity (optional).
Note:
  • Clipping is supported.

CImg<T>& draw_image ( const CImg< ti > &  sprite,
const CImg< tm > &  mask,
const int  x0,
const int  y0 = 0,
const int  z0 = 0,
const int  v0 = 0,
const float  mask_valmax = 1.0f,
const float  opacity = 1.0f 
)

Draw a sprite image in the instance image (masked version).

Parameters:
sprite Sprite image.
mask Mask image.
x0 X-coordinate of the sprite position in the instance image.
y0 Y-coordinate of the sprite position in the instance image.
z0 Z-coordinate of the sprite position in the instance image.
v0 V-coordinate of the sprite position in the instance image.
mask_valmax Maximum pixel value of the mask image mask (optional).
opacity Drawing opacity.
Note:
  • Pixel values of mask set the opacity of the corresponding pixels in sprite.
  • Clipping is supported.
  • Dimensions along x,y and z of sprite and mask must be the same.

CImg<T>& draw_rectangle ( const int  x0,
const int  y0,
const int  z0,
const int  v0,
const int  x1,
const int  y1,
const int  z1,
const int  v1,
const T  val,
const float  opacity = 1.0f 
)

Draw a 4D filled rectangle in the instance image, at coordinates (x0,y0,z0,v0)-(x1,y1,z1,v1).

Parameters:
x0 X-coordinate of the upper-left rectangle corner.
y0 Y-coordinate of the upper-left rectangle corner.
z0 Z-coordinate of the upper-left rectangle corner.
v0 V-coordinate of the upper-left rectangle corner.
x1 X-coordinate of the lower-right rectangle corner.
y1 Y-coordinate of the lower-right rectangle corner.
z1 Z-coordinate of the lower-right rectangle corner.
v1 V-coordinate of the lower-right rectangle corner.
val Scalar value used to fill the rectangle area.
opacity Drawing opacity (optional).
Note:
  • Clipping is supported.

CImg<T>& draw_rectangle ( const int  x0,
const int  y0,
const int  z0,
const int  x1,
const int  y1,
const int  z1,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a 3D filled colored rectangle in the instance image, at coordinates (x0,y0,z0)-(x1,y1,z1).

Parameters:
x0 X-coordinate of the upper-left rectangle corner.
y0 Y-coordinate of the upper-left rectangle corner.
z0 Z-coordinate of the upper-left rectangle corner.
x1 X-coordinate of the lower-right rectangle corner.
y1 Y-coordinate of the lower-right rectangle corner.
z1 Z-coordinate of the lower-right rectangle corner.
color Pointer to dimv() consecutive values of type T, defining the drawing color.
opacity Drawing opacity (optional).
Note:
  • Clipping is supported.

CImg<T>& draw_rectangle ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a 2D filled colored rectangle in the instance image, at coordinates (x0,y0)-(x1,y1).

Parameters:
x0 X-coordinate of the upper-left rectangle corner.
y0 Y-coordinate of the upper-left rectangle corner.
x1 X-coordinate of the lower-right rectangle corner.
y1 Y-coordinate of the lower-right rectangle corner.
color Pointer to dimv() consecutive values of type T, defining the drawing color.
opacity Drawing opacity (optional).
Note:
  • Clipping is supported.

CImg<T>& draw_triangle ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const int  x2,
const int  y2,
const tc *const   color,
const float  brightness0,
const float  brightness1,
const float  brightness2,
const float  opacity = 1.0f 
)

Draw a 2D Gouraud-filled triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).

Parameters:
x0 = X-coordinate of the first corner in the instance image.
y0 = Y-coordinate of the first corner in the instance image.
x1 = X-coordinate of the second corner in the instance image.
y1 = Y-coordinate of the second corner in the instance image.
x2 = X-coordinate of the third corner in the instance image.
y2 = Y-coordinate of the third corner in the instance image.
color = array of dimv() values of type T, defining the global drawing color.
brightness0 = brightness of the first corner (in [0,2]).
brightness1 = brightness of the second corner (in [0,2]).
brightness2 = brightness of the third corner (in [0,2]).
opacity = opacity of the drawing.
Note:
Clipping is supported.

CImg<T>& draw_triangle ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const int  x2,
const int  y2,
const CImg< t > &  texture,
const int  tx0,
const int  ty0,
const int  tx1,
const int  ty1,
const int  tx2,
const int  ty2,
const float  opacity = 1.0f,
const float  brightness = 1.0f 
)

Draw a 2D textured triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).

Parameters:
x0 = X-coordinate of the first corner in the instance image.
y0 = Y-coordinate of the first corner in the instance image.
x1 = X-coordinate of the second corner in the instance image.
y1 = Y-coordinate of the second corner in the instance image.
x2 = X-coordinate of the third corner in the instance image.
y2 = Y-coordinate of the third corner in the instance image.
texture = texture image used to fill the triangle.
tx0 = X-coordinate of the first corner in the texture image.
ty0 = Y-coordinate of the first corner in the texture image.
tx1 = X-coordinate of the second corner in the texture image.
ty1 = Y-coordinate of the second corner in the texture image.
tx2 = X-coordinate of the third corner in the texture image.
ty2 = Y-coordinate of the third corner in the texture image.
opacity = opacity of the drawing.
brightness = brightness of the drawing (in [0,2]).
Note:
Clipping is supported, but texture coordinates do not support clipping.

CImg<T>& draw_triangle ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const int  x2,
const int  y2,
const tc *const   color,
const CImg< t > &  light,
const int  lx0,
const int  ly0,
const int  lx1,
const int  ly1,
const int  lx2,
const int  ly2,
const float  opacity = 1.0f 
)

Draw a 2D phong-shaded triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).

Parameters:
x0 = X-coordinate of the first corner in the instance image.
y0 = Y-coordinate of the first corner in the instance image.
x1 = X-coordinate of the second corner in the instance image.
y1 = Y-coordinate of the second corner in the instance image.
x2 = X-coordinate of the third corner in the instance image.
y2 = Y-coordinate of the third corner in the instance image.
color = array of dimv() values of type T, defining the global drawing color.
light = light image.
lx0 = X-coordinate of the first corner in the light image.
ly0 = Y-coordinate of the first corner in the light image.
lx1 = X-coordinate of the second corner in the light image.
ly1 = Y-coordinate of the second corner in the light image.
lx2 = X-coordinate of the third corner in the light image.
ly2 = Y-coordinate of the third corner in the light image.
opacity = opacity of the drawing.
Note:
Clipping is supported, but texture coordinates do not support clipping.

CImg<T>& draw_triangle ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const int  x2,
const int  y2,
const CImg< t > &  texture,
const int  tx0,
const int  ty0,
const int  tx1,
const int  ty1,
const int  tx2,
const int  ty2,
const float  brightness0,
const float  brightness1,
const float  brightness2,
const float  opacity = 1 
)

Draw a 2D textured triangle with Gouraud-Shading in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).

Parameters:
x0 = X-coordinate of the first corner in the instance image.
y0 = Y-coordinate of the first corner in the instance image.
x1 = X-coordinate of the second corner in the instance image.
y1 = Y-coordinate of the second corner in the instance image.
x2 = X-coordinate of the third corner in the instance image.
y2 = Y-coordinate of the third corner in the instance image.
texture = texture image used to fill the triangle.
tx0 = X-coordinate of the first corner in the texture image.
ty0 = Y-coordinate of the first corner in the texture image.
tx1 = X-coordinate of the second corner in the texture image.
ty1 = Y-coordinate of the second corner in the texture image.
tx2 = X-coordinate of the third corner in the texture image.
ty2 = Y-coordinate of the third corner in the texture image.
brightness0 = brightness value of the first corner.
brightness1 = brightness value of the second corner.
brightness2 = brightness value of the third corner.
opacity = opacity of the drawing.
Note:
Clipping is supported, but texture coordinates do not support clipping.

CImg<T>& draw_triangle ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const int  x2,
const int  y2,
const CImg< t > &  texture,
const int  tx0,
const int  ty0,
const int  tx1,
const int  ty1,
const int  tx2,
const int  ty2,
const CImg< tl > &  light,
const int  lx0,
const int  ly0,
const int  lx1,
const int  ly1,
const int  lx2,
const int  ly2,
const float  opacity = 1.0f 
)

Draw a phong-shaded 2D textured triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).

Parameters:
x0 = X-coordinate of the first corner in the instance image.
y0 = Y-coordinate of the first corner in the instance image.
x1 = X-coordinate of the second corner in the instance image.
y1 = Y-coordinate of the second corner in the instance image.
x2 = X-coordinate of the third corner in the instance image.
y2 = Y-coordinate of the third corner in the instance image.
texture = texture image used to fill the triangle.
tx0 = X-coordinate of the first corner in the texture image.
ty0 = Y-coordinate of the first corner in the texture image.
tx1 = X-coordinate of the second corner in the texture image.
ty1 = Y-coordinate of the second corner in the texture image.
tx2 = X-coordinate of the third corner in the texture image.
ty2 = Y-coordinate of the third corner in the texture image.
light = light image.
lx0 = X-coordinate of the first corner in the light image.
ly0 = Y-coordinate of the first corner in the light image.
lx1 = X-coordinate of the second corner in the light image.
ly1 = Y-coordinate of the second corner in the light image.
lx2 = X-coordinate of the third corner in the light image.
ly2 = Y-coordinate of the third corner in the light image.
opacity = opacity of the drawing.
Note:
Clipping is supported, but texture coordinates do not support clipping.

CImg<T>& draw_ellipse ( const int  x0,
const int  y0,
const float  r1,
const float  r2,
const float  ru,
const float  rv,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a filled ellipse.

Parameters:
x0 = X-coordinate of the ellipse center.
y0 = Y-coordinate of the ellipse center.
r1 = First radius of the ellipse.
r2 = Second radius of the ellipse.
ru = X-coordinate of the orientation vector related to the first radius.
rv = Y-coordinate of the orientation vector related to the first radius.
color = array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.

CImg<T>& draw_ellipse ( const int  x0,
const int  y0,
const CImg< t > &  tensor,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a filled ellipse.

Parameters:
x0 = X-coordinate of the ellipse center.
y0 = Y-coordinate of the ellipse center.
tensor = Diffusion tensor describing the ellipse.
color = array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.

CImg<T>& draw_ellipse ( const int  x0,
const int  y0,
const float  r1,
const float  r2,
const float  ru,
const float  rv,
const tc *const   color,
const float  opacity,
const unsigned int  pattern 
)

Draw an outlined ellipse.

Parameters:
x0 = X-coordinate of the ellipse center.
y0 = Y-coordinate of the ellipse center.
r1 = First radius of the ellipse.
r2 = Second radius of the ellipse.
ru = X-coordinate of the orientation vector related to the first radius.
rv = Y-coordinate of the orientation vector related to the first radius.
color = array of dimv() values of type T, defining the drawing color.
pattern = If zero, the ellipse is filled, else pattern is an integer whose bits describe the outline pattern.
opacity = opacity of the drawing.

CImg<T>& draw_ellipse ( const int  x0,
const int  y0,
const CImg< t > &  tensor,
const tc *const   color,
const float  opacity,
const unsigned int  pattern 
)

Draw an outlined ellipse.

Parameters:
x0 = X-coordinate of the ellipse center.
y0 = Y-coordinate of the ellipse center.
tensor = Diffusion tensor describing the ellipse.
color = array of dimv() values of type T, defining the drawing color.
pattern = If zero, the ellipse is filled, else pattern is an integer whose bits describe the outline pattern.
opacity = opacity of the drawing.

CImg<T>& draw_circle ( const int  x0,
const int  y0,
int  radius,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a filled circle.

Parameters:
x0 X-coordinate of the circle center.
y0 Y-coordinate of the circle center.
radius Circle radius.
color Array of dimv() values of type T, defining the drawing color.
opacity Drawing opacity.
Note:
  • Circle version of the Bresenham's algorithm is used.

CImg<T>& draw_circle ( const int  x0,
const int  y0,
int  radius,
const tc *const   color,
const float  opacity,
const unsigned  int 
)

Draw an outlined circle.

Parameters:
x0 X-coordinate of the circle center.
y0 Y-coordinate of the circle center.
radius Circle radius.
color Array of dimv() values of type T, defining the drawing color.
opacity Drawing opacity.

CImg<T>& draw_text ( const char *const   text,
const int  x0,
const int  y0,
const tc1 *const   foreground_color,
const tc2 *const   background_color,
const CImgList< t > &  font,
const float  opacity = 1.0f 
)

Draw a text.

Parameters:
text = a C-string containing the text to display.
x0 = X-coordinate of the text in the instance image.
y0 = Y-coordinate of the text in the instance image.
foreground_color = an array of dimv() values of type T, defining the foreground color (0 means 'transparent').
background_color = an array of dimv() values of type T, defining the background color (0 means 'transparent').
font = List of font characters used for the drawing.
opacity = opacity of the drawing.
Note:
Clipping is supported.

CImg<T>& draw_text ( const char *const   text,
const int  x0,
const int  y0,
const tc1 *const   foreground_color,
const tc2 *const   background_color = 0,
const unsigned int  font_size = 11,
const float  opacity = 1.0f 
)

Draw a text.

Parameters:
text = a C-string containing the text to display.
x0 = X-coordinate of the text in the instance image.
y0 = Y-coordinate of the text in the instance image.
foreground_color = an array of dimv() values of type T, defining the foreground color (0 means 'transparent').
background_color = an array of dimv() values of type T, defining the background color (0 means 'transparent').
font_size = Height of the desired font (11,13,24,38 or 57)
opacity = opacity of the drawing.
Note:
Clipping is supported.

CImg<T>& draw_text ( const int  x0,
const int  y0,
const tc1 *const   foreground_color,
const tc2 *const   background_color,
const unsigned int  font_size,
const float  opacity,
const char *  format,
  ... 
)

Draw a text.

Parameters:
x0 X-coordinate of the text in the instance image.
y0 Y-coordinate of the text in the instance image.
foreground_color Array of dimv() values of type T, defining the foreground color (0 means 'transparent').
background_color Array of dimv() values of type T, defining the background color (0 means 'transparent').
font_size Size of the font (nearest match).
opacity Drawing opacity.
format 'printf'-style format string, followed by arguments.
Note:
Clipping is supported.

CImg<T>& draw_text ( const int  x0,
const int  y0,
const tc1 *const   foreground_color,
const tc2 *const   background_color,
const CImgList< t > &  font,
const float  opacity,
const char *  format,
  ... 
)

Draw a text.

Parameters:
x0 X-coordinate of the text in the instance image.
y0 Y-coordinate of the text in the instance image.
foreground_color Array of dimv() values of type T, defining the foreground color (0 means 'transparent').
background_color Array of dimv() values of type T, defining the background color (0 means 'transparent').
font Font used for drawing text.
opacity Drawing opacity.
format 'printf'-style format string, followed by arguments.
Note:
Clipping is supported.

CImg<T>& draw_quiver ( const CImg< t1 > &  flow,
const t2 *const   color,
const unsigned int  sampling = 25,
const float  factor = -20,
const int  quiver_type = 0,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U 
)

Draw a vector field in the instance image, using a colormap.

Parameters:
flow Image of 2d vectors used as input data.
color Image of dimv()-D vectors corresponding to the color of each arrow.
sampling Length (in pixels) between each arrow.
factor Length factor of each arrow (if <0, computed as a percentage of the maximum length).
quiver_type Type of plot. Can be 0 (arrows) or 1 (segments).
opacity Opacity of the drawing.
pattern Used pattern to draw lines.
Note:
Clipping is supported.

CImg<T>& draw_quiver ( const CImg< t1 > &  flow,
const CImg< t2 > &  color,
const unsigned int  sampling = 25,
const float  factor = -20,
const int  quiver_type = 0,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U 
)

Draw a vector field in the instance image, using a colormap.

Parameters:
flow Image of 2d vectors used as input data.
color Image of dimv()-D vectors corresponding to the color of each arrow.
sampling Length (in pixels) between each arrow.
factor Length factor of each arrow (if <0, computed as a percentage of the maximum length).
quiver_type Type of plot. Can be 0 (arrows) or 1 (segments).
opacity Opacity of the drawing.
pattern Used pattern to draw lines.
Note:
Clipping is supported.

CImg<T>& draw_graph ( const CImg< t > &  data,
const tc *const   color,
const unsigned int  gtype = 1,
const double  ymin = 0,
const double  ymax = 0,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U 
)

Draw a 1D graph on the instance image.

Parameters:
data Image containing the graph values I = f(x).
color Array of dimv() values of type T, defining the drawing color.
gtype Define the type of the plot :
  • 0 = Plot using points clouds.
  • 1 = Plot using linear interpolation (segments).
  • 2 = Plot with bars.
  • 3 = Plot using cubic interpolation (3-polynomials).
ymin Lower bound of the y-range.
ymax Upper bound of the y-range.
opacity Drawing opacity.
pattern Drawing pattern.
Note:
  • if ymin==ymax==0, the y-range is computed automatically from the input sample.

CImg<T>& draw_axis ( const CImg< t > &  xvalues,
const int  y,
const tc *const   color,
const float  opacity = 1.0f,
const unsigned int  pattern = ~0U 
)

Draw a labeled horizontal axis on the instance image.

Parameters:
xvalues Lower bound of the x-range.
y Y-coordinate of the horizontal axis in the instance image.
color Array of dimv() values of type T, defining the drawing color.
opacity Drawing opacity.
pattern Drawing pattern.
Note:
if precision==0, precision of the labels is automatically computed.

CImg<T>& draw_fill ( const int  x,
const int  y,
const int  z,
const tc *const   color,
CImg< t > &  region,
const float  sigma = 0,
const float  opacity = 1.0f,
const bool  high_connexity = false 
)

Draw a 3D filled region starting from a point (x,y,\ z) in the instance image.

Parameters:
x X-coordinate of the starting point of the region to fill.
y Y-coordinate of the starting point of the region to fill.
z Z-coordinate of the starting point of the region to fill.
color An array of dimv() values of type T, defining the drawing color.
region Image that will contain the mask of the filled region mask, as an output.
sigma Tolerance concerning neighborhood values.
opacity Opacity of the drawing.
high_connexity Tells if 8-connexity must be used (only for 2D images).
Returns:
region is initialized with the binary mask of the filled region.

CImg<T>& draw_fill ( const int  x,
const int  y,
const int  z,
const tc *const   color,
const float  sigma = 0,
const float  opacity = 1.0f,
const bool  high_connexity = false 
)

Draw a 3D filled region starting from a point (x,y,\ z) in the instance image.

Parameters:
x = X-coordinate of the starting point of the region to fill.
y = Y-coordinate of the starting point of the region to fill.
z = Z-coordinate of the starting point of the region to fill.
color = an array of dimv() values of type T, defining the drawing color.
sigma = tolerance concerning neighborhood values.
opacity = opacity of the drawing.

CImg<T>& draw_fill ( const int  x,
const int  y,
const tc *const   color,
const float  sigma = 0,
const float  opacity = 1.0f,
const bool  high_connexity = false 
)

Draw a 2D filled region starting from a point (x,y) in the instance image.

Parameters:
x = X-coordinate of the starting point of the region to fill.
y = Y-coordinate of the starting point of the region to fill.
color = an array of dimv() values of type T, defining the drawing color.
sigma = tolerance concerning neighborhood values.
opacity = opacity of the drawing.

CImg<T>& draw_plasma ( const int  x0,
const int  y0,
const int  x1,
const int  y1,
const double  alpha = 1.0,
const double  beta = 1.0,
const float  opacity = 1.0f 
)

Draw a plasma random texture.

Parameters:
x0 = X-coordinate of the upper-left corner of the plasma.
y0 = Y-coordinate of the upper-left corner of the plasma.
x1 = X-coordinate of the lower-right corner of the plasma.
y1 = Y-coordinate of the lower-right corner of the plasma.
alpha = Alpha-parameter of the plasma.
beta = Beta-parameter of the plasma.
opacity = opacity of the drawing.

CImg<T>& draw_plasma ( const double  alpha = 1.0,
const double  beta = 1.0,
const float  opacity = 1.0f 
)

Draw a plasma random texture.

Parameters:
alpha = Alpha-parameter of the plasma.
beta = Beta-parameter of the plasma.
opacity = opacity of the drawing.

CImg<T>& draw_gaussian ( const float  xc,
const double  sigma,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw a 1D gaussian function in the instance image.

Parameters:
xc = X-coordinate of the gaussian center.
sigma = Standard variation of the gaussian distribution.
color = array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.

CImg<T>& draw_gaussian ( const float  xc,
const float  yc,
const CImg< t > &  tensor,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw an anisotropic 2D gaussian function.

Parameters:
xc = X-coordinate of the gaussian center.
yc = Y-coordinate of the gaussian center.
tensor = 2x2 covariance matrix.
color = array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.

CImg<T>& draw_gaussian ( const float  xc,
const float  yc,
const float  sigma,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw an isotropic 2D gaussian function.

Parameters:
xc = X-coordinate of the gaussian center.
yc = Y-coordinate of the gaussian center.
sigma = standard variation of the gaussian distribution.
color = array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.

CImg<T>& draw_gaussian ( const float  xc,
const float  yc,
const float  zc,
const CImg< t > &  tensor,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw an anisotropic 3D gaussian function.

Parameters:
xc = X-coordinate of the gaussian center.
yc = Y-coordinate of the gaussian center.
zc = Z-coordinate of the gaussian center.
tensor = 3x3 covariance matrix.
color = array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.

CImg<T>& draw_gaussian ( const float  xc,
const float  yc,
const float  zc,
const double  sigma,
const tc *const   color,
const float  opacity = 1.0f 
)

Draw an isotropic 3D gaussian function.

Parameters:
xc = X-coordinate of the gaussian center.
yc = Y-coordinate of the gaussian center.
zc = Z-coordinate of the gaussian center.
sigma = standard variation of the gaussian distribution.
color = array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.

CImg<T>& draw_object3d ( const float  X,
const float  Y,
const float  Z,
const CImg< tp > &  points,
const CImgList< tf > &  primitives,
const CImgList< tc > &  colors,
const CImgList< to > &  opacities,
const unsigned int  render_type = 4,
const bool  double_sided = false,
const float  focale = 500,
const float  lightx = 0,
const float  lighty = 0,
const float  lightz = -5000,
const float  specular_light = 0.2f,
const float  specular_shine = 0.1f 
)

Draw a 3D object.

Parameters:
X = X-coordinate of the 3d object position
Y = Y-coordinate of the 3d object position
Z = Z-coordinate of the 3d object position
points = Image N*3 describing 3D point coordinates
primitives = List of P primitives
colors = List of P color (or textures)
opacities = Image of P opacities
render_type = Render type (0=Points, 1=Lines, 2=Faces (no light), 3=Faces (flat), 4=Faces(Gouraud)
double_sided = Tell if object faces have two sides or are oriented.
focale = length of the focale
lightx = X-coordinate of the light
lighty = Y-coordinate of the light
lightz = Z-coordinate of the light
specular_shine = Shininess of the object

CImg<typename cimg::superset2<T,t,float>::type> get_correlate ( const CImg< t > &  mask,
const unsigned int  cond = 1,
const bool  weighted_correl = false 
) const

Compute the correlation of the instance image by a mask.

The correlation of the instance image *this by the mask mask is defined to be :

res(x,y,z) = sum_{i,j,k} (*this)(x+i,y+j,z+k)*mask(i,j,k)

Parameters:
mask = the correlation kernel.
cond = the border condition type (0=zero, 1=dirichlet)
weighted_correl = enable local normalization.

CImg<typename cimg::superset2<T,t,float>::type> get_convolve ( const CImg< t > &  mask,
const unsigned int  cond = 1,
const bool  weighted_convol = false 
) const

Compute the convolution of the image by a mask.

The result res of the convolution of an image img by a mask mask is defined to be :

res(x,y,z) = sum_{i,j,k} img(x-i,y-j,z-k)*mask(i,j,k)

Parameters:
mask = the correlation kernel.
cond = the border condition type (0=zero, 1=dirichlet)
weighted_convol = enable local normalization.

CImg<T> get_noise ( const double  sigma = -20,
const unsigned int  ntype = 0 
) const

Add noise to the image.

Parameters:
sigma = power of the noise. if sigma<0, it corresponds to the percentage of the maximum image value.
ntype = noise type. can be 0=gaussian, 1=uniform or 2=Salt and Pepper.
Returns:
A noisy version of the instance image.

CImg<Tfloat> get_deriche ( const float  sigma,
const int  order = 0,
const char  axe = 'x',
const bool  cond = true 
) const

Compute the result of the Deriche filter.

The Canny-Deriche filter is a recursive algorithm allowing to compute blurred derivatives of order 0,1 or 2 of an image.

CImg<Tfloat> get_blur ( const float  sigmax,
const float  sigmay,
const float  sigmaz,
const bool  cond = true 
) const

Return a blurred version of the image, using a Canny-Deriche filter.

Blur the image with an anisotropic exponential filter (Deriche filter of order 0).

CImg<T> get_blur_anisotropic ( const CImg< t > &  G,
const float  amplitude = 60.0f,
const float  dl = 0.8f,
const float  da = 30.0f,
const float  gauss_prec = 2.0f,
const unsigned int  interpolation_type = 0,
const bool  fast_approx = true 
) const

Blur the image anisotropically following a field of diffusion tensors.

Parameters:
G = Field of square roots of diffusion tensors used to drive the smoothing.
amplitude = amplitude of the smoothing.
dl = spatial discretization.
da = angular discretization.
gauss_prec = precision of the gaussian function.
interpolation Used interpolation scheme (0 = nearest-neighbor, 1 = linear, 2 = Runge-Kutta)
fast_approx = Tell to use the fast approximation or not.

CImg<T> get_blur_anisotropic ( const CImg< tm > &  mask,
const float  amplitude,
const float  sharpness = 0.7f,
const float  anisotropy = 0.3f,
const float  alpha = 0.6f,
const float  sigma = 1.1f,
const float  dl = 0.8f,
const float  da = 30.0f,
const float  gauss_prec = 2.0f,
const unsigned int  interpolation_type = 0,
const bool  fast_approx = true,
const float  geom_factor = 1.0f 
) const

Blur an image in an anisotropic way.

Parameters:
mask Binary mask.
amplitude Amplitude of the anisotropic blur.
sharpness Contour preservation.
anisotropy Smoothing anisotropy.
alpha Image pre-blurring (gaussian).
sigma Regularity of the tensor-valued geometry.
dl Spatial discretization.
da Angular discretization.
gauss_prec Precision of the gaussian function.
interpolation_type Used interpolation scheme (0 = nearest-neighbor, 1 = linear, 2 = Runge-Kutta)
fast_approx Tell to use the fast approximation or not
geom_factor Geometry factor.

CImg<T> get_blur_bilateral ( const float  sigmax,
const float  sigmay,
const float  sigmaz,
const float  sigmar,
const int  bgridx,
const int  bgridy,
const int  bgridz,
const int  bgridr,
const bool  interpolation_type = true 
) const

Blur an image using the bilateral filter.

Parameters:
sigmax Amount of blur along the X-axis.
sigmay Amount of blur along the Y-axis.
sigmaz Amount of blur along the Z-axis.
sigmar Amount of blur along the range axis.
bgridx Size of the bilateral grid along the X-axis.
bgridy Size of the bilateral grid along the Y-axis.
bgridz Size of the bilateral grid along the Z-axis.
bgridr Size of the bilateral grid along the range axis.
interpolation_type Use interpolation for image slicing.
Note:
This algorithm uses the optimisation technique proposed by S. Paris and F. Durand, in ECCV'2006 (extended for 3D volumetric images).

CImg<Tfloat> get_haar ( const char  axis,
const bool  invert = false,
const unsigned int  nb_scales = 1 
) const

Compute the Haar multiscale wavelet transform (monodimensional version).

Parameters:
axis Axis considered for the transform.
invert Set inverse of direct transform.
nb_scales Number of scales used for the transform.

CImg<Tfloat> get_haar ( const bool  invert = false,
const unsigned int  nb_scales = 1 
) const

Compute the Haar multiscale wavelet transform.

Parameters:
invert Set inverse of direct transform.
nb_scales Number of scales used for the transform.

CImg<typename cimg::last<T,int>::type> get_coordinates ( const int  coords_type,
CImgDisplay disp,
unsigned int *const   XYZ = 0,
const unsigned char *const   color = 0 
) const

Simple interface to select shaped from an image.

Parameters:
selection Array of 6 values containing the selection result
coords_type Determine shape type to select (0=point, 1=vector, 2=rectangle, 3=circle)
disp Display window used to make the selection
XYZ Initial XYZ position (for volumetric images only)
color Color of the shape selector.

static CImg<T> get_load ( const char *const   filename  )  [static]

Load an image from a file.

Parameters:
filename is the name of the image file to load.
Note:
The extension of filename defines the file format. If no filename extension is provided, CImg<T>::get_load() will try to load a .cimg file.

const CImg<T>& save ( const char *const   filename,
const int  number = -1 
) const

Save the image as a file.

The used file format is defined by the file extension in the filename filename. Parameter number can be used to add a 6-digit number to the filename before saving.

const CImg<T>& save_graphicsmagick_external ( const char *const   filename,
const unsigned int  quality = 100 
) const

Save the image using GraphicsMagick's gm.

Function that saves the image for other file formats that are not natively handled by CImg, using the tool 'gm' from the GraphicsMagick package.
This is the case for all compressed image formats (GIF,PNG,JPG,TIF, ...). You need to install the GraphicsMagick package in order to get this function working properly (see http://www.graphicsmagick.org ).

const CImg<T>& save_imagemagick_external ( const char *const   filename,
const unsigned int  quality = 100 
) const

Save the image using ImageMagick's convert.

Function that saves the image for other file formats that are not natively handled by CImg, using the tool 'convert' from the ImageMagick package.
This is the case for all compressed image formats (GIF,PNG,JPG,TIF, ...). You need to install the ImageMagick package in order to get this function working properly (see http://www.imagemagick.org ).


Member Data Documentation

unsigned int width

Variable representing the width of the instance image (i.e. dimensions along the X-axis).

Remarks:
  • Prefer using the function CImg<T>::dimx() to get information about the width of an image.
  • Use function CImg<T>::resize() to set a new width for an image. Setting directly the variable width would probably result in a library crash.
  • Empty images have width defined to 0.

unsigned int height

Variable representing the height of the instance image (i.e. dimensions along the Y-axis).

Remarks:
  • Prefer using the function CImg<T>::dimy() to get information about the height of an image.
  • Use function CImg<T>::resize() to set a new height for an image. Setting directly the variable height would probably result in a library crash.
  • 1D signals have height defined to 1.
  • Empty images have height defined to 0.

unsigned int depth

Variable representing the depth of the instance image (i.e. dimensions along the Z-axis).

Remarks:
  • Prefer using the function CImg<T>::dimz() to get information about the depth of an image.
  • Use function CImg<T>::resize() to set a new depth for an image. Setting directly the variable depth would probably result in a library crash.
  • Classical 2D images have depth defined to 1.
  • Empty images have depth defined to 0.

unsigned int dim

Variable representing the number of channels of the instance image (i.e. dimensions along the V-axis).

Remarks:
  • Prefer using the function CImg<T>::dimv() to get information about the depth of an image.
  • Use function CImg<T>::resize() to set a new vector dimension for an image. Setting directly the variable dim would probably result in a library crash.
  • Scalar-valued images (one value per pixel) have dim defined to 1.
  • Empty images have depth defined to 0.