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

CImg Struct Template Reference

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

List of all members.

Image Informations

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

Usual Image Transformations

CImg< T > get_fill (const T val) const
 Fill an image by a value val.
CImg< T > & fill (const T val)
 Fill an image by a value val (in-place).
CImg< T > get_fill (const T val0, const T val1) const
 Fill sequentially all pixel values with values val0 and val1 respectively.
CImg< T > & fill (const T val0, const T val1)
 Fill sequentially all pixel values with values val0 and val1 respectively (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2) const
 Fill sequentially all pixel values with values val0 and val1 and val2.
CImg< T > & fill (const T val0, const T val1, const T val2)
 Fill sequentially all pixel values with values val0 and val1 and val2 (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3) const
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3)
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4) const
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 and val4.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4)
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 and val4 (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5) const
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 and val4 and val5.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5)
 Fill sequentially all pixel values with values val0 and val1 and val2 and val3 and val4 and val5 (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13, const T val14) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13, const T val14)
 Fill sequentially pixel values (in-place).
CImg< T > get_fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13, const T val14, const T val15) const
 Fill sequentially pixel values.
CImg< T > & fill (const T val0, const T val1, const T val2, const T val3, const T val4, const T val5, const T val6, const T val7, const T val8, const T val9, const T val10, const T val11, const T val12, const T val13, const T val14, const T val15)
 Fill sequentially pixel values (in-place).
template<int N>
CImg< T > get_fill (const int val0,...) const
 Fill sequentially pixel values.
template<int N>
CImg< T > & fill (const int val0,...)
 Fill sequentially pixel values (in-place).
template<int N>
CImg< T > get_fill (const double val0,...) const
 Fill sequentially pixel values.
template<int N>
CImg< T > & fill (const double val0,...)
 Fill sequentially pixel values (in-place).
template<int N, typename t>
CImg< T > & _fill (const t val0, va_list &ap)
CImg< T > get_fill (const char *const values, const bool repeat_pattern) const
 Fill image values according to the values found in the specified string.
CImg< T > & fill (const char *const values, const bool repeat_pattern)
 Fill image values according to the values found in the specified string (in-place).
CImg< T > & fillV (const unsigned int x, const unsigned int y, const unsigned int z, const int a0,...)
 Fill image values along the V-axis at the specified pixel position (x,y,z) (int version).
CImg< T > & fillV (const unsigned int x, const unsigned int y, const unsigned int z, const double a0,...)
 Fill image values along the V-axis at the specified pixel position (x,y,z) (double version).
CImg< T > & fillZV (const unsigned int x, const unsigned int y, const int a0,...)
 Fill image values along the ZV-axes at the specified pixel position (x,y) (int version).
CImg< T > & fillZV (const unsigned int x, const unsigned int y, const double a0,...)
 Fill image values along the ZV-axes at the specified pixel position (x,y) (double version).
CImg< T > & fillYZV (const unsigned int x, const int a0,...)
 Fill image values along the YZV-axes at the specified pixel position x (int version).
CImg< T > & fillYZV (const unsigned int x, const double a0,...)
 Fill image values along the YZV-axes at the specified pixel position x (double version).
CImg< T > get_normalize (const T a, const T b) const
 Linear normalization of the pixel values between a and b.
CImg< T > & normalize (const T a, const T b)
 Linear normalization of the pixel values between a and b (in-place).
CImg< T > get_cut (const T a, const T b) const
 Cut pixel values between a and b.
CImg< T > & cut (const T a, const T b)
 Cut pixel values between a and b (in-place).
CImg< T > get_quantize (const unsigned int n=256, const bool keep_range=true) const
 Quantize pixel values into
levels.
CImg< T > & quantize (const unsigned int n=256, const bool keep_range=true)
 Quantize pixel values into
levels (in-place).
CImg< typename cimg::last< T,
bool >::type > 
get_threshold (const T thres, const bool strict=false) const
 Threshold the image.
CImg< T > & threshold (const T thres, const bool strict=false)
 Threshold the image (in-place).
CImg< T > get_rotate (const float angle, const unsigned int cond=3) const
 Rotate an image.
CImg< T > & rotate (const float angle, const unsigned int cond=3)
 Rotate an image (in-place version).
CImg< T > get_rotate (const float angle, const float cx, const float cy, const float zoom=1, const unsigned int cond=3) const
 Rotate an image around a center point (cx,cy).
CImg< T > & rotate (const float angle, const float cx, const float cy, const float zoom=1, const unsigned int cond=3)
 Rotate an image around a center point (cx,cy) (in-place).
CImg< T > get_resize (const int pdx=-100, const int pdy=-100, const int pdz=-100, const int pdv=-100, const int interpolation_type=1, const int border_condition=-1, const bool center=false) const
 Resize an image.
CImg< T > & resize (const int pdx=-100, const int pdy=-100, const int pdz=-100, const int pdv=-100, const int interpolation_type=1, const int border_condition=-1, const bool center=false)
 Resize an image (in-place).
template<typename t>
CImg< T > get_resize (const CImg< t > &src, const int interpolation_type=1, const int border_condition=-1, const bool center=false) const
 Resize an image.
template<typename t>
CImg< T > & resize (const CImg< t > &src, const int interpolation_type=1, const int border_condition=-1, const bool center=false)
 Resize an image (in-place).
CImg< T > get_resize (const CImgDisplay &disp, const int interpolation_type=1, const int border_condition=-1, const bool center=false) const
 Resize an image.
CImg< T > & resize (const CImgDisplay &disp, const int interpolation_type=1, const int border_condition=-1, const bool center=false)
 Resize an image (in-place).
CImg< T > get_resize_halfXY () const
 Half-resize an image, using a special optimized filter.
CImg< T > & resize_halfXY ()
 Half-resize an image, using a special optimized filter (in-place).
CImg< T > get_resize_doubleXY () const
 Upscale an image by a factor 2x.
CImg< T > & resize_doubleXY ()
 Upscale an image by a factor 2x (in-place).
CImg< T > get_resize_tripleXY () const
 Upscale an image by a factor 3x.
CImg< T > & resize_tripleXY ()
 Upscale an image by a factor 3x (in-place).
template<typename t>