The CImg Library - C++ Template Image Processing Toolkit





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

CImg< T > Struct Template Reference

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

Public Types

typedef T * iterator
 Simple iterator type, to loop through each pixel value of an image instance. More...
 
typedef const T * const_iterator
 Simple const iterator type, to loop through each pixel value of a const image instance. More...
 
typedef T value_type
 Pixel value type. More...
 

Constructors / Destructor / Instance Management

 ~CImg ()
 Destroy image. More...
 
 CImg ()
 Construct empty image. More...
 
 CImg (const unsigned int size_x, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1)
 Construct image with specified size. More...
 
 CImg (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const T value)
 Construct image with specified size and initialize pixel values. More...
 
 CImg (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const int value0, const int value1,...)
 Construct image with specified size and initialize pixel values from a sequence of integers. More...
 
 CImg (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const double value0, const double value1,...)
 Construct image with specified size and initialize pixel values from a sequence of doubles. More...
 
 CImg (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const char *const values, const bool repeat_values)
 Construct image with specified size and initialize pixel values from a value string. More...
 
template<typename t >
 CImg (const t *const values, const unsigned int size_x, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1, const bool is_shared=false)
 Construct image with specified size and initialize pixel values from a memory buffer. More...
 
 CImg (const T *const values, const unsigned int size_x, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1, const bool is_shared=false)
 Construct image with specified size and initialize pixel values from a memory buffer [specialization].
 
 CImg (const char *const filename)
 Construct image from reading an image file. More...
 
template<typename t >
 CImg (const CImg< t > &img)
 Construct image copy. More...
 
 CImg (const CImg< T > &img)
 Construct image copy [specialization].
 
template<typename t >
 CImg (const CImg< t > &img, const bool is_shared)
 Advanced copy constructor. More...
 
 CImg (const CImg< T > &img, const bool is_shared)
 Advanced copy constructor [specialization].
 
template<typename t >
 CImg (const CImg< t > &img, const char *const dimensions)
 Construct image with dimensions borrowed from another image. More...
 
template<typename t >
 CImg (const CImg< t > &img, const char *const dimensions, const T value)
 Construct image with dimensions borrowed from another image and initialize pixel values. More...
 
 CImg (const CImgDisplay &disp)
 Construct image from a display window. More...
 
CImg< T > & assign ()
 Construct empty image [in-place version]. More...
 
CImg< T > & assign (const unsigned int size_x, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1)
 Construct image with specified size [in-place version]. More...
 
CImg< T > & assign (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const T value)
 Construct image with specified size and initialize pixel values [in-place version]. More...
 
CImg< T > & assign (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const int value0, const int value1,...)
 Construct image with specified size and initialize pixel values from a sequence of integers [in-place version]. More...
 
CImg< T > & assign (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const double value0, const double value1,...)
 Construct image with specified size and initialize pixel values from a sequence of doubles [in-place version]. More...
 
CImg< T > & assign (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const char *const values, const bool repeat_values)
 Construct image with specified size and initialize pixel values from a value string [in-place version]. More...
 
template<typename t >
CImg< T > & assign (const t *const values, const unsigned int size_x, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1)
 Construct image with specified size and initialize pixel values from a memory buffer [in-place version]. More...
 
CImg< T > & assign (const T *const values, const unsigned int size_x, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1)
 Construct image with specified size and initialize pixel values from a memory buffer [specialization].
 
template<typename t >
CImg< T > & assign (const t *const values, const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const bool is_shared)
 Construct image with specified size and initialize pixel values from a memory buffer [overloading].
 
CImg< T > & assign (const T *const values, const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c, const bool is_shared)
 Construct image with specified size and initialize pixel values from a memory buffer [overloading].
 
CImg< T > & assign (const char *const filename)
 Construct image from reading an image file [in-place version]. More...
 
template<typename t >
CImg< T > & assign (const CImg< t > &img)
 Construct image copy [in-place version]. More...
 
template<typename t >
CImg< T > & assign (const CImg< t > &img, const bool is_shared)
 In-place version of the advanced copy constructor. More...
 
template<typename t >
CImg< T > & assign (const CImg< t > &img, const char *const dimensions)
 Construct image with dimensions borrowed from another image [in-place version]. More...
 
template<typename t >
CImg< T > & assign (const CImg< t > &img, const char *const dimensions, const T value)
 Construct image with dimensions borrowed from another image and initialize pixel values [in-place version]. More...
 
CImg< T > & assign (const CImgDisplay &disp)
 Construct image from a display window [in-place version]. More...
 
CImg< T > & clear ()
 Construct empty image [in-place version]. More...
 
template<typename t >
CImg< t > & move_to (CImg< t > &img)
 Transfer content of an image instance into another one. More...
 
CImg< T > & move_to (CImg< T > &img)
 Transfer content of an image instance into another one [specialization].
 
template<typename t >
CImgList< t > & move_to (CImgList< t > &list, const unsigned int pos=~0U)
 Transfer content of an image instance into a new image in an image list. More...
 
CImg< T > & swap (CImg< T > &img)
 Swap fields of two image instances. More...
 
static CImg< T > & empty ()
 Return a reference to an empty image. More...
 

Overloaded Operators

T & operator() (const unsigned int x, const unsigned int y=0, const unsigned int z=0, const unsigned int c=0)
 Access to a pixel value. More...
 
const T & operator() (const unsigned int x, const unsigned int y=0, const unsigned int z=0, const unsigned int c=0) const
 Access to a pixel value [const version].
 
T & operator() (const unsigned int x, const unsigned int y, const unsigned int z, const unsigned int c, const unsigned long wh, const unsigned long whd=0)
 Access to a pixel value. More...
 
const T & operator() (const unsigned int x, const unsigned int y, const unsigned int z, const unsigned int c, const unsigned long wh, const unsigned long whd=0) const
 Access to a pixel value [const version].
 
 operator T * ()
 Implicitely cast an image into a T*. More...
 
 operator const T * () const
 Implicitely cast an image into a T* [const version].
 
CImg< T > & operator= (const T value)
 Assign a value to all image pixels. More...
 
CImg< T > & operator= (const char *const expression)
 Assign pixels values from a specified expression. More...
 
template<typename t >
CImg< T > & operator= (const CImg< t > &img)
 Copy an image into the current image instance. More...
 
CImg< T > & operator= (const CImg< T > &img)
 Copy an image into the current image instance [specialization].
 
CImg< T > & operator= (const CImgDisplay &disp)
 Copy the content of a display window to the current image instance. More...
 
template<typename t >
CImg< T > & operator+= (const t value)
 In-place addition operator. More...
 
CImg< T > & operator+= (const char *const expression)
 In-place addition operator. More...
 
template<typename t >
CImg< T > & operator+= (const CImg< t > &img)
 In-place addition operator. More...
 
CImg< T > & operator++ ()
 In-place increment operator (prefix). More...
 
CImg< T > operator++ (int)
 In-place increment operator (postfix). More...
 
CImg< T > operator+ () const
 Return a non-shared copy of the image instance. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator+ (const t value) const
 Addition operator. More...
 
CImg< Tfloat > operator+ (const char *const expression) const
 Addition operator. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator+ (const CImg< t > &img) const
 Addition operator. More...
 
template<typename t >
CImg< T > & operator-= (const t value)
 In-place substraction operator. More...
 
CImg< T > & operator-= (const char *const expression)
 In-place substraction operator. More...
 
template<typename t >
CImg< T > & operator-= (const CImg< t > &img)
 In-place substraction operator. More...
 
CImg< T > & operator-- ()
 In-place decrement operator (prefix). More...
 
CImg< T > operator-- (int)
 In-place decrement operator (postfix). More...
 
CImg< T > operator- () const
 Replace each pixel by its opposite value. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator- (const t value) const
 Substraction operator. More...
 
CImg< Tfloat > operator- (const char *const expression) const
 Substraction operator. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator- (const CImg< t > &img) const
 Substraction operator. More...
 
template<typename t >
CImg< T > & operator*= (const t value)
 In-place multiplication operator. More...
 
CImg< T > & operator*= (const char *const expression)
 In-place multiplication operator. More...
 
template<typename t >
CImg< T > & operator*= (const CImg< t > &img)
 In-place multiplication operator. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator* (const t value) const
 Multiplication operator. More...
 
CImg< Tfloat > operator* (const char *const expression) const
 Multiplication operator. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator* (const CImg< t > &img) const
 Multiplication operator. More...
 
template<typename t >
CImg< T > & operator/= (const t value)
 In-place division operator. More...
 
CImg< T > & operator/= (const char *const expression)
 In-place division operator. More...
 
template<typename t >
CImg< T > & operator/= (const CImg< t > &img)
 In-place division operator. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator/ (const t value) const
 Division operator. More...
 
CImg< Tfloat > operator/ (const char *const expression) const
 Division operator. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator/ (const CImg< t > &img) const
 Division operator. More...
 
template<typename t >
CImg< T > & operator%= (const t value)
 In-place modulo operator. More...
 
CImg< T > & operator%= (const char *const expression)
 In-place modulo operator. More...
 
template<typename t >
CImg< T > & operator%= (const CImg< t > &img)
 In-place modulo operator. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator% (const t value) const
 Modulo operator. More...
 
CImg< Tfloat > operator% (const char *const expression) const
 Modulo operator. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
operator% (const CImg< t > &img) const
 Modulo operator. More...
 
template<typename t >
CImg< T > & operator&= (const t value)
 In-place bitwise AND operator. More...
 
CImg< T > & operator&= (const char *const expression)
 In-place bitwise AND operator. More...
 
template<typename t >
CImg< T > & operator&= (const CImg< t > &img)
 In-place bitwise AND operator. More...
 
template<typename t >
CImg< T > operator& (const t value) const
 Bitwise AND operator. More...
 
CImg< T > operator& (const char *const expression) const
 Bitwise AND operator. More...
 
template<typename t >
CImg< T > operator& (const CImg< t > &img) const
 Bitwise AND operator. More...
 
template<typename t >
CImg< T > & operator|= (const t value)
 In-place bitwise OR operator. More...
 
CImg< T > & operator|= (const char *const expression)
 In-place bitwise OR operator. More...
 
template<typename t >
CImg< T > & operator|= (const CImg< t > &img)
 In-place bitwise OR operator. More...
 
template<typename t >
CImg< T > operator| (const t value) const
 Bitwise OR operator. More...
 
CImg< T > operator| (const char *const expression) const
 Bitwise OR operator. More...
 
template<typename t >
CImg< T > operator| (const CImg< t > &img) const
 Bitwise OR operator. More...
 
template<typename t >
CImg< T > & operator^= (const t value)
 In-place bitwise XOR operator. More...
 
CImg< T > & operator^= (const char *const expression)
 In-place bitwise XOR operator. More...
 
template<typename t >
CImg< T > & operator^= (const CImg< t > &img)
 In-place bitwise XOR operator. More...
 
template<typename t >
CImg< T > operator^ (const t value) const
 Bitwise XOR operator. More...
 
CImg< T > operator^ (const char *const expression) const
 Bitwise XOR operator. More...
 
template<typename t >
CImg< T > operator^ (const CImg< t > &img) const
 Bitwise XOR operator. More...
 
template<typename t >
CImg< T > & operator<<= (const t value)
 In-place bitwise left shift operator. More...
 
CImg< T > & operator<<= (const char *const expression)
 In-place bitwise left shift operator. More...
 
template<typename t >
CImg< T > & operator<<= (const CImg< t > &img)
 In-place bitwise left shift operator. More...
 
template<typename t >
CImg< T > operator<< (const t value) const
 Bitwise left shift operator. More...
 
CImg< T > operator<< (const char *const expression) const
 Bitwise left shift operator. More...
 
template<typename t >
CImg< T > operator<< (const CImg< t > &img) const
 Bitwise left shift operator. More...
 
template<typename t >
CImg< T > & operator>>= (const t value)
 In-place bitwise right shift operator. More...
 
CImg< T > & operator>>= (const char *const expression)
 In-place bitwise right shift operator. More...
 
template<typename t >
CImg< T > & operator>>= (const CImg< t > &img)
 In-place bitwise right shift operator. More...
 
template<typename t >
CImg< T > operator>> (const t value) const
 Bitwise right shift operator. More...
 
CImg< T > operator>> (const char *const expression) const
 Bitwise right shift operator. More...
 
template<typename t >
CImg< T > operator>> (const CImg< t > &img) const
 Bitwise right shift operator. More...
 
CImg< T > operator~ () const
 Bitwise inversion operator. More...
 
template<typename t >
bool operator== (const t value) const
 Test if all pixels of an image have the same value. More...
 
bool operator== (const char *const expression) const
 Test if all pixel values of an image follow a specified expression. More...
 
template<typename t >
bool operator== (const CImg< t > &img) const
 Test if two images have the same size and values. More...
 
template<typename t >
bool operator!= (const t value) const
 Test if pixels of an image are all different from a value. More...
 
bool operator!= (const char *const expression) const
 Test if all pixel values of an image are different from a specified expression. More...
 
template<typename t >
bool operator!= (const CImg< t > &img) const
 Test if two images have different sizes or values. More...
 
template<typename t >
CImgList< typename
cimg::superset< T, t >::type > 
operator, (const CImg< t > &img) const
 Construct an image list from two images. More...
 
template<typename t >
CImgList< typename
cimg::superset< T, t >::type > 
operator, (const CImgList< t > &list) const
 Construct an image list from image instance and an input image list. More...
 
CImgList< T > operator< (const char axis) const
 Split image along specified axis. More...
 

Instance Characteristics

int width () const
 Return the number of image columns. More...
 
int height () const
 Return the number of image rows. More...
 
int depth () const
 Return the number of image slices. More...
 
int spectrum () const
 Return the number of image channels. More...
 
unsigned long size () const
 Return the total number of pixel values. More...
 
T * data ()
 Return a pointer to the first pixel value. More...
 
const T * data () const
 Return a pointer to the first pixel value [const version].
 
T * data (const unsigned int x, const unsigned int y=0, const unsigned int z=0, const unsigned int c=0)
 Return a pointer to a located pixel value. More...
 
const T * data (const unsigned int x, const unsigned int y=0, const unsigned int z=0, const unsigned int c=0) const
 Return a pointer to a located pixel value [const version].
 
long offset (const int x, const int y=0, const int z=0, const int c=0) const
 Return the offset to a located pixel value, with respect to the beginning of the pixel buffer. More...
 
iterator begin ()
 Return a CImg<T>::iterator pointing to the first pixel value. More...
 
const_iterator begin () const
 Return a CImg<T>::iterator pointing to the first value of the pixel buffer [const version].
 
iterator end ()
 Return a CImg<T>::iterator pointing next to the last pixel value. More...
 
const_iterator end () const
 Return a CImg<T>::iterator pointing next to the last pixel value [const version].
 
T & front ()
 Return a reference to the first pixel value. More...
 
const T & front () const
 Return a reference to the first pixel value [const version].
 
T & back ()
 Return a reference to the last pixel value. More...
 
const T & back () const
 Return a reference to the last pixel value [const version].
 
T & at (const int offset, const T out_value)
 Access to a pixel value at a specified offset, using Dirichlet boundary conditions. More...
 
at (const int offset, const T out_value) const
 Access to a pixel value at a specified offset, using Dirichlet boundary conditions [const version].
 
T & at (const int offset)
 Access to a pixel value at a specified offset, using Neumann boundary conditions. More...
 
at (const int offset) const
 Access to a pixel value at a specified offset, using Neumann boundary conditions [const version].
 
T & atX (const int x, const int y, const int z, const int c, const T out_value)
 Access to a pixel value, using Dirichlet boundary conditions for the X-coordinate. More...
 
atX (const int x, const int y, const int z, const int c, const T out_value) const
 Access to a pixel value, using Dirichlet boundary conditions for the X-coordinate [const version].
 
T & atX (const int x, const int y=0, const int z=0, const int c=0)
 Access to a pixel value, using Neumann boundary conditions for the X-coordinate. More...
 
atX (const int x, const int y=0, const int z=0, const int c=0) const
 Access to a pixel value, using Neumann boundary conditions for the X-coordinate [const version].
 
T & atXY (const int x, const int y, const int z, const int c, const T out_value)
 Access to a pixel value, using Dirichlet boundary conditions for the X and Y-coordinates. More...
 
atXY (const int x, const int y, const int z, const int c, const T out_value) const
 Access to a pixel value, using Dirichlet boundary conditions for the X and Y coordinates [const version].
 
T & atXY (const int x, const int y, const int z=0, const int c=0)
 Access to a pixel value, using Neumann boundary conditions for the X and Y-coordinates. More...
 
atXY (const int x, const int y, const int z=0, const int c=0) const
 Access to a pixel value, using Neumann boundary conditions for the X and Y-coordinates [const version].
 
T & atXYZ (const int x, const int y, const int z, const int c, const T out_value)
 Access to a pixel value, using Dirichlet boundary conditions for the X,Y and Z-coordinates. More...
 
atXYZ (const int x, const int y, const int z, const int c, const T out_value) const
 Access to a pixel value, using Dirichlet boundary conditions for the X,Y and Z-coordinates [const version].
 
T & atXYZ (const int x, const int y, const int z, const int c=0)
 Access to a pixel value, using Neumann boundary conditions for the X,Y and Z-coordinates. More...
 
atXYZ (const int x, const int y, const int z, const int c=0) const
 Access to a pixel value, using Neumann boundary conditions for the X,Y and Z-coordinates [const version].
 
T & atXYZC (const int x, const int y, const int z, const int c, const T out_value)
 Access to a pixel value, using Dirichlet boundary conditions. More...
 
atXYZC (const int x, const int y, const int z, const int c, const T out_value) const
 Access to a pixel value, using Dirichlet boundary conditions [const version].
 
T & atXYZC (const int x, const int y, const int z, const int c)
 Access to a pixel value, using Neumann boundary conditions. More...
 
atXYZC (const int x, const int y, const int z, const int c) const
 Access to a pixel value, using Neumann boundary conditions [const version].
 
Tfloat linear_atX (const float fx, const int y, const int z, const int c, const T out_value) const
 Return pixel value, using linear interpolation and Dirichlet boundary conditions for the X-coordinate. More...
 
Tfloat linear_atX (const float fx, const int y=0, const int z=0, const int c=0) const
 Return pixel value, using linear interpolation and Neumann boundary conditions for the X-coordinate. More...
 
Tfloat linear_atXY (const float fx, const float fy, const int z, const int c, const T out_value) const
 Return pixel value, using linear interpolation and Dirichlet boundary conditions for the X and Y-coordinates. More...
 
Tfloat linear_atXY (const float fx, const float fy, const int z=0, const int c=0) const
 Return pixel value, using linear interpolation and Neumann boundary conditions for the X and Y-coordinates. More...
 
Tfloat linear_atXYZ (const float fx, const float fy, const float fz, const int c, const T out_value) const
 Return pixel value, using linear interpolation and Dirichlet boundary conditions for the X,Y and Z-coordinates. More...
 
Tfloat linear_atXYZ (const float fx, const float fy=0, const float fz=0, const int c=0) const
 Return pixel value, using linear interpolation and Neumann boundary conditions for the X,Y and Z-coordinates. More...
 
Tfloat linear_atXYZC (const float fx, const float fy, const float fz, const float fc, const T out_value) const
 Return pixel value, using linear interpolation and Dirichlet boundary conditions for all X,Y,Z and C-coordinates. More...
 
Tfloat linear_atXYZC (const float fx, const float fy=0, const float fz=0, const float fc=0) const
 Return pixel value, using linear interpolation and Neumann boundary conditions for all X,Y,Z and C-coordinates. More...
 
Tfloat cubic_atX (const float fx, const int y, const int z, const int c, const T out_value) const
 Return pixel value, using cubic interpolation and Dirichlet boundary conditions for the X-coordinate. More...
 
Tfloat cubic_atX (const float fx, const int y, const int z, const int c, const T out_value, const Tfloat min_value, const Tfloat max_value) const
 Return damped pixel value, using cubic interpolation and Dirichlet boundary conditions for the X-coordinate. More...
 
Tfloat cubic_atX (const float fx, const int y=0, const int z=0, const int c=0) const
 Return pixel value, using cubic interpolation and Neumann boundary conditions for the X-coordinate. More...
 
Tfloat cubic_atX (const float fx, const int y, const int z, const int c, const Tfloat min_value, const Tfloat max_value) const
 Return damped pixel value, using cubic interpolation and Neumann boundary conditions for the X-coordinate. More...
 
Tfloat cubic_atXY (const float fx, const float fy, const int z, const int c, const T out_value) const
 Return pixel value, using cubic interpolation and Dirichlet boundary conditions for the X and Y-coordinates. More...
 
Tfloat cubic_atXY (const float fx, const float fy, const int z, const int c, const T out_value, const Tfloat min_value, const Tfloat max_value) const
 Return damped pixel value, using cubic interpolation and Dirichlet boundary conditions for the X and Y-coordinates. More...
 
Tfloat cubic_atXY (const float fx, const float fy, const int z=0, const int c=0) const
 Return pixel value, using cubic interpolation and Neumann boundary conditions for the X and Y-coordinates. More...
 
Tfloat cubic_atXY (const float fx, const float fy, const int z, const int c, const Tfloat min_value, const Tfloat max_value) const
 Return damped pixel value, using cubic interpolation and Neumann boundary conditions for the X and Y-coordinates. More...
 
Tfloat cubic_atXYZ (const float fx, const float fy, const float fz, const int c, const T out_value) const
 Return pixel value, using cubic interpolation and Dirichlet boundary conditions for the X,Y and Z-coordinates. More...
 
Tfloat cubic_atXYZ (const float fx, const float fy, const float fz, const int c, const T out_value, const Tfloat min_value, const Tfloat max_value) const
 Return damped pixel value, using cubic interpolation and Dirichlet boundary conditions for the X,Y and Z-coordinates. More...
 
Tfloat cubic_atXYZ (const float fx, const float fy, const float fz, const int c=0) const
 Return pixel value, using cubic interpolation and Neumann boundary conditions for the X,Y and Z-coordinates. More...
 
Tfloat cubic_atXYZ (const float fx, const float fy, const float fz, const int c, const Tfloat min_value, const Tfloat max_value) const
 Return damped pixel value, using cubic interpolation and Neumann boundary conditions for the X,Y and Z-coordinates. More...
 
CImg< T > & set_linear_atXY (const T &value, const float fx, const float fy=0, const int z=0, const int c=0, const bool is_added=false)
 Set pixel value, using linear interpolation for the X and Y-coordinates. More...
 
CImg< T > & set_linear_atXYZ (const T &value, const float fx, const float fy=0, const float fz=0, const int c=0, const bool is_added=false)
 Set pixel value, using linear interpolation for the X,Y and Z-coordinates. More...
 
CImg< charT > value_string (const char separator=',', const unsigned int max_size=0) const
 Return a C-string containing a list of all values of the image instance. More...
 
static const char * pixel_type ()
 Return the type of image pixel values as a C string. More...
 

Instance Checking

bool is_shared () const
 Test shared state of the pixel buffer. More...
 
bool is_empty () const
 Test if image instance is empty. More...
 
bool is_inf () const
 Test if image instance contains a 'inf' value. More...
 
bool is_nan () const
 Test if image instance contains a 'nan' value. More...
 
bool is_sameX (const unsigned int size_x) const
 Test if image width is equal to specified value.
 
template<typename t >
bool is_sameX (const CImg< t > &img) const
 Test if image width is equal to specified value.
 
bool is_sameX (const CImgDisplay &disp) const
 Test if image width is equal to specified value.
 
bool is_sameY (const unsigned int size_y) const
 Test if image height is equal to specified value.
 
template<typename t >
bool is_sameY (const CImg< t > &img) const
 Test if image height is equal to specified value.
 
bool is_sameY (const CImgDisplay &disp) const
 Test if image height is equal to specified value.
 
bool is_sameZ (const unsigned int size_z) const
 Test if image depth is equal to specified value.
 
template<typename t >
bool is_sameZ (const CImg< t > &img) const
 Test if image depth is equal to specified value.
 
bool is_sameC (const unsigned int size_c) const
 Test if image spectrum is equal to specified value.
 
template<typename t >
bool is_sameC (const CImg< t > &img) const
 Test if image spectrum is equal to specified value.
 
bool is_sameXY (const unsigned int size_x, const unsigned int size_y) const
 Test if image width and height are equal to specified values. More...
 
template<typename t >
bool is_sameXY (const CImg< t > &img) const
 Test if image width and height are the same as that of another image. More...
 
bool is_sameXY (const CImgDisplay &disp) const
 Test if image width and height are the same as that of an existing display window. More...
 
bool is_sameXZ (const unsigned int size_x, const unsigned int size_z) const
 Test if image width and depth are equal to specified values. More...
 
template<typename t >
bool is_sameXZ (const CImg< t > &img) const
 Test if image width and depth are the same as that of another image. More...
 
bool is_sameXC (const unsigned int size_x, const unsigned int size_c) const
 Test if image width and spectrum are equal to specified values. More...
 
template<typename t >
bool is_sameXC (const CImg< t > &img) const
 Test if image width and spectrum are the same as that of another image. More...
 
bool is_sameYZ (const unsigned int size_y, const unsigned int size_z) const
 Test if image height and depth are equal to specified values. More...
 
template<typename t >
bool is_sameYZ (const CImg< t > &img) const
 Test if image height and depth are the same as that of another image. More...
 
bool is_sameYC (const unsigned int size_y, const unsigned int size_c) const
 Test if image height and spectrum are equal to specified values. More...
 
template<typename t >
bool is_sameYC (const CImg< t > &img) const
 Test if image height and spectrum are the same as that of another image. More...
 
bool is_sameZC (const unsigned int size_z, const unsigned int size_c) const
 Test if image depth and spectrum are equal to specified values. More...
 
template<typename t >
bool is_sameZC (const CImg< t > &img) const
 Test if image depth and spectrum are the same as that of another image. More...
 
bool is_sameXYZ (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z) const
 Test if image width, height and depth are equal to specified values. More...
 
template<typename t >
bool is_sameXYZ (const CImg< t > &img) const
 Test if image width, height and depth are the same as that of another image. More...
 
bool is_sameXYC (const unsigned int size_x, const unsigned int size_y, const unsigned int size_c) const
 Test if image width, height and spectrum are equal to specified values. More...
 
template<typename t >
bool is_sameXYC (const CImg< t > &img) const
 Test if image width, height and spectrum are the same as that of another image. More...
 
bool is_sameXZC (const unsigned int size_x, const unsigned int size_z, const unsigned int size_c) const
 Test if image width, depth and spectrum are equal to specified values. More...
 
template<typename t >
bool is_sameXZC (const CImg< t > &img) const
 Test if image width, depth and spectrum are the same as that of another image. More...
 
bool is_sameYZC (const unsigned int size_y, const unsigned int size_z, const unsigned int size_c) const
 Test if image height, depth and spectrum are equal to specified values. More...
 
template<typename t >
bool is_sameYZC (const CImg< t > &img) const
 Test if image height, depth and spectrum are the same as that of another image. More...
 
bool is_sameXYZC (const unsigned int size_x, const unsigned int size_y, const unsigned int size_z, const unsigned int size_c) const
 Test if image width, height, depth and spectrum are equal to specified values. More...
 
template<typename t >
bool is_sameXYZC (const CImg< t > &img) const
 Test if image width, height, depth and spectrum are the same as that of another image. More...
 
bool containsXYZC (const int x, const int y=0, const int z=0, const int c=0) const
 Test if specified coordinates are inside image bounds. More...
 
template<typename t >
bool contains (const T &pixel, t &x, t &y, t &z, t &c) const
 Test if pixel value is inside image bounds and get its X,Y,Z and C-coordinates. More...
 
template<typename t >
bool contains (const T &pixel, t &x, t &y, t &z) const
 Test if pixel value is inside image bounds and get its X,Y and Z-coordinates. More...
 
template<typename t >
bool contains (const T &pixel, t &x, t &y) const
 Test if pixel value is inside image bounds and get its X and Y-coordinates. More...
 
template<typename t >
bool contains (const T &pixel, t &x) const
 Test if pixel value is inside image bounds and get its X-coordinate. More...
 
bool contains (const T &pixel) const
 Test if pixel value is inside image bounds. More...
 
template<typename t >
bool is_overlapped (const CImg< t > &img) const
 Test if pixel buffers of instance and input images overlap. More...
 
template<typename tp , typename tc , typename to >
bool is_object3d (const CImgList< tp > &primitives, const CImgList< tc > &colors, const to &opacities, const bool full_check=true, char *const error_message=0) const
 Test if the set {*this,primitives,colors,opacities} defines a valid 3d object. More...
 
bool is_CImg3d (const bool full_check=true, char *const error_message=0) const
 Test if image instance represents a valid serialization of a 3d object. More...
 

Mathematical Functions

CImg< T > & sqr ()
 Compute the square value of each pixel value. More...
 
CImg< Tfloat > get_sqr () const
 Compute the square value of each pixel value [new-instance version].
 
CImg< T > & sqrt ()
 Compute the square root of each pixel value. More...
 
CImg< Tfloat > get_sqrt () const
 Compute the square root of each pixel value [new-instance version].
 
CImg< T > & exp ()
 Compute the exponential of each pixel value. More...
 
CImg< Tfloat > get_exp () const
 Compute the exponential of each pixel value [new-instance version].
 
CImg< T > & log ()
 Compute the logarithm of each pixel value. More...
 
CImg< Tfloat > get_log () const
 Compute the logarithm of each pixel value [new-instance version].
 
CImg< T > & log2 ()
 Compute the base-2 logarithm of each pixel value. More...
 
CImg< Tfloat > get_log2 () const
 Compute the base-10 logarithm of each pixel value [new-instance version].
 
CImg< T > & log10 ()
 Compute the base-10 logarithm of each pixel value. More...
 
CImg< Tfloat > get_log10 () const
 Compute the base-10 logarithm of each pixel value [new-instance version].
 
CImg< T > & abs ()
 Compute the absolute value of each pixel value. More...
 
CImg< Tfloat > get_abs () const
 Compute the absolute value of each pixel value [new-instance version].
 
CImg< T > & sign ()
 Compute the sign of each pixel value. More...
 
CImg< Tfloat > get_sign () const
 Compute the sign of each pixel value [new-instance version].
 
CImg< T > & cos ()
 Compute the cosine of each pixel value. More...
 
CImg< Tfloat > get_cos () const
 Compute the cosine of each pixel value [new-instance version].
 
CImg< T > & sin ()
 Compute the sine of each pixel value. More...
 
CImg< Tfloat > get_sin () const
 Compute the sine of each pixel value [new-instance version].
 
CImg< T > & sinc ()
 Compute the sinc of each pixel value. More...
 
CImg< Tfloat > get_sinc () const
 Compute the sinc of each pixel value [new-instance version].
 
CImg< T > & tan ()
 Compute the tangent of each pixel value. More...
 
CImg< Tfloat > get_tan () const
 Compute the tangent of each pixel value [new-instance version].
 
CImg< T > & cosh ()
 Compute the hyperbolic cosine of each pixel value. More...
 
CImg< Tfloat > get_cosh () const
 Compute the hyperbolic cosine of each pixel value [new-instance version].
 
CImg< T > & sinh ()
 Compute the hyperbolic sine of each pixel value. More...
 
CImg< Tfloat > get_sinh () const
 Compute the hyperbolic sine of each pixel value [new-instance version].
 
CImg< T > & tanh ()
 Compute the hyperbolic tangent of each pixel value. More...
 
CImg< Tfloat > get_tanh () const
 Compute the hyperbolic tangent of each pixel value [new-instance version].
 
CImg< T > & acos ()
 Compute the arccosine of each pixel value. More...
 
CImg< Tfloat > get_acos () const
 Compute the arccosine of each pixel value [new-instance version].
 
CImg< T > & asin ()
 Compute the arcsine of each pixel value. More...
 
CImg< Tfloat > get_asin () const
 Compute the arcsine of each pixel value [new-instance version].
 
CImg< T > & atan ()
 Compute the arctangent of each pixel value. More...
 
CImg< Tfloat > get_atan () const
 Compute the arctangent of each pixel value [new-instance version].
 
template<typename t >
CImg< T > & atan2 (const CImg< t > &img)
 Compute the arctangent2 of each pixel value. More...
 
template<typename t >
CImg< Tfloat > get_atan2 (const CImg< t > &img) const
 Compute the arctangent2 of each pixel value [new-instance version].
 
template<typename t >
CImg< T > & mul (const CImg< t > &img)
 In-place pointwise multiplication. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
get_mul (const CImg< t > &img) const
 In-place pointwise multiplication [new-instance version].
 
template<typename t >
CImg< T > & div (const CImg< t > &img)
 In-place pointwise division. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
get_div (const CImg< t > &img) const
 In-place pointwise division [new-instance version].
 
CImg< T > & pow (const double p)
 Raise each pixel value to a specified power. More...
 
CImg< Tfloat > get_pow (const double p) const
 Raise each pixel value to a specified power [new-instance version].
 
CImg< T > & pow (const char *const expression)
 Raise each pixel value to a power, specified from an expression. More...
 
CImg< Tfloat > get_pow (const char *const expression) const
 Raise each pixel value to a power, specified from an expression [new-instance version].
 
template<typename t >
CImg< T > & pow (const CImg< t > &img)
 Raise each pixel value to a power, pointwisely specified from another image. More...
 
template<typename t >
CImg< Tfloat > get_pow (const CImg< t > &img) const
 Raise each pixel value to a power, pointwisely specified from another image [new-instance version].
 
CImg< T > & rol (const unsigned int n=1)
 Compute the bitwise left rotation of each pixel value. More...
 
CImg< T > get_rol (const unsigned int n=1) const
 Compute the bitwise left rotation of each pixel value [new-instance version].
 
CImg< T > & rol (const char *const expression)
 Compute the bitwise left rotation of each pixel value. More...
 
CImg< T > get_rol (const char *const expression) const
 Compute the bitwise left rotation of each pixel value [new-instance version].
 
template<typename t >
CImg< T > & rol (const CImg< t > &img)
 Compute the bitwise left rotation of each pixel value. More...
 
template<typename t >
CImg< T > get_rol (const CImg< t > &img) const
 Compute the bitwise left rotation of each pixel value [new-instance version].
 
CImg< T > & ror (const unsigned int n=1)
 Compute the bitwise right rotation of each pixel value. More...
 
CImg< T > get_ror (const unsigned int n=1) const
 Compute the bitwise right rotation of each pixel value [new-instance version].
 
CImg< T > & ror (const char *const expression)
 Compute the bitwise right rotation of each pixel value. More...
 
CImg< T > get_ror (const char *const expression) const
 Compute the bitwise right rotation of each pixel value [new-instance version].
 
template<typename t >
CImg< T > & ror (const CImg< t > &img)
 Compute the bitwise right rotation of each pixel value. More...
 
template<typename t >
CImg< T > get_ror (const CImg< t > &img) const
 Compute the bitwise right rotation of each pixel value [new-instance version].
 
CImg< T > & min (const T val)
 Pointwise min operator between instance image and a value. More...
 
CImg< T > get_min (const T val) const
 Pointwise min operator between instance image and a value [new-instance version].
 
template<typename t >
CImg< T > & min (const CImg< t > &img)
 Pointwise min operator between two images. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
get_min (const CImg< t > &img) const
 Pointwise min operator between two images [new-instance version].
 
CImg< T > & min (const char *const expression)
 Pointwise min operator between an image and an expression. More...
 
CImg< Tfloat > get_min (const char *const expression) const
 Pointwise min operator between an image and an expression [new-instance version].
 
CImg< T > & max (const T val)
 Pointwise max operator between instance image and a value. More...
 
CImg< T > get_max (const T val) const
 Pointwise max operator between instance image and a value [new-instance version].
 
template<typename t >
CImg< T > & max (const CImg< t > &img)
 Pointwise max operator between two images. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
get_max (const CImg< t > &img) const
 Pointwise max operator between two images [new-instance version].
 
CImg< T > & max (const char *const expression)
 Pointwise max operator between an image and an expression. More...
 
CImg< Tfloat > get_max (const char *const expression) const
 Pointwise max operator between an image and an expression [new-instance version].
 
T & min ()
 Return a reference to the minimum pixel value.
 
const T & min () const
 Return a reference to the minimum pixel value [const version].
 
T & max ()
 Return a reference to the maximum pixel value.
 
const T & max () const
 Return a reference to the maximum pixel value [const version].
 
template<typename t >
T & min_max (t &max_val)
 Return a reference to the minimum pixel value as well as the maximum pixel value. More...
 
template<typename t >
const T & min_max (t &max_val) const
 Return a reference to the minimum pixel value as well as the maximum pixel value [const version].
 
template<typename t >
T & max_min (t &min_val)
 Return a reference to the maximum pixel value as well as the minimum pixel value. More...
 
template<typename t >
const T & max_min (t &min_val) const
 Return a reference to the maximum pixel value as well as the minimum pixel value [const version].
 
kth_smallest (const unsigned int k) const
 Return the kth smallest pixel value. More...
 
median () const
 Return the median pixel value.
 
Tdouble sum () const
 Return the sum of all the pixel values.
 
Tdouble mean () const
 Return the average pixel value.
 
Tdouble variance (const unsigned int variance_method=1) const
 Return the variance of the pixel values. More...
 
template<typename t >
Tdouble variance_mean (const unsigned int variance_method, t &mean) const
 Return the variance as well as the average of the pixel values. More...
 
Tdouble variance_noise (const unsigned int variance_method=2) const
 Return estimated variance of the noise. More...
 
template<typename t >
Tdouble MSE (const CImg< t > &img) const
 Compute the MSE (Mean-Squared Error) between two images. More...
 
template<typename t >
Tdouble PSNR (const CImg< t > &img, const Tdouble max_value=255) const
 Compute the PSNR (Peak Signal-to-Noise Ratio) between two images. More...
 
double eval (const char *const expression, const double x=0, const double y=0, const double z=0, const double c=0) const
 Evaluate math formula. More...
 
template<typename t >
CImg< doubleT > eval (const char *const expression, const CImg< t > &xyzc) const
 Evaluate math formula on a set of variables. More...
 
CImg< Tdouble > get_stats (const unsigned int variance_method=1) const
 Compute statistics vector from the pixel values.
 
CImg< T > & stats (const unsigned int variance_method=1)
 Compute statistics vector from the pixel values [in-place version].
 

Vector / Matrix Operations

Tdouble magnitude (const int magnitude_type=2) const
 Compute norm of the image, viewed as a matrix. More...
 
Tdouble trace () const
 Compute the trace of the image, viewed as a matrix.
 
Tdouble det () const
 Compute the determinant of the image, viewed as a matrix.
 
template<typename t >
Tdouble dot (const CImg< t > &img) const
 Compute the dot product between instance and argument, viewed as matrices. More...
 
CImg< T > get_vector_at (const unsigned int x, const unsigned int y=0, const unsigned int z=0) const
 Get vector-valued pixel located at specified position. More...
 
CImg< T > get_matrix_at (const unsigned int x=0, const unsigned int y=0, const unsigned int z=0) const
 Get (square) matrix-valued pixel located at specified position. More...
 
CImg< T > get_tensor_at (const unsigned int x, const unsigned int y=0, const unsigned int z=0) const
 Get tensor-valued pixel located at specified position. More...
 
template<typename t >
CImg< T > & set_vector_at (const CImg< t > &vec, const unsigned int x, const unsigned int y=0, const unsigned int z=0)
 Set vector-valued pixel at specified position. More...
 
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 (square) matrix-valued pixel at specified position. More...
 
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 tensor-valued pixel at specified position. More...
 
CImg< T > & vector ()
 Unroll pixel values along axis y. More...
 
CImg< T > get_vector () const
 Unroll pixel values along axis y [new-instance version].
 
CImg< T > & matrix ()
 Resize image to become a scalar square matrix.
 
CImg< T > get_matrix () const
 Resize image to become a scalar square matrix [new-instance version].
 
CImg< T > & tensor ()
 Resize image to become a symmetric tensor.
 
CImg< T > get_tensor () const
 Resize image to become a symmetric tensor [new-instance version].
 
CImg< T > & diagonal ()
 Resize image to become a diagonal matrix. More...
 
CImg< T > get_diagonal () const
 Resize image to become a diagonal matrix [new-instance version].
 
CImg< T > & identity_matrix ()
 Replace the image by an identity matrix. More...
 
CImg< T > get_identity_matrix () const
 Replace the image by an identity matrix [new-instance version].
 
CImg< T > & sequence (const T a0, const T a1)
 Fill image with a linear sequence of values. More...
 
CImg< T > get_sequence (const T a0, const T a1) const
 Fill image with a linear sequence of values [new-instance version].
 
CImg< T > & transpose ()
 Transpose the image, viewed as a matrix. More...
 
CImg< T > get_transpose () const
 Transpose the image, viewed as a matrix [new-instance version].
 
template<typename t >
CImg< T > & cross (const CImg< t > &img)
 Compute the cross product between two 1x3 images, viewed as 3d vectors. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
get_cross (const CImg< t > &img) const
 Compute the cross product between two 1x3 images, viewed as 3d vectors [new-instance version].
 
CImg< T > & invert (const bool use_LU=true)
 Invert the instance image, viewed as a matrix. More...
 
CImg< Tfloat > get_invert (const bool use_LU=true) const
 Invert the instance image, viewed as a matrix [new-instance version].
 
CImg< T > & pseudoinvert ()
 Compute the Moore-Penrose pseudo-inverse of the instance image, viewed as a matrix.
 
CImg< Tfloat > get_pseudoinvert () const
 Compute the Moore-Penrose pseudo-inverse of the instance image, viewed as a matrix [new-instance version].
 
template<typename t >
CImg< T > & solve (const CImg< t > &A)
 Solve a system of linear equations. More...
 
template<typename t >
CImg< typename cimg::superset2
< T, t, float >::type > 
get_solve (const CImg< t > &A) const
 Solve a system of linear equations [new-instance version].
 
template<typename t >
CImg< T > & solve_tridiagonal (const CImg< t > &A)
 Solve a tridiagonal system of linear equations. More...
 
template<typename t >
CImg< typename cimg::superset2
< T, t, float >::type > 
get_solve_tridiagonal (const CImg< t > &A) const
 Solve a tridiagonal system of linear equations [new-instance version].
 
template<typename t >
const CImg< T > & eigen (CImg< t > &val, CImg< t > &vec) const
 Compute eigenvalues and eigenvectors of the instance image, viewed as a matrix. More...
 
CImgList< Tfloat > get_eigen () const
 Compute eigenvalues and eigenvectors of the instance image, viewed as a matrix. More...
 
template<typename t >
const CImg< T > & symmetric_eigen (CImg< t > &val, CImg< t > &vec) const
 Compute eigenvalues and eigenvectors of the instance image, viewed as a symmetric matrix. More...
 
CImgList< Tfloat > get_symmetric_eigen () const
 Compute eigenvalues and eigenvectors of the instance image, viewed as a symmetric matrix. More...
 
template<typename t >
CImg< T > & sort (CImg< t > &permutations, const bool is_increasing=true)
 Sort pixel values and get sorting permutations. More...
 
template<typename t >
CImg< T > get_sort (CImg< t > &permutations, const bool is_increasing=true) const
 Sort pixel values and get sorting permutations [new-instance version].
 
CImg< T > & sort (const bool is_increasing=true, const char axis=0)
 Sort pixel values. More...
 
CImg< T > get_sort (const bool is_increasing=true, const char axis=0) const
 Sort pixel values [new-instance version].
 
template<typename t >
const CImg< T > & SVD (CImg< t > &U, CImg< t > &S, CImg< t > &V, const bool sorting=true, const unsigned int max_iteration=40, const float lambda=0) const
 Compute the SVD of the instance image, viewed as a general matrix. More...
 
CImgList< Tfloat > get_SVD (const bool sorting=true, const unsigned int max_iteration=40, const float lambda=0) const
 Compute the SVD of the instance image, viewed as a general matrix. More...
 
template<typename t >
CImg< T > & dijkstra (const unsigned int starting_node, const unsigned int ending_node, CImg< t > &previous_node)
 Return minimal path in a graph, using the Dijkstra algorithm. More...
 
template<typename t >
CImg< T > get_dijkstra (const unsigned int starting_node, const unsigned int ending_node, CImg< t > &previous_node) const
 Return minimal path in a graph, using the Dijkstra algorithm [new-instance version].
 
CImg< T > & dijkstra (const unsigned int starting_node, const unsigned int ending_node=~0U)
 Return minimal path in a graph, using the Dijkstra algorithm.
 
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 [new-instance version].
 
template<typename tf , typename t >
static CImg< T > dijkstra (const tf &distance, const unsigned int nb_nodes, const unsigned int starting_node, const unsigned int ending_node, CImg< t > &previous_node)
 Compute minimal path in a graph, using the Dijkstra algorithm. More...
 
template<typename tf , typename t >
static CImg< T > 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.
 
static CImg< T > string (const char *const str, const bool is_last_zero=true)
 Return an image containing the ascii codes of the specified string. More...
 
static CImg< T > vector (const T &a0)
 Return a 1x1 image containing specified value. More...
 
static CImg< T > vector (const T &a0, const T &a1)
 Return a 1x2 image containing specified values. More...
 
static CImg< T > vector (const T &a0, const T &a1, const T &a2)
 Return a 1x3 image containing specified values. More...
 
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3)
 Return a 1x4 image containing specified values. More...
 
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4)
 Return a 1x5 image containing specified values.
 
static CImg< T > vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5)
 Return a 1x6 image containing specified values.
 
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 1x7 image containing specified values.
 
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 1x8 image containing specified values.
 
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 1x9 image containing specified values.
 
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 1x10 image containing specified values.
 
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 1x11 image containing specified values.
 
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 1x12 image containing specified values.
 
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 1x13 image containing specified values.
 
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 1x14 image containing specified values.
 
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 1x15 image containing specified values.
 
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 1x16 image containing specified values.
 
static CImg< T > matrix (const T &a0)
 Return a 1x1 matrix containing specified coefficients. More...
 
static CImg< T > matrix (const T &a0, const T &a1, const T &a2, const T &a3)
 Return a 2x2 matrix containing specified coefficients. More...
 
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 matrix containing specified coefficients. More...
 
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 matrix containing 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 matrix containing specified coefficients.
 
static CImg< T > tensor (const T &a0)
 Return a 1x1 symmetric matrix containing specified coefficients. More...
 
static CImg< T > tensor (const T &a0, const T &a1, const T &a2)
 Return a 2x2 symmetric matrix tensor containing specified coefficients.
 
static CImg< T > tensor (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5)
 Return a 3x3 symmetric matrix containing specified coefficients.
 
static CImg< T > diagonal (const T &a0)
 Return a 1x1 diagonal matrix containing specified coefficients.
 
static CImg< T > diagonal (const T &a0, const T &a1)
 Return a 2x2 diagonal matrix containing specified coefficients.
 
static CImg< T > diagonal (const T &a0, const T &a1, const T &a2)
 Return a 3x3 diagonal matrix containing specified coefficients.
 
static CImg< T > diagonal (const T &a0, const T &a1, const T &a2, const T &a3)
 Return a 4x4 diagonal matrix containing 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 containing specified coefficients.
 
static CImg< T > identity_matrix (const unsigned int N)
 Return a NxN identity matrix. More...
 
static CImg< T > sequence (const unsigned int N, const T a0, const T a1)
 Return a N-numbered sequence vector from a0 to a1. More...
 
static CImg< T > rotation_matrix (const float x, const float y, const float z, const float w, const bool is_quaternion=false)
 Return a 3x3 rotation matrix along the (x,y,z)-axis with an angle w. More...
 

Value Manipulation

CImg< T > & fill (const T val)
 Fill all pixel values with specified value. More...
 
CImg< T > get_fill (const T val) const
 Fill all pixel values with specified value [new-instance version].
 
CImg< T > & fill (const T val0, const T val1)
 Fill sequentially all pixel values with specified values. More...
 
CImg< T > get_fill (const T val0, const T val1) const
 Fill sequentially all pixel values with specified values [new-instance version].
 
CImg< T > & fill (const T val0, const T val1, const T val2)
 Fill sequentially all pixel values with specified values [overloading].
 
CImg< T > get_fill (const T val0, const T val1, const T val2) const
 Fill sequentially all pixel values with specified values [new-instance version].
 
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3)
 Fill sequentially all pixel values with specified values [overloading].
 
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3) const
 Fill sequentially all pixel values with specified values [new-instance version].
 
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4)
 Fill sequentially all pixel values with specified values [overloading].
 
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 specified values [new-instance version].
 
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 specified values [overloading].
 
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 specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
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 all pixel values with specified values [overloading].
 
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 all pixel values with specified values [new-instance version].
 
CImg< T > & fill (const char *const expression, const bool repeat_flag)
 Fill sequentially pixel values according to a given expression. More...
 
CImg< T > get_fill (const char *const values, const bool repeat_values) const
 Fill sequentially pixel values according to a given expression [new-instance version].
 
template<typename t >
CImg< T > & fill (const CImg< t > &values, const bool repeat_values=true)
 Fill sequentially pixel values according to the values found in another image. More...
 
template<typename t >
CImg< T > get_fill (const CImg< t > &values, const bool repeat_values=true) const
 Fill sequentially pixel values according to the values found in another image [new-instance version].
 
CImg< T > & fillX (const unsigned int y, const unsigned int z, const unsigned int c, const int a0,...)
 Fill pixel values along the X-axis at a specified pixel position. More...
 
CImg< T > & fillX (const unsigned int y, const unsigned int z, const unsigned int c, const double a0,...)
 Fill pixel values along the X-axis at a specified pixel position [overloading].
 
CImg< T > & fillY (const unsigned int x, const unsigned int z, const unsigned int c, const int a0,...)
 Fill pixel values along the Y-axis at a specified pixel position. More...
 
CImg< T > & fillY (const unsigned int x, const unsigned int z, const unsigned int c, const double a0,...)
 Fill pixel values along the Y-axis at a specified pixel position [overloading].
 
CImg< T > & fillZ (const unsigned int x, const unsigned int y, const unsigned int c, const int a0,...)
 Fill pixel values along the Z-axis at a specified pixel position. More...
 
CImg< T > & fillZ (const unsigned int x, const unsigned int y, const unsigned int c, const double a0,...)
 Fill pixel values along the Z-axis at a specified pixel position [overloading].
 
CImg< T > & fillC (const unsigned int x, const unsigned int y, const unsigned int z, const int a0,...)
 Fill pixel values along the C-axis at a specified pixel position. More...
 
CImg< T > & fillC (const unsigned int x, const unsigned int y, const unsigned int z, const double a0,...)
 Fill pixel values along the C-axis at a specified pixel position [overloading].
 
CImg< T > & discard (const T value)
 Discard specified value in the image buffer. More...
 
CImg< T > get_discard (const T value) const
 Discard specified value in the image buffer [new-instance version].
 
template<typename t >
CImg< T > & discard (const CImg< t > &values)
 Discard specified sequence of values in the image buffer. More...
 
template<typename t >
CImg< T > get_discard (const CImg< t > &values) const
 Discard specified sequence of values in the image buffer [new-instance version].
 
CImg< T > & invert_endianness ()
 Invert endianness of all pixel values.
 
CImg< T > get_invert_endianness () const
 Invert endianness of all pixel values [new-instance version].
 
CImg< T > & rand (const T val_min, const T val_max)
 Fill image with random values in specified range. More...
 
CImg< T > get_rand (const T val_min, const T val_max) const
 Fill image with random values in specified range [new-instance version].
 
CImg< T > & round (const double y=1, const int rounding_type=0)
 Round pixel values. More...
 
CImg< T > get_round (const double y=1, const unsigned int rounding_type=0) const
 Round pixel values [new-instance version].
 
CImg< T > & noise (const double sigma, const unsigned int noise_type=0)
 Add random noise to pixel values. More...
 
CImg< T > get_noise (const double sigma, const unsigned int noise_type=0) const
 Add random noise to pixel values [new-instance version].
 
CImg< T > & normalize (const T min_value, const T max_value)
 Linearly normalize pixel values. More...
 
CImg< Tfloat > get_normalize (const T min_value, const T max_value) const
 Linearly normalize pixel values [new-instance version].
 
CImg< T > & normalize ()
 Normalize multi-valued pixels of the image instance, with respect to their L2-norm. More...
 
CImg< Tfloat > get_normalize () const
 Normalize multi-valued pixels of the image instance, with respect to their L2-norm [new-instance version].
 
CImg< T > & norm (const int norm_type=2)
 Compute L2-norm of each multi-valued pixel of the image instance. More...
 
CImg< Tfloat > get_norm (const int norm_type=2) const
 Compute L2-norm of each multi-valued pixel of the image instance [new-instance version].
 
CImg< T > & cut (const T min_value, const T max_value)
 Cut pixel values in specified range. More...
 
CImg< T > get_cut (const T min_value, const T max_value) const
 Cut pixel values in specified range [new-instance version].
 
CImg< T > & quantize (const unsigned int nb_levels, const bool keep_range=true)
 Uniformly quantize pixel values. More...
 
CImg< T > get_quantize (const unsigned int n, const bool keep_range=true) const
 Uniformly quantize pixel values [new-instance version].
 
CImg< T > & threshold (const T value, const bool soft_threshold=false, const bool strict_threshold=false)
 Threshold pixel values. More...
 
CImg< T > get_threshold (const T value, const bool soft_threshold=false, const bool strict_threshold=false) const
 Threshold pixel values [new-instance version].
 
CImg< T > & histogram (const unsigned int nb_levels, const T min_value=(T) 0, const T max_value=(T) 0)
 Compute the histogram of pixel values. More...
 
CImg< ulongT > get_histogram (const unsigned int nb_levels, const T min_value=(T) 0, const T max_value=(T) 0) const
 Compute the histogram of pixel values [new-instance version].
 
CImg< T > & equalize (const unsigned int nb_levels, const T min_value=(T) 0, const T max_value=(T) 0)
 Equalize histogram of pixel values. More...
 
CImg< T > get_equalize (const unsigned int nblevels, const T val_min=(T) 0, const T val_max=(T) 0) const
 Equalize histogram of pixel values [new-instance version].
 
template<typename t >
CImg< T > & index (const CImg< t > &colormap, const float dithering=1, const bool map_indexes=false)
 Index multi-valued pixels regarding to a specified colormap. More...
 
template<typename t >
CImg< typename CImg< t >::Tuint > get_index (const CImg< t > &colormap, const float dithering=1, const bool map_indexes=true) const
 Index multi-valued pixels regarding to a specified colormap [new-instance version].
 
template<typename t >
CImg< T > & map (const CImg< t > &colormap)
 Map predefined colormap on the scalar (indexed) image instance. More...
 
template<typename t >
CImg< t > get_map (const CImg< t > &colormap) const
 Map predefined colormap on the scalar (indexed) image instance [new-instance version].
 
CImg< T > & label (const bool is_high_connectivity=false, const Tfloat tolerance=0)
 Label connected components. More...
 
CImg< unsigned long > get_label (const bool is_high_connectivity=false, const Tfloat tolerance=0) const
 Label connected components [new-instance version].
 
template<typename t >
CImg< T > & label (const CImg< t > &connectivity_mask, const Tfloat tolerance=0)
 Label connected components [overloading]. More...
 
template<typename t >
CImg< unsigned long > get_label (const CImg< t > &connectivity_mask, const Tfloat tolerance=0) const
 Label connected components [new-instance version].
 

Color Base Management

CImg< T > & sRGBtoRGB ()
 Convert pixel values from sRGB to RGB color spaces.
 
CImg< Tfloat > get_sRGBtoRGB () const
 Convert pixel values from sRGB to RGB color spaces [new-instance version].
 
CImg< T > & RGBtosRGB ()
 Convert pixel values from RGB to sRGB color spaces.
 
CImg< Tfloat > get_RGBtosRGB () const
 Convert pixel values from RGB to sRGB color spaces [new-instance version].
 
CImg< T > & RGBtoHSV ()
 Convert pixel values from RGB to HSV color spaces.
 
CImg< Tfloat > get_RGBtoHSV () const
 Convert pixel values from RGB to HSV color spaces [new-instance version].
 
CImg< T > & HSVtoRGB ()
 Convert pixel values from HSV to RGB color spaces.
 
CImg< Tuchar > get_HSVtoRGB () const
 Convert pixel values from HSV to RGB color spaces [new-instance version].
 
CImg< T > & RGBtoHSL ()
 Convert pixel values from RGB to HSL color spaces.
 
CImg< Tfloat > get_RGBtoHSL () const
 Convert pixel values from RGB to HSL color spaces [new-instance version].
 
CImg< T > & HSLtoRGB ()
 Convert pixel values from HSL to RGB color spaces.
 
CImg< Tuchar > get_HSLtoRGB () const
 Convert pixel values from HSL to RGB color spaces [new-instance version].
 
CImg< T > & RGBtoHSI ()
 Convert pixel values from RGB to HSI color spaces.
 
CImg< Tfloat > get_RGBtoHSI () const
 Convert pixel values from RGB to HSI color spaces [new-instance version].
 
CImg< T > & HSItoRGB ()
 Convert pixel values from HSI to RGB color spaces.
 
CImg< Tfloat > get_HSItoRGB () const
 Convert pixel values from HSI to RGB color spaces [new-instance version].
 
CImg< T > & RGBtoYCbCr ()
 Convert pixel values from RGB to YCbCr color spaces.
 
CImg< Tuchar > get_RGBtoYCbCr () const
 Convert pixel values from RGB to YCbCr color spaces [new-instance version].
 
CImg< T > & YCbCrtoRGB ()
 Convert pixel values from RGB to YCbCr color spaces.
 
CImg< Tuchar > get_YCbCrtoRGB () const
 Convert pixel values from RGB to YCbCr color spaces [new-instance version].
 
CImg< T > & RGBtoYUV ()
 Convert pixel values from RGB to YUV color spaces.
 
CImg< Tfloat > get_RGBtoYUV () const
 Convert pixel values from RGB to YUV color spaces [new-instance version].
 
CImg< T > & YUVtoRGB ()
 Convert pixel values from YUV to RGB color spaces.
 
CImg< Tuchar > get_YUVtoRGB () const
 Convert pixel values from YUV to RGB color spaces [new-instance version].
 
CImg< T > & RGBtoCMY ()
 Convert pixel values from RGB to CMY color spaces.
 
CImg< Tuchar > get_RGBtoCMY () const
 Convert pixel values from RGB to CMY color spaces [new-instance version].
 
CImg< T > & CMYtoRGB ()
 Convert pixel values from CMY to RGB color spaces.
 
CImg< Tuchar > get_CMYtoRGB () const
 Convert pixel values from CMY to RGB color spaces [new-instance version].
 
CImg< T > & CMYtoCMYK ()
 Convert pixel values from CMY to CMYK color spaces.
 
CImg< Tuchar > get_CMYtoCMYK () const
 Convert pixel values from CMY to CMYK color spaces [new-instance version].
 
CImg< T > & CMYKtoCMY ()
 Convert pixel values from CMYK to CMY color spaces.
 
CImg< Tfloat > get_CMYKtoCMY () const
 Convert pixel values from CMYK to CMY color spaces [new-instance version].
 
CImg< T > & RGBtoXYZ ()
 Convert pixel values from RGB to XYZ_709 color spaces. More...
 
CImg< Tfloat > get_RGBtoXYZ () const
 Convert pixel values from RGB to XYZ_709 color spaces [new-instance version].
 
CImg< T > & XYZtoRGB ()
 Convert pixel values from XYZ_709 to RGB color spaces.
 
CImg< Tuchar > get_XYZtoRGB () const
 Convert pixel values from XYZ_709 to RGB color spaces [new-instance version].
 
CImg< T > & XYZtoLab ()
 Convert pixel values from XYZ_709 to Lab color spaces.
 
CImg< Tfloat > get_XYZtoLab () const
 Convert pixel values from XYZ_709 to Lab color spaces [new-instance version].
 
CImg< T > & LabtoXYZ ()
 Convert pixel values from Lab to XYZ_709 color spaces.
 
CImg< Tfloat > get_LabtoXYZ () const
 Convert pixel values from Lab to XYZ_709 color spaces [new-instance version].
 
CImg< T > & XYZtoxyY ()
 Convert pixel values from XYZ_709 to xyY color spaces.
 
CImg< Tfloat > get_XYZtoxyY () const
 Convert pixel values from XYZ_709 to xyY color spaces [new-instance version].
 
CImg< T > & xyYtoXYZ ()
 Convert pixel values from xyY pixels to XYZ_709 color spaces.
 
CImg< Tfloat > get_xyYtoXYZ () const
 Convert pixel values from xyY pixels to XYZ_709 color spaces [new-instance version].
 
CImg< T > & RGBtoLab ()
 Convert pixel values from RGB to Lab color spaces.
 
CImg< Tfloat > get_RGBtoLab () const
 Convert pixel values from RGB to Lab color spaces [new-instance version].
 
CImg< T > & LabtoRGB ()
 Convert pixel values from Lab to RGB color spaces.
 
CImg< Tuchar > get_LabtoRGB () const
 Convert pixel values from Lab to RGB color spaces [new-instance version].
 
CImg< T > & RGBtoxyY ()
 Convert pixel values from RGB to xyY color spaces.
 
CImg< Tfloat > get_RGBtoxyY () const
 Convert pixel values from RGB to xyY color spaces [new-instance version].
 
CImg< T > & xyYtoRGB ()
 Convert pixel values from xyY to RGB color spaces.
 
CImg< Tuchar > get_xyYtoRGB () const
 Convert pixel values from xyY to RGB color spaces [new-instance version].
 
CImg< T > & RGBtoCMYK ()
 Convert pixel values from RGB to CMYK color spaces.
 
CImg< Tfloat > get_RGBtoCMYK () const
 Convert pixel values from RGB to CMYK color spaces [new-instance version].
 
CImg< T > & CMYKtoRGB ()
 Convert pixel values from CMYK to RGB color spaces.
 
CImg< Tuchar > get_CMYKtoRGB () const
 Convert pixel values from CMYK to RGB color spaces [new-instance version].
 
CImg< T > & RGBtoBayer ()
 Convert RGB color image to a Bayer-coded scalar image. More...
 
CImg< T > get_RGBtoBayer () const
 Convert RGB color image to a Bayer-coded scalar image [new-instance version].
 
CImg< T > & BayertoRGB (const unsigned int interpolation_type=3)
 Convert Bayer-coded scalar image to a RGB color image.
 
CImg< Tuchar > get_BayertoRGB (const unsigned int interpolation_type=3) const
 Convert Bayer-coded scalar image to a RGB color image [new-instance version].
 
static const CImg< Tuchar > & default_LUT256 ()
 Return colormap "default", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & HSV_LUT256 ()
 Return colormap "HSV", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & lines_LUT256 ()
 Return colormap "lines", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & hot_LUT256 ()
 Return colormap "hot", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & cool_LUT256 ()
 Return colormap "cool", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & jet_LUT256 ()
 Return colormap "jet", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & flag_LUT256 ()
 Return colormap "flag", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & cube_LUT256 ()
 Return colormap "cube", containing 256 colors entries in RGB. More...
 

Geometric / Spatial Manipulation

CImg< T > & resize (const int size_x, const int size_y=-100, const int size_z=-100, const int size_c=-100, const int interpolation_type=1, const unsigned int boundary_conditions=0, const float centering_x=0, const float centering_y=0, const float centering_z=0, const float centering_c=0)
 Resize image to new dimensions. More...
 
CImg< T > get_resize (const int size_x, const int size_y=-100, const int size_z=-100, const int size_c=-100, const int interpolation_type=1, const unsigned int boundary_conditions=0, const float centering_x=0, const float centering_y=0, const float centering_z=0, const float centering_c=0) const
 Resize image to new dimensions [new-instance version].
 
template<typename t >
CImg< T > & resize (const CImg< t > &src, const int interpolation_type=1, const unsigned int boundary_conditions=0, const float centering_x=0, const float centering_y=0, const float centering_z=0, const float centering_c=0)
 Resize image to dimensions of another image. More...
 
template<typename t >
CImg< T > get_resize (const CImg< t > &src, const int interpolation_type=1, const unsigned int boundary_conditions=0, const float centering_x=0, const float centering_y=0, const float centering_z=0, const float centering_c=0) const
 Resize image to dimensions of another image [new-instance version].
 
CImg< T > & resize (const CImgDisplay &disp, const int interpolation_type=1, const unsigned int boundary_conditions=0, const float centering_x=0, const float centering_y=0, const float centering_z=0, const float centering_c=0)
 Resize image to dimensions of a display window. More...
 
CImg< T > get_resize (const CImgDisplay &disp, const int interpolation_type=1, const unsigned int boundary_conditions=0, const float centering_x=0, const float centering_y=0, const float centering_z=0, const float centering_c=0) const
 Resize image to dimensions of a display window [new-instance version].
 
CImg< T > & resize_halfXY ()
 Resize image to half-size along XY axes, using an optimized filter.
 
CImg< T > get_resize_halfXY () const
 Resize image to half-size along XY axes, using an optimized filter [new-instance version].
 
CImg< T > & resize_doubleXY ()
 Resize image to double-size, using the Scale2X algorithm. More...
 
CImg< T > get_resize_doubleXY () const
 Resize image to double-size, using the Scale2X algorithm [new-instance version].
 
CImg< T > & resize_tripleXY ()
 Resize image to triple-size, using the Scale3X algorithm. More...
 
CImg< T > get_resize_tripleXY () const
 Resize image to triple-size, using the Scale3X algorithm [new-instance version].
 
CImg< T > & mirror (const char axis)
 Mirror image content along specified axis. More...
 
CImg< T > get_mirror (const char axis) const
 Mirror image content along specified axis [new-instance version].
 
CImg< T > & mirror (const char *const axes)
 Mirror image content along specified axes. More...
 
CImg< T > get_mirror (const char *const axes) const
 Mirror image content along specified axes [new-instance version].
 
CImg< T > & shift (const int delta_x, const int delta_y=0, const int delta_z=0, const int delta_c=0, const int boundary_conditions=0)
 Shift image content. More...
 
CImg< T > get_shift (const int delta_x, const int delta_y=0, const int delta_z=0, const int delta_c=0, const int boundary_conditions=0) const
 Shift image content [new-instance version].
 
CImg< T > & permute_axes (const char *const order)
 Permute axes order. More...
 
CImg< T > get_permute_axes (const char *const order) const
 Permute axes order [new-instance version].
 
CImg< T > & unroll (const char axis)
 Unroll pixel values along specified axis. More...
 
CImg< T > get_unroll (const char axis) const
 Unroll pixel values along specified axis [new-instance version].
 
CImg< T > & rotate (const float angle, const unsigned int interpolation=1, const unsigned int boundary=0)
 Rotate image with arbitrary angle. More...
 
CImg< T > get_rotate (const float angle, const unsigned int interpolation=1, const unsigned int boundary=0) const
 Rotate image with arbitrary angle [new-instance version].
 
CImg< T > & rotate (const float angle, const float cx, const float cy, const float zoom, const unsigned int interpolation=1, const unsigned int boundary=3)
 Rotate image with arbitrary angle, around a center point. More...
 
CImg< T > get_rotate (const float angle, const float cx, const float cy, const float zoom, const unsigned int interpolation=1, const unsigned int boundary=3) const
 Rotate image with arbitrary angle, around a center point [new-instance version].
 
template<typename t >
CImg< T > & warp (const CImg< t > &warp, const bool is_relative=false, const unsigned int interpolation=1, const unsigned int boundary_conditions=0)
 Warp image content by a warping field. More...
 
template<typename t >
CImg< T > get_warp (const CImg< t > &warp, const bool is_relative=false, const unsigned int interpolation=1, const unsigned int boundary_conditions=0) const
 Warp image content by a warping field [new-instance version]
 
CImg< T > get_projections2d (const unsigned int x0, const unsigned int y0, const unsigned int z0) const
 Generate a 2d representation of a 3d image, with XY,XZ and YZ views. More...
 
CImg< T > & projections2d (const unsigned int x0, const unsigned int y0, const unsigned int z0)
 Construct a 2d representation of a 3d image, with XY,XZ and YZ views [in-place version].
 
CImg< T > & crop (const int x0, const int y0, const int z0, const int c0, const int x1, const int y1, const int z1, const int c1, const bool boundary_conditions=false)
 Crop image region. More...
 
CImg< T > get_crop (const int x0, const int y0, const int z0, const int c0, const int x1, const int y1, const int z1, const int c1, const bool boundary_conditions=false) const
 Crop image region [new-instance version].
 
CImg< T > & crop (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const bool boundary_conditions=false)
 Crop image region [overloading].
 
CImg< T > get_crop (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const bool boundary_conditions=false) const
 Crop image region [new-instance version].
 
CImg< T > & crop (const int x0, const int y0, const int x1, const int y1, const bool boundary_conditions=false)
 Crop image region [overloading].
 
CImg< T > get_crop (const int x0, const int y0, const int x1, const int y1, const bool boundary_conditions=false) const
 Crop image region [new-instance version].
 
CImg< T > & crop (const int x0, const int x1, const bool boundary_conditions=false)
 Crop image region [overloading].
 
CImg< T > get_crop (const int x0, const int x1, const bool boundary_conditions=false) const
 Crop image region [new-instance version].
 
CImg< T > & autocrop (const T value, const char *const axes="czyx")
 Autocrop image region, regarding the specified background value.
 
CImg< T > get_autocrop (const T value, const char *const axes="czyx") const
 Autocrop image region, regarding the specified background value [new-instance version].
 
CImg< T > & autocrop (const T *const color=0, const char *const axes="zyx")
 Autocrop image region, regarding the specified background color. More...
 
CImg< T > get_autocrop (const T *const color=0, const char *const axes="zyx") const
 Autocrop image region, regarding the specified background color [new-instance version].
 
template<typename t >
CImg< T > & autocrop (const CImg< t > &color, const char *const axes="zyx")
 Autocrop image region, regarding the specified background color [overloading].
 
template<typename t >
CImg< T > get_autocrop (const CImg< t > &color, const char *const axes="zyx") const
 Autocrop image region, regarding the specified background color [new-instance version].
 
CImg< T > get_column (const int x0) const
 Return specified image column. More...
 
CImg< T > & column (const int x0)
 Return specified image column [in-place version].
 
CImg< T > & columns (const int x0, const int x1)
 Return specified range of image columns. More...
 
CImg< T > get_columns (const int x0, const int x1) const
 Return specified range of image columns [in-place version].
 
CImg< T > get_row (const int y0) const
 Return specified image row.
 
CImg< T > & row (const int y0)
 Return specified image row [in-place version]. More...
 
CImg< T > get_rows (const int y0, const int y1) const
 Return specified range of image rows. More...
 
CImg< T > & rows (const int y0, const int y1)
 Return specified range of image rows [in-place version].
 
CImg< T > get_slice (const int z0) const
 Return specified image slice. More...
 
CImg< T > & slice (const int z0)
 Return specified image slice [in-place version].
 
CImg< T > get_slices (const int z0, const int z1) const
 Return specified range of image slices. More...
 
CImg< T > & slices (const int z0, const int z1)
 Return specified range of image slices [in-place version].
 
CImg< T > get_channel (const int c0) const
 Return specified image channel. More...
 
CImg< T > & channel (const int c0)
 Return specified image channel [in-place version].
 
CImg< T > get_channels (const int c0, const int c1) const
 Return specified range of image channels. More...
 
CImg< T > & channels (const int c0, const int c1)
 Return specified range of image channels [in-place version].
 
CImg< floatT > get_streamline (const float x, const float y, const float z, const float L=256, const float dl=0.1f, const unsigned int interpolation_type=2, const bool is_backward_tracking=false, const bool is_oriented_only=false) const
 Return stream line of a 2d or 3d vector field.
 
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 c0=0)
 Return a shared-memory image referencing a range of pixels of the image instance. More...
 
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 c0=0) const
 Return a shared-memory image referencing a range of pixels of the image instance [const version].
 
CImg< T > get_shared_rows (const unsigned int y0, const unsigned int y1, const unsigned int z0=0, const unsigned int c0=0)
 Return a shared-memory image referencing a range of rows of the image instance. More...
 
const CImg< T > get_shared_rows (const unsigned int y0, const unsigned int y1, const unsigned int z0=0, const unsigned int c0=0) const
 Return a shared-memory image referencing a range of rows of the image instance [const version].
 
CImg< T > get_shared_row (const unsigned int y0, const unsigned int z0=0, const unsigned int c0=0)
 Return a shared-memory image referencing one row of the image instance. More...
 
const CImg< T > get_shared_row (const unsigned int y0, const unsigned int z0=0, const unsigned int c0=0) const
 Return a shared-memory image referencing one row of the image instance [const version].
 
CImg< T > get_shared_slices (const unsigned int z0, const unsigned int z1, const unsigned int c0=0)
 Return a shared memory image referencing a range of slices of the image instance. More...
 
const CImg< T > get_shared_slices (const unsigned int z0, const unsigned int z1, const unsigned int c0=0) const
 Return a shared memory image referencing a range of slices of the image instance [const version].
 
CImg< T > get_shared_slice (const unsigned int z0, const unsigned int c0=0)
 Return a shared-memory image referencing one slice of the image instance. More...
 
const CImg< T > get_shared_slice (const unsigned int z0, const unsigned int c0=0) const
 Return a shared-memory image referencing one slice of the image instance [const version].
 
CImg< T > get_shared_channels (const unsigned int c0, const unsigned int c1)
 Return a shared-memory image referencing a range of channels of the image instance. More...
 
const CImg< T > get_shared_channels (const unsigned int c0, const unsigned int c1) const
 Return a shared-memory image referencing a range of channels of the image instance [const version].
 
CImg< T > get_shared_channel (const unsigned int c0)
 Return a shared-memory image referencing one channel of the image instance. More...
 
const CImg< T > get_shared_channel (const unsigned int c0) const
 Return a shared-memory image referencing one channel of the image instance [const version].
 
CImg< T > get_shared ()
 Return a shared-memory version of the image instance.
 
const CImg< T > get_shared () const
 Return a shared-memory version of the image instance [const version].
 
CImgList< T > get_split (const char axis, const int nb=0) const
 Split image into a list along specified axis. More...
 
CImgList< T > get_split (const T value, const bool keep_values, const bool is_shared) const
 Split image into a list of one-column vectors, according to a specified splitting value. More...
 
template<typename t >
CImgList< T > get_split (const CImg< t > &values, const bool keep_values, const bool is_shared) const
 Split image into a list of one-column vectors, according to a specified splitting value sequence. More...
 
CImgList< T > get_split (const bool is_shared) const
 Split the image into a list of one-column vectors each having same values.
 
template<typename t >
CImg< T > & append (const CImg< t > &img, const char axis='x', const float align=0)
 Append two images along specified axis. More...
 
CImg< T > & append (const CImg< T > &img, const char axis='x', const float align=0)
 Append two images along specified axis [specialization].
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
get_append (const CImg< T > &img, const char axis='x', const float align=0) const
 Append two images along specified axis [const version].
 
CImg< T > get_append (const CImg< T > &img, const char axis='x', const float align=0) const
 Append two images along specified axis [specialization].
 
template<typename tfunc >
static CImg< floatT > streamline (const tfunc &func, const float x, const float y, const float z, const float L=256, const float dl=0.1f, const unsigned int interpolation_type=2, const bool is_backward_tracking=false, const bool is_oriented_only=false, const float x0=0, const float y0=0, const float z0=0, const float x1=0, const float y1=0, const float z1=0)
 Return stream line of a 3d vector field. More...
 
static CImg< floatT > streamline (const char *const expression, const float x, const float y, const float z, const float L=256, const float dl=0.1f, const unsigned int interpolation_type=2, const bool is_backward_tracking=true, const bool is_oriented_only=false, const float x0=0, const float y0=0, const float z0=0, const float x1=0, const float y1=0, const float z1=0)
 Return stream line of a 3d vector field [overloading].
 

Filtering / Transforms

template<typename t >
CImg< T > & correlate (const CImg< t > &mask, const unsigned int boundary_conditions=1, const bool is_normalized=false)
 Correlate image by a mask. More...
 
template<typename t >
CImg< typename cimg::superset2
< T, t, float >::type > 
get_correlate (const CImg< t > &mask, const unsigned int boundary_conditions=1, const bool is_normalized=false) const
 Correlate image by a mask [new-instance version].
 
template<typename t >
CImg< T > & convolve (const CImg< t > &mask, const unsigned int boundary_conditions=1, const bool is_normalized=false)
 Convolve image by a mask. More...
 
template<typename t >
CImg< typename cimg::superset2
< T, t, float >::type > 
get_convolve (const CImg< t > &mask, const unsigned int boundary_conditions=1, const bool is_normalized=false) const
 Convolve image by a mask [new-instance version].
 
template<typename t >
CImg< T > & erode (const CImg< t > &mask, const unsigned int boundary_conditions=1, const bool is_normalized=false)
 Erode image by a structuring element. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
get_erode (const CImg< t > &mask, const unsigned int boundary_conditions=1, const bool is_normalized=false) const
 Erode image by a structuring element [new-instance version].
 
CImg< T > & erode (const unsigned int sx, const unsigned int sy, const unsigned int sz=1)
 Erode image by a rectangular structuring element of specified size. More...
 
CImg< T > get_erode (const unsigned int sx, const unsigned int sy, const unsigned int sz=1) const
 Erode image by a rectangular structuring element of specified size [new-instance version].
 
CImg< T > & erode (const unsigned int s)
 Erode the image by a square structuring element of specified size. More...
 
CImg< T > get_erode (const unsigned int s) const
 Erode the image by a square structuring element of specified size [new-instance version].
 
template<typename t >
CImg< T > & dilate (const CImg< t > &mask, const unsigned int boundary_conditions=1, const bool is_normalized=false)
 Dilate image by a structuring element. More...
 
template<typename t >
CImg< typename cimg::superset
< T, t >::type > 
get_dilate (const CImg< t > &mask, const unsigned int boundary_conditions=1, const bool is_normalized=false) const
 Dilate image by a structuring element [new-instance version].
 
CImg< T > & dilate (const unsigned int sx, const unsigned int sy, const unsigned int sz=1)
 Dilate image by a rectangular structuring element of specified size. More...
 
CImg< T > get_dilate (const unsigned int sx, const unsigned int sy, const unsigned int sz=1) const
 Dilate image by a rectangular structuring element of specified size [new-instance version].
 
CImg< T > & dilate (const unsigned int s)
 Dilate image by a square structuring element of specified size. More...
 
CImg< T > get_dilate (const unsigned int s) const
 Dilate image by a square structuring element of specified size [new-instance version].
 
template<typename t >
CImg< T > & watershed (const CImg< t > &priority, const bool fill_lines=true)
 Compute watershed transform. More...
 
template<typename t >
CImg< T > get_watershed (const CImg< t > &priority, const bool fill_lines=true) const
 Compute watershed transform [new-instance version].
 
CImg< T > & deriche (const float sigma, const int order=0, const char axis='x', const bool boundary_conditions=true)
 Apply recursive Deriche filter. More...
 
CImg< Tfloat > get_deriche (const float sigma, const int order=0, const char axis='x', const bool boundary_conditions=true) const
 Apply recursive Deriche filter [new-instance version].
 
CImg< T > & vanvliet (const float sigma, const int order, const char axis='x', const bool boundary_conditions=true)
 Van Vliet recursive Gaussian filter. More...
 
CImg< Tfloat > get_vanvliet (const float sigma, const int order, const char axis='x', const bool boundary_conditions=true) const
 Blur image using Van Vliet recursive Gaussian filter. [new-instance version].
 
CImg< T > & blur (const float sigma_x, const float sigma_y, const float sigma_z, const bool boundary_conditions=true, const bool is_gaussian=false)
 Blur image. More...
 
CImg< Tfloat > get_blur (const float sigma_x, const float sigma_y, const float sigma_z, const bool boundary_conditions=true, const bool is_gaussian=false) const
 Blur image [new-instance version].
 
CImg< T > & blur (const float sigma, const bool boundary_conditions=true, const bool is_gaussian=false)
 Blur image isotropically. More...
 
CImg< Tfloat > get_blur (const float sigma, const bool boundary_conditions=true, const bool is_gaussian=false) const
 Blur image isotropically [new-instance version].
 
template<typename t >
CImg< T > & blur_anisotropic (const CImg< t > &G, const float amplitude=60, const float dl=0.8f, const float da=30, const float gauss_prec=2, const unsigned int interpolation_type=0, const bool is_fast_approx=1)
 Blur image anisotropically, directed by a field of diffusion tensors. More...
 
template<typename t >
CImg< T > get_blur_anisotropic (const CImg< t > &G, const float amplitude=60, const float dl=0.8f, const float da=30, const float gauss_prec=2, const unsigned int interpolation_type=0, const bool is_fast_approx=true) const
 Blur image anisotropically, directed by a field of diffusion tensors [new-instance version].
 
CImg< T > & blur_anisotropic (const float amplitude, const float sharpness=0.7f, const float anisotropy=0.6f, const float alpha=0.6f, const float sigma=1.1f, const float dl=0.8f, const float da=30, const float gauss_prec=2, const unsigned int interpolation_type=0, const bool is_fast_approx=true)
 Blur image anisotropically, in an edge-preserving way. More...
 
CImg< T > get_blur_anisotropic (const float amplitude, const float sharpness=0.7f, const float anisotropy=0.6f, const float alpha=0.6f, const float sigma=1.1f, const float dl=0.8f, const float da=30, const float gauss_prec=2, const unsigned int interpolation_type=0, const bool is_fast_approx=true) const
 Blur image anisotropically, in an edge-preserving way [new-instance version].
 
template<typename t >
CImg< T > & blur_bilateral (const CImg< t > &guide, const float sigma_x, const float sigma_y, const float sigma_z, const float sigma_r, const int bgrid_x, const int bgrid_y, const int bgrid_z, const int bgrid_r, const bool interpolation_type=true)
 Blur image, with the joint bilateral filter. More...
 
template<typename t >
CImg< T > get_blur_bilateral (const CImg< t > &guide, const float sigma_x, const float sigma_y, const float sigma_z, const float sigma_r, const int bgrid_x, const int bgrid_y, const int bgrid_z, const int bgrid_r, const bool interpolation_type=true) const
 Blur image, with the joint bilateral filter [new-instance version].
 
template<typename t >
CImg< T > & blur_bilateral (const CImg< t > &guide, const float sigma_s, const float sigma_r, const int bgrid_s=-33, const int bgrid_r=32, const bool interpolation_type=true)
 Blur image using the joint bilateral filter. More...
 
template<typename t >
CImg< T > get_blur_bilateral (const CImg< t > &guide, const float sigma_s, const float sigma_r, const int bgrid_s=-33, const int bgrid_r=32, const bool interpolation_type=true) const
 Blur image using the bilateral filter [new-instance version].
 
CImg< T > & blur_patch (const float sigma_s, const float sigma_p, const unsigned int patch_size=3, const unsigned int lookup_size=4, const float smoothness=0, const bool is_fast_approx=true)
 Blur image using patch-based space. More...
 
CImg< T > get_blur_patch (const float sigma_s, const float sigma_p, const unsigned int patch_size=3, const unsigned int lookup_size=4, const float smoothness=0, const bool is_fast_approx=true) const
 Blur image using patch-based space [new-instance version].
 
CImg< T > & blur_median (const unsigned int n)
 Blur image with the median filter. More...
 
CImg< T > get_blur_median (const unsigned int n) const
 Blur image with the median filter [new-instance version].
 
CImg< T > & sharpen (const float amplitude, const bool sharpen_type=false, const float edge=1, const float alpha=0, const float sigma=0)
 Sharpen image. More...
 
CImg< T > get_sharpen (const float amplitude, const bool sharpen_type=false, const float edge=1, const float alpha=0, const float sigma=0) const
 Sharpen image [new-instance version].
 
CImgList< Tfloat > get_gradient (const char *const axes=0, const int scheme=3) const
 Return image gradient. More...
 
CImgList< Tfloat > get_hessian (const char *const axes=0) const
 Return image hessian. More...
 
CImg< T > & laplacian ()
 Compute image laplacian.
 
CImg< Tfloat > get_laplacian () const
 Compute image laplacian [new-instance version].
 
CImg< T > & structure_tensors (const unsigned int scheme=2)
 Compute the structure tensor field of an image. More...
 
CImg< Tfloat > get_structure_tensors (const unsigned int scheme=2) const
 Compute the structure tensor field of an image [new-instance version].
 
CImg< T > & diffusion_tensors (const float sharpness=0.7f, const float anisotropy=0.6f, const float alpha=0.6f, const float sigma=1.1f, const bool is_sqrt=false)
 Compute field of diffusion tensors for edge-preserving smoothing. More...
 
CImg< Tfloat > get_diffusion_tensors (const float sharpness=0.7f, const float anisotropy=0.6f, const float alpha=0.6f, const float sigma=1.1f, const bool is_sqrt=false) const
 Compute field of diffusion tensors for edge-preserving smoothing [new-instance version].
 
CImg< T > & displacement (const CImg< T > &source, const float smoothness=0.1f, const float precision=5.0f, const unsigned int nb_scales=0, const unsigned int iteration_max=10000, const bool is_backward=false)
 Estimate displacement field between two images. More...
 
CImg< Tfloat > get_displacement (const CImg< T > &source, const float smoothness=0.1f, const float precision=5.0f, const unsigned int nb_scales=0, const unsigned int iteration_max=10000, const bool is_backward=false) const
 Estimate displacement field between two images [new-instance version].
 
CImg< T > & distance (const T value, const unsigned int metric=2)
 Compute Euclidean distance function to a specified value. More...
 
CImg< Tfloat > get_distance (const T value, const unsigned int metric=2) const
 Compute distance to a specified value [new-instance version].
 
template<typename t >
CImg< T > & distance (const T value, const CImg< t > &metric_mask)
 Compute chamfer distance to a specified value, with a custom metric. More...
 
template<typename t >
CImg< Tfloat > get_distance (const T value, const CImg< t > &metric_mask) const
 Compute chamfer distance to a specified value, with a custom metric [new-instance version].
 
template<typename t , typename to >
CImg< T > & distance_dijkstra (const T value, const CImg< t > &metric, const bool is_high_connectivity, CImg< to > &return_path)
 Compute distance to a specified value, according to a custom metric (use dijkstra algorithm). More...
 
template<typename t , typename to >
CImg< typename cimg::superset
< t, long >::type > 
get_distance_dijkstra (const T value, const CImg< t > &metric, const bool is_high_connectivity, CImg< to > &return_path) const
 Compute distance map to a specified value, according to a custom metric (use dijkstra algorithm). [new-instance version].
 
template<typename t >
CImg< T > & distance_dijkstra (const T value, const CImg< t > &metric, const bool is_high_connectivity=false)
 Compute distance map to a specified value, according to a custom metric (use dijkstra algorithm). [overloading].
 
template<typename t >
CImg< Tfloat > get_distance_dijkstra (const T value, const CImg< t > &metric, const bool is_high_connectivity=false) const
 Compute distance map to a specified value, according to a custom metric (use dijkstra algorithm). [new-instance version].
 
template<typename t >
CImgdistance_eikonal (const T value, const CImg< t > &metric)
 Compute distance map to one source point, according to a custom metric (use fast marching algorithm). More...
 
template<typename t >
CImg< Tfloat > get_distance_eikonal (const T value, const CImg< t > &metric) const
 Compute distance map to one source point, according to a custom metric (use fast marching algorithm).
 
CImg< T > & distance_eikonal (const unsigned int nb_iterations, const float band_size=0, const float time_step=0.5f)
 Compute distance function to 0-valued isophotes, using the Eikonal PDE. More...
 
CImg< Tfloat > get_distance_eikonal (const unsigned int nb_iterations, const float band_size=0, const float time_step=0.5f) const
 Compute distance function to 0-valued isophotes, using the Eikonal PDE [new-instance version].
 
CImg< T > & haar (const char axis, const bool invert=false, const unsigned int nb_scales=1)
 Compute Haar multiscale wavelet transform. More...
 
CImg< Tfloat > get_haar (const char axis, const bool invert=false, const unsigned int nb_scales=1) const
 Compute Haar multiscale wavelet transform [new-instance version].
 
CImg< T > & haar (const bool invert=false, const unsigned int nb_scales=1)
 Compute Haar multiscale wavelet transform [overloading]. More...
 
CImg< Tfloat > get_haar (const bool invert=false, const unsigned int nb_scales=1) const
 Compute Haar multiscale wavelet transform [new-instance version].
 
CImgList< Tfloat > get_FFT (const char axis, const bool is_invert=false) const
 Compute 1d Fast Fourier Transform, along a specified axis. More...
 
CImgList< Tfloat > get_FFT (const bool is_invert=false) const
 Compute n-d Fast Fourier Transform.
 
static void FFT (CImg< T > &real, CImg< T > &imag, const char axis, const bool is_invert=false)
 Compute 1d Fast Fourier Transform, along a specified axis. More...
 
static void FFT (CImg< T > &real, CImg< T > &imag, const bool is_invert=false, const unsigned int nb_threads=0)
 Compute n-d Fast Fourier Transform. More...
 

3d Objects Management

CImg< T > & shift_object3d (const float tx, const float ty=0, const float tz=0)
 Shift 3d object's vertices. More...
 
CImg< Tfloat > get_shift_object3d (const float tx, const float ty=0, const float tz=0) const
 Shift 3d object's vertices [new-instance version].
 
CImg< T > & shift_object3d ()
 Shift 3d object's vertices, so that it becomes centered. More...
 
CImg< Tfloat > get_shift_object3d () const
 Shift 3d object's vertices, so that it becomes centered [new-instance version].
 
CImg< T > & resize_object3d (const float sx, const float sy=-100, const float sz=-100)
 Resize 3d object. More...
 
CImg< Tfloat > get_resize_object3d (const float sx, const float sy=-100, const float sz=-100) const
 Resize 3d object [new-instance version].
 
CImg< T > resize_object3d ()
 Resize 3d object to unit size.
 
CImg< Tfloat > get_resize_object3d () const
 Resize 3d object to unit size [new-instance version].
 
template<typename tf , typename tp , typename tff >
CImg< T > & append_object3d (CImgList< tf > &primitives, const CImg< tp > &obj_vertices, const CImgList< tff > &obj_primitives)
 Merge two 3d objects together. More...
 
template<typename tp , typename tc , typename tt , typename tx >
const CImg< T > & texturize_object3d (CImgList< tp > &primitives, CImgList< tc > &colors, const CImg< tt > &texture, const CImg< tx > &coords=CImg< tx >::empty()) const
 Texturize primitives of a 3d object. More...
 
template<typename tf , typename tc , typename te >
CImg< floatT > get_elevation3d (CImgList< tf > &primitives, CImgList< tc > &colors, const CImg< te > &elevation) const
 Generate a 3d elevation of the image instance. More...
 
template<typename tf , typename tc >
CImg< floatT > get_projections3d (CImgList< tf > &primitives, CImgList< tc > &colors, const unsigned int x0, const unsigned int y0, const unsigned int z0, const bool normalize_colors=false) const
 Generate the 3d projection planes of the image instance. More...
 
template<typename tf >
CImg< floatT > get_isoline3d (CImgList< tf > &primitives, const float isovalue, const int size_x=-100, const int size_y=-100) const
 Generate a isoline of the image instance as a 3d object. More...
 
template<typename tf >
CImg< floatT > get_isosurface3d (CImgList< tf > &primitives, const float isovalue, const int size_x=-100, const int size_y=-100, const int size_z=-100) const
 Generate an isosurface of the image instance as a 3d object. More...
 
template<typename tp , typename tc , typename to >
CImg< T > & object3dtoCImg3d (const CImgList< tp > &primitives, const CImgList< tc > &colors, const to &opacities, const bool full_check=true)
 Convert 3d object into a CImg3d representation. More...
 
template<typename tp , typename tc >
CImg< T > & object3dtoCImg3d (const CImgList< tp > &primitives, const CImgList< tc > &colors, const bool full_check=true)
 Convert 3d object into a CImg3d representation [overloading].
 
template<typename tp >
CImg< T > & object3dtoCImg3d (const CImgList< tp > &primitives, const bool full_check=true)
 Convert 3d object into a CImg3d representation [overloading].
 
CImg< T > & object3dtoCImg3d (const bool full_check=true)
 Convert 3d object into a CImg3d representation [overloading].
 
template<typename tp , typename tc , typename to >
CImg< floatT > get_object3dtoCImg3d (const CImgList< tp > &primitives, const CImgList< tc > &colors, const to &opacities, const bool full_check=true) const
 Convert 3d object into a CImg3d representation [new-instance version].
 
template<typename tp , typename tc >
CImg< floatT > get_object3dtoCImg3d (const CImgList< tp > &primitives, const CImgList< tc > &colors, const bool full_check=true) const
 Convert 3d object into a CImg3d representation [overloading].
 
template<typename tp >
CImg< floatT > get_object3dtoCImg3d (const CImgList< tp > &primitives, const bool full_check=true) const
 Convert 3d object into a CImg3d representation [overloading].
 
CImg< floatT > get_object3dtoCImg3d (const bool full_check=true) const
 Convert 3d object into a CImg3d representation [overloading].
 
template<typename tp , typename tc , typename to >
CImg< T > & CImg3dtoobject3d (CImgList< tp > &primitives, CImgList< tc > &colors, CImgList< to > &opacities, const bool full_check=true)
 Convert CImg3d representation into a 3d object. More...
 
template<typename tp , typename tc , typename to >
CImg< T > get_CImg3dtoobject3d (CImgList< tp > &primitives, CImgList< tc > &colors, CImgList< to > &opacities, const bool full_check=true) const
 Convert CImg3d representation into a 3d object [new-instance version].
 
template<typename tf , typename tfunc >
static CImg< floatT > elevation3d (CImgList< tf > &primitives, const tfunc &func, const float x0, const float y0, const float x1, const float y1, const int size_x=256, const int size_y=256)
 Compute 3d elevation of a function as a 3d object. More...
 
template<typename tf >
static CImg< floatT > elevation3d (CImgList< tf > &primitives, const char *const expression, const float x0, const float y0, const float x1, const float y1, const int size_x=256, const int size_y=256)
 Compute 3d elevation of a function, as a 3d object [overloading].
 
template<typename tf , typename tfunc >
static CImg< floatT > isoline3d (CImgList< tf > &primitives, const tfunc &func, const float isovalue, const float x0, const float y0, const float x1, const float y1, const int size_x=256, const int size_y=256)
 Compute 0-isolines of a function, as a 3d object. More...
 
template<typename tf >
static CImg< floatT > isoline3d (CImgList< tf > &primitives, const char *const expression, const float isovalue, const float x0, const float y0, const float x1, const float y1, const int size_x=256, const int size_y=256)
 Compute isolines of a function, as a 3d object [overloading].
 
template<typename tf , typename tfunc >
static CImg< floatT > isosurface3d (CImgList< tf > &primitives, const tfunc &func, const float isovalue, const float x0, const float y0, const float z0, const float x1, const float y1, const float z1, const int size_x=32, const int size_y=32, const int size_z=32)
 Compute isosurface of a function, as a 3d object. More...
 
template<typename tf >
static CImg< floatT > isosurface3d (CImgList< tf > &primitives, const char *const expression, const float isovalue, const float x0, const float y0, const float z0, const float x1, const float y1, const float z1, const int dx=32, const int dy=32, const int dz=32)
 Compute isosurface of a function, as a 3d object [overloading].
 
template<typename tf >
static CImg< floatT > box3d (CImgList< tf > &primitives, const float size_x=200, const float size_y=100, const float size_z=100)
 Generate a 3d box object. More...
 
template<typename tf >
static CImg< floatT > cone3d (CImgList< tf > &primitives, const float radius=50, const float size_z=100, const unsigned int subdivisions=24)
 Generate a 3d cone. More...
 
template<typename tf >
static CImg< floatT > cylinder3d (CImgList< tf > &primitives, const float radius=50, const float size_z=100, const unsigned int subdivisions=24)
 Generate a 3d cylinder. More...
 
template<typename tf >
static CImg< floatT > torus3d (CImgList< tf > &primitives, const float radius1=100, const float radius2=30, const unsigned int subdivisions1=24, const unsigned int subdivisions2=12)
 Generate a 3d torus. More...
 
template<typename tf >
static CImg< floatT > plane3d (CImgList< tf > &primitives, const float size_x=100, const float size_y=100, const unsigned int subdivisions_x=10, const unsigned int subdivisions_y=10)
 Generate a 3d XY-plane. More...
 
template<typename tf >
static CImg< floatT > sphere3d (CImgList< tf > &primitives, const float radius=50, const unsigned int subdivisions=3)
 Generate a 3d sphere. More...
 
template<typename tf , typename t >
static CImg< floatT > ellipsoid3d (CImgList< tf > &primitives, const CImg< t > &tensor, const unsigned int subdivisions=3)
 Generate a 3d ellipsoid. More...
 

Drawing Functions

template<typename tc >
CImg< T > & draw_point (const int x0, const int y0, const int z0, const tc *const color, const float opacity=1)
 Draw a 3d point. More...
 
template<typename tc >
CImg< T > & draw_point (const int x0, const int y0, const tc *const color, const float opacity=1)
 Draw a 2d point [simplification].
 
template<typename t , typename tc >
CImg< T > & draw_point (const CImg< t > &points, const tc *const color, const float opacity=1)
 
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, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a 2d line. More...
 
template<typename tz , typename tc >
CImg< T > & draw_line (CImg< tz > &zbuffer, const int x0, const int y0, const float z0, const int x1, const int y1, const float z1, const tc *const color, const float opacity=1, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a 2d line, with z-buffering. More...
 
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, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a 3d line. More...
 
template<typename tc >
CImg< T > & draw_line (const int x0, const int y0, const int x1, const int y1, const CImg< tc > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const float opacity=1, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a textured 2d line. More...
 
template<typename tc >
CImg< T > & draw_line (const int x0, const int y0, const float z0, const int x1, const int y1, const float z1, const CImg< tc > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const float opacity=1, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a textured 2d line, with perspective correction. More...
 
template<typename tz , typename tc >
CImg< T > & draw_line (CImg< tz > &zbuffer, const int x0, const int y0, const float z0, const int x1, const int y1, const float z1, const CImg< tc > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const float opacity=1, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a textured 2d line, with perspective correction and z-buffering. More...
 
template<typename t , typename tc >
CImg< T > & draw_line (const CImg< t > &points, const tc *const color, const float opacity=1, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive lines. More...
 
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 opacity=1, const float angle=30, const float length=-10, const unsigned int pattern=~0U)
 Draw a 2d arrow. More...
 
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 opacity=1, const float precision=0.25, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a 2d spline. More...
 
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 opacity=1, const float precision=4, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a 3d spline [overloading]. More...
 
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 opacity=1, const float precision=4, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a textured 2d spline. More...
 
template<typename tp , typename tt , typename tc >
CImg< T > & draw_spline (const CImg< tp > &points, const CImg< tt > &tangents, const tc *const color, const float opacity=1, const bool is_closed_set=false, const float precision=4, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive splines. More...
 
template<typename tp , typename tc >
CImg< T > & draw_spline (const CImg< tp > &points, const tc *const color, const float opacity=1, const bool is_closed_set=false, const float precision=4, const unsigned int pattern=~0U, const bool init_hatch=true)
 Draw a set of consecutive splines [overloading]. More...
 
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)
 Draw a filled 2d triangle. More...
 
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 outlined 2d triangle. More...
 
template<typename tz , typename tc >
CImg< T > & draw_triangle (CImg< tz > &zbuffer, 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 tc *const color, const float opacity=1, const float brightness=1)
 Draw a filled 2d triangle, with z-buffering. More...
 
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)
 Draw a Gouraud-shaded 2d triangle. More...
 
template<typename tz , typename tc >
CImg< T > & draw_triangle (CImg< tz > &zbuffer, 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 tc *const color, const float brightness0, const float brightness1, const float brightness2, const float opacity=1)
 Draw a Gouraud-shaded 2d triangle, with z-buffering [overloading].
 
template<typename tc1 , typename tc2 , typename tc3 >
CImg< T > & draw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const tc1 *const color1, const tc2 *const color2, const tc3 *const color3, const float opacity=1)
 Draw a color-interpolated 2d triangle. More...
 
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 > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const float opacity=1, const float brightness=1)
 Draw a textured 2d triangle. More...
 
template<typename tc >
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< tc > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const float opacity=1, const float brightness=1)
 Draw a 2d textured triangle, with perspective correction.
 
template<typename tz , typename tc >
CImg< T > & draw_triangle (CImg< tz > &zbuffer, 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< tc > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const float opacity=1, const float brightness=1)
 Draw a textured 2d triangle, with perspective correction and z-buffering.
 
template<typename tc , 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 tc *const color, 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)
 Draw a Phong-shaded 2d triangle. More...
 
template<typename tz , typename tc , typename tl >
CImg< T > & draw_triangle (CImg< tz > &zbuffer, 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 tc *const color, 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)
 Draw a Phong-shaded 2d triangle, with z-buffering.
 
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 > &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 textured Gouraud-shaded 2d triangle. More...
 
template<typename tc >
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< tc > &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 textured Gouraud-shaded 2d triangle, with perspective correction [overloading].
 
template<typename tz , typename tc >
CImg< T > & draw_triangle (CImg< tz > &zbuffer, 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< tc > &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 textured Gouraud-shaded 2d triangle, with perspective correction and z-buffering [overloading].
 
template<typename tc , 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< tc > &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)
 Draw a textured Phong-shaded 2d triangle. More...
 
template<typename tc , 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< tc > &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)
 Draw a textured Phong-shaded 2d triangle, with perspective correction.
 
template<typename tz , typename tc , typename tl >
CImg< T > & draw_triangle (CImg< tz > &zbuffer, 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< tc > &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)
 Draw a textured Phong-shaded 2d triangle, with perspective correction and z-buffering.
 
CImg< T > & draw_rectangle (const int x0, const int y0, const int z0, const int c0, const int x1, const int y1, const int z1, const int c1, const T val, const float opacity=1)
 Draw a filled 4d rectangle. More...
 
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)
 Draw a filled 3d rectangle. More...
 
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 an outlined 3d rectangle [overloading].
 
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)
 Draw a filled 2d rectangle. More...
 
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 outlined 2d rectangle [overloading].
 
template<typename t , typename tc >
CImg< T > & draw_polygon (const CImg< t > &points, const tc *const color, const float opacity=1)
 Draw a filled 2d polygon. More...
 
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 outlined 2d polygon [overloading].
 
template<typename tc >
CImg< T > & draw_ellipse (const int x0, const int y0, const float r1, const float r2, const float angle, const tc *const color, const float opacity=1)
 Draw a filled 2d ellipse. More...
 
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)
 Draw a filled 2d ellipse [overloading]. More...
 
template<typename tc >
CImg< T > & draw_ellipse (const int x0, const int y0, const float r1, const float r2, const float angle, const tc *const color, const float opacity, const unsigned int pattern)
 Draw an outlined 2d ellipse. More...
 
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 2d ellipse [overloading]. More...
 
template<typename tc >
CImg< T > & draw_circle (const int x0, const int y0, int radius, const tc *const color, const float opacity=1)
 Draw a filled 2d circle. More...
 
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 pattern)
 Draw an outlined 2d circle. More...
 
template<typename t >
CImg< T > & draw_image (const int x0, const int y0, const int z0, const int c0, const CImg< t > &sprite, const float opacity=1)
 Draw an image. More...
 
CImg< T > & draw_image (const int x0, const int y0, const int z0, const int c0, const CImg< T > &sprite, const float opacity=1)
 Draw an image [specialization].
 
template<typename t >
CImg< T > & draw_image (const int x0, const int y0, const int z0, const CImg< t > &sprite, const float opacity=1)
 Draw an image [overloading].
 
template<typename t >
CImg< T > & draw_image (const int x0, const int y0, const CImg< t > &sprite, const float opacity=1)
 Draw an image [overloading].
 
template<typename t >
CImg< T > & draw_image (const int x0, const CImg< t > &sprite, const float opacity=1)
 Draw an image [overloading].
 
template<typename t >
CImg< T > & draw_image (const CImg< t > &sprite, const float opacity=1)
 Draw an image [overloading].
 
template<typename ti , typename tm >
CImg< T > & draw_image (const int x0, const int y0, const int z0, const int c0, const CImg< ti > &sprite, const CImg< tm > &mask, const float opacity=1, const float mask_max_value=1)
 Draw a masked image. More...
 
template<typename ti , typename tm >
CImg< T > & draw_image (const int x0, const int y0, const int z0, const CImg< ti > &sprite, const CImg< tm > &mask, const float opacity=1, const float mask_max_value=1)
 Draw a masked image [overloading].
 
template<typename ti , typename tm >
CImg< T > & draw_image (const int x0, const int y0, const CImg< ti > &sprite, const CImg< tm > &mask, const float opacity=1, const float mask_max_value=1)
 Draw a image [overloading].
 
template<typename ti , typename tm >
CImg< T > & draw_image (const int x0, const CImg< ti > &sprite, const CImg< tm > &mask, const float opacity=1, const float mask_max_value=1)
 Draw a image [overloading].
 
template<typename ti , typename tm >
CImg< T > & draw_image (const CImg< ti > &sprite, const CImg< tm > &mask, const float opacity=1, const float mask_max_value=1)
 Draw an image.
 
template<typename tc1 , typename tc2 , typename t >
CImg< T > & draw_text (const int x0, const int y0, const char *const text, const tc1 *const foreground_color, const tc2 *const background_color, const float opacity, const CImgList< t > &font,...)
 Draw a text string. More...
 
template<typename tc , typename t >
CImg< T > & draw_text (const int x0, const int y0, const char *const text, const tc *const foreground_color, const int, const float opacity, const CImgList< t > &font,...)
 Draw a text string [overloading]. More...
 
template<typename tc , typename t >
CImg< T > & draw_text (const int x0, const int y0, const char *const text, const int, const tc *const background_color, const float opacity, const CImgList< t > &font,...)
 Draw a text string [overloading]. More...
 
template<typename tc1 , typename tc2 >
CImg< T > & draw_text (const int x0, const int y0, const char *const text, const tc1 *const foreground_color, const tc2 *const background_color, const float opacity=1, const unsigned int font_height=13,...)
 Draw a text string [overloading]. More...
 
template<typename tc >
CImg< T > & draw_text (const int x0, const int y0, const char *const text, const tc *const foreground_color, const int background_color=0, const float opacity=1, const unsigned int font_height=13,...)
 Draw a text string [overloading].
 
template<typename tc >
CImg< T > & draw_text (const int x0, const int y0, const char *const text, const int, const tc *const background_color, const float opacity=1, const unsigned int font_height=13,...)
 Draw a text string [overloading].
 
template<typename t1 , typename t2 >
CImg< T > & draw_quiver (const CImg< t1 > &flow, const t2 *const color, const float opacity=1, const unsigned int sampling=25, const float factor=-20, const bool is_arrow=true, const unsigned int pattern=~0U)
 Draw a 2d vector field. More...
 
template<typename t1 , typename t2 >
CImg< T > & draw_quiver (const CImg< t1 > &flow, const CImg< t2 > &color, const float opacity=1, const unsigned int sampling=25, const float factor=-20, const bool is_arrow=true, const unsigned int pattern=~0U)
 Draw a 2d vector field, using a field of colors. More...
 
template<typename t , typename tc >
CImg< T > & draw_axis (const CImg< t > &values_x, const int y, const tc *const color, const float opacity=1, const unsigned int pattern=~0U, const unsigned int font_height=13, const bool allow_zero=true)
 Draw a labeled horizontal axis. More...
 
template<typename t , typename tc >
CImg< T > & draw_axis (const int x, const CImg< t > &values_y, const tc *const color, const float opacity=1, const unsigned int pattern=~0U, const unsigned int font_height=13, const bool allow_zero=true)
 Draw a labeled vertical axis. More...
 
template<typename tx , typename ty , typename tc >
CImg< T > & draw_axes (const CImg< tx > &values_x, const CImg< ty > &values_y, const tc *const color, const float opacity=1, const unsigned int pattern_x=~0U, const unsigned int pattern_y=~0U, const unsigned int font_height=13, const bool allow_zero=true)
 Draw labeled horizontal and vertical axes. More...
 
template<typename tc >
CImg< T > & draw_axes (const float x0, const float x1, const float y0, const float y1, const tc *const color, const float opacity=1, const int subdivisionx=-60, const int subdivisiony=-60, const float precisionx=0, const float precisiony=0, const unsigned int pattern_x=~0U, const unsigned int pattern_y=~0U, const unsigned int font_height=13)
 Draw labeled horizontal and vertical axes [overloading].
 
template<typename tx , typename ty , typename tc >
CImg< T > & draw_grid (const CImg< tx > &values_x, const CImg< ty > &values_y, const tc *const color, const float opacity=1, const unsigned int pattern_x=~0U, const unsigned int pattern_y=~0U)
 Draw 2d grid. More...
 
template<typename tc >
CImg< T > & draw_grid (const float delta_x, const float delta_y, const float offsetx, const float offsety, const bool invertx, const bool inverty, const tc *const color, const float opacity=1, const unsigned int pattern_x=~0U, const unsigned int pattern_y=~0U)
 Draw 2d grid [simplification].
 
template<typename t , typename tc >
CImg< T > & draw_graph (const CImg< t > &data, const tc *const color, const float opacity=1, const unsigned int plot_type=1, const int vertex_type=1, const double ymin=0, const double ymax=0, const unsigned int pattern=~0U)
 Draw 1d graph. More...
 
template<typename tc , typename t >
CImg< T > & draw_fill (const int x, const int y, const int z, const tc *const color, const float opacity, CImg< t > &region, const float sigma=0, const bool is_high_connexity=false)
 Draw filled 3d region with the flood fill algorithm. More...
 
template<typename tc >
CImg< T > & draw_fill (const int x, const int y, const int z, const tc *const color, const float opacity=1, const float sigma=0, const bool is_high_connexity=false)
 Draw filled 3d region with the flood fill algorithm [simplification].
 
template<typename tc >
CImg< T > & draw_fill (const int x, const int y, const tc *const color, const float opacity=1, const float sigma=0, const bool is_high_connexity=false)
 Draw filled 2d region with the flood fill algorithm [simplification].
 
CImg< T > & draw_plasma (const float alpha=1, const float beta=0, const unsigned int scale=8)
 Draw a random plasma texture. More...
 
template<typename tc >
CImg< T > & draw_mandelbrot (const int x0, const int y0, const int x1, const int y1, const CImg< tc > &colormap, const float opacity=1, const double z0r=-2, const double z0i=-2, const double z1r=2, const double z1i=2, const unsigned int iteration_max=255, const bool is_normalized_iteration=false, const bool is_julia_set=false, const double param_r=0, const double param_i=0)
 Draw a quadratic Mandelbrot or Julia 2d fractal. More...
 
template<typename tc >
CImg< T > & draw_mandelbrot (const CImg< tc > &colormap, const float opacity=1, const double z0r=-2, const double z0i=-2, const double z1r=2, const double z1i=2, const unsigned int iteration_max=255, const bool is_normalized_iteration=false, const bool is_julia_set=false, const double param_r=0, const double param_i=0)
 Draw a quadratic Mandelbrot or Julia 2d fractal [overloading].
 
template<typename tc >
CImg< T > & draw_gaussian (const float xc, const float sigma, const tc *const color, const float opacity=1)
 Draw a 1d gaussian function. More...
 
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)
 Draw a 2d gaussian function. More...
 
template<typename tc >
CImg< T > & draw_gaussian (const int xc, const int yc, const float r1, const float r2, const float ru, const float rv, const tc *const color, const float opacity=1)
 Draw a 2d gaussian function [overloading].
 
template<typename tc >
CImg< T > & draw_gaussian (const float xc, const float yc, const float sigma, const tc *const color, const float opacity=1)
 Draw a 2d gaussian function [overloading].
 
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)
 Draw a 3d gaussian function [overloading].
 
template<typename tc >
CImg< T > & draw_gaussian (const float xc, const float yc, const float zc, const float sigma, const tc *const color, const float opacity=1)
 Draw a 3d gaussian function [overloading].
 
template<typename tp , typename tf , typename tc , typename to >
CImg< T > & draw_object3d (const float x0, const float y0, const float z0, const CImg< tp > &vertices, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImg< to > &opacities, const unsigned int render_type=4, const bool is_double_sided=false, const float focale=700, const float lightx=0, const float lighty=0, const float lightz=-5e8, const float specular_lightness=0.2f, const float specular_shininess=0.1f)
 Draw a 3d object. More...
 
template<typename tp , typename tf , typename tc , typename to , typename tz >
CImg< T > & draw_object3d (const float x0, const float y0, const float z0, const CImg< tp > &vertices, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImg< to > &opacities, const unsigned int render_type, const bool is_double_sided, const float focale, const float lightx, const float lighty, const float lightz, const float specular_lightness, const float specular_shininess, CImg< tz > &zbuffer)
 Draw a 3d object [simplification].
 
template<typename tp , typename tf , typename tc , typename to >
CImg< T > & draw_object3d (const float x0, const float y0, const float z0, const CImg< tp > &vertices, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImgList< to > &opacities, const unsigned int render_type=4, const bool is_double_sided=false, const float focale=700, const float lightx=0, const float lighty=0, const float lightz=-5e8, const float specular_lightness=0.2f, const float specular_shininess=0.1f)
 Draw a 3d object [simplification].
 
template<typename tp , typename tf , typename tc , typename to , typename tz >
CImg< T > & draw_object3d (const float x0, const float y0, const float z0, const CImg< tp > &vertices, const CImgList< tf > &primitives, const CImgList< tc > &colors, const CImgList< to > &opacities, const unsigned int render_type, const bool is_double_sided, const float focale, const float lightx, const float lighty, const float lightz, const float specular_lightness, const float specular_shininess, CImg< tz > &zbuffer)
 Draw a 3d object [simplification].
 
template<typename tp , typename tf , typename tc >
CImg< T > & draw_object3d (const float x0, const float y0, const float z0, const CImg< tp > &vertices, const CImgList< tf > &primitives, const CImgList< tc > &colors, const unsigned int render_type=4, const bool is_double_sided=false, const float focale=700, const float lightx=0, const float lighty=0, const float lightz=-5e8, const float specular_lightness=0.2f, const float specular_shininess=0.1f)
 Draw a 3d object [simplification].
 
template<typename tp , typename tf , typename tc , typename tz >
CImg< T > & draw_object3d (const float x0, const float y0, const float z0, const CImg< tp > &vertices, const CImgList< tf > &primitives, const CImgList< tc > &colors, const unsigned int render_type, const bool is_double_sided, const float focale, const float lightx, const float lighty, const float lightz, const float specular_lightness, const float specular_shininess, CImg< tz > &zbuffer)
 Draw a 3d object [simplification].
 

Data Input

CImg< T > & select (CImgDisplay &disp, const unsigned int feature_type=2, unsigned int *const XYZ=0)
 Launch simple interface to select a shape from an image. More...
 
CImg< T > & select (const char *const title, const unsigned int feature_type=2, unsigned int *const XYZ=0)
 Simple interface to select a shape from an image [overloading].
 
CImg< intT > get_select (CImgDisplay &disp, const unsigned int feature_type=2, unsigned int *const XYZ=0) const
 Simple interface to select a shape from an image [new-instance version].
 
CImg< intT > get_select (const char *const title, const unsigned int feature_type=2, unsigned int *const XYZ=0) const
 Simple interface to select a shape from an image [new-instance version].
 
CImg< intT > get_select_graph (CImgDisplay &disp, const unsigned int plot_type=1, const unsigned int vertex_type=1, const char *const labelx=0, const double xmin=0, const double xmax=0, const char *const labely=0, const double ymin=0, const double ymax=0) const
 Select sub-graph in a graph.
 
CImg< T > & load (const char *const filename)
 Load image from a file. More...
 
CImg< T > & load_ascii (const char *const filename)
 Load image from an ascii file. More...
 
CImg< T > & load_ascii (std::FILE *const file)
 Load image from an ascii file [overloading].
 
CImg< T > & load_dlm (const char *const filename)
 Load image from a DLM file. More...
 
CImg< T > & load_dlm (std::FILE *const file)
 Load image from a DLM file [overloading].
 
CImg< T > & load_bmp (const char *const filename)
 Load image from a BMP file. More...
 
CImg< T > & load_bmp (std::FILE *const file)
 Load image from a BMP file [overloading].
 
CImg< T > & load_jpeg (const char *const filename)
 Load image from a JPEG file. More...
 
CImg< T > & load_jpeg (std::FILE *const file)
 Load image from a JPEG file [overloading].
 
CImg< T > & load_magick (const char *const filename)
 Load image from a file, using Magick++ library. More...
 
CImg< T > & load_png (const char *const filename)
 Load image from a PNG file. More...
 
CImg< T > & load_png (std::FILE *const file)
 Load image from a PNG file [overloading].
 
CImg< T > & load_pnm (const char *const filename)
 Load image from a PNM file. More...
 
CImg< T > & load_pnm (std::FILE *const file)
 Load image from a PNM file [overloading].
 
CImg< T > & load_pfm (const char *const filename)
 Load image from a PFM file. More...
 
CImg< T > & load_pfm (std::FILE *const file)
 Load image from a PFM file [overloading].
 
CImg< T > & load_rgb (const char *const filename, const unsigned int dimw, const unsigned int dimh=1)
 Load image from a RGB file. More...
 
CImg< T > & load_rgb (std::FILE *const file, const unsigned int dimw, const unsigned int dimh=1)
 Load image from a RGB file [overloading].
 
CImg< T > & load_rgba (const char *const filename, const unsigned int dimw, const unsigned int dimh=1)
 Load image from a RGBA file. More...
 
CImg< T > & load_rgba (std::FILE *const file, const unsigned int dimw, const unsigned int dimh=1)
 Load image from a RGBA file [overloading].
 
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 image from a TIFF file. More...
 
CImg< T > & load_minc2 (const char *const filename)
 Load image from a MINC2 file. More...
 
CImg< T > & load_analyze (const char *const filename, float *const voxel_size=0)
 Load image from an ANALYZE7.5/NIFTI file. More...
 
CImg< T > & load_analyze (std::FILE *const file, float *const voxel_size=0)
 Load image from an ANALYZE7.5/NIFTI file [overloading].
 
CImg< T > & load_cimg (const char *const filename, const char axis='z', const float align=0)
 Load image from a .cimg[z] file. More...
 
CImg< T > & load_cimg (std::FILE *const file, const char axis='z', const float align=0)
 Load image from a .cimg[z] file [overloading].
 
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 c0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int c1, const char axis='z', const float align=0)
 Load sub-images of a .cimg file. More...
 
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 c0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int c1, const char axis='z', const float align=0)
 Load sub-images of a .cimg file [overloading].
 
CImg< T > & load_inr (const char *const filename, float *const voxel_size=0)
 Load image from an INRIMAGE-4 file. More...
 
CImg< T > & load_inr (std::FILE *const file, float *const voxel_size=0)
 Load image from an INRIMAGE-4 file [overloading].
 
CImg< T > & load_exr (const char *const filename)
 Load image from a EXR file. More...
 
CImg< T > & load_pandore (const char *const filename)
 Load image from a PANDORE-5 file. More...
 
CImg< T > & load_pandore (std::FILE *const file)
 Load image from a PANDORE-5 file [overloading].
 
CImg< T > & load_parrec (const char *const filename, const char axis='c', const float align=0)
 Load image from a PAR-REC (Philips) file. More...
 
CImg< T > & load_raw (const char *const filename, const unsigned int size_x=0, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1, const bool is_multiplexed=false, const bool invert_endianness=false, const unsigned long offset=0)
 Load image from a raw binary file. More...
 
CImg< T > & load_raw (std::FILE *const file, const unsigned int size_x=0, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1, const bool is_multiplexed=false, const bool invert_endianness=false, const unsigned long offset=0)
 Load image from a raw binary file [overloading].
 
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 float align=0)
 Load image sequence using FFMPEG av's libraries. More...
 
CImg< T > & load_yuv (const char *const filename, const unsigned int size_x, const unsigned int size_y=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')
 Load image sequence from a YUV file. More...
 
CImg< T > & load_yuv (std::FILE *const file, const unsigned int size_x, const unsigned int size_y=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')
 Load image sequence from a YUV file [overloading].
 
template<typename tf , typename tc >
CImg< T > & load_off (CImgList< tf > &primitives, CImgList< tc > &colors, const char *const filename)
 Load 3d object from a .OFF file. More...
 
template<typename tf , typename tc >
CImg< T > & load_off (CImgList< tf > &primitives, CImgList< tc > &colors, std::FILE *const file)
 Load 3d object from a .OFF file [overloading].
 
CImg< T > & load_ffmpeg_external (const char *const filename, const char axis='z', const float align=0)
 Load image sequence using FFMPEG's external tool 'ffmpeg'. More...
 
CImg< T > & load_gif_external (const char *const filename, const char axis='z', const float align=0)
 Load gif file, using Imagemagick or GraphicsMagicks's external tools. More...
 
CImg< T > & load_graphicsmagick_external (const char *const filename)
 Load image using GraphicsMagick's external tool 'gm'. More...
 
CImg< T > & load_gzip_external (const char *const filename)
 Load gzipped image file, using external tool 'gunzip'. More...
 
CImg< T > & load_imagemagick_external (const char *const filename)
 Load image using ImageMagick's external tool 'convert'. More...
 
CImg< T > & load_medcon_external (const char *const filename)
 Load image from a DICOM file, using XMedcon's external tool 'medcon'. More...
 
CImg< T > & load_dcraw_external (const char *const filename)
 Load image from a RAW Color Camera file, using external tool 'dcraw'. More...
 
CImg< T > & load_camera (const unsigned int camera_index=0, const unsigned int skip_frames=0, const bool release_camera=false, const unsigned int capture_width=0, const unsigned int capture_height=0)
 Load image from a camera stream, using OpenCV. More...
 
CImg< T > & load_other (const char *const filename)
 Load image using various non-native ways. More...
 
static CImg< T > get_load (const char *const filename)
 Load image from a file [new-instance version].
 
static CImg< T > get_load_ascii (const char *const filename)
 Load image from an ascii file [in-place version].
 
static CImg< T > get_load_ascii (std::FILE *const file)
 Loadimage from an ascii file [new-instance version].
 
static CImg< T > get_load_dlm (const char *const filename)
 Load image from a DLM file [new-instance version].
 
static CImg< T > get_load_dlm (std::FILE *const file)
 Load image from a DLM file [new-instance version].
 
static CImg< T > get_load_bmp (const char *const filename)
 Load image from a BMP file [new-instance version].
 
static CImg< T > get_load_bmp (std::FILE *const file)
 Load image from a BMP file [new-instance version].
 
static CImg< T > get_load_jpeg (const char *const filename)
 Load image from a JPEG file [new-instance version].
 
static CImg< T > get_load_jpeg (std::FILE *const file)
 Load image from a JPEG file [new-instance version].
 
static CImg< T > get_load_magick (const char *const filename)
 Load image from a file, using Magick++ library [new-instance version].
 
static CImg< T > get_load_png (const char *const filename)
 Load image from a PNG file [new-instance version].
 
static CImg< T > get_load_png (std::FILE *const file)
 Load image from a PNG file [new-instance version].
 
static CImg< T > get_load_pnm (const char *const filename)
 Load image from a PNM file [new-instance version].
 
static CImg< T > get_load_pnm (std::FILE *const file)
 Load image from a PNM file [new-instance version].
 
static CImg< T > get_load_pfm (const char *const filename)
 Load image from a PFM file [new-instance version].
 
static CImg< T > get_load_pfm (std::FILE *const file)
 Load image from a PFM file [new-instance version].
 
static CImg< T > get_load_rgb (const char *const filename, const unsigned int dimw, const unsigned int dimh=1)
 Load image from a RGB file [new-instance version].
 
static CImg< T > get_load_rgb (std::FILE *const file, const unsigned int dimw, const unsigned int dimh=1)
 Load image from a RGB file [new-instance version].
 
static CImg< T > get_load_rgba (const char *const filename, const unsigned int dimw, const unsigned int dimh=1)
 Load image from a RGBA file [new-instance version].
 
static CImg< T > get_load_rgba (std::FILE *const file, const unsigned int dimw, const unsigned int dimh=1)
 Load image from a RGBA file [new-instance version].
 
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 image from a TIFF file [new-instance version].
 
static CImg< T > get_load_minc2 (const char *const filename)
 Load image from a MINC2 file [new-instance version].
 
static CImg< T > get_load_analyze (const char *const filename, float *const voxel_size=0)
 Load image from an ANALYZE7.5/NIFTI file [new-instance version].
 
static CImg< T > get_load_analyze (std::FILE *const file, float *const voxel_size=0)
 Load image from an ANALYZE7.5/NIFTI file [new-instance version].
 
static CImg< T > get_load_cimg (const char *const filename, const char axis='z', const float align=0)
 Load image from a .cimg[z] file [new-instance version]
 
static CImg< T > get_load_cimg (std::FILE *const file, const char axis='z', const float align=0)
 Load image from a .cimg[z] file [new-instance version]
 
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 c0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int c1, const char axis='z', const float align=0)
 Load sub-images of a .cimg file [new-instance version].
 
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 c0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int c1, const char axis='z', const float align=0)
 Load sub-images of a .cimg file [new-instance version].
 
static CImg< T > get_load_inr (const char *const filename, float *const voxel_size=0)
 Load image from an INRIMAGE-4 file [new-instance version].
 
static CImg< T > get_load_inr (std::FILE *const file, float *voxel_size=0)
 Load image from an INRIMAGE-4 file [new-instance version].
 
static CImg< T > get_load_exr (const char *const filename)
 Load image from a EXR file [new-instance version].
 
static CImg< T > get_load_pandore (const char *const filename)
 Load image from a PANDORE-5 file [new-instance version].
 
static CImg< T > get_load_pandore (std::FILE *const file)
 Load image from a PANDORE-5 file [new-instance version].
 
static CImg< T > get_load_parrec (const char *const filename, const char axis='c', const float align=0)
 Load image from a PAR-REC (Philips) file [new-instance version].
 
static CImg< T > get_load_raw (const char *const filename, const unsigned int size_x=0, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1, const bool is_multiplexed=false, const bool invert_endianness=false, const unsigned long offset=0)
 Load image from a raw binary file [new-instance version].
 
static CImg< T > get_load_raw (std::FILE *const file, const unsigned int size_x=0, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1, const bool is_multiplexed=false, const bool invert_endianness=false, const unsigned long offset=0)
 Load image from a raw binary file [new-instance version].
 
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 float align=0)
 Load image sequence using FFMPEG av's libraries [new-instance version].
 
static CImg< T > get_load_yuv (const char *const filename, const unsigned int size_x, const unsigned int size_y=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')
 Load image sequence from a YUV file [new-instance version].
 
static CImg< T > get_load_yuv (std::FILE *const file, const unsigned int size_x, const unsigned int size_y=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')
 Load image sequence from a YUV file [new-instance version].
 
template<typename tf , typename tc >
static CImg< T > get_load_off (CImgList< tf > &primitives, CImgList< tc > &colors, const char *const filename)
 Load 3d object from a .OFF file [new-instance version].
 
template<typename tf , typename tc >
static CImg< T > get_load_off (CImgList< tf > &primitives, CImgList< tc > &colors, std::FILE *const file)
 Load 3d object from a .OFF file [new-instance version].
 
static CImg< T > get_load_ffmpeg_external (const char *const filename, const char axis='z', const float align=0)
 Load image sequence using FFMPEG's external tool 'ffmpeg' [new-instance version].
 
static CImg< T > get_load_gif_external (const char *const filename, const char axis='z', const float align=0)
 Load gif file, using ImageMagick or GraphicsMagick's external tool 'convert' [new-instance version].
 
static CImg< T > get_load_graphicsmagick_external (const char *const filename)
 Load image using GraphicsMagick's external tool 'gm' [new-instance version].
 
static CImg< T > get_load_gzip_external (const char *const filename)
 Load gzipped image file, using external tool 'gunzip' [new-instance version].
 
static CImg< T > get_load_imagemagick_external (const char *const filename)
 Load image using ImageMagick's external tool 'convert' [new-instance version].
 
static CImg< T > get_load_medcon_external (const char *const filename)
 Load image from a DICOM file, using XMedcon's external tool 'medcon' [new-instance version].
 
static CImg< T > get_load_dcraw_external (const char *const filename)
 Load image from a RAW Color Camera file, using external tool 'dcraw' [new-instance version].
 
static CImg< T > get_load_camera (const unsigned int camera_index=0, const unsigned int skip_frames=0, const bool release_camera=false, const unsigned int capture_width=0, const unsigned int capture_height=0)
 Load image from a camera stream, using OpenCV [new-instance version].
 
static CImg< T > get_load_other (const char *const filename)
 Load image using various non-native ways [new-instance version].
 

Data Output

const CImg< T > & print (const char *const title=0, const bool display_stats=true) const
 Display informations about the image data. More...
 
const CImg< T > & display (CImgDisplay &disp) const
 Display image into a CImgDisplay window. More...
 
const CImg< T > & display (CImgDisplay &disp, const bool display_info, unsigned int *const XYZ=0) const
 Display image into a CImgDisplay window, in an interactive way. More...
 
const CImg< T > & display (const char *const title=0, const bool display_info=true, unsigned int *const XYZ=0) const
 Display image into an interactive window. More...
 
template<typename tp , typename tf , typename tc , typename to >
const CImg< T > & display_object3d (CImgDisplay &disp, const CImg< tp > &vertices, 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 is_double_sided=true, const float focale=700, const float light_x=0, const float light_y=0, const float light_z=-5e8f, const float specular_lightness=0.2f, const float specular_shininess=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 Display object 3d in an interactive window. More...
 
template<typename tp , typename tf , typename tc , typename to >
const CImg< T > & display_object3d (const char *const title, const CImg< tp > &vertices, 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 is_double_sided=true, const float focale=700, const float light_x=0, const float light_y=0, const float light_z=-5e8f, const float specular_lightness=0.2f, const float specular_shininess=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 Display object 3d in an interactive window [simplification].
 
template<typename tp , typename tf , typename tc >
const CImg< T > & display_object3d (CImgDisplay &disp, const CImg< tp > &vertices, const CImgList< tf > &primitives, const CImgList< tc > &colors, const bool centering=true, const int render_static=4, const int render_motion=1, const bool is_double_sided=true, const float focale=700, const float light_x=0, const float light_y=0, const float light_z=-5e8f, const float specular_lightness=0.2f, const float specular_shininess=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 Display object 3d in an interactive window [simplification].
 
template<typename tp , typename tf , typename tc >
const CImg< T > & display_object3d (const char *const title, const CImg< tp > &vertices, const CImgList< tf > &primitives, const CImgList< tc > &colors, const bool centering=true, const int render_static=4, const int render_motion=1, const bool is_double_sided=true, const float focale=700, const float light_x=0, const float light_y=0, const float light_z=-5e8f, const float specular_lightness=0.2f, const float specular_shininess=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 Display object 3d in an interactive window [simplification].
 
template<typename tp , typename tf >
const CImg< T > & display_object3d (CImgDisplay &disp, const CImg< tp > &vertices, const CImgList< tf > &primitives, const bool centering=true, const int render_static=4, const int render_motion=1, const bool is_double_sided=true, const float focale=700, const float light_x=0, const float light_y=0, const float light_z=-5e8f, const float specular_lightness=0.2f, const float specular_shininess=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 Display object 3d in an interactive window [simplification].
 
template<typename tp , typename tf >
const CImg< T > & display_object3d (const char *const title, const CImg< tp > &vertices, const CImgList< tf > &primitives, const bool centering=true, const int render_static=4, const int render_motion=1, const bool is_double_sided=true, const float focale=700, const float light_x=0, const float light_y=0, const float light_z=-5e8f, const float specular_lightness=0.2f, const float specular_shininess=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 Display object 3d in an interactive window [simplification].
 
template<typename tp >
const CImg< T > & display_object3d (CImgDisplay &disp, const CImg< tp > &vertices, const bool centering=true, const int render_static=4, const int render_motion=1, const bool is_double_sided=true, const float focale=700, const float light_x=0, const float light_y=0, const float light_z=-5e8f, const float specular_lightness=0.2f, const float specular_shininess=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 Display object 3d in an interactive window [simplification].
 
template<typename tp >
const CImg< T > & display_object3d (const char *const title, const CImg< tp > &vertices, const bool centering=true, const int render_static=4, const int render_motion=1, const bool is_double_sided=true, const float focale=700, const float light_x=0, const float light_y=0, const float light_z=-5e8f, const float specular_lightness=0.2f, const float specular_shininess=0.1f, const bool display_axes=true, float *const pose_matrix=0) const
 Display object 3d in an interactive window [simplification].
 
const CImg< T > & display_graph (CImgDisplay &disp, const unsigned int plot_type=1, const unsigned int vertex_type=1, const char *const labelx=0, const double xmin=0, const double xmax=0, const char *const labely=0, const double ymin=0, const double ymax=0) const
 Display 1d graph in an interactive window. More...
 
const CImg< T > & display_graph (const char *const title=0, const unsigned int plot_type=1, const unsigned int vertex_type=1, const char *const labelx=0, const double xmin=0, const double xmax=0, const char *const labely=0, const double ymin=0, const double ymax=0) const
 Display 1d graph in an interactive window [overloading].
 
const CImg< T > & save (const char *const filename, const int number=-1, const unsigned int digits=6) const
 Save image as a file. More...
 
const CImg< T > & save_ascii (const char *const filename) const
 Save image as an ascii file. More...
 
const CImg< T > & save_ascii (std::FILE *const file) const
 Save image as an ascii file [overloading].
 
const CImg< T > & save_cpp (const char *const filename) const
 Save image as a .cpp source file. More...
 
const CImg< T > & save_cpp (std::FILE *const file) const
 Save image as a .cpp source file [overloading].
 
const CImg< T > & save_dlm (const char *const filename) const
 Save image as a DLM file. More...
 
const CImg< T > & save_dlm (std::FILE *const file) const
 Save image as a DLM file [overloading].
 
const CImg< T > & save_bmp (const char *const filename) const
 Save image as a BMP file. More...
 
const CImg< T > & save_bmp (std::FILE *const file) const
 Save image as a BMP file [overloading].
 
const CImg< T > & save_jpeg (const char *const filename, const unsigned int quality=100) const
 Save image as a JPEG file. More...
 
const CImg< T > & save_jpeg (std::FILE *const file, const unsigned int quality=100) const
 Save image as a JPEG file [overloading].
 
const CImg< T > & save_magick (const char *const filename, const unsigned int bytes_per_pixel=0) const
 Save image, using built-in ImageMagick++ library. More...
 
const CImg< T > & save_png (const char *const filename, const unsigned int bytes_per_pixel=0) const
 Save image as a PNG file. More...
 
const CImg< T > & save_png (std::FILE *const file, const unsigned int bytes_per_pixel=0) const
 Save image as a PNG file [overloading].
 
const CImg< T > & save_pnm (const char *const filename, const unsigned int bytes_per_pixel=0) const
 Save image as a PNM file. More...
 
const CImg< T > & save_pnm (std::FILE *const file, const unsigned int bytes_per_pixel=0) const
 Save image as a PNM file [overloading].
 
const CImg< T > & save_pnk (const char *const filename) const
 Save image as a PNK file. More...
 
const CImg< T > & save_pnk (std::FILE *const file) const
 Save image as a PNK file [overloading].
 
const CImg< T > & save_pfm (const char *const filename) const
 Save image as a PFM file. More...
 
const CImg< T > & save_pfm (std::FILE *const file) const
 Save image as a PFM file [overloading].
 
const CImg< T > & save_rgb (const char *const filename) const
 Save image as a RGB file. More...
 
const CImg< T > & save_rgb (std::FILE *const file) const
 Save image as a RGB file [overloading].
 
const CImg< T > & save_rgba (const char *const filename) const
 Save image as a RGBA file. More...
 
const CImg< T > & save_rgba (std::FILE *const file) const
 Save image as a RGBA file [overloading].
 
const CImg< T > & save_tiff (const char *const filename, const unsigned int compression_type=0) const
 Save image as a TIFF file. More...
 
const CImg< T > & save_minc2 (const char *const filename, const char *const imitate_file=0) const
 Save image as a MINC2 file. More...
 
const CImg< T > & save_analyze (const char *const filename, const float *const voxel_size=0) const
 Save image as an ANALYZE7.5 or NIFTI file. More...
 
const CImg< T > & save_cimg (const char *const filename, const bool is_compressed=false) const
 Save image as a .cimg file. More...
 
const CImg< T > & save_cimg (std::FILE *const file, const bool is_compressed=false) const
 Save image as a .cimg file [overloading].
 
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 c0) const
 Save image as a sub-image into an existing .cimg file. More...
 
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 c0) const
 Save image as a sub-image into an existing .cimg file [overloading].
 
const CImg< T > & save_inr (const char *const filename, const float *const voxel_size=0) const
 Save image as an INRIMAGE-4 file. More...
 
const CImg< T > & save_inr (std::FILE *const file, const float *const voxel_size=0) const
 Save image as an INRIMAGE-4 file [overloading].
 
const CImg< T > & save_exr (const char *const filename) const
 Save image as an OpenEXR file. More...
 
const CImg< T > & save_pandore (const char *const filename, const unsigned int colorspace=0) const
 Save image as a Pandore-5 file. More...
 
const CImg< T > & save_pandore (std::FILE *const file, const unsigned int colorspace=0) const
 Save image as a Pandore-5 file [overloading]. More...
 
const CImg< T > & save_raw (const char *const filename, const bool is_multiplexed=false) const
 Save image as a raw data file. More...
 
const CImg< T > & save_raw (std::FILE *const file, const bool is_multiplexed=false) const
 Save image as a raw data file [overloading]. More...
 
const CImg< T > & save_ffmpeg (const char *const filename, const unsigned int fps=25, const unsigned int bitrate=2048) const
 Save image as a video file, using the FFmpeg library. More...
 
const CImg< T > & save_yuv (const char *const filename, const bool is_rgb=true) const
 Save image as a .yuv video file. More...
 
const CImg< T > & save_yuv (std::FILE *const file, const bool is_rgb=true) const
 Save image as a .yuv video file [overloading]. More...
 
template<typename tf , typename tc >
const CImg< T > & save_off (const CImgList< tf > &primitives, const CImgList< tc > &colors, const char *const filename) const
 Save 3d object as an Object File Format (.off) file. More...
 
template<typename tf , typename tc >
const CImg< T > & save_off (const CImgList< tf > &primitives, const CImgList< tc > &colors, std::FILE *const file) const
 Save 3d object as an Object File Format (.off) file [overloading]. More...
 
const CImg< T > & save_ffmpeg_external (const char *const filename, const char *const codec=0, const unsigned int fps=25, const unsigned int bitrate=2048) const
 Save volumetric image as a video, using ffmpeg external binary. More...
 
const CImg< T > & save_gzip_external (const char *const filename) const
 Save image using gzip external binary. More...
 
const CImg< T > & save_graphicsmagick_external (const char *const filename, const unsigned int quality=100) const
 Save image using GraphicsMagick's external binary. More...
 
const CImg< T > & save_imagemagick_external (const char *const filename, const unsigned int quality=100) const
 Save image using ImageMagick's external binary. More...
 
const CImg< T > & save_medcon_external (const char *const filename) const
 Save image as a Dicom file. More...
 
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 dc=1)
 Save blank image as a .cimg file. More...
 
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 dc=1)
 Save blank image as a .cimg file [overloading]. More...
 

Detailed Description

template<typename T = float>
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:

  • _width defines the number of columns of the image (size along the X-axis).
  • _height defines the number of rows of the image (size along the Y-axis).
  • _depth defines the number of slices of the image (size along the Z-axis).
  • _spectrum defines the number of channels of the image (size along the C-axis).
  • _data defines a pointer to the pixel data (of type T).
  • _is_shared is a boolean that tells if the memory buffer data is shared with another image.

You can access these fields publicly although it is recommended to use the dedicated functions width(), height(), depth(), spectrum() 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:

  • Construct images from arbitrary dimensions:
    • CImg<char> img; declares an empty image.
    • CImg<unsigned char> img(128,128); declares a 128x128 greyscale image with unsigned char pixel values.
    • CImg<double> img(3,3); declares a 3x3 matrix with double coefficients.
    • CImg<unsigned char> img(256,256,1,3); declares a 256x256x1x3 (color) image (colors are stored as an image with three channels).
    • CImg<double> img(128,128,128); declares a 128x128x128 volumetric and greyscale image (with double pixel values).
    • CImg<> img(128,128,128,3); declares a 128x128x128 volumetric color image (with float pixels, which is the default value of the template parameter T).
    • Note: images pixels are not automatically initialized to 0. You may use the function fill() to do it, or use the specific constructor taking 5 parameters like this: CImg<> img(128,128,128,3,0); declares a 128x128x128 volumetric color image with all pixel values to 0.
  • Construct images from filenames:
    • CImg<unsigned char> img("image.jpg"); reads a JPEG color image from the file "image.jpg".
    • CImg<float> img("analyze.hdr"); reads a volumetric image (ANALYZE7.5 format) from the file "analyze.hdr".
    • Note: You need to install ImageMagick to be able to read common compressed image formats (JPG,PNG, ...) (See Files IO in CImg.).
  • Construct images from C-style arrays:

    • CImg<int> img(data_buffer,256,256); constructs a 256x256 greyscale image from a int* buffer data_buffer (of size 256x256=65536).
    • CImg<unsigned char> img(data_buffer,256,256,1,3,false); constructs a 256x256 color image from a unsigned char* buffer data_buffer (where R,G,B channels follow each others).
    • CImg<unsigned char> img(data_buffer,256,256,1,3,true); constructs a 256x256 color image from a unsigned char* buffer data_buffer (where R,G,B channels are multiplexed).

    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

Simple iterator type, to loop through each pixel value of an image instance.

Note
  • The CImg<T>::iterator type is defined to be a T*.
  • You will seldom have to use iterators in CImg, most classical operations being achieved (often in a faster way) using methods of CImg<T>.
Example
CImg<float> img("reference.jpg"); // Load image from file.
for (CImg<float>::iterator it = img.begin(), it<img.end(); ++it) *it = 0; // Set all pixels to '0', through a CImg iterator.
img.fill(0); // Do the same with a built-in method.
typedef const T* const_iterator

Simple const iterator type, to loop through each pixel value of a const image instance.

Note
  • The CImg<T>::const_iterator type is defined to be a const T*.
  • You will seldom have to use iterators in CImg, most classical operations being achieved (often in a faster way) using methods of CImg<T>.
Example
const CImg<float> img("reference.jpg"); // Load image from file.
float sum = 0;
for (CImg<float>::iterator it = img.begin(), it<img.end(); ++it) sum+=*it; // Compute sum of all pixel values, through a CImg iterator.
const float sum2 = img.sum(); // Do the same with a built-in method.
typedef T value_type

Pixel value type.

Refer to the type of the pixel values of an image instance.

Note
  • The CImg<T>::value_type type of a CImg<T> is defined to be a T.
  • CImg<T>::value_type is actually not used in CImg methods. It has been mainly defined for compatibility with STL naming conventions.

Constructor & Destructor Documentation

~CImg ( )

Destroy image.

Note
  • The pixel buffer data() is deallocated if necessary, e.g. for non-empty and non-shared image instances.
  • Destroying an empty or shared image does nothing actually.
Warning
  • When destroying a non-shared image, make sure that you will not operate on a remaining shared image that shares its buffer with the destroyed instance, in order to avoid further invalid memory access (to a deallocated buffer).
CImg ( )

Construct empty image.

Note
Example
CImg<float> img1, img2; // Construct two empty images.
img1.assign(256,256,1,3); // Re-assign 'img1' to be a 256x256x1x3 (color) image.
img2 = img1.get_rand(0,255); // Re-assign 'img2' to be a random-valued version of 'img1'.
img2.assign(); // Re-assign 'img2' to be an empty image again.
CImg ( const unsigned int  size_x,
const unsigned int  size_y = 1,
const unsigned int  size_z = 1,
const unsigned int  size_c = 1 
)
explicit

Construct image with specified size.

Parameters
size_xImage width().
size_yImage height().
size_zImage depth().
size_cImage spectrum() (number of channels).
Note
  • It is able to create only non-shared images, and allocates thus a pixel buffer data() for each constructed image instance.
  • Setting one dimension size_x,size_y,size_z or size_c to 0 leads to the construction of an empty image.
  • A CImgInstanceException is thrown when the pixel buffer cannot be allocated (e.g. when requested size is too big for available memory).
Warning
Example
CImg<float> img1(256,256,1,3); // Construct a 256x256x1x3 (color) image, filled with garbage values.
CImg<float> img2(256,256,1,3,0); // Construct a 256x256x1x3 (color) image, filled with value '0'.
CImg ( const unsigned int  size_x,
const unsigned int  size_y,
const unsigned int  size_z,
const unsigned int  size_c,
const T  value 
)

Construct image with specified size and initialize pixel values.

Parameters
size_xImage width().
size_yImage height().
size_zImage depth().
size_cImage spectrum() (number of channels).
valueInitialization value.
Note
Warning
  • It cannot be used to construct a vector-valued image and initialize it with vector-valued pixels (e.g. RGB vector, for color images). For this task, you may use fillC() after construction.
CImg ( const unsigned int  size_x,
const unsigned int  size_y,
const unsigned int  size_z,
const unsigned int  size_c,
const int  value0,
const int  value1,
  ... 
)

Construct image with specified size and initialize pixel values from a sequence of integers.

Construct a new image instance of size size_x x size_y x size_z x size_c, with pixels of type T, and initialize pixel values from the specified sequence of integers value0,value1,...

Parameters
size_xImage width().
size_yImage height().
size_zImage depth().
size_cImage spectrum() (number of channels).
value0First value of the initialization sequence (must be an integer).
value1Second value of the initialization sequence (must be an integer).
...
Note
Warning
  • You must specify exactly size_x*size_y*size_z*size_c integers in the initialization sequence. Otherwise, the constructor may crash or fill your image pixels with garbage.
Example
const CImg<float> img(2,2,1,3, // Construct a 2x2 color (RGB) image.
0,255,0,255, // Set the 4 values for the red component.
0,0,255,255, // Set the 4 values for the green component.
64,64,64,64); // Set the 4 values for the blue component.
img.resize(150,150).display();
ref_constructor1.jpg
CImg ( const unsigned int  size_x,
const unsigned int  size_y,
const unsigned int  size_z,
const unsigned int  size_c,
const double  value0,
const double  value1,
  ... 
)

Construct image with specified size and initialize pixel values from a sequence of doubles.

Construct a new image instance of size size_x x size_y x size_z x size_c, with pixels of type T, and initialize pixel values from the specified sequence of doubles value0,value1,...

Parameters
size_xImage width().
size_yImage height().
size_zImage depth().
size_cImage spectrum() (number of channels).
value0First value of the initialization sequence (must be a double).
value1Second value of the initialization sequence (must be a double).
...
Note
  • Similar to CImg(unsigned int,unsigned int,unsigned int,unsigned int,int,int,...), but takes a sequence of double values instead of integers.
Warning
  • You must specify exactly dx*dy*dz*dc doubles in the initialization sequence. Otherwise, the constructor may crash or fill your image with garbage. For instance, the code below will probably crash on most platforms:
    const CImg<float> img(2,2,1,1, 0.5,0.5,255,255); // FAIL: The two last arguments are 'int', not 'double'!
CImg ( const unsigned int  size_x,
const unsigned int  size_y,
const unsigned int  size_z,
const unsigned int  size_c,
const char *const  values,
const bool  repeat_values 
)

Construct image with specified size and initialize pixel values from a value string.

Construct a new image instance of size size_x x size_y x size_z x size_c, with pixels of type T, and initializes pixel values from the specified string values.

Parameters
size_xImage width().
size_yImage height().
size_zImage depth().
size_cImage spectrum() (number of channels).
valuesValue string describing the way pixel values are set.
repeat_valuesTells if the value filling process is repeated over the image.
Note
  • Similar to CImg(unsigned int,unsigned int,unsigned int,unsigned int), but it also fills the pixel buffer with values described in the value string values.
  • Value string values may describe two different filling processes:
    • Either values is a sequences of values assigned to the image pixels, as in "1,2,3,7,8,2". In this case, set repeat_values to true to periodically fill the image with the value sequence.
    • Either, values is a formula, as in "cos(x/10)*sin(y/20)". In this case, parameter repeat_values is pointless.
  • For both cases, specifying repeat_values is mandatory. It disambiguates the possible overloading of constructor CImg(unsigned int,unsigned int,unsigned int,unsigned int,T) with T being a const char*.
  • A CImgArgumentException is thrown when an invalid value string values is specified.
Example
const CImg<float> img1(129,129,1,3,"0,64,128,192,255",true), // Construct image filled from a value sequence.
img2(129,129,1,3,"if(c==0,255*abs(cos(x/10)),1.8*y)",false); // Construct image filled from a formula.
(img1,img2).display();
ref_constructor2.jpg
CImg ( const t *const  values,
const unsigned int  size_x,
const unsigned int  size_y = 1,
const unsigned int  size_z = 1,
const unsigned int  size_c = 1,
const bool  is_shared = false 
)

Construct image with specified size and initialize pixel values from a memory buffer.

Construct a new image instance of size size_x x size_y x size_z x size_c, with pixels of type T, and initializes pixel values from the specified t* memory buffer.

Parameters
valuesPointer to the input memory buffer.
size_xImage width().
size_yImage height().
size_zImage depth().
size_cImage spectrum() (number of channels).
is_sharedTells if input memory buffer must be shared by the current instance.
Note
  • If is_shared is false, the image instance allocates its own pixel buffer, and values from the specified input buffer are copied to the instance buffer. If buffer types T and t are different, a regular static cast is performed during buffer copy.
  • Otherwise, the image instance does not allocate a new buffer, and uses the input memory buffer as its own pixel buffer. This case requires that types T and t are the same. Later, destroying such a shared image will not deallocate the pixel buffer, this task being obviously charged to the initial buffer allocator.
  • A CImgInstanceException is thrown when the pixel buffer cannot be allocated (e.g. when requested size is too big for available memory).
Warning
  • You must take care when operating on a shared image, since it may have an invalid pixel buffer pointer data() (e.g. already deallocated).
Example
unsigned char tab[256*256] = { 0 };
CImg<unsigned char> img1(tab,256,256,1,1,false), // Construct new non-shared image from buffer 'tab'.
img2(tab,256,256,1,1,true); // Construct new shared-image from buffer 'tab'.
tab[1024] = 255; // Here, 'img2' is indirectly modified, but not 'img1'.
CImg ( const char *const  filename)
explicit

Construct image from reading an image file.

Construct a new image instance with pixels of type T, and initialize pixel values with the data read from an image file.

Parameters
filenameFilename, as a C-string.
Note
  • Similar to CImg(unsigned int,unsigned int,unsigned int,unsigned int), but it reads the image dimensions and pixel values from the specified image file.
  • The recognition of the image file format by CImg higly depends on the tools installed on your system and on the external libraries you used to link your code against.
  • Considered pixel type T should better fit the file format specification, or data loss may occur during file load (e.g. constructing a CImg<unsigned char> from a float-valued image file).
  • A CImgIOException is thrown when the specified filename cannot be read, or if the file format is not recognized.
Example
const CImg<float> img("reference.jpg");
img.display();
ref_image.jpg
CImg ( const CImg< t > &  img)

Construct image copy.

Construct a new image instance with pixels of type T, as a copy of an existing CImg<t> instance.

Parameters
imgInput image to copy.
Note
  • Constructed copy has the same size width() x height() x depth() x spectrum() and pixel values as the input image img.
  • If input image img is shared and if types T and t are the same, the constructed copy is also shared, and shares its pixel buffer with img. Modifying a pixel value in the constructed copy will thus also modifies it in the input image img. This behavior is needful to allow functions to return shared images.
  • Otherwise, the constructed copy allocates its own pixel buffer, and copies pixel values from the input image img into its buffer. The copied pixel values may be eventually statically casted if types T and t are different.
  • Constructing a copy from an image img when types t and T are the same is significantly faster than with different types.
  • A CImgInstanceException is thrown when the pixel buffer cannot be allocated (e.g. not enough available memory).
CImg ( const CImg< t > &  img,
const bool  is_shared 
)

Advanced copy constructor.

Construct a new image instance with pixels of type T, as a copy of an existing CImg<t> instance, while forcing the shared state of the constructed copy.

Parameters
imgInput image to copy.
is_sharedTells about the shared state of the constructed copy.
Note
  • Similar to CImg(const CImg<t>&), except that it allows to decide the shared state of the constructed image, which does not depend anymore on the shared state of the input image img:
    • If is_shared is true, the constructed copy will share its pixel buffer with the input image img. For that case, the pixel types T and t must be the same.
    • If is_shared is false, the constructed copy will allocate its own pixel buffer, whether the input image img is shared or not.
  • A CImgArgumentException is thrown when a shared copy is requested with different pixel types T and t.
CImg ( const CImg< t > &  img,
const char *const  dimensions 
)

Construct image with dimensions borrowed from another image.

Construct a new image instance with pixels of type T, and size get from some dimensions of an existing CImg<t> instance.

Parameters
imgInput image from which dimensions are borrowed.
dimensionsC-string describing the image size along the X,Y,Z and C-dimensions.
Note
Example
const CImg<float> img1(256,128,1,3), // 'img1' is a 256x128x1x3 image.
img2(img1,"xyzc"), // 'img2' is a 256x128x1x3 image.
img3(img1,"y,x,z,c"), // 'img3' is a 128x256x1x3 image.
img4(img1,"c,x,y,3",0), // 'img4' is a 3x128x256x3 image (with pixels initialized to '0').
CImg ( const CImg< t > &  img,
const char *const  dimensions,
const T  value 
)

Construct image with dimensions borrowed from another image and initialize pixel values.

Construct a new image instance with pixels of type T, and size get from the dimensions of an existing CImg<t> instance, and set all pixel values to specified value.

Parameters
imgInput image from which dimensions are borrowed.
dimensionsString describing the image size along the X,Y,Z and V-dimensions.
valueValue used for initialization.
Note
CImg ( const CImgDisplay disp)
explicit

Construct image from a display window.

Construct a new image instance with pixels of type T, as a snapshot of an existing CImgDisplay instance.

Parameters
dispInput display window.
Note
  • The width() and height() of the constructed image instance are the same as the specified CImgDisplay.
  • The depth() and spectrum() of the constructed image instance are respectively set to 1 and 3 (i.e. a 2d color image).
  • The image pixels are read as 8-bits RGB values.

Member Function Documentation

CImg<T>& assign ( )

Construct empty image [in-place version].

In-place version of the default constructor CImg(). It simply resets the instance to an empty image.

CImg<T>& assign ( const unsigned int  size_x,
const unsigned int  size_y = 1,
const unsigned int  size_z = 1,
const unsigned int  size_c = 1 
)

Construct image with specified size [in-place version].

In-place version of the constructor CImg(unsigned int,unsigned int,unsigned int,unsigned int).

CImg<T>& assign ( const unsigned int  size_x,
const unsigned int  size_y,
const unsigned int  size_z,
const unsigned int  size_c,
const T  value 
)

Construct image with specified size and initialize pixel values [in-place version].

In-place version of the constructor CImg(unsigned int,unsigned int,unsigned int,unsigned int,T).

CImg<T>& assign ( const unsigned int  size_x,
const unsigned int  size_y,
const unsigned int  size_z,
const unsigned int  size_c,
const int  value0,
const int  value1,
  ... 
)

Construct image with specified size and initialize pixel values from a sequence of integers [in-place version].

In-place version of the constructor CImg(unsigned int,unsigned int,unsigned int,unsigned int,int,int,...).

CImg<T>& assign ( const unsigned int  size_x,
const unsigned int  size_y,
const unsigned int  size_z,
const unsigned int  size_c,
const double  value0,
const double  value1,
  ... 
)

Construct image with specified size and initialize pixel values from a sequence of doubles [in-place version].

In-place version of the constructor CImg(unsigned int,unsigned int,unsigned int,unsigned int,double,double,...).

CImg<T>& assign ( const unsigned int  size_x,
const unsigned int  size_y,
const unsigned int  size_z,
const unsigned int  size_c,
const char *const  values,
const bool  repeat_values 
)

Construct image with specified size and initialize pixel values from a value string [in-place version].

In-place version of the constructor CImg(unsigned int,unsigned int,unsigned int,unsigned int,const char*,bool).

CImg<T>& assign ( const t *const  values,
const unsigned int  size_x,
const unsigned int  size_y = 1,
const unsigned int  size_z = 1,
const unsigned int  size_c = 1 
)

Construct image with specified size and initialize pixel values from a memory buffer [in-place version].

In-place version of the constructor CImg(const t*,unsigned int,unsigned int,unsigned int,unsigned int).

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

Construct image from reading an image file [in-place version].

In-place version of the constructor CImg(const char*).

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

Construct image copy [in-place version].

In-place version of the constructor CImg(const CImg<t>&).

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

In-place version of the advanced copy constructor.

In-place version of the constructor CImg(const CImg<t>&,bool).

CImg<T>& assign ( const CImg< t > &  img,
const char *const  dimensions 
)

Construct image with dimensions borrowed from another image [in-place version].

In-place version of the constructor CImg(const CImg<t>&,const char*).

CImg<T>& assign ( const CImg< t > &  img,
const char *const  dimensions,
const T  value 
)

Construct image with dimensions borrowed from another image and initialize pixel values [in-place version].

In-place version of the constructor CImg(const CImg<t>&,const char*,T).

CImg<T>& assign ( const CImgDisplay disp)

Construct image from a display window [in-place version].

In-place version of the constructor CImg(const CImgDisplay&).

CImg<T>& clear ( )

Construct empty image [in-place version].

Equivalent to assign().

Note
  • It has been defined for compatibility with STL naming conventions.
CImg<t>& move_to ( CImg< t > &  img)

Transfer content of an image instance into another one.

Transfer the dimensions and the pixel buffer content of an image instance into another one, and replace instance by an empty image. It avoids the copy of the pixel buffer when possible.

Parameters
imgDestination image.
Note
  • Pixel types T and t of source and destination images can be different, though the process is designed to be instantaneous when T and t are the same.
Example
CImg<float> src(256,256,1,3,0), // Construct a 256x256x1x3 (color) image filled with value '0'.
dest(16,16); // Construct a 16x16x1x1 (scalar) image.
src.move_to(dest); // Now, 'src' is empty and 'dest' is the 256x256x1x3 image.
CImgList<t>& move_to ( CImgList< t > &  list,
const unsigned int  pos = ~0U 
)

Transfer content of an image instance into a new image in an image list.

Transfer the dimensions and the pixel buffer content of an image instance into a newly inserted image at position pos in specified CImgList<t> instance.

Parameters
listDestination list.
posPosition of the newly inserted image in the list.
Note
  • When optionnal parameter pos is ommited, the image instance is transfered as a new image at the end of the specified list.
  • It is convenient to sequentially insert new images into image lists, with no additional copies of memory buffer.
Example
CImgList<float> list; // Construct an empty image list.
CImg<float> img("reference.jpg"); // Read image from filename.
img.move_to(list); // Transfer image content as a new item in the list (no buffer copy).
CImg<T>& swap ( CImg< T > &  img)

Swap fields of two image instances.

Parameters
imgImage to swap fields with.
Note
  • It can be used to interchange the content of two images in a very fast way. Can be convenient when dealing with algorithms requiring two swapping buffers.
Example
CImg<float> img1("lena.jpg"),
img2("milla.jpg");
img1.swap(img2); // Now, 'img1' is 'milla' and 'img2' is 'lena'.
static CImg<T>& empty ( )
static

Return a reference to an empty image.

Note
This function is useful mainly to declare optional parameters having type CImg<T> in functions prototypes, e.g.
void f(const int x=0, const int y=0, const CImg<float>& img=CImg<float>::empty());
T& operator() ( const unsigned int  x,
const unsigned int  y = 0,
const unsigned int  z = 0,
const unsigned int  c = 0 
)

Access to a pixel value.

Return a reference to a located pixel value of the image instance, being possibly const, whether the image instance is const or not. This is the standard method to get/set pixel values in CImg<T> images.

Parameters
xX-coordinate of the pixel value.
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.
cC-coordinate of the pixel value.
Note
  • Range of pixel coordinates start from (0,0,0,0) to (width()-1,height()-1,depth()-1,spectrum()-1).
  • Due to the particular arrangement of the pixel buffers defined in CImg, you can omit one coordinate if the corresponding dimension is equal to 1. For instance, pixels of a 2d image (depth() equal to 1) can be accessed by img(x,y,c) instead of img(x,y,0,c).
Warning
  • There is no boundary checking done in this operator, to make it as fast as possible. You must take care of out-of-bounds access by yourself, if necessary. For debuging purposes, you may want to define macro 'cimg_verbosity'>=3 to enable additional boundary checking operations in this operator. In that case, warning messages will be printed on the error output when accessing out-of-bounds pixels.
Example
CImg<float> img(100,100,1,3,0); // Construct a 100x100x1x3 (color) image with pixels set to '0'.
const float
valR = img(10,10,0,0), // Read red value at coordinates (10,10).
valG = img(10,10,0,1), // Read green value at coordinates (10,10)
valB = img(10,10,2), // Read blue value at coordinates (10,10) (Z-coordinate can be omitted).
avg = (valR + valG + valB)/3; // Compute average pixel value.
img(10,10,0) = img(10,10,1) = img(10,10,2) = avg; // Replace the color pixel (10,10) by the average grey value.
T& operator() ( const unsigned int  x,
const unsigned int  y,
const unsigned int  z,
const unsigned int  c,
const unsigned long  wh,
const unsigned long  whd = 0 
)

Access to a pixel value.

Parameters
xX-coordinate of the pixel value.
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.
cC-coordinate of the pixel value.
whPrecomputed offset, must be equal to width()*height().
whdPrecomputed offset, must be equal to width()*height()*depth().
Note
  • Similar to (but faster than) operator()(). It uses precomputed offsets to optimize memory access. You may use it to optimize the reading/writing of several pixel values in the same image (e.g. in a loop).
operator T * ( )

Implicitely cast an image into a T*.

Implicitely cast a CImg<T> instance into a T* or const T* pointer, whether the image instance is const or not. The returned pointer points on the first value of the image pixel buffer.

Note
  • It simply returns the pointer data() to the pixel buffer.
  • This implicit conversion is convenient to test the empty state of images (data() being 0 in this case), e.g.
    CImg<float> img1(100,100), img2; // 'img1' is a 100x100 image, 'img2' is an empty image.
    if (img1) { // Test succeeds, 'img1' is not an empty image.
    if (!img2) { // Test succeeds, 'img2' is an empty image.
    std::printf("'img1' is not empty, 'img2' is empty.");
    }
    }
  • It also allows to use brackets to access pixel values, without need for a CImg<T>::operator[](), e.g.
    CImg<float> img(100,100);
    const float value = img[99]; // Access to value of the last pixel on the first row.
    img[510] = 255; // Set pixel value at (10,5).
CImg<T>& operator= ( const T  value)

Assign a value to all image pixels.

Assign specified value to each pixel value of the image instance.

Parameters
valueValue that will be assigned to image pixels.
Note
  • The image size is never modified.
  • The value may be casted to pixel type T if necessary.
Example
CImg<char> img(100,100); // Declare image (with garbage values).
img = 0; // Set all pixel values to '0'.
img = 1.2; // Set all pixel values to '1' (cast of '1.2' as a 'char').
CImg<T>& operator= ( const char *const  expression)

Assign pixels values from a specified expression.

Initialize all pixel values from the specified string expression.

Parameters
expressionValue string describing the way pixel values are set.
Note
  • String parameter expression may describe different things:
    • If expression is a list of values (as in "1,2,3,8,3,2"), or a formula (as in "(x*y)%255"), the pixel values are set from specified expression and the image size is not modified.
    • If expression is a filename (as in "reference.jpg"), the corresponding image file is loaded and replace the image instance. The image size is modified if necessary.
Example
CImg<float> img1(100,100), img2(img1), img3(img1); // Declare three 100x100 scalar images with unitialized pixel values.
img1 = "0,50,100,150,200,250,200,150,100,50"; // Set pixel values of 'img1' from a value sequence.
img2 = "10*((x*y)%25)"; // Set pixel values of 'img2' from a formula.
img3 = "reference.jpg"; // Set pixel values of 'img3' from a file (image size is modified).
(img1,img2,img3).display();
ref_operator_eq.jpg
CImg<T>& operator= ( const CImg< t > &  img)

Copy an image into the current image instance.

Similar to the in-place copy constructor assign(const CImg<t>&).

CImg<T>& operator= ( const CImgDisplay disp)

Copy the content of a display window to the current image instance.

Similar to assign(const CImgDisplay&).

CImg<T>& operator+= ( const t  value)

In-place addition operator.

Add specified value to all pixels of an image instance.

Parameters
valueValue to add.
Note
  • Resulting pixel values are casted to fit the pixel type T. For instance, adding 0.2 to a CImg<char> is possible but does nothing indeed.
  • Overflow values are treated as with standard C++ numeric types. For instance,
    CImg<unsigned char> img(100,100,1,1,255); // Construct a 100x100 image with pixel values '255'.
    img+=1; // Add '1' to each pixels -> Overflow.
    // here all pixels of image 'img' are equal to '0'.
  • To prevent value overflow, you may want to consider pixel type T as float or double, and use cut() after addition.
Example
CImg<unsigned char> img1("reference.jpg"); // Load a 8-bits RGB image (values in [0,255]).
CImg<float> img2(img1); // Construct a float-valued copy of 'img1'.
img2+=100; // Add '100' to pixel values -> goes out of [0,255] but no problems with floats.
img2.cut(0,255); // Cut values in [0,255] to fit the 'unsigned char' constraint.
img1 = img2; // Rewrite safe result in 'unsigned char' version 'img1'.
const CImg<unsigned char> img3 = (img1 + 100).cut(0,255); // Do the same in a more simple and elegant way.
(img1,img2,img3).display();
ref_operator_plus.jpg
CImg<T>& operator+= ( const char *const  expression)

In-place addition operator.

Add values to image pixels, according to the specified string expression.

Parameters
expressionValue string describing the way pixel values are added.
Note
  • Similar to operator=(const char*), except that it adds values to the pixels of the current image instance, instead of assigning them.
CImg<T>& operator+= ( const CImg< t > &  img)

In-place addition operator.

Add values to image pixels, according to the values of the input image img.

Parameters
imgInput image to add.
Note
  • The size of the image instance is never modified.
  • It is not mandatory that input image img has the same size as the image instance. If less values are available in img, then the values are added cyclically. For instance, adding one WxH scalar image (spectrum() equal to 1) to one WxH color image (spectrum() equal to 3) means each color channel will be incremented with the same values at the same locations.
Example
CImg<float> img1("reference.jpg"); // Load a RGB color image (img1.spectrum()==3)
const CImg<float> img2(img1.width(),img.height(),1,1,"255*(x/w)^2"); // Construct a scalar shading (img2.spectrum()==1).
img1+=img2; // Add shading to each channel of 'img1'.
img1.cut(0,255); // Prevent [0,255] overflow.
(img2,img1).display();
ref_operator_plus1.jpg
CImg<T>& operator++ ( )

In-place increment operator (prefix).

Add 1 to all image pixels, and return a reference to the current incremented image instance.

Note
  • Writing ++img is equivalent to img+=1.
CImg<T> operator++ ( int  )

In-place increment operator (postfix).

Add 1 to all image pixels, and return a new copy of the initial (pre-incremented) image instance.

Note
  • Use the prefixed version operator++() if you don't need a copy of the initial (pre-incremented) image instance, since a useless image copy may be expensive in terms of memory usage.
CImg<T> operator+ ( ) const

Return a non-shared copy of the image instance.

Note
  • Use this operator to ensure you get a non-shared copy of an image instance with same pixel type T. Indeed, the usual copy constructor CImg<T>(const CImg<T>&) returns a shared copy of a shared input image, and it may be not desirable to work on a regular copy (e.g. for a resize operation) if you have no informations about the shared state of the input image.
  • Writing (+img) is equivalent to CImg<T>(img,false).
CImg< typename cimg::superset<T,t>::type > operator+ ( const t  value) const

Addition operator.

Similar to operator+=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg<Tfloat> operator+ ( const char *const  expression) const

Addition operator.

Similar to operator+=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg< typename cimg::superset<T,t>::type > operator+ ( const CImg< t > &  img) const

Addition operator.

Similar to operator+=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg<T>& operator-= ( const t  value)

In-place substraction operator.

Similar to operator+=(const t), except that it performs a substraction instead of an addition.

CImg<T>& operator-= ( const char *const  expression)

In-place substraction operator.

Similar to operator+=(const char*), except that it performs a substraction instead of an addition.

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

In-place substraction operator.

Similar to operator+=(const CImg<t>&), except that it performs a substraction instead of an addition.

CImg<T>& operator-- ( )

In-place decrement operator (prefix).

Similar to operator++(), except that it performs a decrement instead of an increment.

CImg<T> operator-- ( int  )

In-place decrement operator (postfix).

Similar to operator++(int), except that it performs a decrement instead of an increment.

CImg<T> operator- ( ) const

Replace each pixel by its opposite value.

Note
  • If the computed opposite values are out-of-range, they are treated as with standard C++ numeric types. For instance, the unsigned char opposite of 1 is 255.
Example
const CImg<unsigned char>
img1("reference.jpg"), // Load a RGB color image.
img2 = -img1; // Compute its opposite (in 'unsigned char').
(img1,img2).display();
ref_operator_minus.jpg
CImg< typename cimg::superset<T,t>::type > operator- ( const t  value) const

Substraction operator.

Similar to operator-=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg<Tfloat> operator- ( const char *const  expression) const

Substraction operator.

Similar to operator-=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg< typename cimg::superset<T,t>::type > operator- ( const CImg< t > &  img) const

Substraction operator.

Similar to operator-=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg<T>& operator*= ( const t  value)

In-place multiplication operator.

Similar to operator+=(const t), except that it performs a multiplication instead of an addition.

CImg<T>& operator*= ( const char *const  expression)

In-place multiplication operator.

Similar to operator+=(const char*), except that it performs a multiplication instead of an addition.

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

In-place multiplication operator.

Replace the image instance by the matrix multiplication between the image instance and the specified matrix img.

Parameters
imgSecond operand of the matrix multiplication.
Note
  • It does not compute a pointwise multiplication between two images. For this purpose, use mul(const CImg<t>&) instead.
  • The size of the image instance can be modified by this operator.
Example
CImg<float> A(2,2,1,1, 1,2,3,4); // Construct 2x2 matrix A = [1,2;3,4].
const CImg<float> X(1,2,1,1, 1,2); // Construct 1x2 vector X = [1;2].
A*=X; // Assign matrix multiplication A*X to 'A'.
// 'A' is now a 1x2 vector whose values are [5;11].
CImg< typename cimg::superset<T,t>::type > operator* ( const t  value) const

Multiplication operator.

Similar to operator*=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg<Tfloat> operator* ( const char *const  expression) const

Multiplication operator.

Similar to operator*=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg< typename cimg::superset<T,t>::type > operator* ( const CImg< t > &  img) const

Multiplication operator.

Similar to operator*=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg<T>& operator/= ( const t  value)

In-place division operator.

Similar to operator+=(const t), except that it performs a division instead of an addition.

CImg<T>& operator/= ( const char *const  expression)

In-place division operator.

Similar to operator+=(const char*), except that it performs a division instead of an addition.

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

In-place division operator.

Replace the image instance by the (right) matrix division between the image instance and the specified matrix img.

Parameters
imgSecond operand of the matrix division.
Note
  • It does not compute a pointwise division between two images. For this purpose, use div(const CImg<t>&) instead.
  • It returns the matrix operation A*inverse(img).
  • The size of the image instance can be modified by this operator.
CImg< typename cimg::superset<T,t>::type > operator/ ( const t  value) const

Division operator.

Similar to operator/=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg<Tfloat> operator/ ( const char *const  expression) const

Division operator.

Similar to operator/=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg< typename cimg::superset<T,t>::type > operator/ ( const CImg< t > &  img) const

Division operator.

Similar to operator/=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg<T>& operator%= ( const t  value)

In-place modulo operator.

Similar to operator+=(const t), except that it performs a modulo operation instead of an addition.

CImg<T>& operator%= ( const char *const  expression)

In-place modulo operator.

Similar to operator+=(const char*), except that it performs a modulo operation instead of an addition.

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

In-place modulo operator.

Similar to operator+=(const CImg<t>&), except that it performs a modulo operation instead of an addition.

CImg< typename cimg::superset<T,t>::type > operator% ( const t  value) const

Modulo operator.

Similar to operator%=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg<Tfloat> operator% ( const char *const  expression) const

Modulo operator.

Similar to operator%=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

CImg< typename cimg::superset<T,t>::type > operator% ( const CImg< t > &  img) const

Modulo operator.

Similar to operator%=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image may be a superset of the initial pixel type T, if necessary.

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

In-place bitwise AND operator.

Similar to operator+=(const t), except that it performs a bitwise AND operation instead of an addition.

CImg<T>& operator&= ( const char *const  expression)

In-place bitwise AND operator.

Similar to operator+=(const char*), except that it performs a bitwise AND operation instead of an addition.

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

In-place bitwise AND operator.

Similar to operator+=(const CImg<t>&), except that it performs a bitwise AND operation instead of an addition.

CImg<T> operator& ( const t  value) const

Bitwise AND operator.

Similar to operator&=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

CImg<T> operator& ( const char *const  expression) const

Bitwise AND operator.

Similar to operator&=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

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

Bitwise AND operator.

Similar to operator&=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

CImg<T>& operator|= ( const t  value)

In-place bitwise OR operator.

Similar to operator+=(const t), except that it performs a bitwise OR operation instead of an addition.

CImg<T>& operator|= ( const char *const  expression)

In-place bitwise OR operator.

Similar to operator+=(const char*), except that it performs a bitwise OR operation instead of an addition.

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

In-place bitwise OR operator.

Similar to operator+=(const CImg<t>&), except that it performs a bitwise OR operation instead of an addition.

CImg<T> operator| ( const t  value) const

Bitwise OR operator.

Similar to operator|=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

CImg<T> operator| ( const char *const  expression) const

Bitwise OR operator.

Similar to operator|=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

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

Bitwise OR operator.

Similar to operator|=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

CImg<T>& operator^= ( const t  value)

In-place bitwise XOR operator.

Similar to operator+=(const t), except that it performs a bitwise XOR operation instead of an addition.

Warning
  • It does not compute the power of pixel values. For this purpose, use pow(const t) instead.
CImg<T>& operator^= ( const char *const  expression)

In-place bitwise XOR operator.

Similar to operator+=(const char*), except that it performs a bitwise XOR operation instead of an addition.

Warning
  • It does not compute the power of pixel values. For this purpose, use pow(const char*) instead.
CImg<T>& operator^= ( const CImg< t > &  img)

In-place bitwise XOR operator.

Similar to operator+=(const CImg<t>&), except that it performs a bitwise XOR operation instead of an addition.

Warning
  • It does not compute the power of pixel values. For this purpose, use pow(const CImg<t>&) instead.
CImg<T> operator^ ( const t  value) const

Bitwise XOR operator.

Similar to operator^=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

CImg<T> operator^ ( const char *const  expression) const

Bitwise XOR operator.

Similar to operator^=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

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

Bitwise XOR operator.

Similar to operator^=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

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

In-place bitwise left shift operator.

Similar to operator+=(const t), except that it performs a bitwise left shift instead of an addition.

CImg<T>& operator<<= ( const char *const  expression)

In-place bitwise left shift operator.

Similar to operator+=(const char*), except that it performs a bitwise left shift instead of an addition.

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

In-place bitwise left shift operator.

Similar to operator+=(const CImg<t>&), except that it performs a bitwise left shift instead of an addition.

CImg<T> operator<< ( const t  value) const

Bitwise left shift operator.

Similar to operator<<=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

CImg<T> operator<< ( const char *const  expression) const

Bitwise left shift operator.

Similar to operator<<=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

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

Bitwise left shift operator.

Similar to operator<<=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

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

In-place bitwise right shift operator.

Similar to operator+=(const t), except that it performs a bitwise right shift instead of an addition.

CImg<T>& operator>>= ( const char *const  expression)

In-place bitwise right shift operator.

Similar to operator+=(const char*), except that it performs a bitwise right shift instead of an addition.

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

In-place bitwise right shift operator.

Similar to operator+=(const CImg<t>&), except that it performs a bitwise right shift instead of an addition.

CImg<T> operator>> ( const t  value) const

Bitwise right shift operator.

Similar to operator>>=(const t), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

CImg<T> operator>> ( const char *const  expression) const

Bitwise right shift operator.

Similar to operator>>=(const char*), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

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

Bitwise right shift operator.

Similar to operator>>=(const CImg<t>&), except that it returns a new image instance instead of operating in-place. The pixel type of the returned image is T.

CImg<T> operator~ ( ) const

Bitwise inversion operator.

Similar to operator-(), except that it compute the bitwise inverse instead of the opposite value.

bool operator== ( const t  value) const

Test if all pixels of an image have the same value.

Return true is all pixels of the image instance are equal to the specified value.

Parameters
valueReference value to compare with.
bool operator== ( const char *const  expression) const

Test if all pixel values of an image follow a specified expression.

Return true is all pixels of the image instance are equal to the specified expression.

Parameters
expressionValue string describing the way pixel values are compared.
bool operator== ( const CImg< t > &  img) const

Test if two images have the same size and values.

Return true if the image instance and the input image img have the same dimensions and pixel values, and false otherwise.

Parameters
imgInput image to compare with.
Note
  • The pixel buffer pointers data() of the two compared images do not have to be the same for operator==() to return true. Only the dimensions and the pixel values matter. Thus, the comparison can be true even for different pixel types T and t.
Example
const CImg<float> img1(1,3,1,1, 0,1,2); // Construct a 1x3 vector [0;1;2] (with 'float' pixel values).
const CImg<char> img2(1,3,1,1, 0,1,2); // Construct a 1x3 vector [0;1;2] (with 'char' pixel values).
if (img1==img2) { // Test succeeds, image dimensions and values are the same.
std::printf("'img1' and 'img2' have same dimensions and values.");
}
bool operator!= ( const t  value) const

Test if pixels of an image are all different from a value.

Return true is all pixels of the image instance are different than the specified value.

Parameters
valueReference value to compare with.
bool operator!= ( const char *const  expression) const

Test if all pixel values of an image are different from a specified expression.

Return true is all pixels of the image instance are different to the specified expression.

Parameters
expressionValue string describing the way pixel values are compared.
bool operator!= ( const CImg< t > &  img) const

Test if two images have different sizes or values.

Return true if the image instance and the input image img have different dimensions or pixel values, and false otherwise.

Parameters
imgInput image to compare with.
Note
  • Writing img1!=img2 is equivalent to !(img1==img2).
CImgList< typename cimg::superset<T,t>::type > operator, ( const CImg< t > &  img) const

Construct an image list from two images.

Return a new list of image (CImgList instance) containing exactly two elements:

  • A copy of the image instance, at position [0].
  • A copy of the specified image img, at position [1].
Parameters
imgInput image that will be the second image of the resulting list.
Note
  • The family of operator,() is convenient to easily create list of images, but it is also quite slow in practice (see warning below).
  • Constructed lists contain no shared images. If image instance or input image img are shared, they are inserted as new non-shared copies in the resulting list.
  • The pixel type of the returned list may be a superset of the initial pixel type T, if necessary.
Warning
Example
const CImg<float>
img1("reference.jpg"),
img2 = img1.get_mirror('x'),
img3 = img2.get_blur(5);
const CImgList<float> list = (img1,img2); // Create list of two elements from 'img1' and 'img2'.
(list,img3).display(); // Display image list containing copies of 'img1','img2' and 'img3'.
ref_operator_comma.jpg
CImgList< typename cimg::superset<T,t>::type > operator, ( const CImgList< t > &  list) const

Construct an image list from image instance and an input image list.

Return a new list of images (CImgList instance) containing exactly list.size() + 1 elements:

  • A copy of the image instance, at position [0].
  • A copy of the specified image list list, from positions [1] to [list.size()].
Parameters
listInput image list that will be appended to the image instance.
Note
CImgList<T> operator< ( const char  axis) const

Split image along specified axis.

Return a new list of images (CImgList instance) containing the splitted components of the instance image along the specified axis.

Parameters
axisSplitting axis (can be 'x','y','z' or 'c')
Note
Example
const CImg<unsigned char> img("reference.jpg"); // Load a RGB color image.
const CImgList<unsigned char> list = (img<'c'); // Get a list of its three R,G,B channels.
(img,list).display();
ref_operator_less.jpg
static const char* pixel_type ( )
static

Return the type of image pixel values as a C string.

Return a char* string containing the usual type name of the image pixel values (i.e. a stringified version of the template parameter T).

Note
  • The returned string may contain spaces (as in "unsigned char").
  • If the pixel type T does not correspond to a registered type, the string "unknown" is returned.
int width ( ) const

Return the number of image columns.

Return the image width, i.e. the image dimension along the X-axis.

Note
  • The width() of an empty image is equal to 0.
  • width() is typically equal to 1 when considering images as vectors for matrix calculations.
  • width() returns an int, although the image width is internally stored as an unsigned int. Using an int is safer and prevents arithmetic traps possibly encountered when doing calculations involving unsigned int variables. Access to the initial unsigned int variable is possible (though not recommended) by (*this)._width.