Logo

Latest stable version: 3.2.4        Current pre-release: 3.2.5



Reference

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 T value_type
 Pixel value type. More...
 

Public Attributes

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

Constructors / Destructor / Instance Management

static CImg< T > & empty ()
 Return a reference to an empty image. More...
 
static const CImg< T > & const_empty ()
 Return a reference to an empty image [const version].
 
 ~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].
 
template<typename t >
 CImg (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 char *const axes_order)
 Construct image from memory buffer with specified size and pixel ordering scheme.
 
 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].
 
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 char *const axes_order)
 Construct image from memory buffer with specified size and pixel ordering scheme.
 
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...
 

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 ulongT wh, const ulongT 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 ulongT wh, const ulongT whd=0) const
 Access to a pixel value [const version].
 
 operator T* ()
 Implicitly cast an image into a T*. More...
 
 operator const T * () const
 Implicitly 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 subtraction operator. More...
 
CImg< T > & operator-= (const char *const expression)
 In-place subtraction operator. More...
 
template<typename t >
CImg< T > & operator-= (const CImg< t > &img)
 In-place subtraction 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
 Subtraction operator. More...
 
CImg< Tfloat > operator- (const char *const expression) const
 Subtraction operator. More...
 
template<typename t >
CImg< typename cimg::superset< T, t >::type > operator- (const CImg< t > &img) const
 Subtraction 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

static const char * pixel_type ()
 Return the type of image pixel values as a C string. More...
 
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...
 
ulongT 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].
 
longT 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...
 
const T & 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...
 
const T & 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...
 
const T & 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...
 
const T & 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...
 
const T & 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_atX_p (const float fx, const int y=0, const int z=0, const int c=0) const
 Return pixel value, using linear interpolation and periodic boundary conditions for the X-coordinate.
 
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_atXY_p (const float fx, const float fy, const int z=0, const int c=0) const
 Return pixel value, using linear interpolation and periodic boundary conditions for the X and Y-coordinates.
 
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_atXYZ_p (const float fx, const float fy=0, const float fz=0, const int c=0) const
 Return pixel value, using linear interpolation and periodic boundary conditions for the X,Y and Z-coordinates.
 
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,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 linear_atXYZC_p (const float fx, const float fy=0, const float fz=0, const float fc=0) const
 Return pixel value, using linear interpolation and periodic boundary conditions for all X,Y,Z and C-coordinates.
 
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...
 
cubic_atX_c (const float fx, const int y, const int z, const int c, const T &out_value) const
 Return clamped 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...
 
cubic_atX_c (const float fx, const int y, const int z, const int c) const
 Return clamped pixel value, using cubic interpolation and Neumann boundary conditions for the X-coordinate. More...
 
Tfloat cubic_atX_p (const float fx, const int y=0, const int z=0, const int c=0) const
 Return pixel value, using cubic interpolation and periodic boundary conditions for the X-coordinate.
 
cubic_atX_pc (const float fx, const int y, const int z, const int c) const
 
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...
 
cubic_atXY_c (const float fx, const float fy, const int z, const int c, const T &out_value) const
 Return clamped pixel value, using cubic interpolation and Dirichlet boundary conditions for the X,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...
 
cubic_atXY_c (const float fx, const float fy, const int z, const int c) const
 Return clamped pixel value, using cubic interpolation and Neumann boundary conditions for the X,Y-coordinates. More...
 
Tfloat cubic_atXY_p (const float fx, const float fy, const int z=0, const int c=0) const
 Return pixel value, using cubic interpolation and periodic boundary conditions for the X and Y-coordinates.
 
cubic_atXY_pc (const float fx, const float fy, const int z, const int c) const
 
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...
 
cubic_atXYZ_c (const float fx, const float fy, const float fz, const int c, const T &out_value) const
 Return clamped pixel value, using cubic interpolation and Dirichlet boundary conditions for the XYZ-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...
 
cubic_atXYZ_c (const float fx, const float fy, const float fz, const int c) const
 Return clamped pixel value, using cubic interpolation and Neumann boundary conditions for the XYZ-coordinates. More...
 
Tfloat cubic_atXYZ_p (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...
 
cubic_atXYZ_pc (const float fx, const float fy, const float fz, const int c) const
 
CImg< T > & set_linear_atX (const T &value, const float fx, const int y=0, const int z=0, const int c=0, const bool is_added=false)
 Set pixel value, using linear interpolation for the X-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 char *const format=0) const
 Return a C-string containing a list of all values of the image instance. 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
 
CImg< T > & sqrt ()
 Compute the square root of each pixel value. More...
 
CImg< Tfloat > get_sqrt () const
 
CImg< T > & exp ()
 Compute the exponential of each pixel value. More...
 
CImg< Tfloat > get_exp () const
 
CImg< T > & erf ()
 Compute the error function of each pixel value. More...
 
CImg< Tfloat > get_erf () const
 
CImg< T > & log ()
 Compute the logarithm of each pixel value. More...
 
CImg< Tfloat > get_log () const
 
CImg< T > & log2 ()
 Compute the base-2 logarithm of each pixel value. More...
 
CImg< Tfloat > get_log2 () const
 
CImg< T > & log10 ()
 Compute the base-10 logarithm of each pixel value. More...
 
CImg< Tfloat > get_log10 () const
 
CImg< T > & abs ()
 Compute the absolute value of each pixel value. More...
 
CImg< Tfloat > get_abs () const
 
CImg< T > & sign ()
 Compute the sign of each pixel value. More...
 
CImg< Tfloat > get_sign () const
 
CImg< T > & cos ()
 Compute the cosine of each pixel value. More...
 
CImg< Tfloat > get_cos () const
 
CImg< T > & sin ()
 Compute the sine of each pixel value. More...
 
CImg< Tfloat > get_sin () const
 
CImg< T > & sinc ()
 Compute the sinc of each pixel value. More...
 
CImg< Tfloat > get_sinc () const
 
CImg< T > & tan ()
 Compute the tangent of each pixel value. More...
 
CImg< Tfloat > get_tan () const
 
CImg< T > & cosh ()
 Compute the hyperbolic cosine of each pixel value. More...
 
CImg< Tfloat > get_cosh () const
 
CImg< T > & sinh ()
 Compute the hyperbolic sine of each pixel value. More...
 
CImg< Tfloat > get_sinh () const
 
CImg< T > & tanh ()
 Compute the hyperbolic tangent of each pixel value. More...
 
CImg< Tfloat > get_tanh () const
 
CImg< T > & acos ()
 Compute the arccosine of each pixel value. More...
 
CImg< Tfloat > get_acos () const
 
CImg< T > & asin ()
 Compute the arcsine of each pixel value. More...
 
CImg< Tfloat > get_asin () const
 
CImg< T > & atan ()
 Compute the arctangent of each pixel value. More...
 
CImg< Tfloat > get_atan () const
 
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].
 
CImg< T > & acosh ()
 Compute the hyperbolic arccosine of each pixel value. More...
 
CImg< Tfloat > get_acosh () const
 
CImg< T > & asinh ()
 Compute the hyperbolic arcsine of each pixel value. More...
 
CImg< Tfloat > get_asinh () const
 
CImg< T > & atanh ()
 Compute the hyperbolic arctangent of each pixel value. More...
 
CImg< Tfloat > get_atanh () const
 
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 &value)
 Pointwise min operator between instance image and a value. More...
 
CImg< T > get_min (const T &value) 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 &value)
 Pointwise max operator between instance image and a value. More...
 
CImg< T > get_max (const T &value) 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].
 
CImg< T > & minabs (const T &value)
 Pointwise minabs operator between instance image and a value. More...
 
CImg< T > get_minabs (const T &value) const
 Pointwise minabs operator between instance image and a value [new-instance version].
 
template<typename t >
CImg< T > & minabs (const CImg< t > &img)
 Pointwise minabs operator between two images. More...
 
template<typename t >
CImg< typename cimg::superset< T, t >::type > get_minabs (const CImg< t > &img) const
 Pointwise minabs operator between two images [new-instance version].
 
CImg< T > & minabs (const char *const expression)
 Pointwise minabs operator between an image and an expression. More...
 
CImg< Tfloat > get_minabs (const char *const expression) const
 Pointwise minabs operator between an image and an expression [new-instance version].
 
CImg< T > & maxabs (const T &value)
 Pointwise maxabs operator between instance image and a value. More...
 
CImg< T > get_maxabs (const T &value) const
 Pointwise maxabs operator between instance image and a value [new-instance version].
 
template<typename t >
CImg< T > & maxabs (const CImg< t > &img)
 Pointwise maxabs operator between two images. More...
 
template<typename t >
CImg< typename cimg::superset< T, t >::type > get_maxabs (const CImg< t > &img) const
 Pointwise maxabs operator between two images [new-instance version].
 
CImg< T > & maxabs (const char *const expression)
 Pointwise maxabs operator between an image and an expression. More...
 
CImg< Tfloat > get_maxabs (const char *const expression) const
 Pointwise maxabs 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 & minabs ()
 Return a reference to the minimum pixel value in absolute value.
 
const T & minabs () const
 Return a reference to the minimum pixel value in absolute 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].
 
T & maxabs ()
 Return a reference to the maximum pixel value in absolute value.
 
const T & maxabs () const
 Return a reference to the maximum pixel value in absolute 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 ulongT k) const
 Return the kth smallest pixel value. More...
 
median () const
 Return the median pixel value.
 
double product () const
 Return the product of all the pixel values.
 
double sum () const
 Return the sum of all the pixel values.
 
double mean () const
 Return the average pixel value.
 
double variance (const unsigned int variance_method=1) const
 Return the variance of the pixel values. More...
 
template<typename t >
double variance_mean (const unsigned int variance_method, t &mean) const
 Return the variance as well as the average of the pixel values. More...
 
double variance_noise (const unsigned int variance_method=2) const
 Return estimated variance of the noise. More...
 
template<typename t >
double MSE (const CImg< t > &img) const
 Compute the MSE (Mean-Squared Error) between two images. More...
 
template<typename t >
double PSNR (const CImg< t > &img, const double 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, CImgList< T > *const list_images=0)
 Evaluate math formula. More...
 
double eval (const char *const expression, const double x=0, const double y=0, const double z=0, const double c=0, CImgList< T > *const list_images=0) const
 Evaluate math formula [const version].
 
template<typename t >
void eval (CImg< t > &output, const char *const expression, const double x=0, const double y=0, const double z=0, const double c=0, CImgList< T > *const list_images=0)
 Evaluate math formula. More...
 
template<typename t >
void eval (CImg< t > &output, const char *const expression, const double x=0, const double y=0, const double z=0, const double c=0, CImgList< T > *const list_images=0) const
 Evaluate math formula [const version].
 
template<typename t >
CImg< doubleT > eval (const char *const expression, const CImg< t > &xyzc, CImgList< T > *const list_images=0)
 Evaluate math formula on a set of variables. More...
 
template<typename t >
CImg< doubleT > eval (const char *const expression, const CImg< t > &xyzc, CImgList< T > *const list_images=0) const
 Evaluate math formula on a set of variables [const version].
 
CImg< Tdouble > get_stats (const unsigned int variance_method=1) const
 Compute statistics vector from the pixel values. More...
 
CImg< T > & stats (const unsigned int variance_method=1)
 Compute statistics vector from the pixel values [in-place version].
 

Vector / Matrix Operations

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, const bool is_shared=false)
 Return an image containing the character codes of specified string. More...
 
static CImg< T > row_vector (const T &a0)
 Return a 1x1 image containing specified value. More...
 
static CImg< T > row_vector (const T &a0, const T &a1)
 Return a 2x1 image containing specified values. More...
 
static CImg< T > row_vector (const T &a0, const T &a1, const T &a2)
 Return a 3x1 image containing specified values. More...
 
static CImg< T > row_vector (const T &a0, const T &a1, const T &a2, const T &a3)
 Return a 4x1 image containing specified values. More...
 
static CImg< T > row_vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4)
 Return a 5x1 image containing specified values.
 
static CImg< T > row_vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5)
 Return a 6x1 image containing specified values.
 
static CImg< T > row_vector (const T &a0, const T &a1, const T &a2, const T &a3, const T &a4, const T &a5, const T &a6)
 Return a 7x1 image containing specified values.
 
static CImg< T > row_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 8x1 image containing specified values.
 
static CImg< T > row_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 9x1 image containing specified values.
 
static CImg< T > row_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 10x1 image containing specified values.
 
static CImg< T > row_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 11x1 image containing specified values.
 
static CImg< T > row_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 12x1 image containing specified values.
 
static CImg< T > row_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 13x1 image containing specified values.
 
static CImg< T > row_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 14x1 image containing specified values.
 
static CImg< T > row_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 15x1 image containing specified values.
 
static CImg< T > row_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 16x1 image containing specified values.
 
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 > 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, const T &a16)
 Return a 1x17 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, const T &a16, const T &a17)
 Return a 1x18 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, const T &a16, const T &a17, const T &a18)
 Return a 1x19 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, const T &a16, const T &a17, const T &a18, const T &a19)
 Return a 1x20 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, const T &a16, const T &a17, const T &a18, const T &a19, const T &a20)
 Return a 1x21 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 from an { axis + angle } or a quaternion. More...
 
double magnitude (const float magnitude_type=2) const
 Compute norm of the image, viewed as a matrix. More...
 
double trace () const
 Compute the trace of the image, viewed as a matrix.
 
double det () const
 Compute the determinant of the image, viewed as a matrix.
 
template<typename t >
double 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 > & 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=false, const float lambda=0)
 Invert the instance image, viewed as a matrix. More...
 
CImg< Tfloat > get_invert (const bool use_LU=false, const float lambda=0) const
 Invert the instance image, viewed as a matrix [new-instance version].
 
template<typename t >
CImg< T > & solve (const CImg< t > &A, const bool use_LU=false)
 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 bool use_LU=false) 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 > & project_matrix (const CImg< t > &dictionary, const unsigned int method=0, const unsigned int max_iter=0, const double max_residual=1e-6)
 Compute the projection of the instance matrix onto the specified dictionary. More...
 
template<typename t >
CImg< Tfloat > get_project_matrix (const CImg< t > &dictionary, const unsigned int method=0, const unsigned int max_iter=0, const double max_residual=1e-6) const
 
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].
 

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_values, const bool allow_formula=true, CImgList< T > *const list_images=0)
 Fill sequentially pixel values according to a given expression. More...
 
CImg< T > get_fill (const char *const expression, const bool repeat_values, const bool allow_formula=true, CImgList< T > *const list_images=0) const
 Fill sequentially pixel values according to a given expression [new-instance version].
 
CImg< T > & fill_from_values (const char *const values, const bool repeat_values)
 Fill sequentially pixel values according to a value sequence, given as a string. More...
 
CImg< T > get_fill_from_values (const char *const values, const bool repeat_values) const
 Fill sequentially pixel values according to a value sequence, given as a string [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].
 
template<typename t >
CImg< T > & discard (const CImg< t > &values, const char axis=0)
 Discard specified sequence of values in the image buffer, along a specific axis. More...
 
template<typename t >
CImg< T > get_discard (const CImg< t > &values, const char axis=0) const
 
CImg< T > & discard (const char axis=0)
 Discard neighboring duplicates in the image buffer, along the specified axis.
 
CImg< T > get_discard (const char axis=0) const
 Discard neighboring duplicates in the image buffer, along the specified axis [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, const float constant_case_ratio=0)
 Linearly normalize pixel values. More...
 
CImg< Tfloat > get_normalize (const T &min_value, const T &max_value, const float ratio_if_constant_image=0) 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 Lp-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].
 
otsu (const unsigned int nb_levels=256) const
 Return the Otsu threshold. More...
 
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, const T &max_value)
 Compute the histogram of pixel values. More...
 
CImg< T > & histogram (const unsigned int nb_levels)
 Compute the histogram of pixel values [overloading].
 
CImg< ulongT > get_histogram (const unsigned int nb_levels, const T &min_value, const T &max_value) const
 Compute the histogram of pixel values [new-instance version].
 
CImg< ulongT > get_histogram (const unsigned int nb_levels) const
 Compute the histogram of pixel values [new-instance version].
 
CImg< T > & equalize (const unsigned int nb_levels, const T &min_value, const T &max_value)
 Equalize histogram of pixel values. More...
 
CImg< T > & equalize (const unsigned int nb_levels)
 Equalize histogram of pixel values [overloading].
 
CImg< T > get_equalize (const unsigned int nblevels, const T &val_min, const T &val_max) const
 Equalize histogram of pixel values [new-instance version].
 
CImg< T > get_equalize (const unsigned int nblevels) 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 palette. 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 > &palette, const unsigned int boundary_conditions=0)
 Map predefined palette on the scalar (indexed) image instance. More...
 
template<typename t >
CImg< t > get_map (const CImg< t > &palette, const unsigned int boundary_conditions=0) const
 Map predefined palette on the scalar (indexed) image instance [new-instance version].
 
CImg< T > & label (const bool is_high_connectivity=false, const Tfloat tolerance=0, const bool is_L2_norm=true)
 Label connected components. More...
 
CImg< ulongT > get_label (const bool is_high_connectivity=false, const Tfloat tolerance=0, const bool is_L2_norm=true) const
 Label connected components [new-instance version].
 
template<typename t >
CImg< T > & label (const CImg< t > &connectivity_mask, const Tfloat tolerance=0, const bool is_L2_norm=true)
 Label connected components [overloading]. More...
 
template<typename t >
CImg< ulongT > get_label (const CImg< t > &connectivity_mask, const Tfloat tolerance=0, const bool is_L2_norm=true) const
 Label connected components [new-instance version].
 

Color Base Management

static const CImg< Tuchar > & default_LUT256 ()
 Return palette "default", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & HSV_LUT256 ()
 Return palette "HSV", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & lines_LUT256 ()
 Return palette "lines", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & hot_LUT256 ()
 Return palette "hot", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & cool_LUT256 ()
 Return palette "cool", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & jet_LUT256 ()
 Return palette "jet", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & flag_LUT256 ()
 Return palette "flag", containing 256 colors entries in RGB. More...
 
static const CImg< Tuchar > & cube_LUT256 ()
 Return palette "cube", containing 256 colors entries in RGB. More...
 
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 > & 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 > & 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 > & 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 > & 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 (const bool use_D65=true)
 Convert pixel values from RGB to XYZ color spaces. More...
 
CImg< Tfloat > get_RGBtoXYZ (const bool use_D65=true) const
 Convert pixel values from RGB to XYZ color spaces [new-instance version].
 
CImg< T > & XYZtoRGB (const bool use_D65=true)
 Convert pixel values from XYZ to RGB color spaces. More...
 
CImg< Tuchar > get_XYZtoRGB (const bool use_D65=true) const
 Convert pixel values from XYZ to RGB color spaces [new-instance version].
 
CImg< T > & XYZtoLab (const bool use_D65=true)
 Convert pixel values from XYZ to Lab color spaces.
 
CImg< Tfloat > get_XYZtoLab (const bool use_D65=true) const
 Convert pixel values from XYZ to Lab color spaces [new-instance version].
 
CImg< T > & LabtoXYZ (const bool use_D65=true)
 Convert pixel values from Lab to XYZ color spaces.
 
CImg< Tfloat > get_LabtoXYZ (const bool use_D65=true) const
 Convert pixel values from Lab to XYZ color spaces [new-instance version].
 
CImg< T > & XYZtoxyY ()
 Convert pixel values from XYZ to xyY color spaces.
 
CImg< Tfloat > get_XYZtoxyY () const
 Convert pixel values from XYZ to xyY color spaces [new-instance version].
 
CImg< T > & xyYtoXYZ ()
 Convert pixel values from xyY pixels to XYZ color spaces.
 
CImg< Tfloat > get_xyYtoXYZ () const
 Convert pixel values from xyY pixels to XYZ color spaces [new-instance version].
 
CImg< T > & RGBtoLab (const bool use_D65=true)
 Convert pixel values from RGB to Lab color spaces.
 
CImg< Tfloat > get_RGBtoLab (const bool use_D65=true) const
 Convert pixel values from RGB to Lab color spaces [new-instance version].
 
CImg< T > & LabtoRGB (const bool use_D65=true)
 Convert pixel values from Lab to RGB color spaces.
 
CImg< Tuchar > get_LabtoRGB (const bool use_D65=true) const
 Convert pixel values from Lab to RGB color spaces [new-instance version].
 
CImg< T > & RGBtoxyY (const bool use_D65=true)
 Convert pixel values from RGB to xyY color spaces.
 
CImg< Tfloat > get_RGBtoxyY (const bool use_D65=true) const
 Convert pixel values from RGB to xyY color spaces [new-instance version].
 
CImg< T > & xyYtoRGB (const bool use_D65=true)
 Convert pixel values from xyY to RGB color spaces.
 
CImg< Tuchar > get_xyYtoRGB (const bool use_D65=true) 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].
 

Geometric / Spatial Manipulation

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].
 
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 unsigned 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 unsigned int boundary_conditions=0) const
 Shift image content [new-instance version].
 
CImg< T > & permute_axes (const char *const axes_order)
 Permute axes order. More...
 
CImg< T > get_permute_axes (const char *const axes_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_conditions=0)
 Rotate image with arbitrary angle. More...
 
CImg< T > get_rotate (const float angle, const unsigned int interpolation=1, const unsigned int boundary_conditions=0) const
 Rotate image with arbitrary angle [new-instance version].
 
CImg< T > & rotate (const float angle, const float cx, const float cy, const unsigned int interpolation, const unsigned int boundary_conditions=0)
 Rotate image with arbitrary angle, around a center point. More...
 
CImg< T > get_rotate (const float angle, const float cx, const float cy, const unsigned int interpolation, const unsigned int boundary_conditions=0) const
 Rotate image with arbitrary angle, around a center point [new-instance version].
 
CImg< T > rotate (const float u, const float v, const float w, const float angle, const unsigned int interpolation, const unsigned int boundary_conditions)
 Rotate volumetric image with arbitrary angle and axis. More...
 
CImg< T > get_rotate (const float u, const float v, const float w, const float angle, const unsigned int interpolation, const unsigned int boundary_conditions) const
 Rotate volumetric image with arbitrary angle and axis [new-instance version].
 
CImg< T > rotate (const float u, const float v, const float w, const float angle, const float cx, const float cy, const float cz, const unsigned int interpolation=1, const unsigned int boundary_conditions=0)
 Rotate volumetric image with arbitrary angle and axis, around a center point. More...
 
CImg< T > get_rotate (const float u, const float v, const float w, const float angle, const float cx, const float cy, const float cz, const unsigned int interpolation=1, const unsigned int boundary_conditions=0) const
 Rotate volumetric image with arbitrary angle and axis, around a center point [new-instance version].
 
template<typename t >
CImg< T > & warp (const CImg< t > &p_warp, const unsigned int mode=0, 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 > &p_warp, const unsigned int mode=0, 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 unsigned int boundary_conditions=0)
 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 unsigned int boundary_conditions=0) 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 unsigned int boundary_conditions=0)
 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 unsigned int boundary_conditions=0) const
 Crop image region [new-instance version].
 
CImg< T > & crop (const int x0, const int y0, const int x1, const int y1, const unsigned int boundary_conditions=0)
 Crop image region [overloading].
 
CImg< T > get_crop (const int x0, const int y0, const int x1, const int y1, const unsigned int boundary_conditions=0) const
 Crop image region [new-instance version].
 
CImg< T > & crop (const int x0, const int x1, const unsigned int boundary_conditions=0)
 Crop image region [overloading].
 
CImg< T > get_crop (const int x0, const int x1, const unsigned int boundary_conditions=0) 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].
 
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=-1) const
 Split image into a list along specified axis. More...
 
template<typename t >
CImgList< T > get_split (const CImg< t > &values, const char axis=0, const bool keep_values=true) const
 Split image into a list of sub-images, according to a specified splitting value sequence and optionally axis. More...
 
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].
 

Filtering / Transforms

static void FFT (CImg< T > &real, CImg< T > &imag, const char axis, const bool is_inverse=false, const unsigned int nb_threads=0)
 Compute 1D Fast Fourier Transform, along a specified axis. More...
 
static void FFT (CImg< T > &real, CImg< T > &imag, const bool is_inverse=false, const unsigned int nb_threads=0)
 Compute n-D Fast Fourier Transform. More...
 
template<typename t >
CImg< T > & correlate (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_normalized=false, const unsigned int channel_mode=1, const int xcenter=(int)(~0U >>1), const int ycenter=(int)(~0U >>1), const int zcenter=(int)(~0U >>1), const int xstart=0, const int ystart=0, const int zstart=0, const int xend=(int)(~0U >>1), const int yend=(int)(~0U >>1), const int zend=(int)(~0U >>1), const float xstride=1, const float ystride=1, const float zstride=1, const float xdilation=1, const float ydilation=1, const float zdilation=1, const bool interpolation_type=false)
 Correlate image by a kernel. More...
 
template<typename t >
CImg< typename cimg::superset2< T, t, float >::type > get_correlate (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_normalized=false, const unsigned int channel_mode=1, const int xcenter=(int)(~0U >>1), const int ycenter=(int)(~0U >>1), const int zcenter=(int)(~0U >>1), const int xstart=0, const int ystart=0, const int zstart=0, const int xend=(int)(~0U >>1), const int yend=(int)(~0U >>1), const int zend=(int)(~0U >>1), const float xstride=1, const float ystride=1, const float zstride=1, const float xdilation=1, const float ydilation=1, const float zdilation=1, const bool interpolation_type=false) const
 
template<typename t >
CImg< T > & convolve (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_normalized=false, const unsigned int channel_mode=1, const int xcenter=(int)(~0U >>1), const int ycenter=(int)(~0U >>1), const int zcenter=(int)(~0U >>1), const int xstart=0, const int ystart=0, const int zstart=0, const int xend=(int)(~0U >>1), const int yend=(int)(~0U >>1), const int zend=(int)(~0U >>1), const float xstride=1, const float ystride=1, const float zstride=1, const float xdilation=1, const float ydilation=1, const float zdilation=1, const bool interpolation_type=false)
 Convolve image by a kernel. More...
 
template<typename t >
CImg< typename cimg::superset2< T, t, float >::type > get_convolve (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_normalized=false, const unsigned int channel_mode=1, const int xcenter=(int)(~0U >>1), const int ycenter=(int)(~0U >>1), const int zcenter=(int)(~0U >>1), const int xstart=0, const int ystart=0, const int zstart=0, const int xend=(int)(~0U >>1), const int yend=(int)(~0U >>1), const int zend=(int)(~0U >>1), const float xstride=1, const float ystride=1, const float zstride=1, const float xdilation=1, const float ydilation=1, const float zdilation=1, const bool interpolation_type=false) const
 Convolve image by a kernel [new-instance version].
 
CImg< T > & cumulate (const char axis=0)
 Cumulate image values, optionally along specified axis. More...
 
CImg< Tlong > get_cumulate (const char axis=0) const
 Cumulate image values, optionally along specified axis [new-instance version].
 
CImg< T > & cumulate (const char *const axes)
 Cumulate image values, along specified axes. More...
 
CImg< Tlong > get_cumulate (const char *const axes) const
 Cumulate image values, along specified axes [new-instance version].
 
template<typename t >
CImg< T > & erode (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_real=false)
 Erode image by a structuring element. More...
 
template<typename t >
CImg< typename cimg::superset< T, t >::type > get_erode (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_real=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 > &kernel, const unsigned int boundary_conditions=1, const bool is_real=false)
 Dilate image by a structuring element. More...
 
template<typename t >
CImg< typename cimg::superset< T, t >::type > get_dilate (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_real=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 > & closing (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_real=false)
 Apply morphological closing by a structuring element. More...
 
template<typename t >
CImg< T > get_closing (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_real=false) const
 Apply morphological closing by a structuring element [new-instance version].
 
CImg< T > & closing (const unsigned int sx, const unsigned int sy, const unsigned int sz=1)
 Apply morphological closing by a rectangular structuring element of specified size.
 
CImg< T > get_closing (const unsigned int sx, const unsigned int sy, const unsigned int sz=1) const
 Apply morphological closing by a rectangular structuring element of specified size [new-instance version].
 
CImg< T > & closing (const unsigned int s)
 Apply morphological closing by a square structuring element of specified size. More...
 
CImg< T > get_closing (const unsigned int s) const
 Apply morphological closing by a square structuring element of specified size [new-instance version].
 
template<typename t >
CImg< T > & opening (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_real=false)
 Apply morphological opening by a structuring element. More...
 
template<typename t >
CImg< T > get_opening (const CImg< t > &kernel, const unsigned int boundary_conditions=1, const bool is_real=false) const
 Apply morphological opening by a structuring element [new-instance version].
 
CImg< T > & opening (const unsigned int sx, const unsigned int sy, const unsigned int sz=1)
 Apply morphological opening by a rectangular structuring element of specified size.
 
CImg< T > get_opening (const unsigned int sx, const unsigned int sy, const unsigned int sz=1) const
 Apply morphological opening by a rectangular structuring element of specified size [new-instance version].
 
CImg< T > & opening (const unsigned int s)
 Apply morphological opening by a square structuring element of specified size. More...
 
CImg< T > get_opening (const unsigned int s) const
 Apply morphological opening by a square structuring element of specified size [new-instance version].
 
template<typename t >
CImg< T > & watershed (const CImg< t > &priority, const bool is_high_connectivity=false)
 Compute watershed transform. More...
 
template<typename t >
CImg< T > get_watershed (const CImg< t > &priority, const bool is_high_connectivity=false) const
 Compute watershed transform [new-instance version].
 
CImg< T > & deriche (const float sigma, const unsigned int order=0, const char axis='x', const unsigned int boundary_conditions=1)
 Apply recursive Deriche filter. More...
 
CImg< Tfloat > get_deriche (const float sigma, const unsigned int order=0, const char axis='x', const unsigned int boundary_conditions=1) const
 Apply recursive Deriche filter [new-instance version].
 
CImg< T > & vanvliet (const float sigma, const unsigned int order, const char axis='x', const unsigned int boundary_conditions=1)
 Van Vliet recursive Gaussian filter. More...
 
CImg< Tfloat > get_vanvliet (const float sigma, const unsigned int order, const char axis='x', const unsigned int boundary_conditions=1) 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 unsigned int boundary_conditions=1, const bool is_gaussian=true)
 Blur image. More...
 
CImg< Tfloat > get_blur (const float sigma_x, const float sigma_y, const float sigma_z, const unsigned int boundary_conditions=1, const bool is_gaussian=true) const
 Blur image [new-instance version].
 
CImg< T > & blur (const float sigma, const unsigned int boundary_conditions=1, const bool is_gaussian=true)
 Blur image isotropically. More...
 
CImg< Tfloat > get_blur (const float sigma, const unsigned int boundary_conditions=1, const bool is_gaussian=true) 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< Tfloat > 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< Tfloat > 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 float sampling_x, const float sampling_y, const float sampling_z, const float sampling_r)
 Blur image, with the joint bilateral filter. More...
 
template<typename t >
CImg< Tfloat > get_blur_bilateral (const CImg< t > &guide, const float sigma_x, const float sigma_y, const float sigma_z, const float sigma_r, const float sampling_x, const float sampling_y, const float sampling_z, const float sampling_r) 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 float sampling_s=0, const float sampling_r=0)
 Blur image using the joint bilateral filter. More...
 
template<typename t >
CImg< Tfloat > get_blur_bilateral (const CImg< t > &guide, const float sigma_s, const float sigma_r, const float sampling_s=0, const float sampling_r=0) const
 Blur image using the bilateral filter [new-instance version].
 
CImg< T > & boxfilter (const float boxsize, const int order, const char axis='x', const unsigned int boundary_conditions=1, const unsigned int nb_iter=1)
 
CImg< Tfloat > get_boxfilter (const float boxsize, const int order, const char axis='x', const unsigned int boundary_conditions=1, const unsigned int nb_iter=1) const
 
CImg< T > & blur_box (const float boxsize_x, const float boxsize_y, const float boxsize_z, const unsigned int boundary_conditions=1, const unsigned int nb_iter=1)
 Blur image with a box filter. More...
 
CImg< Tfloat > get_blur_box (const float boxsize_x, const float boxsize_y, const float boxsize_z, const unsigned int boundary_conditions=1) const
 Blur image with a box filter [new-instance version].
 
CImg< T > & blur_box (const float boxsize, const unsigned int boundary_conditions=1)
 Blur image with a box filter. More...
 
CImg< Tfloat > get_blur_box (const float boxsize, const unsigned int boundary_conditions=1) const
 Blur image with a box filter [new-instance version].
 
template<typename t >
CImg< T > & blur_guided (const CImg< t > &guide, const float radius, const float regularization)
 Blur image, with the image guided filter. More...
 
template<typename t >
CImg< Tfloat > get_blur_guided (const CImg< t > &guide, const float radius, const float regularization) const
 Blur image, with the image guided filter [new-instance version].
 
template<typename t >
CImg< T > & blur_patch (const CImg< t > &guide, const float sigma_s, const float sigma_r, 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...
 
template<typename t >
CImg< Tfloat > get_blur_patch (const CImg< t > &guide, const float sigma_s, const float sigma_r, 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_patch (const float sigma_s, const float sigma_r, 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 [simplification].
 
CImg< Tfloat > get_blur_patch (const float sigma_s, const float sigma_r, 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 [simplification] [new-instance version].
 
CImg< T > & blur_median (const unsigned int n, const float threshold=0)
 Blur image with the median filter. More...
 
CImg< T > get_blur_median (const unsigned int n, const float threshold=0) 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=0) 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 bool is_fwbw_scheme=false)
 Compute the structure tensor field of an image. More...
 
CImg< Tfloat > get_structure_tensors (const bool is_fwbw_scheme=false) 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.f, const unsigned int nb_scales=0, const unsigned int iteration_max=10000, const bool is_backward=false, const CImg< floatT > &guide=CImg< floatT >::const_empty())
 Estimate displacement field between two images. More...
 
CImg< floatT > get_displacement (const CImg< T > &source, const float smoothness=0.1f, const float precision=5.f, const unsigned int nb_scales=0, const unsigned int iteration_max=10000, const bool is_backward=false, const CImg< floatT > &guide=CImg< floatT >::const_empty()) const
 Estimate displacement field between two images [new-instance version].
 
template<typename t1 , typename t2 >
CImg< T > & matchpatch (const CImg< T > &patch_image, const unsigned int patch_width, const unsigned int patch_height, const unsigned int patch_depth, const unsigned int nb_iterations, const unsigned int nb_randoms, const float patch_penalization, const CImg< t1 > &guide, CImg< t2 > &matching_score)
 Compute correspondence map between two images, using a patch-matching algorithm. More...
 
template<typename t1 , typename t2 >
CImg< intT > get_matchpatch (const CImg< T > &patch_image, const unsigned int patch_width, const unsigned int patch_height, const unsigned int patch_depth, const unsigned int nb_iterations, const unsigned int nb_randoms, const float patch_penalization, const CImg< t1 > &guide, CImg< t2 > &matching_score) const
 Compute correspondence map between two images, using the patch-match algorithm [new-instance version].
 
template<typename t >
CImg< T > & matchpatch (const CImg< T > &patch_image, const unsigned int patch_width, const unsigned int patch_height, const unsigned int patch_depth, const unsigned int nb_iterations=5, const unsigned int nb_randoms=5, const float patch_penalization=0, const CImg< t > &guide=CImg< t >::const_empty())
 Compute correspondence map between two images, using the patch-match algorithm [overloading].
 
template<typename t >
CImg< intT > get_matchpatch (const CImg< T > &patch_image, const unsigned int patch_width, const unsigned int patch_height, const unsigned int patch_depth, const unsigned int nb_iterations=5, const unsigned int nb_randoms=5, const float patch_penalization=0, const CImg< t > &guide=CImg< t >::const_empty()) const
 Compute correspondence map between two images, using the patch-match algorithm [overloading].
 
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 >
CImg< T > & distance_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_inverse=false) const
 Compute 1D Fast Fourier Transform, along a specified axis. More...
 
CImgList< Tfloat > get_FFT (const bool is_inverse=false) const
 Compute n-D Fast Fourier Transform.
 

3D Objects Management

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 isolines of a function, as a 3D object. More...
 
template<typename tv , typename tf , typename tfunc >
static void isoline3d (tv &add_vertex, tf &add_segment, const tfunc &func, const float isovalue, const float x0, const float y0, const float x1, const float y1, const int size_x, const int size_y)
 Compute 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 tv , typename tf , typename tfunc >
static void isosurface3d (tv &add_vertex, tf &add_triangle, 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, const int size_y, const int size_z)
 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 , 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 >
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...
 
CImg< T > & rotate_object3d (const float x, const float y, const float z, const float w, const bool is_quaternion=false)
 Rotate 3D object's vertices. More...
 
CImg< Tfloat > get_rotate_object3d (const float x, const float y, const float z, const float w, const bool is_quaternion=false) const
 
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 >::const_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].
 

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 (int x0, int y0, int x1, 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, int x0, int y0, const float z0, int x1, 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 (int x0, int y0, int x1, int y1, const CImg< tc > &texture, int tx0, int ty0, int tx1, 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 (int x0, int y0, const float z0, int x1, 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, int x0, int y0, const float z0, int x1, 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 tp , typename tc >
CImg< T > & draw_line (const CImg< tp > &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 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, int x0, int y0, const float z0, int x1, int y1, const float z1, int x2, 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 (int x0, int y0, int x1, int y1, int x2, int y2, const tc *const color, float bs0, float bs1, float bs2, const float opacity=1)
 Draw a Gouraud-shaded 2D triangle. More...
 
template<typename tz , typename tc >
CImg< T > & draw_triangle (CImg< tz > &zbuffer, int x0, int y0, const float z0, int x1, int y1, const float z1, int x2, int y2, const float z2, const tc *const color, float bs0, float bs1, float bs2, float opacity=1)
 Draw a Gouraud-shaded 2D triangle, with z-buffering [overloading].
 
template<typename tc >
CImg< T > & draw_triangle (int x0, int y0, int x1, int y1, int x2, int y2, const tc *color0, const tc *color1, const tc *color2, const float opacity=1)
 Draw a color-interpolated 2D triangle. More...
 
template<typename tc >
CImg< T > & draw_triangle (int x0, int y0, int x1, int y1, int x2, int y2, const CImg< tc > &texture, int tx0, int ty0, int tx1, int ty1, int tx2, int ty2, const float opacity=1, const float brightness=1)
 Draw a textured 2D triangle. More...
 
template<typename tc >
CImg< T > & draw_triangle (int x0, int y0, const float z0, int x1, int y1, const float z1, int x2, int y2, const float z2, const CImg< tc > &texture, int tx0, int ty0, int tx1, int ty1, int tx2, 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, int x0, int y0, const float z0, int x1, int y1, const float z1, int x2, int y2, const float z2, const CImg< tc > &texture, int tx0, int ty0, int tx1, int ty1, int tx2, 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 (int x0, int y0, int x1, int y1, int x2, int y2, const tc *const color, const CImg< tl > &light, int lx0, int ly0, int lx1, int ly1, int lx2, 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, int x0, int y0, const float z0, int x1, int y1, const float z1, int x2, int y2, const float z2, const tc *const color, const CImg< tl > &light, int lx0, int ly0, int lx1, int ly1, int lx2, int ly2, const float opacity=1)
 Draw a Phong-shaded 2D triangle, with z-buffering.
 
template<typename tc >
CImg< T > & draw_triangle (int x0, int y0, int x1, int y1, int x2, int y2, const CImg< tc > &texture, int tx0, int ty0, int tx1, int ty1, int tx2, int ty2, float bs0, float bs1, float bs2, const float opacity=1)
 Draw a textured Gouraud-shaded 2D triangle. More...
 
template<typename tc >
CImg< T > & draw_triangle (int x0, int y0, const float z0, int x1, int y1, const float z1, int x2, int y2, const float z2, const CImg< tc > &texture, int tx0, int ty0, int tx1, int ty1, int tx2, int ty2, float bs0, float bs1, float bs2, 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, int x0, int y0, const float z0, int x1, int y1, const float z1, int x2, int y2, const float z2, const CImg< tc > &texture, int tx0, int ty0, int tx1, int ty1, int tx2, int ty2, float bs0, float bs1, float bs2, 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 (int x0, int y0, int x1, int y1, int x2, int y2, const CImg< tc > &texture, int tx0, int ty0, int tx1, int ty1, int tx2, int ty2, const CImg< tl > &light, int lx0, int ly0, int lx1, int ly1, int lx2, int ly2, const float opacity=1)
 Draw a textured Phong-shaded 2D triangle. More...
 
template<typename tc , typename tl >
CImg< T > & draw_triangle (int x0, int y0, const float z0, int x1, int y1, const float z1, int x2, int y2, const float z2, const CImg< tc > &texture, int tx0, int ty0, int tx1, int ty1, int tx2, int ty2, const CImg< tl > &light, int lx0, int ly0, int lx1, int ly1, int lx2, 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, int x0, int y0, const float z0, int x1, int y1, const float z1, int x2, int y2, const float z2, const CImg< tc > &texture, int tx0, int ty0, int tx1, int ty1, int tx2, int ty2, const CImg< tl > &light, int lx0, int ly0, int lx1, int ly1, int lx2, 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 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 tp , typename tc >
CImg< T > & draw_polygon (const CImg< tp > &points, const tc *const color, const float opacity=1)
 Draw a filled 2D polygon. More...
 
template<typename tp , typename tc >
CImg< T > & draw_polygon (const CImg< tp > &points, const tc *const color, const float opacity, const unsigned int pattern)
 Draw a outlined 2D or 3D 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 > *const 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 > *const 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 > *const 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, const float round_x=0)
 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, const float round_y=0)
 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, const float round_x=0, const float round_y=0)
 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 x0, const int y0, const int z0, const tc *const color, const float opacity, CImg< t > &region, const float tolerance=0, const bool is_high_connectivity=false)
 Draw filled 3D region with the flood fill algorithm. More...
 
template<typename tc >
CImg< T > & draw_fill (const int x0, const int y0, const int z0, const tc *const color, const float opacity=1, const float tolerance=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 x0, const int y0, const tc *const color, const float opacity=1, const float tolerance=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, const float g_opacity=1)
 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, const float g_opacity, 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, const float g_opacity=1)
 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, const float g_opacity, 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, const float g_opacity=1)
 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, const float g_opacity, CImg< tz > &zbuffer)
 Draw a 3D object [simplification].
 

Data Input

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, unsigned int *const bits_per_value=0)
 Load image from a PNG file [new-instance version].
 
static CImg< T > get_load_png (std::FILE *const file, unsigned int *const bits_per_value=0)
 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, unsigned int *const bits_per_value=0, float *const voxel_size=0, CImg< charT > *const description=0)
 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 ulongT 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 ulongT offset=0)
 Load image from a raw binary file [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 chroma_subsampling=444, 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 chroma_subsampling=444, 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_video (const char *const filename, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1, const char axis='z', const float align=0)
 Load image sequence from a video file, using OpenCV library [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_heif (const char *const filename)
 Load image from a HEIC file [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 Medcon's external tool 'medcon' [new-instance version].
 
static CImg< T > get_load_pdf_external (const char *const filename, const unsigned int resolution=400)
 Load image from a .pdf file [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 capture_width=0, const unsigned int capture_height=0, const unsigned int skip_frames=0, const bool release_camera=true)
 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].
 
CImg< T > & select (CImgDisplay &disp, const unsigned int feature_type=2, unsigned int *const XYZ=0, const bool exit_on_anykey=false, const bool is_deep_selection_default=false)
 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, const bool exit_on_anykey=false, const bool is_deep_selection_default=false)
 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 bool exit_on_anykey=false, const bool is_deep_selection_default=false) 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 bool exit_on_anykey=false, const bool is_deep_selection_default=false) 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 bool exit_on_anykey=false) 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, unsigned int *const bits_per_value=0)
 Load image from a PNG file. More...
 
CImg< T > & load_png (std::FILE *const file, unsigned int *const bits_per_value=0)
 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, unsigned int *const bits_per_value=0, float *const voxel_size=0, CImg< charT > *const description=0)
 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 ulongT 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 ulongT offset=0)
 Load image from a raw binary file [overloading].
 
CImg< T > & load_yuv (const char *const filename, const unsigned int size_x, const unsigned int size_y=1, const unsigned int chroma_subsampling=444, 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 chroma_subsampling=444, 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_video (const char *const filename, const unsigned int first_frame=0, const unsigned int last_frame=~0U, const unsigned int step_frame=1, const char axis='z', const float align=0)
 Load image sequence from a video file, using OpenCV library. More...
 
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_heif (const char *const filename)
 Load image from a HEIC file. 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 Medcon's external tool 'medcon'. More...
 
CImg< T > & load_pdf_external (const char *const filename, const unsigned int resolution=400)
 Load image from a .pdf file. 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 capture_width=0, const unsigned int capture_height=0, const unsigned int skip_frames=0, const bool release_camera=true)
 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...
 

Data Output

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...
 
const CImg< T > & print (const char *const title=0, const bool display_stats=true) const
 Display information 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 bool exit_on_anykey=false) 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 float *const voxel_size=0, const char *const description=0, const bool use_bigtiff=true) 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_yuv (const char *const filename, const unsigned int chroma_subsampling=444, const bool is_rgb=true) const
 Save image as a .yuv video file. More...
 
const CImg< T > & save_yuv (std::FILE *const file, const unsigned int chroma_subsampling=444, 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_video (const char *const filename, const unsigned int fps=25, const char *codec=0, const bool keep_open=false) const
 Save volumetric image as a video (using the OpenCV library when available). More...
 
const CImg< T > & save_ffmpeg_external (const char *const filename, const unsigned int fps=25, const char *const codec=0, 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
 
CImg< ucharT > get_serialize (const bool is_compressed=false, const unsigned int header_size=0) const
 Serialize a CImg<T> instance into a raw CImg<unsigned char> buffer. More...
 

Detailed Description

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

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

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

Image representation

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

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

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

Image structure

The CImg<T> structure contains six fields:

  • _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); constructs a 256x256 color image from a unsigned char* buffer data_buffer (where R,G,B channels follow each others).

    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

◆ iterator

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
// Set all pixels to '0', with a CImg iterator.
for (CImg<float>::iterator it = img.begin(), it<img.end(); ++it) *it = 0;
img.fill(0); // Do the same with a built-in method

◆ value_type

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()

~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() [1/13]

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() [2/13]

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
  • The allocated pixel buffer is not filled with a default value, and is likely to contain garbage values. In order to initialize pixel values during construction (e.g. with 0), use constructor CImg(unsigned int,unsigned int,unsigned int,unsigned int,T) instead.
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() [3/13]

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() [4/13]

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();

◆ CImg() [5/13]

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
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() [6/13]

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 from a value sequence
img2(129,129,1,3,"if(c==0,255*abs(cos(x/10)),1.8*y)",false); // Construct image from a formula
(img1,img2).display();

◆ CImg() [7/13]

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] = {};
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() [8/13]

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 higlhy 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();

◆ CImg() [9/13]

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() [10/13]

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() [11/13]

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
  • Similar to CImg(unsigned int,unsigned int,unsigned int,unsigned int), but it takes the image dimensions (not its pixel values) from an existing CImg<t> instance.
  • The allocated pixel buffer is not filled with a default value, and is likely to contain garbage values. In order to initialize pixel values (e.g. with 0), use constructor CImg(const CImg<t>&,const char*,T) instead.
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() [12/13]

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() [13/13]

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

◆ assign() [1/13]

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.

◆ assign() [2/13]

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).

◆ assign() [3/13]

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).

◆ assign() [4/13]

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,...).

◆ assign() [5/13]

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,...).

◆ assign() [6/13]

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).

◆ assign() [7/13]

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).

◆ assign() [8/13]

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*).

◆ assign() [9/13]

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

Construct image copy [in-place version].

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

◆ assign() [10/13]

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).

◆ assign() [11/13]

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*).

◆ assign() [12/13]

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).

◆ assign() [13/13]

CImg<T>& assign ( const CImgDisplay disp)

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

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

◆ clear()

CImg<T>& clear ( )

Construct empty image [in-place version].

Equivalent to assign().

Note
  • It has been defined for compatibility with STL naming conventions.

◆ move_to() [1/2]

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

◆ move_to() [2/2]

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 optional parameter pos is omitted, the image instance is transferred 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)

◆ swap()

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'

◆ empty()

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());

◆ operator()() [1/2]

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 debugging 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

◆ operator()() [2/2]

T& operator() ( const unsigned int  x,
const unsigned int  y,
const unsigned int  z,
const unsigned int  c,
const ulongT  wh,
const ulongT  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*()

operator T* ( )

Implicitly cast an image into a T*.

Implicitly 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)

◆ operator=() [1/4]

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')

◆ operator=() [2/4]

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 3 scalar images 100x100 with uninitialized 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();

◆ operator=() [3/4]

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>&).

◆ operator=() [4/4]

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

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

Similar to assign(const CImgDisplay&).

◆ operator+=() [1/3]

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();

◆ operator+=() [2/3]

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.

◆ operator+=() [3/3]

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 periodically. 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)
// Construct a scalar shading (img2.spectrum()==1).
const CImg<float> img2(img1.width(),img.height(),1,1,"255*(x/w)^2");
img1+=img2; // Add shading to each channel of 'img1'
img1.cut(0,255); // Prevent [0,255] overflow
(img2,img1).display();

◆ operator++() [1/2]

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.

◆ operator++() [2/2]

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.

◆ operator+() [1/4]

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 information about the shared state of the input image.
  • Writing (+img) is equivalent to CImg<T>(img,false).

◆ operator+() [2/4]

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.

◆ operator+() [3/4]

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.

◆ operator+() [4/4]

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.

◆ operator-=() [1/3]

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

In-place subtraction operator.

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

◆ operator-=() [2/3]

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

In-place subtraction operator.

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

◆ operator-=() [3/3]

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

In-place subtraction operator.

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

◆ operator--() [1/2]

CImg<T>& operator-- ( )

In-place decrement operator (prefix).

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

◆ operator--() [2/2]

CImg<T> operator-- ( int  )

In-place decrement operator (postfix).

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

◆ operator-() [1/4]

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();

◆ operator-() [2/4]

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

Subtraction 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.

◆ operator-() [3/4]

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

Subtraction 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.

◆ operator-() [4/4]

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

Subtraction 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.

◆ operator*=() [1/3]

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.

◆ operator*=() [2/3]

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.

◆ operator*=() [3/3]

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].

◆ operator*() [1/3]

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.

◆ operator*() [2/3]

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.

◆ operator*() [3/3]

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.

◆ operator/=() [1/3]

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.

◆ operator/=() [2/3]

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.

◆ operator/=() [3/3]

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.

◆ operator/() [1/3]

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.

◆ operator/() [2/3]

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.

◆ operator/() [3/3]

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.

◆ operator%=() [1/3]

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.

◆ operator%=() [2/3]

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.

◆ operator%=() [3/3]

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.

◆ operator%() [1/3]

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.

◆ operator%() [2/3]

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.

◆ operator%() [3/3]

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.

◆ operator&=() [1/3]

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.

◆ operator&=() [2/3]

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.

◆ operator&=() [3/3]

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.

◆ operator&() [1/3]

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.

◆ operator&() [2/3]

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.

◆ operator&() [3/3]

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.

◆ operator|=() [1/3]

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.

◆ operator|=() [2/3]

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.

◆ operator|=() [3/3]

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.

◆ operator|() [1/3]

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.

◆ operator|() [2/3]

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.

◆ operator|() [3/3]

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.

◆ operator^=() [1/3]

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.

◆ operator^=() [2/3]

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.

◆ operator^=() [3/3]

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.

◆ operator^() [1/3]

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.

◆ operator^() [2/3]

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.

◆ operator^() [3/3]

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.

◆ operator<<=() [1/3]

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.

◆ operator<<=() [2/3]

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.

◆ operator<<=() [3/3]

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.

◆ operator<<() [1/3]

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.

◆ operator<<() [2/3]

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.

◆ operator<<() [3/3]

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.

◆ operator>>=() [1/3]

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.

◆ operator>>=() [2/3]

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.

◆ operator>>=() [3/3]

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.

◆ operator>>() [1/3]

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.

◆ operator>>() [2/3]

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.

◆ operator>>() [3/3]

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.

◆ operator~()

CImg<T> operator~ ( ) const

Bitwise inversion operator.

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

◆ operator==() [1/3]

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.

◆ operator==() [2/3]

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.

◆ operator==() [3/3]

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 pixel values, even if the dimensions of the two images do not match. It returns 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.");
}

◆ operator!=() [1/3]

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.

◆ operator!=() [2/3]

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.

◆ operator!=() [3/3]

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).

◆ operator,() [1/2]

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'

◆ operator,() [2/2]

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

◆ operator<()

CImgList<T> operator< ( const char  axis) const

Split image along specified axis.

Return a new list of images (CImgList instance) containing the split 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();

◆ pixel_type()

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 does not contain any spaces.
  • If the pixel type T does not correspond to a registered type, the string "unknown" is returned.

◆ width()

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.

◆ height()

int height ( ) const

Return the number of image rows.

Return the image height, i.e. the image dimension along the Y-axis.

Note
  • The height() of an empty image is equal to 0.
  • height() returns an int, although the image height 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)._height.

◆ depth()

int depth ( ) const

Return the number of image slices.

Return the image depth, i.e. the image dimension along the Z-axis.

Note
  • The depth() of an empty image is equal to 0.
  • depth() is typically equal to 1 when considering usual 2D images. When depth()> 1, the image is said to be volumetric.
  • depth() returns an int, although the image depth 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)._depth.

◆ spectrum()

int spectrum ( ) const

Return the number of image channels.

Return the number of image channels, i.e. the image dimension along the C-axis.

Note
  • The spectrum() of an empty image is equal to 0.
  • spectrum() is typically equal to 1 when considering scalar-valued images, to 3 for RGB-coded color images, and to 4 for RGBA-coded color images (with alpha-channel). The number of channels of an image instance is not limited. The meaning of the pixel values is not linked up to the number of channels (e.g. a 4-channel image may indifferently stands for a RGBA or CMYK color image).
  • spectrum() returns an int, although the image spectrum 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)._spectrum.

◆ size()

ulongT size ( ) const

Return the total number of pixel values.

Return width()*height()*depth()*spectrum(), i.e. the total number of values of type T in the pixel buffer of the image instance.

Note
  • The size() of an empty image is equal to 0.
  • The allocated memory size for a pixel buffer of a non-shared CImg<T> instance is equal to size()*sizeof(T).
Example
const CImg<float> img(100,100,1,3); // Construct new 100x100 color image
if (img.size()==30000) // Test succeeds
std::printf("Pixel buffer uses %lu bytes",
img.size()*sizeof(float));

◆ data() [1/2]

T* data ( )

Return a pointer to the first pixel value.

Return a T*, or a const T* pointer to the first value in the pixel buffer of the image instance, whether the instance is const or not.

Note

◆ data() [2/2]

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.

Return a T*, or a const T* pointer to the value located at (x,y,z,c) in the pixel buffer of the image instance, whether the instance is const or not.

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

◆ offset()

longT 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.

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
Example
const CImg<float> img(100,100,1,3); // Define a 100x100 RGB-color image
const long off = img.offset(10,10,0,2); // Get the offset of the blue value of the pixel located at (10,10)
const float val = img[off]; // Get the blue value of this pixel

◆ begin()

iterator begin ( )

Return a CImg<T>::iterator pointing to the first pixel value.

Note
  • Equivalent to data().
  • It has been mainly defined for compatibility with STL naming conventions.

◆ end()

iterator end ( )

Return a CImg<T>::iterator pointing next to the last pixel value.

Note
  • Writing img.end() is equivalent to img.data() + img.size().
  • It has been mainly defined for compatibility with STL naming conventions.
Warning
  • The returned iterator actually points to a value located outside the acceptable bounds of the pixel buffer. Trying to read or write the content of the returned iterator will probably result in a crash. Use it mainly as a strict upper bound for a CImg<T>::iterator.
Example
CImg<float> img(100,100,1,3); // Define a 100x100 RGB color image
// 'img.end()' used below as an upper bound for the iterator.
for (CImg<float>::iterator it = img.begin(); it<img.end(); ++it)
*it = 0;

◆ front()

T& front ( )

Return a reference to the first pixel value.

Note
  • Writing img.front() is equivalent to img[0], or img(0,0,0,0).
  • It has been mainly defined for compatibility with STL naming conventions.

◆ back()

T& back ( )

Return a reference to the last pixel value.

Note
  • Writing img.back() is equivalent to img[img.size() - 1], or img(img.width() - 1,img.height() - 1,img.depth() - 1,img.spectrum() - 1).
  • It has been mainly defined for compatibility with STL naming conventions.

◆ at() [1/2]

T& at ( const int  offset,
const T &  out_value 
)

Access to a pixel value at a specified offset, using Dirichlet boundary conditions.

Return a reference to the pixel value of the image instance located at a specified offset, or to a specified default value in case of out-of-bounds access.

Parameters
offsetOffset to the desired pixel value.
out_valueDefault value returned if offset is outside image bounds.
Note
  • Writing img.at(offset,out_value) is similar to img[offset], except that if offset is outside bounds (e.g. offset<0 or offset>=img.size()), a reference to a value out_value is safely returned instead.
  • Due to the additional boundary checking operation, this method is slower than operator()(). Use it when you are not sure about the validity of the specified pixel offset.

◆ at() [2/2]

T& at ( const int  offset)

Access to a pixel value at a specified offset, using Neumann boundary conditions.

Return a reference to the pixel value of the image instance located at a specified offset, or to the nearest pixel location in the image instance in case of out-of-bounds access.

Parameters
offsetOffset to the desired pixel value.
Note
  • Similar to at(int,const T), except that an out-of-bounds access returns the value of the nearest pixel in the image instance, regarding the specified offset, i.e.
    • If offset<0, then img[0] is returned.
    • If offset>=img.size(), then img[img.size() - 1] is returned.
  • Due to the additional boundary checking operation, this method is slower than operator()(). Use it when you are not sure about the validity of the specified pixel offset.
  • If you know your image instance is not empty, you may rather use the slightly faster method _at(int).

◆ atX() [1/2]

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.

Return a reference to the pixel value of the image instance located at (x,y,z,c), or to a specified default value in case of out-of-bounds access along the X-axis.

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.
out_valueDefault value returned if (x,y,z,c) is outside image bounds.
Note
  • Similar to operator()(), except that an out-of-bounds access along the X-axis returns the specified value out_value.
  • Due to the additional boundary checking operation, this method is slower than operator()(). Use it when you are not sure about the validity of the specified pixel coordinates.
Warning
  • There is no boundary checking performed for the Y,Z and C-coordinates, so they must be inside image bounds.

◆ atX() [2/2]

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.

Return a reference to the pixel value of the image instance located at (x,y,z,c), or to the nearest pixel location in the image instance in case of out-of-bounds access along the X-axis.

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
  • Similar to at(int,int,int,int,const T), except that an out-of-bounds access returns the value of the nearest pixel in the image instance, regarding the specified X-coordinate.
  • Due to the additional boundary checking operation, this method is slower than operator()(). Use it when you are not sure about the validity of the specified pixel coordinates.
  • If you know your image instance is not empty, you may rather use the slightly faster method _at(int,int,int,int).
Warning
  • There is no boundary checking performed for the Y,Z and C-coordinates, so they must be inside image bounds.

◆ atXY() [1/2]

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.

Similar to atX(int,int,int,int,const T), except that boundary checking is performed both on X and Y-coordinates.

◆ atXY() [2/2]

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.

Similar to atX(int,int,int,int), except that boundary checking is performed both on X and Y-coordinates.

Note
  • If you know your image instance is not empty, you may rather use the slightly faster method _atXY(int,int,int,int).

◆ atXYZ() [1/2]

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.

Similar to atX(int,int,int,int,const T), except that boundary checking is performed both on X,Y and Z-coordinates.

◆ atXYZ() [2/2]

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.

Similar to atX(int,int,int,int), except that boundary checking is performed both on X,Y and Z-coordinates.

Note
  • If you know your image instance is not empty, you may rather use the slightly faster method _atXYZ(int,int,int,int).

◆ atXYZC() [1/2]

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.

Similar to atX(int,int,int,int,const T), except that boundary checking is performed on all X,Y,Z and C-coordinates.

◆ atXYZC() [2/2]

T& atXYZC ( const int  x,
const int  y,
const int  z,
const int  c 
)

Access to a pixel value, using Neumann boundary conditions.

Similar to atX(int,int,int,int), except that boundary checking is performed on all X,Y,Z and C-coordinates.

Note
  • If you know your image instance is not empty, you may rather use the slightly faster method _atXYZC(int,int,int,int).

◆ linear_atX() [1/2]

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.

Return a linearly-interpolated pixel value of the image instance located at (fx,y,z,c), or a specified default value in case of out-of-bounds access along the X-axis.

Parameters
fxX-coordinate of the pixel value (float-valued).
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.
cC-coordinate of the pixel value.
out_valueDefault value returned if (fx,y,z,c) is outside image bounds.
Note
  • Similar to atX(int,int,int,int,const T), except that the returned pixel value is approximated by a linear interpolation along the X-axis, if corresponding coordinates are not integers.
  • The type of the returned pixel value is extended to float, if the pixel type T is not float-valued.
Warning
  • There is no boundary checking performed for the Y,Z and C-coordinates, so they must be inside image bounds.

◆ linear_atX() [2/2]

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.

Return a linearly-interpolated pixel value of the image instance located at (fx,y,z,c), or the value of the nearest pixel location in the image instance in case of out-of-bounds access along the X-axis.

Parameters
fxX-coordinate of the pixel value (float-valued).
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.
cC-coordinate of the pixel value.
Note
  • Similar to linear_atX(float,int,int,int,const T) const, except that an out-of-bounds access returns the value of the nearest pixel in the image instance, regarding the specified X-coordinate.
  • If you know your image instance is not empty, you may rather use the slightly faster method _linear_atX(float,int,int,int).
Warning
  • There is no boundary checking performed for the Y,Z and C-coordinates, so they must be inside image bounds.

◆ linear_atXY() [1/2]

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.

Similar to linear_atX(float,int,int,int,const T) const, except that the linear interpolation and the boundary checking are achieved both for X and Y-coordinates.

◆ linear_atXY() [2/2]

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.

Similar to linear_atX(float,int,int,int) const, except that the linear interpolation and the boundary checking are achieved both for X and Y-coordinates.

Note
  • If you know your image instance is not empty, you may rather use the slightly faster method _linear_atXY(float,float,int,int).

◆ linear_atXYZ() [1/2]

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.

Similar to linear_atX(float,int,int,int,const T) const, except that the linear interpolation and the boundary checking are achieved both for X,Y and Z-coordinates.

◆ linear_atXYZ() [2/2]

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.

Similar to linear_atX(float,int,int,int) const, except that the linear interpolation and the boundary checking are achieved both for X,Y and Z-coordinates.

Note
  • If you know your image instance is not empty, you may rather use the slightly faster method _linear_atXYZ(float,float,float,int).

◆ linear_atXYZC() [1/2]

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,C-coordinates.

Similar to linear_atX(float,int,int,int,const T) const, except that the linear interpolation and the boundary checking are achieved for all X,Y,Z and C-coordinates.

◆ linear_atXYZC() [2/2]

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.

Similar to linear_atX(float,int,int,int) const, except that the linear interpolation and the boundary checking are achieved for all X,Y,Z and C-coordinates.

Note
  • If you know your image instance is not empty, you may rather use the slightly faster method _linear_atXYZC(float,float,float,float).

◆ cubic_atX() [1/2]

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.

Return a cubicly-interpolated pixel value of the image instance located at (fx,y,z,c), or a specified default value in case of out-of-bounds access along the X-axis. The cubic interpolation uses Hermite splines.

Parameters
fxd X-coordinate of the pixel value (float-valued).
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.
cC-coordinate of the pixel value.
out_valueDefault value returned if (fx,y,z,c) is outside image bounds.
Note
  • Similar to linear_atX(float,int,int,int,const T) const, except that the returned pixel value is approximated by a cubic interpolation along the X-axis.
  • The type of the returned pixel value is extended to float, if the pixel type T is not float-valued.
Warning
  • There is no boundary checking performed for the Y,Z and C-coordinates, so they must be inside image bounds.

◆ cubic_atX_c() [1/2]

T cubic_atX_c ( const float  fx,
const int  y,
const int  z,
const int  c,
const T &  out_value 
) const

Return clamped pixel value, using cubic interpolation and Dirichlet boundary conditions for the X-coordinate.

Similar to cubic_atX(float,int,int,int,const T) const, except that the return value is clamped to stay in the min/max range of the datatype T.

◆ cubic_atX() [2/2]

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.

Return a cubicly-interpolated pixel value of the image instance located at (fx,y,z,c), or the value of the nearest pixel location in the image instance in case of out-of-bounds access along the X-axis. The cubic interpolation uses Hermite splines.

Parameters
fxX-coordinate of the pixel value (float-valued).
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.
cC-coordinate of the pixel value.
Note
  • Similar to cubic_atX(float,int,int,int,const T) const, except that the returned pixel value is approximated by a cubic interpolation along the X-axis.
  • If you know your image instance is not empty, you may rather use the slightly faster method _cubic_atX(float,int,int,int).
Warning
  • There is no boundary checking performed for the Y,Z and C-coordinates, so they must be inside image bounds.

◆ cubic_atX_c() [2/2]

T cubic_atX_c ( const float  fx,
const int  y,
const int  z,
const int  c 
) const

Return clamped pixel value, using cubic interpolation and Neumann boundary conditions for the X-coordinate.

Similar to cubic_atX(float,int,int,int) const, except that the return value is clamped to stay in the min/max range of the datatype T.

◆ cubic_atXY() [1/2]

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.

Similar to cubic_atX(float,int,int,int,const T) const, except that the cubic interpolation and boundary checking are achieved both for X and Y-coordinates.

◆ cubic_atXY_c() [1/2]

T cubic_atXY_c ( const float  fx,
const float  fy,
const int  z,
const int  c,
const T &  out_value 
) const

Return clamped pixel value, using cubic interpolation and Dirichlet boundary conditions for the X,Y-coordinates.

Similar to cubic_atXY(float,float,int,int,const T) const, except that the return value is clamped to stay in the min/max range of the datatype T.

◆ cubic_atXY() [2/2]

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.

Similar to cubic_atX(float,int,int,int) const, except that the cubic interpolation and boundary checking are achieved for both X and Y-coordinates.

Note
  • If you know your image instance is not empty, you may rather use the slightly faster method _cubic_atXY(float,float,int,int).

◆ cubic_atXY_c() [2/2]

T cubic_atXY_c ( const float  fx,
const float  fy,
const int  z,
const int  c 
) const

Return clamped pixel value, using cubic interpolation and Neumann boundary conditions for the X,Y-coordinates.

Similar to cubic_atXY(float,float,int,int) const, except that the return value is clamped to stay in the min/max range of the datatype T.

◆ cubic_atXYZ() [1/2]

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.

Similar to cubic_atX(float,int,int,int,const T) const, except that the cubic interpolation and boundary checking are achieved both for X,Y and Z-coordinates.

◆ cubic_atXYZ_c() [1/2]

T cubic_atXYZ_c ( const float  fx,
const float  fy,
const float  fz,
const int  c,
const T &  out_value 
) const

Return clamped pixel value, using cubic interpolation and Dirichlet boundary conditions for the XYZ-coordinates.

Similar to cubic_atXYZ(float,float,float,int,const T) const, except that the return value is clamped to stay in the min/max range of the datatype T.

◆ cubic_atXYZ() [2/2]

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.

Similar to cubic_atX(float,int,int,int) const, except that the cubic interpolation and boundary checking are achieved both for X,Y and Z-coordinates.

Note
  • If you know your image instance is not empty, you may rather use the slightly faster method _cubic_atXYZ(float,float,float,int).

◆ cubic_atXYZ_c() [2/2]

T cubic_atXYZ_c ( const float  fx,
const float  fy,
const float  fz,
const int  c 
) const

Return clamped pixel value, using cubic interpolation and Neumann boundary conditions for the XYZ-coordinates.

Similar to cubic_atXYZ(float,float,float,int) const, except that the return value is clamped to stay in the min/max range of the datatype T.

◆ cubic_atXYZ_p()

Tfloat cubic_atXYZ_p ( 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.

Similar to cubic_atX(float,int,int,int) const, except that the cubic interpolation and boundary checking are achieved both for X,Y and Z-coordinates.

Note
  • If you know your image instance is not empty, you may rather use the slightly faster method _cubic_atXYZ(float,float,float,int).

◆ set_linear_atX()

CImg<T>& set_linear_atX ( const T &  value,
const float  fx,
const int  y = 0,
const int  z = 0,
const int  c = 0,
const bool  is_added = false 
)

Set pixel value, using linear interpolation for the X-coordinates.

Set pixel value at specified coordinates (fx,y,z,c) in the image instance, in a way that the value is spread amongst several neighbors if the pixel coordinates are float-valued.

Parameters
valuePixel value to set.
fxX-coordinate of the pixel value (float-valued).
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.
cC-coordinate of the pixel value.
is_addedTells if the pixel value is added to (true), or simply replace (false) the current image pixel(s).
Returns
A reference to the current image instance.
Note
  • Calling this method with out-of-bounds coordinates does nothing.

◆ set_linear_atXY()

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.

Similar to set_linear_atX(const T&,float,int,int,int,bool), except that the linear interpolation is achieved both for X and Y-coordinates.

◆ set_linear_atXYZ()

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.

Similar to set_linear_atXY(const T&,float,float,int,int,bool), except that the linear interpolation is achieved both for X,Y and Z-coordinates.

◆ value_string()

CImg<charT> value_string ( const char  separator = ',',
const unsigned int  max_size = 0,
const char *const  format = 0 
) const

Return a C-string containing a list of all values of the image instance.

Return a new CImg<char> image whose buffer data() is a char* string describing the list of all pixel values of the image instance (written in base 10), separated by specified separator character.

Parameters
separatorA char character which specifies the separator between values in the returned C-string.
max_sizeMaximum size of the returned image (or 0 if no limits are set).
formatFor float/double-values, tell the printf format used to generate the text representation of the numbers (or 0 for default representation).
Note
  • The returned image is never empty.
  • For an empty image instance, the returned string is "".
  • If max_size is equal to 0, there are no limits on the size of the returned string.
  • Otherwise, if the maximum number of string characters is exceeded, the value string is cut off and terminated by character '\0'. In that case, the returned image size is max_size + 1.

◆ is_shared()

bool is_shared ( ) const

Test shared state of the pixel buffer.

Return true if image instance has a shared memory buffer, and false otherwise.

Note
  • A shared image do not own his pixel buffer data() and will not deallocate it on destruction.
  • Most of the time, a CImg<T> image instance will not be shared.
  • A shared image can only be obtained by a limited set of constructors and methods (see list below).

◆ is_empty()

bool is_empty ( ) const

Test if image instance is empty.

Return true, if image instance is empty, i.e. does not contain any pixel values, has dimensions 0 x 0 x 0 x 0 and a pixel buffer pointer set to 0 (null pointer), and false otherwise.

◆ is_inf()

bool is_inf ( ) const

Test if image instance contains a 'inf' value.

Return true, if image instance contains a 'inf' value, and false otherwise.

◆ is_nan()

bool is_nan ( ) const

Test if image instance contains a NaN value.

Return true, if image instance contains a NaN value, and false otherwise.

◆ is_sameXY() [1/3]

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.

Test if is_sameX(unsigned int) const and is_sameY(unsigned int) const are both verified.

◆ is_sameXY() [2/3]

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

Test if image width and height are the same as that of another image.

Test if is_sameX(const CImg<t>&) const and is_sameY(const CImg<t>&) const are both verified.

◆ is_sameXY() [3/3]

bool is_sameXY ( const CImgDisplay disp) const

Test if image width and height are the same as that of an existing display window.

Test if is_sameX(const CImgDisplay&) const and is_sameY(const CImgDisplay&) const are both verified.

◆ is_sameXZ() [1/2]

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.

Test if is_sameX(unsigned int) const and is_sameZ(unsigned int) const are both verified.

◆ is_sameXZ() [2/2]

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

Test if image width and depth are the same as that of another image.

Test if is_sameX(const CImg<t>&) const and is_sameZ(const CImg<t>&) const are both verified.

◆ is_sameXC() [1/2]

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.

Test if is_sameX(unsigned int) const and is_sameC(unsigned int) const are both verified.

◆ is_sameXC() [2/2]

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

Test if image width and spectrum are the same as that of another image.

Test if is_sameX(const CImg<t>&) const and is_sameC(const CImg<t>&) const are both verified.

◆ is_sameYZ() [1/2]

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.

Test if is_sameY(unsigned int) const and is_sameZ(unsigned int) const are both verified.

◆ is_sameYZ() [2/2]

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

Test if image height and depth are the same as that of another image.

Test if is_sameY(const CImg<t>&) const and is_sameZ(const CImg<t>&) const are both verified.

◆ is_sameYC() [1/2]

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.

Test if is_sameY(unsigned int) const and is_sameC(unsigned int) const are both verified.

◆ is_sameYC() [2/2]

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

Test if image height and spectrum are the same as that of another image.

Test if is_sameY(const CImg<t>&) const and is_sameC(const CImg<t>&) const are both verified.

◆ is_sameZC() [1/2]

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.

Test if is_sameZ(unsigned int) const and is_sameC(unsigned int) const are both verified.

◆ is_sameZC() [2/2]

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

Test if image depth and spectrum are the same as that of another image.

Test if is_sameZ(const CImg<t>&) const and is_sameC(const CImg<t>&) const are both verified.

◆ is_sameXYZ() [1/2]

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.

Test if is_sameXY(unsigned int,unsigned int) const and is_sameZ(unsigned int) const are both verified.

◆ is_sameXYZ() [2/2]

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

Test if image width, height and depth are the same as that of another image.

Test if is_sameXY(const CImg<t>&) const and is_sameZ(const CImg<t>&) const are both verified.

◆ is_sameXYC() [1/2]

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.

Test if is_sameXY(unsigned int,unsigned int) const and is_sameC(unsigned int) const are both verified.

◆ is_sameXYC() [2/2]

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

Test if image width, height and spectrum are the same as that of another image.

Test if is_sameXY(const CImg<t>&) const and is_sameC(const CImg<t>&) const are both verified.

◆ is_sameXZC() [1/2]

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.

Test if is_sameXZ(unsigned int,unsigned int) const and is_sameC(unsigned int) const are both verified.

◆ is_sameXZC() [2/2]

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

Test if image width, depth and spectrum are the same as that of another image.

Test if is_sameXZ(const CImg<t>&) const and is_sameC(const CImg<t>&) const are both verified.

◆ is_sameYZC() [1/2]

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.

Test if is_sameYZ(unsigned int,unsigned int) const and is_sameC(unsigned int) const are both verified.

◆ is_sameYZC() [2/2]

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

Test if image height, depth and spectrum are the same as that of another image.

Test if is_sameYZ(const CImg<t>&) const and is_sameC(const CImg<t>&) const are both verified.

◆ is_sameXYZC() [1/2]

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.

Test if is_sameXYZ(unsigned int,unsigned int,unsigned int) const and is_sameC(unsigned int) const are both verified.

◆ is_sameXYZC() [2/2]

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

Test if image width, height, depth and spectrum are the same as that of another image.

Test if is_sameXYZ(const CImg<t>&) const and is_sameC(const CImg<t>&) const are both verified.

◆ containsXYZC()

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.

Return true if pixel located at (x,y,z,c) is inside bounds of the image instance, and false otherwise.

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
  • Return true only if all these conditions are verified:

◆ contains() [1/5]

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.

Return true, if specified reference refers to a pixel value inside bounds of the image instance, and false otherwise.

Parameters
pixelReference to pixel value to test.
[out]xX-coordinate of the pixel value, if test succeeds.
[out]yY-coordinate of the pixel value, if test succeeds.
[out]zZ-coordinate of the pixel value, if test succeeds.
[out]cC-coordinate of the pixel value, if test succeeds.
Note
  • Useful to convert an offset to a buffer value into pixel value coordinates:
    const CImg<float> img(100,100,1,3); // Construct a 100x100 RGB color image
    const unsigned long offset = 1249; // Offset to the pixel (49,12,0,0)
    unsigned int x,y,z,c;
    if (img.contains(img[offset],x,y,z,c)) { // Convert offset to (x,y,z,c) coordinates
    std::printf("Offset %u refers to pixel located at (%u,%u,%u,%u).\n",
    offset,x,y,z,c);
    }

◆ contains() [2/5]

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.

Similar to contains(const T&,t&,t&,t&,t&) const, except that only the X,Y and Z-coordinates are set.

◆ contains() [3/5]

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.

Similar to contains(const T&,t&,t&,t&,t&) const, except that only the X and Y-coordinates are set.

◆ contains() [4/5]

bool contains ( const T &  pixel,
t &  x 
) const

Test if pixel value is inside image bounds and get its X-coordinate.

Similar to contains(const T&,t&,t&,t&,t&) const, except that only the X-coordinate is set.

◆ contains() [5/5]

bool contains ( const T &  pixel) const

Test if pixel value is inside image bounds.

Similar to contains(const T&,t&,t&,t&,t&) const, except that no pixel coordinates are set.

◆ is_overlapped()

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

Test if pixel buffers of instance and input images overlap.

Return true, if pixel buffers attached to image instance and input image img overlap, and false otherwise.

Parameters
imgInput image to compare with.
Note
  • Buffer overlapping may happen when manipulating shared images.
  • If two image buffers overlap, operating on one of the image will probably modify the other one.
  • Most of the time, CImg<T> instances are non-shared and do not overlap between each others.
Example
const CImg<float>
img1("reference.jpg"), // Load RGB-color image
img2 = img1.get_shared_channel(1); // Get shared version of the green channel
if (img1.is_overlapped(img2)) { // Test succeeds, 'img1' and 'img2' overlaps
std::printf("Buffers overlap!\n");
}

◆ is_object3d()

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.

Return true is the 3D object represented by the set {*this,primitives,colors,opacities} defines a valid 3D object, and false otherwise. The vertex coordinates are defined by the instance image.

Parameters
primitivesList of primitives of the 3D object.
colorsList of colors of the 3D object.
opacitiesList (or image) of opacities of the 3D object.
full_checkTells if full checking of the 3D object must be performed.
[out]error_messageC-string to contain the error message, if the test does not succeed (at least 256 bytes).
Note
  • Set full_checking to false to speed-up the 3D object checking. In this case, only the size of each 3D object component is checked.
  • Size of the string error_message should be at least 128-bytes long, to be able to contain the error message.

◆ is_CImg3d()

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.

Return true if the image instance represents a valid serialization of a 3D object, and false otherwise.

Parameters
full_checkTells if full checking of the instance must be performed.
[out]error_messageC-string to contain the error message, if the test does not succeed.
Note
  • Set full_check to false to speed-up the 3D object checking. In this case, only the size of each 3D object component is checked.
  • Size of the string error_message should be at least 256-bytes long, to be able to contain the error message.

◆ sqr()

CImg<T>& sqr ( )

Compute the square value of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its square value $I_{(x,y,z,c)}^2$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.
Example
const CImg<float> img("reference.jpg");
(img,img.get_sqr().normalize(0,255)).display();

◆ sqrt()

CImg<T>& sqrt ( )

Compute the square root of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its square root $\sqrt{I_{(x,y,z,c)}}$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.
Example
const CImg<float> img("reference.jpg");
(img,img.get_sqrt().normalize(0,255)).display();

◆ exp()

CImg<T>& exp ( )

Compute the exponential of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its exponential $e^{I_{(x,y,z,c)}}$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ erf()

CImg<T>& erf ( )

Compute the error function of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its error function.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ log()

CImg<T>& log ( )

Compute the logarithm of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its logarithm $\mathrm{log}_{e}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ log2()

CImg<T>& log2 ( )

Compute the base-2 logarithm of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its base-2 logarithm $\mathrm{log}_{2}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ log10()

CImg<T>& log10 ( )

Compute the base-10 logarithm of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its base-10 logarithm $\mathrm{log}_{10}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ abs()

CImg<T>& abs ( )

Compute the absolute value of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its absolute value $|I_{(x,y,z,c)}|$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ sign()

CImg<T>& sign ( )

Compute the sign of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its sign $\mathrm{sign}(I_{(x,y,z,c)})$.

Note
  • The sign is set to:
    • 1 if pixel value is strictly positive.
    • -1 if pixel value is strictly negative.
    • 0 if pixel value is equal to 0.
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ cos()

CImg<T>& cos ( )

Compute the cosine of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its cosine $\cos(I_{(x,y,z,c)})$.

Note
  • Pixel values are regarded as being in radian.
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ sin()

CImg<T>& sin ( )

Compute the sine of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its sine $\sin(I_{(x,y,z,c)})$.

Note
  • Pixel values are regarded as being in radian.
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ sinc()

CImg<T>& sinc ( )

Compute the sinc of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its sinc $\mathrm{sinc}(I_{(x,y,z,c)})$.

Note
  • Pixel values are regarded as being exin radian.
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ tan()

CImg<T>& tan ( )

Compute the tangent of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its tangent $\tan(I_{(x,y,z,c)})$.

Note
  • Pixel values are regarded as being exin radian.
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ cosh()

CImg<T>& cosh ( )

Compute the hyperbolic cosine of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its hyperbolic cosine $\mathrm{cosh}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ sinh()

CImg<T>& sinh ( )

Compute the hyperbolic sine of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its hyperbolic sine $\mathrm{sinh}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ tanh()

CImg<T>& tanh ( )

Compute the hyperbolic tangent of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its hyperbolic tangent $\mathrm{tanh}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ acos()

CImg<T>& acos ( )

Compute the arccosine of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its arccosine $\mathrm{acos}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ asin()

CImg<T>& asin ( )

Compute the arcsine of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its arcsine $\mathrm{asin}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ atan()

CImg<T>& atan ( )

Compute the arctangent of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its arctangent $\mathrm{atan}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ atan2()

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

Compute the arctangent2 of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its arctangent2 $\mathrm{atan2}(I_{(x,y,z,c)})$.

Parameters
imgImage whose pixel values specify the second argument of the atan2() function.
Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.
Example
const CImg<float>
img_x(100,100,1,1,"x-w/2",false), // Define an horizontal centered gradient, from '-width/2' to 'width/2'
img_y(100,100,1,1,"y-h/2",false), // Define a vertical centered gradient, from '-height/2' to 'height/2'
img_atan2 = img_y.get_atan2(img_x); // Compute atan2(y,x) for each pixel value
(img_x,img_y,img_atan2).display();

◆ acosh()

CImg<T>& acosh ( )

Compute the hyperbolic arccosine of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its arccosineh $\mathrm{acosh}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ asinh()

CImg<T>& asinh ( )

Compute the hyperbolic arcsine of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its hyperbolic arcsine $\mathrm{asinh}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ atanh()

CImg<T>& atanh ( )

Compute the hyperbolic arctangent of each pixel value.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its hyperbolic arctangent $\mathrm{atanh}(I_{(x,y,z,c)})$.

Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.

◆ mul()

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

In-place pointwise multiplication.

Compute the pointwise multiplication between the image instance and the specified input image img.

Parameters
imgInput image, as the second operand of the multiplication.
Note
Example
CImg<float>
img("reference.jpg"),
shade(img.width,img.height(),1,1,"-(x-w/2)^2-(y-h/2)^2",false);
shade.normalize(0,1);
(img,shade,img.get_mul(shade)).display();

◆ div()

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

In-place pointwise division.

Similar to mul(const CImg<t>&), except that it performs a pointwise division instead of a multiplication.

◆ pow() [1/3]

CImg<T>& pow ( const double  p)

Raise each pixel value to a specified power.

Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by its power $I_{(x,y,z,c)}^p$.

Parameters
pExponent value.
Note
  • The [in-place version] of this method statically casts the computed values to the pixel type T.
  • The [new-instance version] returns a CImg<float> image, if the pixel type T is not float-valued.
Example
const CImg<float>
img0("reference.jpg"), // Load reference color image
img1 = (img0/255).pow(1.8)*=255, // Compute gamma correction, with gamma = 1.8
img2 = (img0/255).pow(0.5)*=255; // Compute gamma correction, with gamma = 0.5
(img0,img1,img2).display();

◆ pow() [2/3]

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

Raise each pixel value to a power, specified from an expression.

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

◆ pow() [3/3]

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

Raise each pixel value to a power, pointwisely specified from another image.

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

◆ rol() [1/3]

CImg<T>& rol ( const unsigned int  n = 1)

Compute the bitwise left rotation of each pixel value.

Similar to operator<<=(unsigned int), except that it performs a left rotation instead of a left shift.

◆ rol() [2/3]

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

Compute the bitwise left rotation of each pixel value.

Similar to operator<<=(const char*), except that it performs a left rotation instead of a left shift.

◆ rol() [3/3]

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

Compute the bitwise left rotation of each pixel value.

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

◆ ror() [1/3]

CImg<T>& ror ( const unsigned int  n = 1)

Compute the bitwise right rotation of each pixel value.

Similar to operator>>=(unsigned int), except that it performs a right rotation instead of a right shift.

◆ ror() [2/3]

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

Compute the bitwise right rotation of each pixel value.

Similar to operator>>=(const char*), except that it performs a right rotation instead of a right shift.

◆ ror() [3/3]

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

Compute the bitwise right rotation of each pixel value.

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

◆ min() [1/3]

CImg<T>& min ( const T &  value)

Pointwise min operator between instance image and a value.

Parameters
valValue used as the reference argument of the min operator.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{min}(I_{(x,y,z,c)},\mathrm{val})$.

◆ min() [2/3]

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

Pointwise min operator between two images.

Parameters
imgImage used as the reference argument of the min operator.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{min}(I_{(x,y,z,c)},\mathrm{img}_{(x,y,z,c)})$.

◆ min() [3/3]

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

Pointwise min operator between an image and an expression.

Parameters
expressionMath formula as a C-string.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{min}(I_{(x,y,z,c)},\mathrm{expr}_{(x,y,z,c)})$.

◆ max() [1/3]

CImg<T>& max ( const T &  value)

Pointwise max operator between instance image and a value.

Parameters
valValue used as the reference argument of the max operator.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{max}(I_{(x,y,z,c)},\mathrm{val})$.

◆ max() [2/3]

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

Pointwise max operator between two images.

Parameters
imgImage used as the reference argument of the max operator.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{max}(I_{(x,y,z,c)},\mathrm{img}_{(x,y,z,c)})$.

◆ max() [3/3]

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

Pointwise max operator between an image and an expression.

Parameters
expressionMath formula as a C-string.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{max}(I_{(x,y,z,c)},\mathrm{expr}_{(x,y,z,c)})$.

◆ minabs() [1/3]

CImg<T>& minabs ( const T &  value)

Pointwise minabs operator between instance image and a value.

Parameters
valValue used as the reference argument of the minabs operator.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{minabs}(I_{(x,y,z,c)},\mathrm{val})$.

◆ minabs() [2/3]

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

Pointwise minabs operator between two images.

Parameters
imgImage used as the reference argument of the minabs operator.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{minabs}(I_{(x,y,z,c)},\mathrm{img}_{(x,y,z,c)})$.

◆ minabs() [3/3]

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

Pointwise minabs operator between an image and an expression.

Parameters
expressionMath formula as a C-string.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{minabs}(I_{(x,y,z,c)},\mathrm{expr}_{(x,y,z,c)})$.

◆ maxabs() [1/3]

CImg<T>& maxabs ( const T &  value)

Pointwise maxabs operator between instance image and a value.

Parameters
valValue used as the reference argument of the maxabs operator.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{maxabs}(I_{(x,y,z,c)},\mathrm{val})$.

◆ maxabs() [2/3]

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

Pointwise maxabs operator between two images.

Parameters
imgImage used as the reference argument of the maxabs operator.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{maxabs}(I_{(x,y,z,c)},\mathrm{img}_{(x,y,z,c)})$.

◆ maxabs() [3/3]

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

Pointwise maxabs operator between an image and an expression.

Parameters
expressionMath formula as a C-string.
Note
Replace each pixel value $I_{(x,y,z,c)}$ of the image instance by $\mathrm{maxabs}(I_{(x,y,z,c)},\mathrm{expr}_{(x,y,z,c)})$.

◆ min_max()

T& min_max ( t &  max_val)

Return a reference to the minimum pixel value as well as the maximum pixel value.

Parameters
[out]max_valMaximum pixel value.

◆ max_min()

T& max_min ( t &  min_val)

Return a reference to the maximum pixel value as well as the minimum pixel value.

Parameters
[out]min_valMinimum pixel value.

◆ kth_smallest()

T kth_smallest ( const ulongT  k) const

Return the kth smallest pixel value.

Parameters
kRank of the smallest element searched.

◆ variance()

double variance ( const unsigned int  variance_method = 1) const

Return the variance of the pixel values.

Parameters
variance_methodMethod used to estimate the variance. Can be:
  • 0: Second moment, computed as $1/N \sum\limits_{k=1}^{N} (x_k - \bar x)^2 = 1/N \left( \sum\limits_{k=1}^N x_k^2 - \left( \sum\limits_{k=1}^N x_k \right)^2 / N \right)$ with $ \bar x = 1/N \sum\limits_{k=1}^N x_k $.
  • 1: Best unbiased estimator, computed as $\frac{1}{N - 1} \sum\limits_{k=1}^{N} (x_k - \bar x)^2 $.
  • 2: Least median of squares.
  • 3: Least trimmed of squares.

◆ variance_mean()

double variance_mean ( const unsigned int  variance_method,
t &  mean 
) const

Return the variance as well as the average of the pixel values.

Parameters
variance_methodMethod used to estimate the variance (see variance(const unsigned int) const).
[out]meanAverage pixel value.

◆ variance_noise()

double variance_noise ( const unsigned int  variance_method = 2) const

Return estimated variance of the noise.

Parameters
variance_methodMethod used to compute the variance (see variance(const unsigned int) const).
Note
Because of structures such as edges in images it is recommended to use a robust variance estimation. The variance of the noise is estimated by computing the variance of the Laplacian $(\Delta I)^2 $ scaled by a factor $c$ insuring $ c E[(\Delta I)^2]= \sigma^2$ where $\sigma$ is the noise variance.

◆ MSE()

double MSE ( const CImg< t > &  img) const

Compute the MSE (Mean-Squared Error) between two images.

Parameters
imgImage used as the second argument of the MSE operator.

◆ PSNR()

double PSNR ( const CImg< t > &  img,
const double  max_value = 255 
) const

Compute the PSNR (Peak Signal-to-Noise Ratio) between two images.

Parameters
imgImage used as the second argument of the PSNR operator.
max_valueMaximum theoretical value of the signal.

◆ eval() [1/3]

double eval ( const char *const  expression,
const double  x = 0,
const double  y = 0,
const double  z = 0,
const double  c = 0,
CImgList< T > *const  list_images = 0 
)

Evaluate math formula.

Parameters
expressionMath formula, as a C-string.
xValue of the pre-defined variable x.
yValue of the pre-defined variable y.
zValue of the pre-defined variable z.
cValue of the pre-defined variable c.
list_imagesA list of images attached to the specified math formula.

◆ eval() [2/3]

void eval ( CImg< t > &  output,
const char *const  expression,
const double  x = 0,
const double  y = 0,
const double  z = 0,
const double  c = 0,
CImgList< T > *const  list_images = 0 
)

Evaluate math formula.

Parameters
[out]outputContains values of output vector returned by the evaluated expression (or is empty if the returned type is scalar).
expressionMath formula, as a C-string.
xValue of the pre-defined variable x.
yValue of the pre-defined variable y.
zValue of the pre-defined variable z.
cValue of the pre-defined variable c.
list_imagesA list of input images attached to the specified math formula.

◆ eval() [3/3]

CImg<doubleT> eval ( const char *const  expression,
const CImg< t > &  xyzc,
CImgList< T > *const  list_images = 0 
)

Evaluate math formula on a set of variables.

Parameters
expressionMath formula, as a C-string.
xyzcSet of values (x,y,z,c) used for the evaluation.
list_imagesA list of input images attached to the specified math formula.

◆ get_stats()

CImg<Tdouble> get_stats ( const unsigned int  variance_method = 1) const

Compute statistics vector from the pixel values.

Parameters
variance_methodMethod used to compute the variance (see variance(const unsigned int) const).
Returns
Statistics vector as [min, max, mean, variance, xmin, ymin, zmin, cmin, xmax, ymax, zmax, cmax, sum, product].

◆ magnitude()

double magnitude ( const float  magnitude_type = 2) const

Compute norm of the image, viewed as a matrix.

Parameters
magnitude_typeCan be:
  • 0: L0-norm
  • 1: L1-norm
  • 2: L2-norm
  • p>2 : Lp-norm
  • ~0U: Linf-norm

◆ dot()

double dot ( const CImg< t > &  img) const

Compute the dot product between instance and argument, viewed as matrices.

Parameters
imgImage used as a second argument of the dot product.

◆ get_vector_at()

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.

Parameters
xX-coordinate of the pixel value.
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.

◆ get_matrix_at()

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.

Parameters
xX-coordinate of the pixel value.
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.
Note
- The spectrum() of the image must be a square.

◆ get_tensor_at()

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.

Parameters
xX-coordinate of the pixel value.
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.

◆ set_vector_at()

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.

Parameters
vecVector to put on the instance image.
xX-coordinate of the pixel value.
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.

◆ set_matrix_at()

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.

Parameters
matMatrix to put on the instance image.
xX-coordinate of the pixel value.
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.

◆ set_tensor_at()

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.

Parameters
tenTensor to put on the instance image.
xX-coordinate of the pixel value.
yY-coordinate of the pixel value.
zZ-coordinate of the pixel value.

◆ diagonal()

CImg<T>& diagonal ( )

Resize image to become a diagonal matrix.

Note
Transform the image as a diagonal matrix so that each of its initial value becomes a diagonal coefficient.

◆ identity_matrix() [1/2]

CImg<T>& identity_matrix ( )

Replace the image by an identity matrix.

Note
If the instance image is not square, it is resized to a square matrix using its maximum dimension as a reference.

◆ sequence() [1/2]

CImg<T>& sequence ( const T &  a0,
const T &  a1 
)

Fill image with a linear sequence of values.

Parameters
a0Starting value of the sequence.
a1Ending value of the sequence.

◆ transpose()

CImg<T>& transpose ( )

Transpose the image, viewed as a matrix.

Note
Equivalent to
permute_axes("yxzc");
.

◆ cross()

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

Compute the cross product between two 1x3 images, viewed as 3D vectors.

Parameters
imgImage used as the second argument of the cross product.
Note
The first argument of the cross product is *this.

◆ invert()

CImg<T>& invert ( const bool  use_LU = false,
const float  lambda = 0 
)

Invert the instance image, viewed as a matrix.

If the instance matrix is not square, the Moore-Penrose pseudo-inverse is computed instead.

Parameters
use_LUChoose the inverting algorithm. Can be:
  • true: LU solver (faster but sometimes less precise).
  • false: SVD solver (more precise but slower).
lambdais used only in the Moore-Penrose pseudoinverse for estimating A^t.(A^t.A + lambda.Id)^-1.

◆ solve()

CImg<T>& solve ( const CImg< t > &  A,
const bool  use_LU = false 
)

Solve a system of linear equations.

Parameters
AMatrix of the linear system.
use_LUIn case of non square system (least-square solution), choose between SVD (false) or LU (true) solver. LU solver is faster for large matrices, but numerically less stable.
Note
Solve AX = B where B=*this.

◆ solve_tridiagonal()

CImg<T>& solve_tridiagonal ( const CImg< t > &  A)

Solve a tridiagonal system of linear equations.

Parameters
ACoefficients of the tridiagonal system. A is a tridiagonal matrix A = [ b0,c0,0,...; a1,b1,c1,0,... ; ... ; ...,0,aN,bN ], stored as a 3 columns matrix
Note
Solve AX=B where B=*this, using the Thomas algorithm.

◆ eigen()

const CImg<T>& eigen ( CImg< t > &  val,
CImg< t > &  vec 
) const

Compute eigenvalues and eigenvectors of the instance image, viewed as a matrix.

Parameters
[out]valVector of the estimated eigenvalues, in decreasing order.
[out]vecMatrix of the estimated eigenvectors, sorted by columns.

◆ get_eigen()

CImgList<Tfloat> get_eigen ( ) const

Compute eigenvalues and eigenvectors of the instance image, viewed as a matrix.

Returns
A list of two images [val; vec], whose meaning is similar as in eigen(CImg<t>&,CImg<t>&) const.

◆ symmetric_eigen()

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.

Parameters
[out]valVector of the estimated eigenvalues, in decreasing order.
[out]vecMatrix of the estimated eigenvectors, sorted by columns.

◆ get_symmetric_eigen()

CImgList<Tfloat> get_symmetric_eigen ( ) const

Compute eigenvalues and eigenvectors of the instance image, viewed as a symmetric matrix.

Returns
A list of two images [val; vec], whose meaning are similar as in symmetric_eigen(CImg<t>&,CImg<t>&) const.

◆ sort() [1/2]

CImg<T>& sort ( CImg< t > &  permutations,
const bool  is_increasing = true 
)

Sort pixel values and get sorting permutations.

Parameters
[out]permutationsPermutation map used for the sorting.
is_increasingTells if pixel values are sorted in an increasing (true) or decreasing (false) way.

◆ sort() [2/2]

CImg<T>& sort ( const bool  is_increasing = true,
const char  axis = 0 
)

Sort pixel values.

Parameters
is_increasingTells if pixel values are sorted in an increasing (true) or decreasing (false) way.
axisTells if the value sorting must be done along a specific axis. Can be:
  • 0: All pixel values are sorted, independently on their initial position.
  • 'x': Image columns are sorted, according to the first value in each column.
  • 'y': Image rows are sorted, according to the first value in each row.
  • 'z': Image slices are sorted, according to the first value in each slice.
  • 'c': Image channels are sorted, according to the first value in each channel.

◆ SVD()

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.

Compute the SVD decomposition *this=U*S*V' where U and V are orthogonal matrices and S is a diagonal matrix. V' denotes the matrix transpose of V.

Parameters
[out]UFirst matrix of the SVD product.
[out]SCoefficients of the second (diagonal) matrix of the SVD product. These coefficients are stored as a vector.
[out]VThird matrix of the SVD product.
sortingTells if the diagonal coefficients are sorted (in decreasing order).
max_iterationMaximum number of iterations considered for the algorithm convergence.
lambdaEpsilon used for the algorithm convergence.
Note
The instance matrix can be computed from U,S and V by
const CImg<> A; // Input matrix (assumed to contain some values)
CImg<> U,S,V;
A.SVD(U,S,V)

◆ get_SVD()

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.

Returns
A list of three images [U; S; V], whose meaning is similar as in SVD(CImg<t>&,CImg<t>&,CImg<t>&,bool,unsigned int,float) const.

◆ project_matrix()

CImg<T>& project_matrix ( const CImg< t > &  dictionary,
const unsigned int  method = 0,
const unsigned int  max_iter = 0,
const double  max_residual = 1e-6 
)

Compute the projection of the instance matrix onto the specified dictionary.

Find the best matching projection of selected matrix onto the span of an over-complete dictionary D, using the orthogonal projection or (opt. Orthogonal) Matching Pursuit algorithm. Instance image must a 2D-matrix in which each column represent a signal to project.

Parameters
dictionaryA matrix in which each column is an element of the dictionary D.
methodTell what projection method is applied. It can be:
  • 0 = orthogonal projection (default).
  • 1 = matching pursuit.
  • 2 = matching pursuit, with a single orthogonal projection step at the end.
  • >=3 = orthogonal matching pursuit where an orthogonal projection step is performed every 'method-2' iterations.
max_iterSets the max number of iterations processed for each signal. If set to '0' (default), 'max_iter' is set to the number of dictionary columns. (only meaningful for matching pursuit and its variants).
max_residualGives a stopping criterion on signal reconstruction accuracy. (only meaningful for matching pursuit and its variants).
Returns
A matrix W whose columns correspond to the sparse weights of associated to each input matrix column. Thus, the matrix product D*W is an approximation of the input matrix.

◆ dijkstra() [1/2]

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 
)
static

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

Parameters
distanceAn object having operator()(unsigned int i, unsigned int j) which returns distance between two nodes (i,j).
nb_nodesNumber of graph nodes.
starting_nodeIndex of the starting node.
ending_nodeIndex of the ending node (set to ~0U to ignore ending node).
previous_nodeArray that gives the previous node index in the path to the starting node (optional parameter).
Returns
Array of distances of each node to the starting node.

◆ dijkstra() [2/2]

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.

Parameters
starting_nodeIndex of the starting node.
ending_nodeIndex of the ending node.
previous_nodeArray that gives the previous node index in the path to the starting node (optional parameter).
Returns
Array of distances of each node to the starting node.
Note
image instance corresponds to the adjacency matrix of the graph.

◆ string()

static CImg<T> string ( const char *const  str,
const bool  is_last_zero = true,
const bool  is_shared = false 
)
static

Return an image containing the character codes of specified string.

Parameters
strinput C-string to encode as an image.
is_last_zeroTells if the ending '0' character appear in the resulting image.
is_sharedReturn result that shares its buffer with str.

◆ row_vector() [1/4]

static CImg<T> row_vector ( const T &  a0)
static

Return a 1x1 image containing specified value.

Parameters
a0First vector value.

◆ row_vector() [2/4]

static CImg<T> row_vector ( const T &  a0,
const T &  a1 
)
static

Return a 2x1 image containing specified values.

Parameters
a0First vector value.
a1Second vector value.

◆ row_vector() [3/4]

static CImg<T> row_vector ( const T &  a0,
const T &  a1,
const T &  a2 
)
static

Return a 3x1 image containing specified values.

Parameters
a0First vector value.
a1Second vector value.
a2Third vector value.

◆ row_vector() [4/4]

static CImg<T> row_vector ( const T &  a0,
const T &  a1,
const T &  a2,
const T &  a3 
)
static

Return a 4x1 image containing specified values.

Parameters
a0First vector value.
a1Second vector value.
a2Third vector value.
a3Fourth vector value.

◆ vector() [1/4]

static CImg<T> vector ( const T &  a0)
static

Return a 1x1 image containing specified value.

Parameters
a0First vector value.

◆ vector() [2/4]

static CImg<T> vector ( const T &  a0,
const T &  a1 
)
static

Return a 1x2 image containing specified values.

Parameters
a0First vector value.
a1Second vector value.

◆ vector() [3/4]

static CImg<T> vector ( const T &  a0,
const T &  a1,
const T &  a2 
)
static

Return a 1x3 image containing specified values.

Parameters
a0First vector value.
a1Second vector value.
a2Third vector value.

◆ vector() [4/4]

static CImg<T> vector ( const T &  a0,
const T &  a1,
const T &  a2,
const T &  a3 
)
static

Return a 1x4 image containing specified values.

Parameters
a0First vector value.
a1Second vector value.
a2Third vector value.
a3Fourth vector value.

◆ matrix() [1/3]

static CImg<T> matrix ( const T &  a0)
static

Return a 1x1 matrix containing specified coefficients.

Parameters
a0First matrix value.
Note
Equivalent to vector(const T&).

◆ matrix() [2/3]

static CImg<T> matrix ( const T &  a0,
const T &  a1,
const T &  a2,
const T &  a3 
)
static

Return a 2x2 matrix containing specified coefficients.

Parameters
a0First matrix value.
a1Second matrix value.
a2Third matrix value.
a3Fourth matrix value.

◆ matrix() [3/3]

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 
)
static

Return a 3x3 matrix containing specified coefficients.

Parameters
a0First matrix value.
a1Second matrix value.
a2Third matrix value.
a3Fourth matrix value.
a4Fifth matrix value.
a5Sixth matrix value.
a6Seventh matrix value.
a7Eighth matrix value.
a8Ninth matrix value.

◆ tensor()

static CImg<T> tensor ( const T &  a0)
static

Return a 1x1 symmetric matrix containing specified coefficients.

Parameters
a0First matrix value.
Note
Equivalent to vector(const T&).

◆ identity_matrix() [2/2]

static CImg<T> identity_matrix ( const unsigned int  N)
static

Return a NxN identity matrix.

Parameters
NDimension of the matrix.

◆ sequence() [2/2]

static CImg<T> sequence ( const unsigned int  N,
const T &  a0,
const T &  a1 
)
static

Return a N-numbered sequence vector from a0 to a1.

Parameters
NSize of the resulting vector.
a0Starting value of the sequence.
a1Ending value of the sequence.

◆ rotation_matrix()

static CImg<T> rotation_matrix ( const float  x,
const float  y,
const float  z,
const float  w,
const bool  is_quaternion = false 
)
static

Return a 3x3 rotation matrix from an { axis + angle } or a quaternion.

Parameters
xX-coordinate of the rotation axis, or first quaternion coordinate.
yY-coordinate of the rotation axis, or second quaternion coordinate.
zZ-coordinate of the rotation axis, or third quaternion coordinate.
wAngle of the rotation axis (in degree), or fourth quaternion coordinate.
is_quaternionTell is the four arguments denotes a set { axis + angle } or a quaternion (x,y,z,w).

◆ fill() [1/4]

CImg<T>& fill ( const T &  val)

Fill all pixel values with specified value.

Parameters
valFill value.

◆ fill() [2/4]

CImg<T>& fill ( const T &  val0,
const T &  val1 
)

Fill sequentially all pixel values with specified values.

Parameters
val0First fill value.
val1Second fill value.

◆ fill() [3/4]

CImg<T>& fill ( const char *const  expression,
const bool  repeat_values,
const bool  allow_formula = true,
CImgList< T > *const  list_images = 0 
)

Fill sequentially pixel values according to a given expression.

Parameters
expressionC-string describing a math formula, or a sequence of values.
repeat_valuesIn case a list of values is provided, tells if this list must be repeated for the filling.
allow_formulaTells that mathematical formulas are authorized for the filling.
list_imagesIn case of a mathematical expression, attach a list of images to the specified expression.

◆ fill_from_values()

CImg<T>& fill_from_values ( const char *const  values,
const bool  repeat_values 
)

Fill sequentially pixel values according to a value sequence, given as a string.

Parameters
valuesC-string describing a sequence of values.
repeat_valuesTells if this sequence must be repeated when filling.

◆ fill() [4/4]

CImg<T>& fill ( const CImg< t > &  values,
const bool  repeat_values = true 
)

Fill sequentially pixel values according to the values found in another image.

Parameters
valuesImage containing the values used for the filling.
repeat_valuesIn case there are less values than necessary in values, tells if these values must be repeated for the filling.

◆ fillX()

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.

Parameters
yY-coordinate of the filled column.
zZ-coordinate of the filled column.
cC-coordinate of the filled column.
a0First fill value.

◆ fillY()

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.

Parameters
xX-coordinate of the filled row.
zZ-coordinate of the filled row.
cC-coordinate of the filled row.
a0First fill value.

◆ fillZ()

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.

Parameters
xX-coordinate of the filled slice.
yY-coordinate of the filled slice.
cC-coordinate of the filled slice.
a0First fill value.

◆ fillC()

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.

Parameters
xX-coordinate of the filled channel.
yY-coordinate of the filled channel.
zZ-coordinate of the filled channel.
a0First filling value.

◆ discard()

CImg<T>& discard ( const CImg< t > &  values,
const char  axis = 0 
)

Discard specified sequence of values in the image buffer, along a specific axis.

Parameters
valuesSequence of values to discard.
axisAxis along which the values are discarded. If set to 0 (default value) the method does it for all the buffer values and returns a one-column vector.
Note
Discarded values will change the image geometry, so the resulting image is returned as a one-column vector.

◆ rand()

CImg<T>& rand ( const T &  val_min,
const T &  val_max 
)

Fill image with random values in specified range.

Parameters
val_minMinimal authorized random value.
val_maxMaximal authorized random value.
Note
Random variables are uniformly distributed in [val_min,val_max].

◆ round()

CImg<T>& round ( const double  y = 1,
const int  rounding_type = 0 
)

Round pixel values.

Parameters
yRounding precision.
rounding_typeRounding type. Can be:
  • -1: Backward.
  • 0: Nearest.
  • 1: Forward.

◆ noise()

CImg<T>& noise ( const double  sigma,
const unsigned int  noise_type = 0 
)

Add random noise to pixel values.

Parameters
sigmaAmplitude of the random additive noise. If sigma<0, it stands for a percentage of the global value range.
noise_typeType of additive noise (can be 0=gaussian, 1=uniform, 2=Salt and Pepper, 3=Poisson or 4=Rician).
Returns
A reference to the modified image instance.
Note
  • For Poisson noise (noise_type=3), parameter sigma is ignored, as Poisson noise only depends on the image value itself.
  • Function CImg<T>::get_noise() is also defined. It returns a non-shared modified copy of the image instance.
Example
const CImg<float> img("reference.jpg"), res = img.get_noise(40);
(img,res.normalize(0,255)).display();

◆ normalize() [1/2]

CImg<T>& normalize ( const T &  min_value,
const T &  max_value,
const float  constant_case_ratio = 0 
)

Linearly normalize pixel values.

Parameters
min_valueMinimum desired value of the resulting image.
max_valueMaximum desired value of the resulting image.
constant_case_ratioIn case of instance image having a constant value, tell what ratio of [min_value,max_value] is used to fill the normalized image (=0 for min_value, =1 for max_value, =0.5 for (min_value + max_value)/2).
Example
const CImg<float> img("reference.jpg"), res = img.get_normalize(160,220);
(img,res).display();

◆ normalize() [2/2]

CImg<T>& normalize ( )

Normalize multi-valued pixels of the image instance, with respect to their L2-norm.

Example
const CImg<float> img("reference.jpg"), res = img.get_normalize();
(img,res.normalize(0,255)).display();

◆ norm()

CImg<T>& norm ( const int  norm_type = 2)

Compute Lp-norm of each multi-valued pixel of the image instance.

Parameters
norm_typeType of computed vector norm (can be -1=Linf, or greater or equal than 0).
Example
const CImg<float> img("reference.jpg"), res = img.get_norm();
(img,res.normalize(0,255)).display();

◆ cut()

CImg<T>& cut ( const T &  min_value,
const T &  max_value 
)

Cut pixel values in specified range.

Parameters
min_valueMinimum desired value of the resulting image.
max_valueMaximum desired value of the resulting image.
Example
const CImg<float> img("reference.jpg"), res = img.get_cut(160,220);
(img,res).display();

◆ quantize()

CImg<T>& quantize ( const unsigned int  nb_levels,
const bool  keep_range = true 
)

Uniformly quantize pixel values.

Parameters
nb_levelsNumber of quantization levels.
keep_rangeTells if resulting values keep the same range as the original ones.
Example
const CImg<float> img("reference.jpg"), res = img.get_quantize(4);
(img,res).display();

◆ otsu()

T otsu ( const unsigned int  nb_levels = 256) const

Return the Otsu threshold.

Parameters
nb_levelsNumber of histogram levels used for the estimation.

◆ threshold()

CImg<T>& threshold ( const T &  value,
const bool  soft_threshold = false,
const bool  strict_threshold = false 
)

Threshold pixel values.

Parameters
valueThreshold value
soft_thresholdTells if soft thresholding must be applied (instead of hard one).
strict_thresholdTells if threshold value is strict.
Example
const CImg<float> img("reference.jpg"), res = img.get_threshold(128);
(img,res.normalize(0,255)).display();

◆ histogram()

CImg<T>& histogram ( const unsigned int  nb_levels,
const T &  min_value,
const T &  max_value 
)

Compute the histogram of pixel values.

Parameters
nb_levelsNumber of desired histogram levels.
min_valueMinimum pixel value considered for the histogram computation. All pixel values lower than min_value will not be counted.
max_valueMaximum pixel value considered for the histogram computation. All pixel values higher than max_value will not be counted.
Note
  • The histogram H of an image I is the 1D function where H(x) counts the number of occurrences of the value x in the image I.
  • The resulting histogram is always defined in 1D. Histograms of multi-valued images are not multi-dimensional.
Example
const CImg<float> img = CImg<float>("reference.jpg").histogram(256);
img.display_graph(0,3);

◆ equalize()

CImg<T>& equalize ( const unsigned int  nb_levels,
const T &  min_value,
const T &  max_value 
)

Equalize histogram of pixel values.

Parameters
nb_levelsNumber of histogram levels used for the equalization.
min_valueMinimum pixel value considered for the histogram computation. All pixel values lower than min_value will not be counted.
max_valueMaximum pixel value considered for the histogram computation. All pixel values higher than max_value will not be counted.
Example
const CImg<float> img("reference.jpg"), res = img.get_equalize(256);
(img,res).display();

◆ index()

CImg<T>& index ( const CImg< t > &  colormap,
const float  dithering = 1,
const bool  map_indexes = false 
)

Index multi-valued pixels regarding to a specified palette.

Parameters
colormapMulti-valued colormap used as the basis for multi-valued pixel indexing.
ditheringLevel of dithering (0=disable, 1=standard level).
map_indexesTell if the values of the resulting image are the colormap indices or the colormap vectors.
Note
  • img.index(colormap,dithering,1) is equivalent to img.index(colormap,dithering,0).map(colormap).
Example
const CImg<float> img("reference.jpg"), colormap(3,1,1,3, 0,128,255, 0,128,255, 0,128,255);
const CImg<float> res = img.get_index(colormap,1,true);
(img,res).display();

◆ map()

CImg<T>& map ( const CImg< t > &  palette,
const unsigned int  boundary_conditions = 0 
)

Map predefined palette on the scalar (indexed) image instance.

Parameters
paletteMulti-valued palette used for mapping the indexes.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
Example
const CImg<float> img("reference.jpg"),
palette1(3,1,1,3, 0,128,255, 0,128,255, 0,128,255),
palette2(3,1,1,3, 255,0,0, 0,255,0, 0,0,255),
res = img.get_index(palette1,0).map(palette2);
(img,res).display();

◆ label() [1/2]

CImg<T>& label ( const bool  is_high_connectivity = false,
const Tfloat  tolerance = 0,
const bool  is_L2_norm = true 
)

Label connected components.

Parameters
is_high_connectivityBoolean that choose between 4(false)- or 8(true)-connectivity in 2D case, and between 6(false)- or 26(true)-connectivity in 3D case.
toleranceTolerance used to determine if two neighboring pixels belong to the same region.
is_L2_normIf true, tolerance is compared against L2 difference, otherwise L1 is used.
Note
The algorithm of connected components computation has been primarily done by A. Meijster, according to the publication: 'W.H. Hesselink, A. Meijster, C. Bron, "Concurrent Determination of Connected Components.", In: Science of Computer Programming 41 (2001), pp. 173–194'. The submitted code has then been modified to fit CImg coding style and constraints.

◆ label() [2/2]

CImg<T>& label ( const CImg< t > &  connectivity_mask,
const Tfloat  tolerance = 0,
const bool  is_L2_norm = true 
)

Label connected components [overloading].

Parameters
connectivity_maskMask of the neighboring pixels.
toleranceTolerance used to determine if two neighboring pixels belong to the same region.
is_L2_normIf true, tolerance is compared against L2 difference, otherwise L1 is used.

◆ default_LUT256()

static const CImg<Tuchar>& default_LUT256 ( )
static

Return palette "default", containing 256 colors entries in RGB.

Returns
The following 256x1x1x3 palette is returned:

◆ HSV_LUT256()

static const CImg<Tuchar>& HSV_LUT256 ( )
static

Return palette "HSV", containing 256 colors entries in RGB.

Returns
The following 256x1x1x3 palette is returned:

◆ lines_LUT256()

static const CImg<Tuchar>& lines_LUT256 ( )
static

Return palette "lines", containing 256 colors entries in RGB.

Returns
The following 256x1x1x3 palette is returned:

◆ hot_LUT256()

static const CImg<Tuchar>& hot_LUT256 ( )
static

Return palette "hot", containing 256 colors entries in RGB.

Returns
The following 256x1x1x3 palette is returned:

◆ cool_LUT256()

static const CImg<Tuchar>& cool_LUT256 ( )
static

Return palette "cool", containing 256 colors entries in RGB.

Returns
The following 256x1x1x3 palette is returned:

◆ jet_LUT256()

static const CImg<Tuchar>& jet_LUT256 ( )
static

Return palette "jet", containing 256 colors entries in RGB.

Returns
The following 256x1x1x3 palette is returned:

◆ flag_LUT256()

static const CImg<Tuchar>& flag_LUT256 ( )
static

Return palette "flag", containing 256 colors entries in RGB.

Returns
The following 256x1x1x3 colormap is returned:

◆ cube_LUT256()

static const CImg<Tuchar>& cube_LUT256 ( )
static

Return palette "cube", containing 256 colors entries in RGB.

Returns
The following 256x1x1x3 palette is returned:

◆ RGBtoXYZ()

CImg<T>& RGBtoXYZ ( const bool  use_D65 = true)

Convert pixel values from RGB to XYZ color spaces.

Parameters
use_D65Tell to use the D65 illuminant (D50 otherwise).

◆ XYZtoRGB()

CImg<T>& XYZtoRGB ( const bool  use_D65 = true)

Convert pixel values from XYZ to RGB color spaces.

Parameters
use_D65Tell to use the D65 illuminant (D50 otherwise).

◆ resize() [1/3]

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.

Parameters
size_xNumber of columns (new size along the X-axis).
size_yNumber of rows (new size along the Y-axis).
size_zNumber of slices (new size along the Z-axis).
size_cNumber of vector-channels (new size along the C-axis).
interpolation_typeMethod of interpolation:
  • -1 = no interpolation: raw memory resizing.
  • 0 = no interpolation: additional space is filled according to boundary_conditions.
  • 1 = nearest-neighbor interpolation.
  • 2 = moving average interpolation.
  • 3 = linear interpolation.
  • 4 = grid interpolation.
  • 5 = cubic interpolation.
  • 6 = lanczos interpolation.
boundary_conditionsType of boundary conditions used if necessary.
centering_xSet centering type (only if interpolation_type=0).
centering_ySet centering type (only if interpolation_type=0).
centering_zSet centering type (only if interpolation_type=0).
centering_cSet centering type (only if interpolation_type=0).
Note
If pd[x,y,z,v]<0, it corresponds to a percentage of the original size (the default value is -100).

◆ resize() [2/3]

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.

Parameters
srcReference image used for dimensions.
interpolation_typeInterpolation method.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
centering_xSet centering type (only if interpolation_type=0).
centering_ySet centering type (only if interpolation_type=0).
centering_zSet centering type (only if interpolation_type=0).
centering_cSet centering type (only if interpolation_type=0).

◆ resize() [3/3]

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.

Parameters
dispReference display window used for dimensions.
interpolation_typeInterpolation method.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
centering_xSet centering type (only if interpolation_type=0).
centering_ySet centering type (only if interpolation_type=0).
centering_zSet centering type (only if interpolation_type=0).
centering_cSet centering type (only if interpolation_type=0).

◆ resize_doubleXY()

CImg<T>& resize_doubleXY ( )

Resize image to double-size, using the Scale2X algorithm.

Note
Use anisotropic upscaling algorithm described here.

◆ resize_tripleXY()

CImg<T>& resize_tripleXY ( )

Resize image to triple-size, using the Scale3X algorithm.

Note
Use anisotropic upscaling algorithm described here.

◆ mirror() [1/2]

CImg<T>& mirror ( const char  axis)

Mirror image content along specified axis.

Parameters
axisMirror axis

◆ mirror() [2/2]

CImg<T>& mirror ( const char *const  axes)

Mirror image content along specified axes.

Parameters
axesMirror axes, as a C-string.
Note
axes may contains multiple characters, e.g. "xyz"

◆ shift()

CImg<T>& shift ( const int  delta_x,
const int  delta_y = 0,
const int  delta_z = 0,
const int  delta_c = 0,
const unsigned int  boundary_conditions = 0 
)

Shift image content.

Parameters
delta_xAmount of displacement along the X-axis.
delta_yAmount of displacement along the Y-axis.
delta_zAmount of displacement along the Z-axis.
delta_cAmount of displacement along the C-axis.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.

◆ permute_axes()

CImg<T>& permute_axes ( const char *const  axes_order)

Permute axes order.

Parameters
axes_orderAxes permutations, as a C-string of 4 characters. This function permutes image content regarding the specified axes permutation.

◆ unroll()

CImg<T>& unroll ( const char  axis)

Unroll pixel values along specified axis.

Parameters
axisUnroll axis (can be 'x', 'y', 'z' or c 'c').

◆ rotate() [1/4]

CImg<T>& rotate ( const float  angle,
const unsigned int  interpolation = 1,
const unsigned int  boundary_conditions = 0 
)

Rotate image with arbitrary angle.

Parameters
angleRotation angle, in degrees.
interpolationType of interpolation. Can be { 0=nearest | 1=linear | 2=cubic }.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
Note
The size of the image is modified.

◆ rotate() [2/4]

CImg<T>& rotate ( const float  angle,
const float  cx,
const float  cy,
const unsigned int  interpolation,
const unsigned int  boundary_conditions = 0 
)

Rotate image with arbitrary angle, around a center point.

Parameters
angleRotation angle, in degrees.
cxX-coordinate of the rotation center.
cyY-coordinate of the rotation center.
interpolationType of interpolation, { 0=nearest | 1=linear | 2=cubic | 3=mirror }.
boundary_conditionsBoundary conditions, { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.

◆ rotate() [3/4]

CImg<T> rotate ( const float  u,
const float  v,
const float  w,
const float  angle,
const unsigned int  interpolation,
const unsigned int  boundary_conditions 
)

Rotate volumetric image with arbitrary angle and axis.

Parameters
uX-coordinate of the 3D rotation axis.
vY-coordinate of the 3D rotation axis.
wZ-coordinate of the 3D rotation axis.
angleRotation angle, in degrees.
interpolationType of interpolation. Can be { 0=nearest | 1=linear | 2=cubic }.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
Note
Most of the time, size of the image is modified.

◆ rotate() [4/4]

CImg<T> rotate ( const float  u,
const float  v,
const float  w,
const float  angle,
const float  cx,
const float  cy,
const float  cz,
const unsigned int  interpolation = 1,
const unsigned int  boundary_conditions = 0 
)

Rotate volumetric image with arbitrary angle and axis, around a center point.

Parameters
uX-coordinate of the 3D rotation axis.
vY-coordinate of the 3D rotation axis.
wZ-coordinate of the 3D rotation axis.
angleRotation angle, in degrees.
cxX-coordinate of the rotation center.
cyY-coordinate of the rotation center.
czZ-coordinate of the rotation center.
interpolationType of interpolation. Can be { 0=nearest | 1=linear | 2=cubic | 3=mirror }.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic }.
Note
Most of the time, size of the image is modified.

◆ warp()

CImg<T>& warp ( const CImg< t > &  p_warp,
const unsigned int  mode = 0,
const unsigned int  interpolation = 1,
const unsigned int  boundary_conditions = 0 
)

Warp image content by a warping field.

Parameters
warpWarping field.
modeCan be { 0=backward-absolute | 1=backward-relative | 2=forward-absolute | 3=foward-relative }
interpolationCan be { 0=nearest | 1=linear | 2=cubic }.
boundary_conditionsBoundary conditions { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.

◆ get_projections2d()

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.

Parameters
x0X-coordinate of the projection point.
y0Y-coordinate of the projection point.
z0Z-coordinate of the projection point.

◆ crop()

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 unsigned int  boundary_conditions = 0 
)

Crop image region.

Parameters
x0= X-coordinate of the upper-left crop rectangle corner.
y0= Y-coordinate of the upper-left crop rectangle corner.
z0= Z-coordinate of the upper-left crop rectangle corner.
c0= C-coordinate of the upper-left crop rectangle corner.
x1= X-coordinate of the lower-right crop rectangle corner.
y1= Y-coordinate of the lower-right crop rectangle corner.
z1= Z-coordinate of the lower-right crop rectangle corner.
c1= C-coordinate of the lower-right crop rectangle corner.
boundary_conditions= Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.

◆ autocrop()

CImg<T>& autocrop ( const T *const  color = 0,
const char *const  axes = "zyx" 
)

Autocrop image region, regarding the specified background color.

Parameters
colorColor used for the crop. If 0, color is guessed.
axesAxes used for the crop.

◆ get_column()

CImg<T> get_column ( const int  x0) const

Return specified image column.

Parameters
x0Image column.

◆ columns()

CImg<T>& columns ( const int  x0,
const int  x1 
)

Return specified range of image columns.

Parameters
x0Starting image column.
x1Ending image column.

◆ row()

CImg<T>& row ( const int  y0)

Return specified image row [in-place version].

Parameters
y0Image row.

◆ get_rows()

CImg<T> get_rows ( const int  y0,
const int  y1 
) const

Return specified range of image rows.

Parameters
y0Starting image row.
y1Ending image row.

◆ get_slice()

CImg<T> get_slice ( const int  z0) const

Return specified image slice.

Parameters
z0Image slice.

◆ get_slices()

CImg<T> get_slices ( const int  z0,
const int  z1 
) const

Return specified range of image slices.

Parameters
z0Starting image slice.
z1Ending image slice.

◆ get_channel()

CImg<T> get_channel ( const int  c0) const

Return specified image channel.

Parameters
c0Image channel.

◆ get_channels()

CImg<T> get_channels ( const int  c0,
const int  c1 
) const

Return specified range of image channels.

Parameters
c0Starting image channel.
c1Ending image channel.

◆ streamline()

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 
)
static

Return stream line of a 3D vector field.

Parameters
funcVector field function.
xX-coordinate of the starting point of the streamline.
yY-coordinate of the starting point of the streamline.
zZ-coordinate of the starting point of the streamline.
LStreamline length.
dlStreamline length increment.
interpolation_typeType of interpolation. Can be { 0=nearest int | 1=linear | 2=2nd-order RK | 3=4th-order RK. }.
is_backward_trackingTells if the streamline is estimated forward or backward.
is_oriented_onlyTells if the direction of the vectors must be ignored.
x0X-coordinate of the first bounding-box vertex.
y0Y-coordinate of the first bounding-box vertex.
z0Z-coordinate of the first bounding-box vertex.
x1X-coordinate of the second bounding-box vertex.
y1Y-coordinate of the second bounding-box vertex.
z1Z-coordinate of the second bounding-box vertex.

◆ get_shared_points()

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.

Parameters
x0X-coordinate of the starting pixel.
x1X-coordinate of the ending pixel.
y0Y-coordinate.
z0Z-coordinate.
c0C-coordinate.

◆ get_shared_rows()

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.

Parameters
y0Y-coordinate of the starting row.
y1Y-coordinate of the ending row.
z0Z-coordinate.
c0C-coordinate.

◆ get_shared_row()

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.

Parameters
y0Y-coordinate.
z0Z-coordinate.
c0C-coordinate.

◆ get_shared_slices()

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.

Parameters
z0Z-coordinate of the starting slice.
z1Z-coordinate of the ending slice.
c0C-coordinate.

◆ get_shared_slice()

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.

Parameters
z0Z-coordinate.
c0C-coordinate.

◆ get_shared_channels()

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.

Parameters
c0C-coordinate of the starting channel.
c1C-coordinate of the ending channel.

◆ get_shared_channel()

CImg<T> get_shared_channel ( const unsigned int  c0)

Return a shared-memory image referencing one channel of the image instance.

Parameters
c0C-coordinate.

◆ get_split() [1/2]

CImgList<T> get_split ( const char  axis,
const int  nb = -1 
) const

Split image into a list along specified axis.

Parameters
axisSplitting axis. Can be { 'x' | 'y' | 'z' | 'c' }.
nbNumber of split parts.
Note
  • If nb==0, instance image is split into blocs of equal values along the specified axis.
  • If nb<=0, instance image is split into blocs of -nb pixel wide.
  • If nb>0, instance image is split into nb blocs.

◆ get_split() [2/2]

CImgList<T> get_split ( const CImg< t > &  values,
const char  axis = 0,
const bool  keep_values = true 
) const

Split image into a list of sub-images, according to a specified splitting value sequence and optionally axis.

Parameters
valuesSplitting value sequence.
axisAxis along which the splitting is performed. Can be '0' to ignore axis.
keep_valuesTells if the splitting sequence must be kept in the split blocs.

◆ append()

CImg<T>& append ( const CImg< t > &  img,
const char  axis = 'x',
const float  align = 0 
)

Append two images along specified axis.

Parameters
imgImage to append with instance image.
axisAppending axis. Can be { 'x' | 'y' | 'z' | 'c' }.
alignAppend alignment in [0,1].

◆ correlate()

CImg<T>& correlate ( const CImg< t > &  kernel,
const unsigned int  boundary_conditions = 1,
const bool  is_normalized = false,
const unsigned int  channel_mode = 1,
const int  xcenter = (int)(~0U>>1),
const int  ycenter = (int)(~0U>>1),
const int  zcenter = (int)(~0U>>1),
const int  xstart = 0,
const int  ystart = 0,
const int  zstart = 0,
const int  xend = (int)(~0U>>1),
const int  yend = (int)(~0U>>1),
const int  zend = (int)(~0U>>1),
const float  xstride = 1,
const float  ystride = 1,
const float  zstride = 1,
const float  xdilation = 1,
const float  ydilation = 1,
const float  zdilation = 1,
const bool  interpolation_type = false 
)

Correlate image by a kernel.

Parameters
kernel= the correlation kernel.
boundary_conditionsBoundary condition. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
is_normalized= enable local normalization.
channel_modeChannel processing mode. Can be { 0=all | 1=one for one (default) | 2=partial sum | 3=full sum }.
xcenterX-coordinate of the kernel center (~0U>>1 means 'centered').
ycenterY-coordinate of the kernel center (~0U>>1 means 'centered').
zcenterZ-coordinate of the kernel center (~0U>>1 means 'centered').
xstartStarting X-coordinate of the instance image.
ystartStarting Y-coordinate of the instance image.
zstartStarting Z-coordinate of the instance image.
xendEnding X-coordinate of the instance image.
yendEnding Y-coordinate of the instance image.
zendEnding Z-coordinate of the instance image.
xstrideStride along the X-axis.
ystrideStride along the Y-axis.
zstrideStride along the Z-axis.
xdilationDilation along the X-axis.
ydilationDilation along the Y-axis.
zdilationDilation along the Z-axis.
interpolation_typeCan be { false=nearest | true=linear }.
Note
  • The correlation of the image instance *this by the kernel kernel is defined to be: res(x,y,z) = sum_{i,j,k} (*this)(\alpha_x\;x + \beta_x\;(i - c_x),\alpha_y\;y + \beta_y\;(j - c_y),\alpha_z\;z + \beta_z\;(k - c_z))*kernel(i,j,k).

◆ convolve()

CImg<T>& convolve ( const CImg< t > &  kernel,
const unsigned int  boundary_conditions = 1,
const bool  is_normalized = false,
const unsigned int  channel_mode = 1,
const int  xcenter = (int)(~0U>>1),
const int  ycenter = (int)(~0U>>1),
const int  zcenter = (int)(~0U>>1),
const int  xstart = 0,
const int  ystart = 0,
const int  zstart = 0,
const int  xend = (int)(~0U>>1),
const int  yend = (int)(~0U>>1),
const int  zend = (int)(~0U>>1),
const float  xstride = 1,
const float  ystride = 1,
const float  zstride = 1,
const float  xdilation = 1,
const float  ydilation = 1,
const float  zdilation = 1,
const bool  interpolation_type = false 
)

Convolve image by a kernel.

Parameters
kernel= the correlation kernel.
boundary_conditionsBoundary condition. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
is_normalized= enable local normalization.
channel_modeChannel processing mode. Can be { 0=all | 1=one for one (default) | 2=partial sum | 3=full sum }.
xcenterX-coordinate of the kernel center (~0U means 'centered').
ycenterY-coordinate of the kernel center (~0U means 'centered').
zcenterZ-coordinate of the kernel center (~0U means 'centered').
xstartStarting X-coordinate of the instance image.
ystartStarting Y-coordinate of the instance image.
zstartStarting Z-coordinate of the instance image.
xendEnding X-coordinate of the instance image.
yendEnding Y-coordinate of the instance image.
zendEnding Z-coordinate of the instance image.
xstrideStride along the X-axis.
ystrideStride along the Y-axis.
zstrideStride along the Z-axis.
xdilationDilation along the X-axis.
ydilationDilation along the Y-axis.
zdilationDilation along the Z-axis.
interpolation_typeCan be { false=nearest | true=linear }.
Note
  • The convolution of the image instance *this by the kernel kernel is defined to be: res(x,y,z) = sum_{i,j,k} (*this)(\alpha_x\;x - \beta_x\;(i - c_x),\alpha_y\;y
    • \beta_y\;(j - c_y),\alpha_z\;z - \beta_z\;(k - c_z))*kernel(i,j,k).

◆ cumulate() [1/2]

CImg<T>& cumulate ( const char  axis = 0)

Cumulate image values, optionally along specified axis.

Parameters
axisCumulation axis. Set it to 0 to cumulate all values globally without taking axes into account.

◆ cumulate() [2/2]

CImg<T>& cumulate ( const char *const  axes)

Cumulate image values, along specified axes.

Parameters
axesCumulation axes, as a C-string.
Note
axes may contains multiple characters, e.g. "xyz"

◆ erode() [1/3]

CImg<T>& erode ( const CImg< t > &  kernel,
const unsigned int  boundary_conditions = 1,
const bool  is_real = false 
)

Erode image by a structuring element.

Parameters
kernelStructuring element.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
is_realDo the erosion in real (a.k.a 'non-flat') mode (true) rather than binary mode (false).

◆ erode() [2/3]

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.

Parameters
sxWidth of the structuring element.
syHeight of the structuring element.
szDepth of the structuring element.

◆ erode() [3/3]

CImg<T>& erode ( const unsigned int  s)

Erode the image by a square structuring element of specified size.

Parameters
sSize of the structuring element.

◆ dilate() [1/3]

CImg<T>& dilate ( const CImg< t > &  kernel,
const unsigned int  boundary_conditions = 1,
const bool  is_real = false 
)

Dilate image by a structuring element.

Parameters
kernelStructuring element.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
is_realDo the dilation in real (a.k.a 'non-flat') mode (true) rather than binary mode (false).

◆ dilate() [2/3]

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.

Parameters
sxWidth of the structuring element.
syHeight of the structuring element.
szDepth of the structuring element.

◆ dilate() [3/3]

CImg<T>& dilate ( const unsigned int  s)

Dilate image by a square structuring element of specified size.

Parameters
sSize of the structuring element.

◆ closing() [1/2]

CImg<T>& closing ( const CImg< t > &  kernel,
const unsigned int  boundary_conditions = 1,
const bool  is_real = false 
)

Apply morphological closing by a structuring element.

Parameters
kernelStructuring element.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
is_realDo the closing in real (a.k.a 'non-flat') mode (true) rather than binary mode (false).

◆ closing() [2/2]

CImg<T>& closing ( const unsigned int  s)

Apply morphological closing by a square structuring element of specified size.

Parameters
sSize of the structuring element.

◆ opening() [1/2]

CImg<T>& opening ( const CImg< t > &  kernel,
const unsigned int  boundary_conditions = 1,
const bool  is_real = false 
)

Apply morphological opening by a structuring element.

Parameters
kernelStructuring element.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
is_realDo the opening in real (a.k.a 'non-flat') mode (true) rather than binary mode (false).

◆ opening() [2/2]

CImg<T>& opening ( const unsigned int  s)

Apply morphological opening by a square structuring element of specified size.

Parameters
sSize of the structuring element.

◆ watershed()

CImg<T>& watershed ( const CImg< t > &  priority,
const bool  is_high_connectivity = false 
)

Compute watershed transform.

Parameters
priorityPriority map.
is_high_connectivityBoolean that choose between 4(false)- or 8(true)-connectivity in 2D case, and between 6(false)- or 26(true)-connectivity in 3D case.
Note
Non-zero values of the instance instance are propagated to zero-valued ones according to specified the priority map.

◆ deriche()

CImg<T>& deriche ( const float  sigma,
const unsigned int  order = 0,
const char  axis = 'x',
const unsigned int  boundary_conditions = 1 
)

Apply recursive Deriche filter.

Parameters
sigmaStandard deviation of the filter.
orderOrder of the filter. Can be { 0=smooth-filter | 1=1st-derivative | 2=2nd-derivative }.
axisAxis along which the filter is computed. Can be { 'x' | 'y' | 'z' | 'c' }.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.

◆ vanvliet()

CImg<T>& vanvliet ( const float  sigma,
const unsigned int  order,
const char  axis = 'x',
const unsigned int  boundary_conditions = 1 
)

Van Vliet recursive Gaussian filter.

Parameters
sigmastandard deviation of the Gaussian filter
orderthe order of the filter 0,1,2,3
axisAxis along which the filter is computed. Can be { 'x' | 'y' | 'z' | 'c' }.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
Note
dirichlet boundary condition has a strange behavior

I.T. Young, L.J. van Vliet, M. van Ginkel, Recursive Gabor filtering. IEEE Trans. Sig. Proc., vol. 50, pp. 2799-2805, 2002.

(this is an improvement over Young-Van Vliet, Sig. Proc. 44, 1995)

Boundary conditions (only for order 0) using Triggs matrix, from B. Triggs and M. Sdika. Boundary conditions for Young-van Vliet recursive filtering. IEEE Trans. Signal Processing, vol. 54, pp. 2365-2367, 2006.

◆ blur() [1/2]

CImg<T>& blur ( const float  sigma_x,
const float  sigma_y,
const float  sigma_z,
const unsigned int  boundary_conditions = 1,
const bool  is_gaussian = true 
)

Blur image.

Parameters
sigma_xStandard deviation of the blur, along the X-axis.
sigma_yStandard deviation of the blur, along the Y-axis.
sigma_zStandard deviation of the blur, along the Z-axis.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
is_gaussianTells if the blur uses a gaussian (true) or quasi-gaussian (false) kernel.
Note
  • The blur is computed as a 0-order Vanvliet (gaussian) or Deriche filter (quasi-gaussian).
  • This is a recursive algorithm, not depending on the values of the standard deviations.
See also
deriche(), vanvliet().

◆ blur() [2/2]

CImg<T>& blur ( const float  sigma,
const unsigned int  boundary_conditions = 1,
const bool  is_gaussian = true 
)

Blur image isotropically.

Parameters
sigmaStandard deviation of the blur.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.a
is_gaussianUse a gaussian kernel (VanVliet) is set, a quasi-gaussian (Deriche) otherwise.
See also
deriche(), vanvliet().

◆ blur_anisotropic() [1/2]

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.

Parameters
GField of square roots of diffusion tensors/vectors used to drive the smoothing.
amplitudeAmplitude of the smoothing.
dlSpatial discretization.
daAngular discretization.
gauss_precPrecision of the diffusion process.
interpolation_typeInterpolation scheme. Can be { 0=nearest-neighbor | 1=linear | 2=Runge-Kutta }.
is_fast_approxTells if a fast approximation of the gaussian function is used or not.

◆ blur_anisotropic() [2/2]

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.

Parameters
amplitudeAmplitude of the smoothing.
sharpnessSharpness.
anisotropyAnisotropy.
alphaStandard deviation of the gradient blur.
sigmaStandard deviation of the structure tensor blur.
dlSpatial discretization.
daAngular discretization.
gauss_precPrecision of the diffusion process.
interpolation_typeInterpolation scheme. Can be { 0=nearest-neighbor | 1=linear | 2=Runge-Kutta }.
is_fast_approxTells if a fast approximation of the gaussian function is used or not.

◆ blur_bilateral() [1/2]

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 float  sampling_x,
const float  sampling_y,
const float  sampling_z,
const float  sampling_r 
)

Blur image, with the joint bilateral filter.

Parameters
guideImage used to model the smoothing weights.
sigma_xAmount of blur along the X-axis.
sigma_yAmount of blur along the Y-axis.
sigma_zAmount of blur along the Z-axis.
sigma_rAmount of blur along the value axis.
sampling_xAmount of downsampling along the X-axis used for the approximation. Defaults (0) to sigma_x.
sampling_yAmount of downsampling along the Y-axis used for the approximation. Defaults (0) to sigma_y.
sampling_zAmount of downsampling along the Z-axis used for the approximation. Defaults (0) to sigma_z.
sampling_rAmount of downsampling along the value axis used for the approximation. Defaults (0) to sigma_r.
Note
This algorithm uses the optimisation technique proposed by S. Paris and F. Durand, in ECCV'2006 (extended for 3D volumetric images). It is based on the reference implementation http://people.csail.mit.edu/jiawen/software/bilateralFilter.m

◆ blur_bilateral() [2/2]

CImg<T>& blur_bilateral ( const CImg< t > &  guide,
const float  sigma_s,
const float  sigma_r,
const float  sampling_s = 0,
const float  sampling_r = 0 
)

Blur image using the joint bilateral filter.

Parameters
guideImage used to model the smoothing weights.
sigma_sAmount of blur along the XYZ-axes.
sigma_rAmount of blur along the value axis.
sampling_sAmount of downsampling along the XYZ-axes used for the approximation. Defaults to sigma_s.
sampling_rAmount of downsampling along the value axis used for the approximation. Defaults to sigma_r.

◆ boxfilter()

CImg<T>& boxfilter ( const float  boxsize,
const int  order,
const char  axis = 'x',
const unsigned int  boundary_conditions = 1,
const unsigned int  nb_iter = 1 
)
Parameters
boxsizeSize of the box window (can be subpixel)
orderthe order of the filter 0,1 or 2.
axisAxis along which the filter is computed. Can be { 'x' | 'y' | 'z' | 'c' }.
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.
nb_iterNumber of filter iterations.

◆ blur_box() [1/2]

CImg<T>& blur_box ( const float  boxsize_x,
const float  boxsize_y,
const float  boxsize_z,
const unsigned int  boundary_conditions = 1,
const unsigned int  nb_iter = 1 
)

Blur image with a box filter.

Parameters
boxsize_xSize of the box window, along the X-axis (can be subpixel).
boxsize_ySize of the box window, along the Y-axis (can be subpixel).
boxsize_zSize of the box window, along the Z-axis (can be subpixel).
boundary_conditionsBoundary conditions. Can be { false=dirichlet | true=neumann | 2=periodic | 3=mirror }.
nb_iterNumber of filter iterations.
Note
  • This is a recursive algorithm, not depending on the values of the box kernel size.
See also
blur().

◆ blur_box() [2/2]

CImg<T>& blur_box ( const float  boxsize,
const unsigned int  boundary_conditions = 1 
)

Blur image with a box filter.

Parameters
boxsizeSize of the box window (can be subpixel).
boundary_conditionsBoundary conditions. Can be { 0=dirichlet | 1=neumann | 2=periodic | 3=mirror }.a
See also
deriche(), vanvliet().

◆ blur_guided()

CImg<T>& blur_guided ( const CImg< t > &  guide,
const float  radius,
const float  regularization 
)

Blur image, with the image guided filter.

Parameters
guideImage used to guide the smoothing process.
radiusSpatial radius. If negative, it is expressed as a percentage of the largest image size.
regularizationRegularization parameter. If negative, it is expressed as a percentage of the guide value range.
Note
This method implements the filtering algorithm described in: He, Kaiming; Sun, Jian; Tang, Xiaoou, "Guided Image Filtering," Pattern Analysis and Machine Intelligence, IEEE Transactions on , vol.35, no.6, pp.1397,1409, June 2013

◆ blur_patch()

CImg<T>& blur_patch ( const CImg< t > &  guide,
const float  sigma_s,
const float  sigma_r,
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.

Parameters
guideImage used to model the smoothing weights.
sigma_sAmount of blur along the XYZ-axes.
sigma_rAmount of blur along the value axis.
patch_sizeSize of the patches.
lookup_sizeSize of the window to search similar patches.
smoothnessSmoothness for the patch comparison.
is_fast_approxTells if a fast approximation of the gaussian function is used or not.

◆ blur_median()

CImg<T>& blur_median ( const unsigned int  n,
const float  threshold = 0 
)

Blur image with the median filter.

Parameters
nSize of the median filter.
thresholdThreshold used to discard pixels too far from the current pixel value in the median computation.

◆ sharpen()

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.

Parameters
amplitudeSharpening amplitude
sharpen_typeSelect sharpening method. Can be { false=inverse diffusion | true=shock filters }.
edgeEdge threshold (shock filters only).
alphaGradient smoothness (shock filters only).
sigmaTensor smoothness (shock filters only).

◆ get_gradient()

CImgList<Tfloat> get_gradient ( const char *const  axes = 0,
const int  scheme = 0 
) const

Return image gradient.

Parameters
axesAxes considered for the gradient computation, as a C-string (e.g "xy").
scheme= Numerical scheme used for the gradient computation:
  • -1 = Backward finite differences
  • 0 = Centered finite differences (default)
  • 1 = Forward finite differences
  • 2 = Using Sobel kernels
  • 3 = Using rotation invariant kernels
  • 4 = Using Deriche recursive filter.
  • 5 = Using Van Vliet recursive filter.

◆ get_hessian()

CImgList<Tfloat> get_hessian ( const char *const  axes = 0) const

Return image hessian.

Parameters
axesAxes considered for the hessian computation, as a C-string (e.g "xy").

◆ structure_tensors()

CImg<T>& structure_tensors ( const bool  is_fwbw_scheme = false)

Compute the structure tensor field of an image.

Parameters
is_fwbw_schemescheme. Can be { false=centered | true=forward-backward }

◆ diffusion_tensors()

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.

Parameters
sharpnessSharpness
anisotropyAnisotropy
alphaStandard deviation of the gradient blur.
sigmaStandard deviation of the structure tensor blur.
is_sqrtTells if the square root of the tensor field is computed instead.

◆ displacement()

CImg<T>& displacement ( const CImg< T > &  source,
const float  smoothness = 0.1f,
const float  precision = 5.f,
const unsigned int  nb_scales = 0,
const unsigned int  iteration_max = 10000,
const bool  is_backward = false,
const CImg< floatT > &  guide = CImg<floatT>::const_empty() 
)

Estimate displacement field between two images.

Parameters
sourceReference image.
smoothnessSmoothness of estimated displacement field.
precisionPrecision required for algorithm convergence.
nb_scalesNumber of scales used to estimate the displacement field.
iteration_maxMaximum number of iterations allowed for one scale.
is_backwardIf false, match I2(X + U(X)) = I1(X), else match I2(X) = I1(X - U(X)).
guideImage used as the initial correspondence estimate for the algorithm. 'guide' may have a last channel with boolean values (0=false | other=true) that tells for each pixel if its correspondence vector is constrained to its initial value (constraint mask).

◆ matchpatch()

CImg<T>& matchpatch ( const CImg< T > &  patch_image,
const unsigned int  patch_width,
const unsigned int  patch_height,
const unsigned int  patch_depth,
const unsigned int  nb_iterations,
const unsigned int  nb_randoms,
const float  patch_penalization,
const CImg< t1 > &  guide,
CImg< t2 > &  matching_score 
)

Compute correspondence map between two images, using a patch-matching algorithm.

Parameters
patch_imageThe image containing the reference patches to match with the instance image.
patch_widthWidth of the patch used for matching.
patch_heightHeight of the patch used for matching.
patch_depthDepth of the patch used for matching.
nb_iterationsNumber of patch-match iterations.
nb_randomsNumber of randomization attempts (per pixel).
patch_penalizationPenalization factor in score related patch occurrences. if negative, also tells that identity result is not avoided.
guideImage used as the initial correspondence estimate for the algorithm. 'guide' may have a last channel with boolean values (0=false | other=true) that tells for each pixel if its correspondence vector is constrained to its initial value (constraint mask).
[out]matching_scoreReturned as the image of matching scores.

◆ distance() [1/2]

CImg<T>& distance ( const T &  value,
const unsigned int  metric = 2 
)

Compute Euclidean distance function to a specified value.

Parameters
valueReference value.
metricType of metric. Can be { 0=Chebyshev | 1=Manhattan | 2=Euclidean | 3=Squared-euclidean }.
Note
The distance transform implementation has been submitted by A. Meijster, and implements the article 'W.H. Hesselink, A. Meijster, J.B.T.M. Roerdink, "A general algorithm for computing distance transforms in linear time.", In: Mathematical Morphology and its Applications to Image and Signal Processing, J. Goutsias, L. Vincent, and D.S. Bloomberg (eds.), Kluwer, 2000, pp. 331-340.' The submitted code has then been modified to fit CImg coding style and constraints.

◆ distance() [2/2]

CImg<T>& distance ( const T &  value,
const CImg< t > &  metric_mask 
)

Compute chamfer distance to a specified value, with a custom metric.

Parameters
valueReference value.
metric_maskMetric mask.
Note
The algorithm code has been initially proposed by A. Meijster, and modified by D. Tschumperlé.

◆ distance_dijkstra()

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).

Parameters
valueReference value.
metricField of distance potentials.
is_high_connectivityTells if the algorithm uses low or high connectivity.
[out]return_pathAn image containing the nodes of the minimal path.

◆ distance_eikonal() [1/2]

CImg<T>& distance_eikonal ( const T &  value,
const CImg< t > &  metric 
)

Compute distance map to one source point, according to a custom metric (use fast marching algorithm).

Parameters
valueReference value.
metricField of distance potentials.

◆ distance_eikonal() [2/2]

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.

Parameters
nb_iterationsNumber of PDE iterations.
band_sizeSize of the narrow band.
time_stepTime step of the PDE iterations.

◆ haar() [1/2]

CImg<T>& haar ( const char  axis,
const bool  invert = false,
const unsigned int  nb_scales = 1 
)

Compute Haar multiscale wavelet transform.

Parameters
axisAxis considered for the transform.
invertSet inverse of direct transform.
nb_scalesNumber of scales used for the transform.

◆ haar() [2/2]

CImg<T>& haar ( const bool  invert = false,
const unsigned int  nb_scales = 1 
)

Compute Haar multiscale wavelet transform [overloading].

Parameters
invertSet inverse of direct transform.
nb_scalesNumber of scales used for the transform.

◆ get_FFT()

CImgList<Tfloat> get_FFT ( const char  axis,
const bool  is_inverse = false 
) const

Compute 1D Fast Fourier Transform, along a specified axis.

Parameters
axisAxis along which the FFT is computed.
is_inverseTells if the forward (false) or inverse (true) FFT is computed.

◆ FFT() [1/2]

static void FFT ( CImg< T > &  real,
CImg< T > &  imag,
const char  axis,
const bool  is_inverse = false,
const unsigned int  nb_threads = 0 
)
static

Compute 1D Fast Fourier Transform, along a specified axis.

Parameters
[in,out]realReal part of the pixel values.
[in,out]imagImaginary part of the pixel values.
axisAxis along which the FFT is computed.
is_inverseTells if the forward (false) or inverse (true) FFT is computed.

◆ FFT() [2/2]

static void FFT ( CImg< T > &  real,
CImg< T > &  imag,
const bool  is_inverse = false,
const unsigned int  nb_threads = 0 
)
static

Compute n-D Fast Fourier Transform.

Parameters
[in,out]realReal part of the pixel values.
[in,out]imagImaginary part of the pixel values.
is_inverseTells if the forward (false) or inverse (true) FFT is computed.
nb_threadsNumber of parallel threads used for the computation. Use 0 to set this to the number of available cpus.

◆ rotate_object3d()

CImg<T>& rotate_object3d ( const float  x,
const float  y,
const float  z,
const float  w,
const bool  is_quaternion = false 
)

Rotate 3D object's vertices.

Parameters
xX-coordinate of the rotation axis, or first quaternion coordinate.
yY-coordinate of the rotation axis, or second quaternion coordinate.
zZ-coordinate of the rotation axis, or second quaternion coordinate.
wAngle of the rotation axis (in degree), or fourth quaternion coordinate.
is_quaternionTell is the four arguments denotes a set { axis + angle } or a quaternion (x,y,z,w).

◆ shift_object3d() [1/2]

CImg<T>& shift_object3d ( const float  tx,
const float  ty = 0,
const float  tz = 0 
)

Shift 3D object's vertices.

Parameters
txX-coordinate of the 3D displacement vector.
tyY-coordinate of the 3D displacement vector.
tzZ-coordinate of the 3D displacement vector.

◆ shift_object3d() [2/2]

CImg<T>& shift_object3d ( )

Shift 3D object's vertices, so that it becomes centered.

Note
The object center is computed as its barycenter.

◆ resize_object3d()

CImg<T>& resize_object3d ( const float  sx,
const float  sy = -100,
const float  sz = -100 
)

Resize 3D object.

Parameters
sxWidth of the 3D object's bounding box.
syHeight of the 3D object's bounding box.
szDepth of the 3D object's bounding box.

◆ append_object3d()

CImg<T>& append_object3d ( CImgList< tf > &  primitives,
const CImg< tp > &  obj_vertices,
const CImgList< tff > &  obj_primitives 
)

Merge two 3D objects together.

Parameters
[in,out]primitivesPrimitives data of the current 3D object.
obj_verticesVertices data of the additional 3D object.
obj_primitivesPrimitives data of the additional 3D object.

◆ texturize_object3d()

const CImg<T>& texturize_object3d ( CImgList< tp > &  primitives,
CImgList< tc > &  colors,
const CImg< tt > &  texture,
const CImg< tx > &  coords = CImg<tx>::const_empty() 
) const

Texturize primitives of a 3D object.

Parameters
[in,out]primitivesPrimitives data of the 3D object.
[in,out]colorsColors data of the 3D object.
textureTexture image to map to 3D object.
coordsTexture-mapping coordinates.

◆ get_elevation3d()

CImg<floatT> get_elevation3d ( CImgList< tf > &  primitives,
CImgList< tc > &  colors,
const CImg< te > &  elevation 
) const

Generate a 3D elevation of the image instance.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
[out]colorsThe returned list of the 3D object colors.
elevationThe input elevation map.
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
const CImg<float> img("reference.jpg");
CImgList<unsigned int> faces3d;
CImgList<unsigned char> colors3d;
const CImg<float> points3d = img.get_elevation3d(faces3d,colors3d,img.get_norm()*0.2);
CImg<unsigned char>().display_object3d("Elevation3d",points3d,faces3d,colors3d);

◆ get_projections3d()

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.

Parameters
[out]primitivesPrimitives data of the returned 3D object.
[out]colorsColors data of the returned 3D object.
x0X-coordinate of the projection point.
y0Y-coordinate of the projection point.
z0Z-coordinate of the projection point.
normalize_colorsTells if the created textures have normalized colors.

◆ get_isoline3d()

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.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
isovalueThe returned list of the 3D object colors.
size_xThe number of subdivisions along the X-axis.
size_yThe number of subdisivions along the Y-axis.
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
const CImg<float> img("reference.jpg");
CImgList<unsigned int> faces3d;
const CImg<float> points3d = img.get_isoline3d(faces3d,100);
CImg<unsigned char>().display_object3d("Isoline3d",points3d,faces3d,colors3d);

◆ isoline3d() [1/2]

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 
)
static

Compute isolines of a function, as a 3D object.

Parameters
[out]primitivesPrimitives data of the resulting 3D object.
funcElevation functor. Must have operator()(x,y) defined.
isovalueIsovalue to extract from function.
x0X-coordinate of the starting point.
y0Y-coordinate of the starting point.
x1X-coordinate of the ending point.
y1Y-coordinate of the ending point.
size_xResolution of the function along the X-axis.
size_yResolution of the function along the Y-axis.
Note
Use the marching squares algorithm for extracting the isolines.

◆ isoline3d() [2/2]

static void isoline3d ( tv &  add_vertex,
tf &  add_segment,
const tfunc &  func,
const float  isovalue,
const float  x0,
const float  y0,
const float  x1,
const float  y1,
const int  size_x,
const int  size_y 
)
static

Compute isolines of a function, as a 3D object.

Parameters
[out]add_vertex: Functor with operator()(x,y,z) defined for adding new vertex.
[out]add_segment: Functor with operator()(i,j) defined for adding new segment.
funcElevation function. Is of type float (*func)(const float x,const float y).
isovalueIsovalue to extract from function.
x0X-coordinate of the starting point.
y0Y-coordinate of the starting point.
x1X-coordinate of the ending point.
y1Y-coordinate of the ending point.
size_xResolution of the function along the X-axis.
size_yResolution of the function along the Y-axis.
Note
Use the marching squares algorithm for extracting the isolines.

◆ get_isosurface3d()

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.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
isovalueThe returned list of the 3D object colors.
size_xNumber of subdivisions along the X-axis.
size_yNumber of subdisivions along the Y-axis.
size_zNumber of subdisivions along the Z-axis.
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
const CImg<float> img = CImg<unsigned char>("reference.jpg").resize(-100,-100,20);
CImgList<unsigned int> faces3d;
const CImg<float> points3d = img.get_isosurface3d(faces3d,100);
CImg<unsigned char>().display_object3d("Isosurface3d",points3d,faces3d,colors3d);

◆ isosurface3d() [1/2]

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 
)
static

Compute isosurface of a function, as a 3D object.

Parameters
[out]primitivesPrimitives data of the resulting 3D object.
funcImplicit function. Is of type float (*func)(const float x, const float y, const float z).
isovalueIsovalue to extract.
x0X-coordinate of the starting point.
y0Y-coordinate of the starting point.
z0Z-coordinate of the starting point.
x1X-coordinate of the ending point.
y1Y-coordinate of the ending point.
z1Z-coordinate of the ending point.
size_xResolution of the elevation function along the X-axis.
size_yResolution of the elevation function along the Y-axis.
size_zResolution of the elevation function along the Z-axis.
Note
Use the marching cubes algorithm for extracting the isosurface.

◆ isosurface3d() [2/2]

static void isosurface3d ( tv &  add_vertex,
tf &  add_triangle,
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,
const int  size_y,
const int  size_z 
)
static

Compute isosurface of a function, as a 3D object.

Parameters
[out]add_vertex: Functor with operator()(x,y,z) defined for adding new vertex.
[out]add_triangle: Functor with operator()(i,j) defined for adding new segment.
funcImplicit function. Is of type float (*func)(const float x, const float y, const float z).
isovalueIsovalue to extract.
x0X-coordinate of the starting point.
y0Y-coordinate of the starting point.
z0Z-coordinate of the starting point.
x1X-coordinate of the ending point.
y1Y-coordinate of the ending point.
z1Z-coordinate of the ending point.
size_xResolution of the elevation function along the X-axis.
size_yResolution of the elevation function along the Y-axis.
size_zResolution of the elevation function along the Z-axis.
Note
Use the marching cubes algorithm for extracting the isosurface.

◆ elevation3d()

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 
)
static

Compute 3D elevation of a function as a 3D object.

Parameters
[out]primitivesPrimitives data of the resulting 3D object.
funcElevation function. Is of type float (*func)(const float x,const float y).
x0X-coordinate of the starting point.
y0Y-coordinate of the starting point.
x1X-coordinate of the ending point.
y1Y-coordinate of the ending point.
size_xResolution of the function along the X-axis.
size_yResolution of the function along the Y-axis.

◆ box3d()

static CImg<floatT> box3d ( CImgList< tf > &  primitives,
const float  size_x = 200,
const float  size_y = 100,
const float  size_z = 100 
)
static

Generate a 3D box object.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
size_xThe width of the box (dimension along the X-axis).
size_yThe height of the box (dimension along the Y-axis).
size_zThe depth of the box (dimension along the Z-axis).
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
CImgList<unsigned int> faces3d;
const CImg<float> points3d = CImg<float>::box3d(faces3d,10,20,30);
CImg<unsigned char>().display_object3d("Box3d",points3d,faces3d);

◆ cone3d()

static CImg<floatT> cone3d ( CImgList< tf > &  primitives,
const float  radius = 50,
const float  size_z = 100,
const unsigned int  subdivisions = 24 
)
static

Generate a 3D cone.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
radiusThe radius of the cone basis.
size_zThe cone's height.
subdivisionsThe number of basis angular subdivisions.
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
CImgList<unsigned int> faces3d;
const CImg<float> points3d = CImg<float>::cone3d(faces3d,50);
CImg<unsigned char>().display_object3d("Cone3d",points3d,faces3d);

◆ cylinder3d()

static CImg<floatT> cylinder3d ( CImgList< tf > &  primitives,
const float  radius = 50,
const float  size_z = 100,
const unsigned int  subdivisions = 24 
)
static

Generate a 3D cylinder.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
radiusThe radius of the cylinder basis.
size_zThe cylinder's height.
subdivisionsThe number of basis angular subdivisions.
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
CImgList<unsigned int> faces3d;
const CImg<float> points3d = CImg<float>::cylinder3d(faces3d,50);
CImg<unsigned char>().display_object3d("Cylinder3d",points3d,faces3d);

◆ torus3d()

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 
)
static

Generate a 3D torus.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
radius1The large radius.
radius2The small radius.
subdivisions1The number of angular subdivisions for the large radius.
subdivisions2The number of angular subdivisions for the small radius.
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
CImgList<unsigned int> faces3d;
const CImg<float> points3d = CImg<float>::torus3d(faces3d,20,4);
CImg<unsigned char>().display_object3d("Torus3d",points3d,faces3d);

◆ plane3d()

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 
)
static

Generate a 3D XY-plane.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
size_xThe width of the plane (dimension along the X-axis).
size_yThe height of the plane (dimensions along the Y-axis).
subdivisions_xThe number of planar subdivisions along the X-axis.
subdivisions_yThe number of planar subdivisions along the Y-axis.
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
CImgList<unsigned int> faces3d;
const CImg<float> points3d = CImg<float>::plane3d(faces3d,100,50);
CImg<unsigned char>().display_object3d("Plane3d",points3d,faces3d);

◆ sphere3d()

static CImg<floatT> sphere3d ( CImgList< tf > &  primitives,
const float  radius = 50,
const unsigned int  subdivisions = 3 
)
static

Generate a 3D sphere.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
radiusThe radius of the sphere (dimension along the X-axis).
subdivisionsThe number of recursive subdivisions from an initial icosahedron.
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
CImgList<unsigned int> faces3d;
const CImg<float> points3d = CImg<float>::sphere3d(faces3d,100,4);
CImg<unsigned char>().display_object3d("Sphere3d",points3d,faces3d);

◆ ellipsoid3d()

static CImg<floatT> ellipsoid3d ( CImgList< tf > &  primitives,
const CImg< t > &  tensor,
const unsigned int  subdivisions = 3 
)
static

Generate a 3D ellipsoid.

Parameters
[out]primitivesThe returned list of the 3D object primitives (template type tf should be at least unsigned int).
tensorThe tensor which gives the shape and size of the ellipsoid.
subdivisionsThe number of recursive subdivisions from an initial stretched icosahedron.
Returns
The N vertices (xi,yi,zi) of the 3D object as a Nx3 CImg<float> image (0<=i<=N - 1).
Example
CImgList<unsigned int> faces3d;
const CImg<float> tensor = CImg<float>::diagonal(10,7,3),
points3d = CImg<float>::ellipsoid3d(faces3d,tensor,4);
CImg<unsigned char>().display_object3d("Ellipsoid3d",points3d,faces3d);

◆ object3dtoCImg3d()

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.

Parameters
primitivesPrimitives data of the 3D object.
colorsColors data of the 3D object.
opacitiesOpacities data of the 3D object.
full_checkTells if full checking of the 3D object must be performed.

◆ CImg3dtoobject3d()

CImg<T>& CImg3dtoobject3d ( CImgList< tp > &  primitives,
CImgList< tc > &  colors,
CImgList< to > &  opacities,
const bool  full_check = true 
)

Convert CImg3d representation into a 3D object.

Parameters
[out]primitivesPrimitives data of the 3D object.
[out]colorsColors data of the 3D object.
[out]opacitiesOpacities data of the 3D object.
full_checkTells if full checking of the 3D object must be performed.

◆ draw_point() [1/2]

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.

Parameters
x0X-coordinate of the point.
y0Y-coordinate of the point.
z0Z-coordinate of the point.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
Note
  • To set pixel values without clipping needs, you should use the faster CImg::operator()() function.
Example:
CImg<unsigned char> img(100,100,1,3,0);
const unsigned char color[] = { 255,128,64 };
img.draw_point(50,50,color);

◆ draw_point() [2/2]

CImg<T>& draw_point ( const CImg< t > &  points,
const tc *const  color,
const float  opacity = 1 
)
Parameters
pointsImage of vertices coordinates.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.

◆ draw_line() [1/6]

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

Draw a 2D line.

Parameters
x0X-coordinate of the starting line point.
y0Y-coordinate of the starting line point.
x1X-coordinate of the ending line point.
y1Y-coordinate of the ending line point.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.
patternAn integer whose bits describe the line pattern.
init_hatchTells if a reinitialization of the hash state must be done.
Note
  • Line routine uses Bresenham's algorithm.
  • Set init_hatch = false to draw consecutive hatched segments without breaking the line pattern.
Example:
CImg<unsigned char> img(100,100,1,3,0);
const unsigned char color[] = { 255,128,64 };
img.draw_line(40,40,80,70,color);

◆ draw_line() [2/6]

CImg<T>& draw_line ( CImg< tz > &  zbuffer,
int  x0,
int  y0,
const float  z0,
int  x1,
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.

Parameters
zbufferZbuffer image.
x0X-coordinate of the starting point.
y0Y-coordinate of the starting point.
z0Z-coordinate of the starting point
x1X-coordinate of the ending point.
y1Y-coordinate of the ending point.
z1Z-coordinate of the ending point.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.
patternAn integer whose bits describe the line pattern.
init_hatchTells if a reinitialization of the hash state must be done.

◆ draw_line() [3/6]

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

Draw a textured 2D line.

Parameters
x0X-coordinate of the starting line point.
y0Y-coordinate of the starting line point.
x1X-coordinate of the ending line point.
y1Y-coordinate of the ending line point.
textureTexture image defining the pixel colors.
tx0X-coordinate of the starting texture point.
ty0Y-coordinate of the starting texture point.
tx1X-coordinate of the ending texture point.
ty1Y-coordinate of the ending texture point.
opacityDrawing opacity.
patternAn integer whose bits describe the line pattern.
init_hatchTells if the hash variable must be reinitialized.
Note
  • Line routine uses the well known Bresenham's algorithm.
Example:
CImg<unsigned char> img(100,100,1,3,0), texture("texture256x256.ppm");
const unsigned char color[] = { 255,128,64 };
img.draw_line(40,40,80,70,texture,0,0,255,255);

◆ draw_line() [4/6]

CImg<T>& draw_line ( int  x0,
int  y0,
const float  z0,
int  x1,
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.

Parameters
x0X-coordinate of the starting point.
y0Y-coordinate of the starting point.
z0Z-coordinate of the starting point
x1X-coordinate of the ending point.
y1Y-coordinate of the ending point.
z1Z-coordinate of the ending point.
textureTexture image defining the pixel colors.
tx0X-coordinate of the starting texture point.
ty0Y-coordinate of the starting texture point.
tx1X-coordinate of the ending texture point.
ty1Y-coordinate of the ending texture point.
opacityDrawing opacity.
patternAn integer whose bits describe the line pattern.
init_hatchTells if the hash variable must be reinitialized.

◆ draw_line() [5/6]

CImg<T>& draw_line ( CImg< tz > &  zbuffer,
int  x0,
int  y0,
const float  z0,
int  x1,
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.

Parameters
zbufferZ-buffer image.
x0X-coordinate of the starting point.
y0Y-coordinate of the starting point.
z0Z-coordinate of the starting point
x1X-coordinate of the ending point.
y1Y-coordinate of the ending point.
z1Z-coordinate of the ending point.
textureTexture image defining the pixel colors.
tx0X-coordinate of the starting texture point.
ty0Y-coordinate of the starting texture point.
tx1X-coordinate of the ending texture point.
ty1Y-coordinate of the ending texture point.
opacityDrawing opacity.
patternAn integer whose bits describe the line pattern.
init_hatchTells if the hash variable must be reinitialized.

◆ draw_line() [6/6]

CImg<T>& draw_line ( const CImg< tp > &  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.

Parameters
pointsCoordinates of vertices, stored as a list of vectors.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.
patternAn integer whose bits describe the line pattern.
init_hatchIf set to true, init hatch motif.
Note
  • This function uses several call to the single CImg::draw_line() procedure, depending on the vectors size in points.

◆ draw_arrow()

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.

Parameters
x0X-coordinate of the starting arrow point (tail).
y0Y-coordinate of the starting arrow point (tail).
x1X-coordinate of the ending arrow point (head).
y1Y-coordinate of the ending arrow point (head).
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
angleAperture angle of the arrow head.
lengthLength of the arrow head. If negative, describes a percentage of the arrow length.
opacityDrawing opacity.
patternAn integer whose bits describe the line pattern.

◆ draw_spline() [1/4]

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.

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

◆ draw_spline() [2/4]

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.

Parameters
x0X-coordinate of the starting curve point
y0Y-coordinate of the starting curve point
u0X-coordinate of the starting velocity
v0Y-coordinate of the starting velocity
x1X-coordinate of the ending curve point
y1Y-coordinate of the ending curve point
u1X-coordinate of the ending velocity
v1Y-coordinate of the ending velocity
textureTexture image defining line pixel colors.
tx0X-coordinate of the starting texture point.
ty0Y-coordinate of the starting texture point.
tx1X-coordinate of the ending texture point.
ty1Y-coordinate of the ending texture point.
precisionCurve drawing precision.
opacityDrawing opacity.
patternAn integer whose bits describe the line pattern.
init_hatchif true, reinit hatch motif.

◆ draw_spline() [3/4]

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.

Parameters
pointsVertices data.
tangentsTangents data.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.
is_closed_setTells if the drawn spline set is closed.
precisionPrecision of the drawing.
patternAn integer whose bits describe the line pattern.
init_hatchIf true, init hatch motif.

◆ draw_spline() [4/4]

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].

Similar to previous function, with the point tangents automatically estimated from the given points set.

◆ draw_triangle() [1/9]

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.

Parameters
x0X-coordinate of the first vertex.
y0Y-coordinate of the first vertex.
x1X-coordinate of the second vertex.
y1Y-coordinate of the second vertex.
x2X-coordinate of the third vertex.
y2Y-coordinate of the third vertex.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.

◆ draw_triangle() [2/9]

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.

Parameters
x0X-coordinate of the first vertex.
y0Y-coordinate of the first vertex.
x1X-coordinate of the second vertex.
y1Y-coordinate of the second vertex.
x2X-coordinate of the third vertex.
y2Y-coordinate of the third vertex.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.
patternAn integer whose bits describe the outline pattern.

◆ draw_triangle() [3/9]

CImg<T>& draw_triangle ( CImg< tz > &  zbuffer,
int  x0,
int  y0,
const float  z0,
int  x1,
int  y1,
const float  z1,
int  x2,
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.

Parameters
zbufferZ-buffer image.
x0X-coordinate of the first vertex.
y0Y-coordinate of the first vertex.
z0Z-coordinate of the first vertex.
x1X-coordinate of the second vertex.
y1Y-coordinate of the second vertex.
z1Z-coordinate of the second vertex.
x2X-coordinate of the third vertex.
y2Y-coordinate of the third vertex.
z2Z-coordinate of the third vertex.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.
brightnessBrightness factor.

◆ draw_triangle() [4/9]

CImg<T>& draw_triangle ( int  x0,
int  y0,
int  x1,
int  y1,
int  x2,
int  y2,
const tc *const  color,
float  bs0,
float  bs1,
float  bs2,
const float  opacity = 1 
)

Draw a Gouraud-shaded 2D triangle.

Parameters
x0X-coordinate of the first vertex in the image instance.
y0Y-coordinate of the first vertex in the image instance.
x1X-coordinate of the second vertex in the image instance.
y1Y-coordinate of the second vertex in the image instance.
x2X-coordinate of the third vertex in the image instance.
y2Y-coordinate of the third vertex in the image instance.
colorPointer to spectrum() consecutive values, defining the drawing color.
bs0Brightness factor of the first vertex (in [0,2]).
bs1brightness factor of the second vertex (in [0,2]).
bs2brightness factor of the third vertex (in [0,2]).
opacityDrawing opacity.

◆ draw_triangle() [5/9]

CImg<T>& draw_triangle ( int  x0,
int  y0,
int  x1,
int  y1,
int  x2,
int  y2,
const tc *  color0,
const tc *  color1,
const tc *  color2,
const float  opacity = 1 
)

Draw a color-interpolated 2D triangle.

Parameters
x0X-coordinate of the first vertex in the image instance.
y0Y-coordinate of the first vertex in the image instance.
x1X-coordinate of the second vertex in the image instance.
y1Y-coordinate of the second vertex in the image instance.
x2X-coordinate of the third vertex in the image instance.
y2Y-coordinate of the third vertex in the image instance.
color1Pointer to spectrum() consecutive values of type T, defining the color of the first vertex.
color2Pointer to spectrum() consecutive values of type T, defining the color of the second vertex.
color3Pointer to spectrum() consecutive values of type T, defining the color of the third vertex.
opacityDrawing opacity.

◆ draw_triangle() [6/9]

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

Draw a textured 2D triangle.

Parameters
x0X-coordinate of the first vertex in the image instance.
y0Y-coordinate of the first vertex in the image instance.
x1X-coordinate of the second vertex in the image instance.
y1Y-coordinate of the second vertex in the image instance.
x2X-coordinate of the third vertex in the image instance.
y2Y-coordinate of the third vertex in the image instance.
textureTexture image used to fill the triangle.
tx0X-coordinate of the first vertex in the texture image.
ty0Y-coordinate of the first vertex in the texture image.
tx1X-coordinate of the second vertex in the texture image.
ty1Y-coordinate of the second vertex in the texture image.
tx2X-coordinate of the third vertex in the texture image.
ty2Y-coordinate of the third vertex in the texture image.
opacityDrawing opacity.
brightnessBrightness factor of the drawing (in [0,2]).

◆ draw_triangle() [7/9]

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

Draw a Phong-shaded 2D triangle.

Parameters
x0X-coordinate of the first vertex in the image instance.
y0Y-coordinate of the first vertex in the image instance.
x1X-coordinate of the second vertex in the image instance.
y1Y-coordinate of the second vertex in the image instance.
x2X-coordinate of the third vertex in the image instance.
y2Y-coordinate of the third vertex in the image instance.
colorPointer to spectrum() consecutive values, defining the drawing color.
lightLight image.
lx0X-coordinate of the first vertex in the light image.
ly0Y-coordinate of the first vertex in the light image.
lx1X-coordinate of the second vertex in the light image.
ly1Y-coordinate of the second vertex in the light image.
lx2X-coordinate of the third vertex in the light image.
ly2Y-coordinate of the third vertex in the light image.
opacityDrawing opacity.

◆ draw_triangle() [8/9]

CImg<T>& draw_triangle ( int  x0,
int  y0,
int  x1,
int  y1,
int  x2,
int  y2,
const CImg< tc > &  texture,
int  tx0,
int  ty0,
int  tx1,
int  ty1,
int  tx2,
int  ty2,
float  bs0,
float  bs1,
float  bs2,
const float  opacity = 1 
)

Draw a textured Gouraud-shaded 2D triangle.

Parameters
x0X-coordinate of the first vertex in the image instance.
y0Y-coordinate of the first vertex in the image instance.
x1X-coordinate of the second vertex in the image instance.
y1Y-coordinate of the second vertex in the image instance.
x2X-coordinate of the third vertex in the image instance.
y2Y-coordinate of the third vertex in the image instance.
textureTexture image used to fill the triangle.
tx0X-coordinate of the first vertex in the texture image.
ty0Y-coordinate of the first vertex in the texture image.
tx1X-coordinate of the second vertex in the texture image.
ty1Y-coordinate of the second vertex in the texture image.
tx2X-coordinate of the third vertex in the texture image.
ty2Y-coordinate of the third vertex in the texture image.
bs0Brightness factor of the first vertex.
bs1Brightness factor of the second vertex.
bs2Brightness factor of the third vertex.
opacityDrawing opacity.

◆ draw_triangle() [9/9]

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

Draw a textured Phong-shaded 2D triangle.

Parameters
x0X-coordinate of the first vertex in the image instance.
y0Y-coordinate of the first vertex in the image instance.
x1X-coordinate of the second vertex in the image instance.
y1Y-coordinate of the second vertex in the image instance.
x2X-coordinate of the third vertex in the image instance.
y2Y-coordinate of the third vertex in the image instance.
textureTexture image used to fill the triangle.
tx0X-coordinate of the first vertex in the texture image.
ty0Y-coordinate of the first vertex in the texture image.
tx1X-coordinate of the second vertex in the texture image.
ty1Y-coordinate of the second vertex in the texture image.
tx2X-coordinate of the third vertex in the texture image.
ty2Y-coordinate of the third vertex in the texture image.
lightLight image.
lx0X-coordinate of the first vertex in the light image.
ly0Y-coordinate of the first vertex in the light image.
lx1X-coordinate of the second vertex in the light image.
ly1Y-coordinate of the second vertex in the light image.
lx2X-coordinate of the third vertex in the light image.
ly2Y-coordinate of the third vertex in the light image.
opacityDrawing opacity.

◆ draw_rectangle() [1/3]

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.

Parameters
x0X-coordinate of the upper-left rectangle corner.
y0Y-coordinate of the upper-left rectangle corner.
z0Z-coordinate of the upper-left rectangle corner.
c0C-coordinate of the upper-left rectangle corner.
x1X-coordinate of the lower-right rectangle corner.
y1Y-coordinate of the lower-right rectangle corner.
z1Z-coordinate of the lower-right rectangle corner.
c1C-coordinate of the lower-right rectangle corner.
valScalar value used to fill the rectangle area.
opacityDrawing opacity.

◆ draw_rectangle() [2/3]

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.

Parameters
x0X-coordinate of the upper-left rectangle corner.
y0Y-coordinate of the upper-left rectangle corner.
z0Z-coordinate of the upper-left rectangle corner.
x1X-coordinate of the lower-right rectangle corner.
y1Y-coordinate of the lower-right rectangle corner.
z1Z-coordinate of the lower-right rectangle corner.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.

◆ draw_rectangle() [3/3]

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.

Parameters
x0X-coordinate of the upper-left rectangle corner.
y0Y-coordinate of the upper-left rectangle corner.
x1X-coordinate of the lower-right rectangle corner.
y1Y-coordinate of the lower-right rectangle corner.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.

◆ draw_polygon()

CImg<T>& draw_polygon ( const CImg< tp > &  points,
const tc *const  color,
const float  opacity = 1 
)

Draw a filled 2D polygon.

Parameters
pointsSet of polygon vertices.
colorPointer to spectrum() consecutive values of type T, defining the drawing color.
opacityDrawing opacity.

◆ draw_ellipse() [1/4]

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.

Parameters
x0X-coordinate of the ellipse center.
y0Y-coordinate of the ellipse center.
r1First radius of the ellipse.
r2Second radius of the ellipse.
angleAngle of the first radius.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.

◆ draw_ellipse() [2/4]

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].

Parameters
x0X-coordinate of the ellipse center.
y0Y-coordinate of the ellipse center.
tensorDiffusion tensor describing the ellipse.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.

◆ draw_ellipse() [3/4]

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.

Parameters
x0X-coordinate of the ellipse center.
y0Y-coordinate of the ellipse center.
r1First radius of the ellipse.
r2Second radius of the ellipse.
angleAngle of the first radius.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
patternAn integer whose bits describe the outline pattern.

◆ draw_ellipse() [4/4]

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].

Parameters
x0X-coordinate of the ellipse center.
y0Y-coordinate of the ellipse center.
tensorDiffusion tensor describing the ellipse.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
patternAn integer whose bits describe the outline pattern.

◆ draw_circle() [1/2]

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.

Parameters
x0X-coordinate of the circle center.
y0Y-coordinate of the circle center.
radiusCircle radius.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
Note
  • Circle version of the Bresenham's algorithm is used.

◆ draw_circle() [2/2]

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.

Parameters
x0X-coordinate of the circle center.
y0Y-coordinate of the circle center.
radiusCircle radius.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
patternAn integer whose bits describe the outline pattern.

◆ draw_image() [1/2]

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.

Parameters
spriteSprite image.
x0X-coordinate of the sprite position.
y0Y-coordinate of the sprite position.
z0Z-coordinate of the sprite position.
c0C-coordinate of the sprite position.
opacityDrawing opacity.

◆ draw_image() [2/2]

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.

Parameters
spriteSprite image.
maskMask image.
x0X-coordinate of the sprite position in the image instance.
y0Y-coordinate of the sprite position in the image instance.
z0Z-coordinate of the sprite position in the image instance.
c0C-coordinate of the sprite position in the image instance.
mask_max_valueMaximum pixel value of the mask image mask.
opacityDrawing opacity.
Note
  • Pixel values of mask set the opacity of the corresponding pixels in sprite.
  • Dimensions along x,y and z of sprite and mask must be the same.

◆ draw_text() [1/4]

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 > *const  font,
  ... 
)

Draw a text string.

Parameters
x0X-coordinate of the text in the image instance.
y0Y-coordinate of the text in the image instance.
textFormat of the text ('printf'-style format string).
foreground_colorPointer to spectrum() consecutive values, defining the foreground drawing color.
background_colorPointer to spectrum() consecutive values, defining the background drawing color.
opacityDrawing opacity.
fontFont used for drawing text.

◆ draw_text() [2/4]

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 > *const  font,
  ... 
)

Draw a text string [overloading].

Note
A transparent background is used for the text.

◆ draw_text() [3/4]

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 > *const  font,
  ... 
)

Draw a text string [overloading].

Note
A transparent foreground is used for the text.

◆ draw_text() [4/4]

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].

Parameters
x0X-coordinate of the text in the image instance.
y0Y-coordinate of the text in the image instance.
textFormat of the text ('printf'-style format string).
foreground_colorArray of spectrum() values of type T, defining the foreground color (0 means 'transparent').
background_colorArray of spectrum() values of type T, defining the background color (0 means 'transparent').
opacityDrawing opacity.
font_heightHeight of the text font (exact match for 13,32,64,128, interpolated otherwise).

◆ draw_quiver() [1/2]

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.

Parameters
flowImage of 2D vectors used as input data.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
samplingLength (in pixels) between each arrow.
factorLength factor of each arrow (if <0, computed as a percentage of the maximum length).
is_arrowTells if arrows must be drawn, instead of oriented segments.
patternUsed pattern to draw lines.
Note
Clipping is supported.

◆ draw_quiver() [2/2]

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.

Parameters
flowImage of 2D vectors used as input data.
colorImage of spectrum()-D vectors corresponding to the color of each arrow.
opacityOpacity of the drawing.
samplingLength (in pixels) between each arrow.
factorLength factor of each arrow (if <0, computed as a percentage of the maximum length).
is_arrowTells if arrows must be drawn, instead of oriented segments.
patternUsed pattern to draw lines.
Note
Clipping is supported.

◆ draw_axis() [1/2]

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,
const float  round_x = 0 
)

Draw a labeled horizontal axis.

Parameters
values_xValues along the horizontal axis.
yY-coordinate of the horizontal axis in the image instance.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
patternDrawing pattern.
font_heightHeight of the labels (exact match for 13,23,53,103, interpolated otherwise).
allow_zeroEnable/disable the drawing of label '0' if found.

◆ draw_axis() [2/2]

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,
const float  round_y = 0 
)

Draw a labeled vertical axis.

Parameters
xX-coordinate of the vertical axis in the image instance.
values_yValues along the Y-axis.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
patternDrawing pattern.
font_heightHeight of the labels (exact match for 13,23,53,103, interpolated otherwise).
allow_zeroEnable/disable the drawing of label '0' if found.

◆ draw_axes()

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,
const float  round_x = 0,
const float  round_y = 0 
)

Draw labeled horizontal and vertical axes.

Parameters
values_xValues along the X-axis.
values_yValues along the Y-axis.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
pattern_xDrawing pattern for the X-axis.
pattern_yDrawing pattern for the Y-axis.
font_heightHeight of the labels (exact match for 13,23,53,103, interpolated otherwise).
allow_zeroEnable/disable the drawing of label '0' if found.

◆ draw_grid()

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.

Parameters
values_xX-coordinates of the vertical lines.
values_yY-coordinates of the horizontal lines.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
pattern_xDrawing pattern for vertical lines.
pattern_yDrawing pattern for horizontal lines.

◆ draw_graph()

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.

Parameters
dataImage containing the graph values I = f(x).
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.
plot_typeDefine the type of the plot:
  • 0 = No plot.
  • 1 = Plot using segments.
  • 2 = Plot using cubic splines.
  • 3 = Plot with bars.
vertex_typeDefine the type of points:
  • 0 = No points.
  • 1 = Point.
  • 2 = Straight cross.
  • 3 = Diagonal cross.
  • 4 = Filled circle.
  • 5 = Outlined circle.
  • 6 = Square.
  • 7 = Diamond.
yminLower bound of the y-range.
ymaxUpper bound of the y-range.
patternDrawing pattern.
Note
  • if ymin==ymax==0, the y-range is computed automatically from the input samples.

◆ draw_fill()

CImg<T>& draw_fill ( const int  x0,
const int  y0,
const int  z0,
const tc *const  color,
const float  opacity,
CImg< t > &  region,
const float  tolerance = 0,
const bool  is_high_connectivity = false 
)

Draw filled 3D region with the flood fill algorithm.

Parameters
x0X-coordinate of the starting point of the region to fill.
y0Y-coordinate of the starting point of the region to fill.
z0Z-coordinate of the starting point of the region to fill.
colorPointer to spectrum() consecutive values, defining the drawing color.
[out]regionImage that will contain the mask of the filled region mask, as an output.
toleranceTolerance concerning neighborhood values.
opacityOpacity of the drawing.
is_high_connectivityTells if 8-connexity must be used.
Returns
region is initialized with the binary mask of the filled region.

◆ draw_plasma()

CImg<T>& draw_plasma ( const float  alpha = 1,
const float  beta = 0,
const unsigned int  scale = 8 
)

Draw a random plasma texture.

Parameters
alphaAlpha-parameter.
betaBeta-parameter.
scaleScale-parameter.
Note
Use the mid-point algorithm to render.

◆ draw_mandelbrot()

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.

Parameters
x0X-coordinate of the upper-left pixel.
y0Y-coordinate of the upper-left pixel.
x1X-coordinate of the lower-right pixel.
y1Y-coordinate of the lower-right pixel.
paletteColormap.
opacityDrawing opacity.
z0rReal part of the upper-left fractal vertex.
z0iImaginary part of the upper-left fractal vertex.
z1rReal part of the lower-right fractal vertex.
z1iImaginary part of the lower-right fractal vertex.
iteration_maxMaximum number of iterations for each estimated point.
is_normalized_iterationTells if iterations are normalized.
is_julia_setTells if the Mandelbrot or Julia set is rendered.
param_rReal part of the Julia set parameter.
param_iImaginary part of the Julia set parameter.
Note
Fractal rendering is done by the Escape Time Algorithm.

◆ draw_gaussian() [1/2]

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

Draw a 1D gaussian function.

Parameters
xcX-coordinate of the gaussian center.
sigmaStandard variation of the gaussian distribution.
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.

◆ draw_gaussian() [2/2]

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.

Parameters
xcX-coordinate of the gaussian center.
ycY-coordinate of the gaussian center.
tensorCovariance matrix (must be 2x2).
colorPointer to spectrum() consecutive values, defining the drawing color.
opacityDrawing opacity.

◆ draw_object3d()

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,
const float  g_opacity = 1 
)

Draw a 3D object.

Parameters
x0X-coordinate of the 3D object position
y0Y-coordinate of the 3D object position
z0Z-coordinate of the 3D object position
verticesImage Nx3 describing 3D point coordinates
primitivesList of P primitives
colorsList of P color (or textures)
opacitiesImage or list of P opacities
render_typed Render type (0=Points, 1=Lines, 2=Faces (no light), 3=Faces (flat), 4=Faces(Gouraud)
is_double_sidedTells if object faces have two sides or are oriented.
focalelength of the focale (0 for parallel projection)
lightxX-coordinate of the light
lightyY-coordinate of the light
lightzZ-coordinate of the light
specular_lightnessAmount of specular light.
specular_shininessShininess of the object
g_opacityGlobal opacity of the object.

◆ select()

CImg<T>& select ( CImgDisplay disp,
const unsigned int  feature_type = 2,
unsigned int *const  XYZ = 0,
const bool  exit_on_anykey = false,
const bool  is_deep_selection_default = false 
)

Launch simple interface to select a shape from an image.

Parameters
dispDisplay window to use.
feature_typeType of feature to select. Can be { 0=point | 1=line | 2=rectangle | 3=ellipse }.
XYZPointer to 3 values X,Y,Z which tells about the projection point coordinates, for volumetric images.
exit_on_anykeyExit function when any key is pressed.

◆ load()

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

Load image from a file.

Parameters
filenameFilename, as a C-string.
Note
The extension of filename defines the file format. If no filename extension is provided, CImg<T>::get_load() will try to load the file as a .cimg or .cimgz file.

◆ load_ascii()

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

Load image from an ascii file.

Parameters
filenameFilename, as a C -string.

◆ load_dlm()

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

Load image from a DLM file.

Parameters
filenameFilename, as a C-string.

◆ load_bmp()

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

Load image from a BMP file.

Parameters
filenameFilename, as a C-string.

◆ load_jpeg()

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

Load image from a JPEG file.

Parameters
filenameFilename, as a C-string.

◆ load_magick()

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

Load image from a file, using Magick++ library.

Parameters
filenameFilename, as a C-string.

◆ load_png()

CImg<T>& load_png ( const char *const  filename,
unsigned int *const  bits_per_value = 0 
)

Load image from a PNG file.

Parameters
filenameFilename, as a C-string.
[out]bits_per_valueNumber of bits used to store a scalar value in the image file.

◆ load_pnm()

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

Load image from a PNM file.

Parameters
filenameFilename, as a C-string.

◆ load_pfm()

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

Load image from a PFM file.

Parameters
filenameFilename, as a C-string.

◆ load_rgb()

CImg<T>& load_rgb ( const char *const  filename,
const unsigned int  dimw,
const unsigned int  dimh = 1 
)

Load image from a RGB file.

Parameters
filenameFilename, as a C-string.
dimwWidth of the image buffer.
dimhHeight of the image buffer.

◆ load_rgba()

CImg<T>& load_rgba ( const char *const  filename,
const unsigned int  dimw,
const unsigned int  dimh = 1 
)

Load image from a RGBA file.

Parameters
filenameFilename, as a C-string.
dimwWidth of the image buffer.
dimhHeight of the image buffer.

◆ load_tiff()

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,
unsigned int *const  bits_per_value = 0,
float *const  voxel_size = 0,
CImg< charT > *const  description = 0 
)

Load image from a TIFF file.

Parameters
filenameFilename, as a C-string.
first_frameFirst frame to read (for multi-pages tiff).
last_frameLast frame to read (for multi-pages tiff).
step_frameStep value of frame reading.
[out]bits_per_valueNumber of bits used to store a scalar value in the image file.
[out]voxel_sizeVoxel size, as stored in the filename.
[out]descriptionDescription, as stored in the filename.
Note
  • libtiff support is enabled by defining the precompilation directive cimg_use_tiff.
  • When libtiff is enabled, 2D and 3D (multipage) several channel per pixel are supported for char,uchar,short,ushort,float and double pixel types.
  • If cimg_use_tiff is not defined at compile time the function uses CImg<T>& load_other(const char*).

◆ load_minc2()

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

Load image from a MINC2 file.

Parameters
filenameFilename, as a C-string.

◆ load_analyze()

CImg<T>& load_analyze ( const char *const  filename,
float *const  voxel_size = 0 
)

Load image from an ANALYZE7.5/NIFTI file.

Parameters
filenameFilename, as a C-string.
[out]voxel_sizePointer to the three voxel sizes read from the file.

◆ load_cimg() [1/2]

CImg<T>& load_cimg ( const char *const  filename,
const char  axis = 'z',
const float  align = 0 
)

Load image from a .cimg[z] file.

Parameters
filenameFilename, as a C-string.
axisAppending axis, if file contains multiple images. Can be { 'x' | 'y' | 'z' | 'c' }.
alignAppending alignment.

◆ load_cimg() [2/2]

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.

Parameters
filenameFilename, as a C-string.
n0Starting frame.
n1Ending frame (~0U for max).
x0X-coordinate of the starting sub-image vertex.
y0Y-coordinate of the starting sub-image vertex.
z0Z-coordinate of the starting sub-image vertex.
c0C-coordinate of the starting sub-image vertex.
x1X-coordinate of the ending sub-image vertex (~0U for max).
y1Y-coordinate of the ending sub-image vertex (~0U for max).
z1Z-coordinate of the ending sub-image vertex (~0U for max).
c1C-coordinate of the ending sub-image vertex (~0U for max).
axisAppending axis, if file contains multiple images. Can be { 'x' | 'y' | 'z' | 'c' }.
alignAppending alignment.

◆ load_inr()

CImg<T>& load_inr ( const char *const  filename,
float *const  voxel_size = 0 
)

Load image from an INRIMAGE-4 file.

Parameters
filenameFilename, as a C-string.
[out]voxel_sizePointer to the three voxel sizes read from the file.

◆ load_exr()

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

Load image from a EXR file.

Parameters
filenameFilename, as a C-string.

◆ load_pandore()

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

Load image from a PANDORE-5 file.

Parameters
filenameFilename, as a C-string.

◆ load_parrec()

CImg<T>& load_parrec ( const char *const  filename,
const char  axis = 'c',
const float  align = 0 
)

Load image from a PAR-REC (Philips) file.

Parameters
filenameFilename, as a C-string.
axisAppending axis, if file contains multiple images. Can be { 'x' | 'y' | 'z' | 'c' }.
alignAppending alignment.

◆ load_raw()

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 ulongT  offset = 0 
)

Load image from a raw binary file.

Parameters
filenameFilename, as a C-string.
size_xWidth of the image buffer.
size_yHeight of the image buffer.
size_zDepth of the image buffer.
size_cSpectrum of the image buffer.
is_multiplexedTells if the image values are multiplexed along the C-axis.
invert_endiannessTells if the endianness of the image buffer must be inverted.
offsetStarting offset of the read in the specified file.

◆ load_yuv()

CImg<T>& load_yuv ( const char *const  filename,
const unsigned int  size_x,
const unsigned int  size_y = 1,
const unsigned int  chroma_subsampling = 444,
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.

Parameters
filenameFilename, as a C-string.
size_xWidth of the frames.
size_yHeight of the frames.
chroma_subsamplingType of chroma subsampling. Can be { 420 | 422 | 444 }.
first_frameIndex of the first frame to read.
last_frameIndex of the last frame to read.
step_frameStep value for frame reading.
yuv2rgbTells if the YUV to RGB transform must be applied.
axisAppending axis, if file contains multiple images. Can be { 'x' | 'y' | 'z' | 'c' }.

◆ load_off()

CImg<T>& load_off ( CImgList< tf > &  primitives,
CImgList< tc > &  colors,
const char *const  filename 
)

Load 3D object from a .OFF file.

Parameters
[out]primitivesPrimitives data of the 3D object.
[out]colorsColors data of the 3D object.
filenameFilename, as a C-string.

◆ load_video()

CImg<T>& load_video ( const char *const  filename,
const unsigned int  first_frame = 0,
const unsigned int  last_frame = ~0U,
const unsigned int  step_frame = 1,
const char  axis = 'z',
const float  align = 0 
)

Load image sequence from a video file, using OpenCV library.

Parameters
filenameFilename, as a C-string.
first_frameIndex of the first frame to read.
last_frameIndex of the last frame to read.
step_frameStep value for frame reading.
axisAlignment axis.
alignAppending alignment.

◆ load_ffmpeg_external()

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'.

Parameters
filenameFilename, as a C-string.
axisAppending axis, if file contains multiple images. Can be { 'x' | 'y' | 'z' | 'c' }.
alignAppending alignment.

◆ load_gif_external()

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.

Parameters
filenameFilename, as a C-string.
axisAppending axis, if file contains multiple images. Can be { 'x' | 'y' | 'z' | 'c' }.
alignAppending alignment.

◆ load_heif()

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

Load image from a HEIC file.

Parameters
filenameFilename, as a C-string.

◆ load_graphicsmagick_external()

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

Load image using GraphicsMagick's external tool 'gm'.

Parameters
filenameFilename, as a C-string.

◆ load_gzip_external()

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

Load gzipped image file, using external tool 'gunzip'.

Parameters
filenameFilename, as a C-string.

◆ load_imagemagick_external()

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

Load image using ImageMagick's external tool 'convert'.

Parameters
filenameFilename, as a C-string.

◆ load_medcon_external()

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

Load image from a DICOM file, using Medcon's external tool 'medcon'.

Parameters
filenameFilename, as a C-string.

◆ load_pdf_external()

CImg<T>& load_pdf_external ( const char *const  filename,
const unsigned int  resolution = 400 
)

Load image from a .pdf file.

Parameters
filenameFilename, as a C-string.
resolutionImage resolution.

◆ load_dcraw_external()

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

Load image from a RAW Color Camera file, using external tool 'dcraw'.

Parameters
filenameFilename, as a C-string.

◆ load_camera()

CImg<T>& load_camera ( const unsigned int  camera_index = 0,
const unsigned int  capture_width = 0,
const unsigned int  capture_height = 0,
const unsigned int  skip_frames = 0,
const bool  release_camera = true 
)

Load image from a camera stream, using OpenCV.

Parameters
indexIndex of the camera to capture images from (from 0 to 63).
capture_widthWidth of the desired image ('0' stands for default value).
capture_heightHeight of the desired image ('0' stands for default value).
skip_framesNumber of frames to skip before the capture.
release_cameraTells if the camera resource must be released at the end of the method.

◆ load_other()

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

Load image using various non-native ways.

Parameters
filenameFilename, as a C-string.

◆ print()

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

Display information about the image data.

Parameters
titleName for the considered image.
display_statsTells to compute and display image statistics.

◆ display() [1/3]

const CImg<T>& display ( CImgDisplay disp) const

Display image into a CImgDisplay window.

Parameters
dispDisplay window.

◆ display() [2/3]

const CImg<T>& display ( CImgDisplay disp,
const bool  display_info,
unsigned int *const  XYZ = 0,
const bool  exit_on_anykey = false 
) const

Display image into a CImgDisplay window, in an interactive way.

Parameters
dispDisplay window.
display_infoTells if image information are displayed on the standard output.
[in,out]XYZContains the XYZ coordinates at start / exit of the function.
exit_on_anykeyExit function when any key is pressed.

◆ display() [3/3]

const CImg<T>& display ( const char *const  title = 0,
const bool  display_info = true,
unsigned int *const  XYZ = 0,
const bool  exit_on_anykey = false 
) const

Display image into an interactive window.

Parameters
titleWindow title
display_infoTells if image information are displayed on the standard output.
[in,out]XYZContains the XYZ coordinates at start / exit of the function.
exit_on_anykeyExit function when any key is pressed.

◆ display_object3d()

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 bool  exit_on_anykey = false 
) const

Display object 3D in an interactive window.

Parameters
dispDisplay window.
verticesVertices data of the 3D object.
primitivesPrimitives data of the 3D object.
colorsColors data of the 3D object.
opacitiesOpacities data of the 3D object.
centeringTells if the 3D object must be centered for the display.
render_staticRendering mode.
render_motionRendering mode, when the 3D object is moved.
is_double_sidedTells if the object primitives are double-sided.
focaleFocale
light_xX-coordinate of the light source.
light_yY-coordinate of the light source.
light_zZ-coordinate of the light source.
specular_lightnessAmount of specular light.
specular_shininessShininess of the object material.
display_axesTells if the 3D axes are displayed.
pose_matrixPointer to 12 values, defining a 3D pose (as a 4x3 matrix).
exit_on_anykeyExit function when any key is pressed.

◆ display_graph()

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 bool  exit_on_anykey = false 
) const

Display 1D graph in an interactive window.

Parameters
dispDisplay window.
plot_typePlot type. Can be { 0=points | 1=segments | 2=splines | 3=bars }.
vertex_typeVertex type.
labelxTitle for the horizontal axis, as a C-string.
xminMinimum value along the X-axis.
xmaxMaximum value along the X-axis.
labelyTitle for the vertical axis, as a C-string.
yminMinimum value along the X-axis.
ymaxMaximum value along the X-axis.
exit_on_anykeyExit function when any key is pressed.

◆ save()

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

Save image as a file.

Parameters
filenameFilename, as a C-string.
numberWhen positive, represents an index added to the filename. Otherwise, no number is added.
digitsNumber of digits used for adding the number to the filename.
Note
  • The used file format is defined by the file extension in the filename filename.
  • Parameter number can be used to add a 6-digit number to the filename before saving.

◆ save_ascii()

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

Save image as an ascii file.

Parameters
filenameFilename, as a C-string.

◆ save_cpp()

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

Save image as a .cpp source file.

Parameters
filenameFilename, as a C-string.

◆ save_dlm()

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

Save image as a DLM file.

Parameters
filenameFilename, as a C-string.

◆ save_bmp()

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

Save image as a BMP file.

Parameters
filenameFilename, as a C-string.

◆ save_jpeg()

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

Save image as a JPEG file.

Parameters
filenameFilename, as a C-string.
qualityImage quality (in %)

◆ save_magick()

const CImg<T>& save_magick ( const char *const  filename,
const unsigned int  bytes_per_pixel = 0 
) const

Save image, using built-in ImageMagick++ library.

Parameters
filenameFilename, as a C-string.
bytes_per_pixelForce the number of bytes per pixel for the saving, when possible.

◆ save_png()

const CImg<T>& save_png ( const char *const  filename,
const unsigned int  bytes_per_pixel = 0 
) const

Save image as a PNG file.

Parameters
filenameFilename, as a C-string.
bytes_per_pixelForce the number of bytes per pixels for the saving, when possible.

◆ save_pnm()

const CImg<T>& save_pnm ( const char *const  filename,
const unsigned int  bytes_per_pixel = 0 
) const

Save image as a PNM file.

Parameters
filenameFilename, as a C-string.
bytes_per_pixelForce the number of bytes per pixels for the saving.

◆ save_pnk()

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

Save image as a PNK file.

Parameters
filenameFilename, as a C-string.

◆ save_pfm()

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

Save image as a PFM file.

Parameters
filenameFilename, as a C-string.

◆ save_rgb()

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

Save image as a RGB file.

Parameters
filenameFilename, as a C-string.

◆ save_rgba()

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

Save image as a RGBA file.

Parameters
filenameFilename, as a C-string.

◆ save_tiff()

const CImg<T>& save_tiff ( const char *const  filename,
const unsigned int  compression_type = 0,
const float *const  voxel_size = 0,
const char *const  description = 0,
const bool  use_bigtiff = true 
) const

Save image as a TIFF file.

Parameters
filenameFilename, as a C-string.
compression_typeType of data compression. Can be { 0=None | 1=LZW | 2=JPEG }.
[out]voxel_sizeVoxel size, to be stored in the filename.
[out]descriptionDescription, to be stored in the filename.
use_bigtiffAllow to save big tiff files (>4Gb).
Note
  • libtiff support is enabled by defining the precompilation directive cimg_use_tiff.
  • When libtiff is enabled, 2D and 3D (multipage) several channel per pixel are supported for char,uchar,short,ushort,float and double pixel types.
  • If cimg_use_tiff is not defined at compile time the function uses CImg<T>&save_other(const char*).

◆ save_minc2()

const CImg<T>& save_minc2 ( const char *const  filename,
const char *const  imitate_file = 0 
) const

Save image as a MINC2 file.

Parameters
filenameFilename, as a C-string.
imitate_fileIf non-zero, reference filename, as a C-string, to borrow header from.

◆ save_analyze()

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.

Parameters
filenameFilename, as a C-string.
voxel_sizePointer to 3 consecutive values that tell about the voxel sizes along the X,Y and Z dimensions.

◆ save_cimg() [1/2]

const CImg<T>& save_cimg ( const char *const  filename,
const bool  is_compressed = false 
) const

Save image as a .cimg file.

Parameters
filenameFilename, as a C-string.
is_compressedTells if the file contains compressed image data.

◆ save_cimg() [2/2]

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.

Parameters
filenameFilename, as a C-string.
n0Index of the image inside the file.
x0X-coordinate of the sub-image location.
y0Y-coordinate of the sub-image location.
z0Z-coordinate of the sub-image location.
c0C-coordinate of the sub-image location.

◆ save_empty_cimg() [1/2]

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 
)
static

Save blank image as a .cimg file.

Parameters
filenameFilename, as a C-string.
dxWidth of the image.
dyHeight of the image.
dzDepth of the image.
dcNumber of channels of the image.
Note
  • All pixel values of the saved image are set to 0.
  • Use this method to save large images without having to instantiate and allocate them.

◆ save_empty_cimg() [2/2]

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 
)
static

Save blank image as a .cimg file [overloading].

Same as save_empty_cimg(const char *,unsigned int,unsigned int,unsigned int,unsigned int) with a file stream argument instead of a filename string.

◆ save_inr()

const CImg<T>& save_inr ( const char *const  filename,
const float *const  voxel_size = 0 
) const

Save image as an INRIMAGE-4 file.

Parameters
filenameFilename, as a C-string.
voxel_sizePointer to 3 values specifying the voxel sizes along the X,Y and Z dimensions.

◆ save_exr()

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

Save image as an OpenEXR file.

Parameters
filenameFilename, as a C-string.
Note
The OpenEXR file format is described here.

◆ save_pandore() [1/2]

const CImg<T>& save_pandore ( const char *const  filename,
const unsigned int  colorspace = 0 
) const

Save image as a Pandore-5 file.

Parameters
filenameFilename, as a C-string.
colorspaceColorspace data field in output file (see Pandore file specifications for more information).

◆ save_pandore() [2/2]

const CImg<T>& save_pandore ( std::FILE *const  file,
const unsigned int  colorspace = 0 
) const

Save image as a Pandore-5 file [overloading].

Same as save_pandore(const char *,unsigned int) const with a file stream argument instead of a filename string.

◆ save_raw() [1/2]

const CImg<T>& save_raw ( const char *const  filename,
const bool  is_multiplexed = false 
) const

Save image as a raw data file.

Parameters
filenameFilename, as a C-string.
is_multiplexedTells if the image channels are stored in a multiplexed way (true) or not (false).
Note
The .raw format does not store the image dimensions in the output file, so you have to keep track of them somewhere to be able to read the file correctly afterwards.

◆ save_raw() [2/2]

const CImg<T>& save_raw ( std::FILE *const  file,
const bool  is_multiplexed = false 
) const

Save image as a raw data file [overloading].

Same as save_raw(const char *,bool) const with a file stream argument instead of a filename string.

◆ save_yuv() [1/2]

const CImg<T>& save_yuv ( const char *const  filename,
const unsigned int  chroma_subsampling = 444,
const bool  is_rgb = true 
) const

Save image as a .yuv video file.

Parameters
filenameFilename, as a C-string.
chroma_subsamplingType of chroma subsampling. Can be { 420 | 422 | 444 }.
is_rgbTells if pixel values of the instance image are RGB-coded (true) or YUV-coded (false).
Note
Each slice of the instance image is considered to be a single frame of the output video file.

◆ save_yuv() [2/2]

const CImg<T>& save_yuv ( std::FILE *const  file,
const unsigned int  chroma_subsampling = 444,
const bool  is_rgb = true 
) const

Save image as a .yuv video file [overloading].

Same as save_yuv(const char*,const unsigned int,const bool) const with a file stream argument instead of a filename string.

◆ save_off() [1/2]

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.

Parameters
filenameFilename, as a C-string.
primitivesList of 3D object primitives.
colorsList of 3D object colors.
Note
  • Instance image contains the vertices data of the 3D object.
  • Textured, transparent or sphere-shaped primitives cannot be managed by the .off file format. Such primitives will be lost or simplified during file saving.
  • The .off file format is described here.

◆ save_off() [2/2]

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].

Same as save_off(const CImgList<tf>&,const CImgList<tc>&,const char*) const with a file stream argument instead of a filename string.

◆ save_video()

const CImg<T>& save_video ( const char *const  filename,
const unsigned int  fps = 25,
const char *  codec = 0,
const bool  keep_open = false 
) const

Save volumetric image as a video (using the OpenCV library when available).

Parameters
filenameFilename to write data to.
fpsNumber of frames per second.
codecType of compression (See http://www.fourcc.org/codecs.php to see available codecs).
keep_openTells if the video writer associated to the specified filename must be kept open or not (to allow frames to be added in the same file afterwards).

◆ save_ffmpeg_external()

const CImg<T>& save_ffmpeg_external ( const char *const  filename,
const unsigned int  fps = 25,
const char *const  codec = 0,
const unsigned int  bitrate = 2048 
) const

Save volumetric image as a video, using ffmpeg external binary.

Parameters
filenameFilename, as a C-string.
fpsVideo framerate.
codecVideo codec, as a C-string.
bitrateVideo bitrate.
Note
  • Each slice of the instance image is considered to be a single frame of the output video file.
  • This method uses ffmpeg, an external executable binary provided by FFmpeg. It must be installed for the method to succeed.

◆ save_gzip_external()

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

Save image using gzip external binary.

Parameters
filenameFilename, as a C-string.
Note
This method uses gzip, an external executable binary provided by gzip. It must be installed for the method to succeed.

◆ save_graphicsmagick_external()

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

Save image using GraphicsMagick's external binary.

Parameters
filenameFilename, as a C-string.
qualityImage quality (expressed in percent), when the file format supports it.
Note
This method uses gm, an external executable binary provided by GraphicsMagick. It must be installed for the method to succeed.

◆ save_imagemagick_external()

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

Save image using ImageMagick's external binary.

Parameters
filenameFilename, as a C-string.
qualityImage quality (expressed in percent), when the file format supports it.
Note
This method uses convert, an external executable binary provided by ImageMagick. It must be installed for the method to succeed.

◆ save_medcon_external()

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

Save image as a Dicom file.

Parameters
filenameFilename, as a C-string.
Note
This method uses medcon, an external executable binary provided by (X)Medcon. It must be installed for the method to succeed.

◆ save_other()

const CImg<T>& save_other ( const char *const  filename,
const unsigned int  quality = 100 
) const
Parameters
filenameFilename, as a C-string.
qualityImage quality (expressed in percent), when the file format supports it.
Note
  • The filename extension tells about the desired file format.
  • This method tries to save the instance image as a file, using external tools from ImageMagick or GraphicsMagick. At least one of these tool must be installed for the method to succeed.
  • It is recommended to use the generic method save(const char*, int) const instead, as it can handle some file formats natively.

◆ get_serialize()

CImg<ucharT> get_serialize ( const bool  is_compressed = false,
const unsigned int  header_size = 0 
) const

Serialize a CImg<T> instance into a raw CImg<unsigned char> buffer.

Parameters
is_compressedtells if zlib compression must be used for serialization (this requires 'cimg_use_zlib' been enabled).
header_sizeReserve empty bytes as a starting header.

Member Data Documentation

◆ const_iterator

const typedef 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;
// Compute sum of all pixel values, with a CImg iterator.
for (CImg<float>::iterator it = img.begin(), it<img.end(); ++it) sum+=*it;
const float sum2 = img.sum(); // Do the same with a built-in method
static CImg< T > tensor(const T &a0)
Return a 1x1 symmetric matrix containing specified coefficients.
Definition: CImg.h:32084
CImg< T > & permute_axes(const char *const axes_order)
Permute axes order.
Definition: CImg.h:36863
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.
Definition: CImg.h:46789
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.
Definition: CImg.h:46815
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.
Definition: CImg.h:46892
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.
Definition: CImg.h:46940
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.
Definition: CImg.h:46852
CImg< T > & diagonal()
Resize image to become a diagonal matrix.
Definition: CImg.h:30387
static CImg< floatT > ellipsoid3d(CImgList< tf > &primitives, const CImg< t > &tensor, const unsigned int subdivisions=3)
Generate a 3D ellipsoid.
Definition: CImg.h:47045
CImg< T > & pow(const double p)
Raise each pixel value to a specified power.
Definition: CImg.h:29024
double sum() const
Return the sum of all the pixel values.
Definition: CImg.h:29689
static CImg< T > & empty()
Return a reference to an empty image.
Definition: CImg.h:12922
const CImg< T > & display(CImgDisplay &disp) const
Display image into a CImgDisplay window.
Definition: CImg.h:57561
static CImg< floatT > sphere3d(CImgList< tf > &primitives, const float radius=50, const unsigned int subdivisions=3)
Generate a 3D sphere.
Definition: CImg.h:46973
CImg< T > & cut(const T &min_value, const T &max_value)
Cut pixel values in specified range.
Definition: CImg.h:33516
longT 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.
Definition: CImg.h:14507
T * iterator
Simple iterator type, to loop through each pixel value of an image instance.
Definition: CImg.h:11791

Copyrights (C) From october 2004, David Tschumperlé - GREYC UMR CNRS 6072, Image team.
Copyrights (C) January->September 2004, David Tschumperlé.
Copyrights (C) 2000->2003, David Tschumperlé - INRIA Sophia-Antipolis. Odyssée group.