The C++ Template Image Processing Library.    

[Introduction]- [News]- [Download]- [Screenshots]- [Tutorial]- [Forums]- [Reference]- [SourceForge Repository ]

Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

CImg Struct Template Reference

This structure represents an image (up to 4 dimensions wide), with pixels of type T. More...

Inheritance diagram for CImg:

CImgROI List of all members.

Constructors - Destructor - Copy

 CImg (const unsigned int dx=0, const unsigned int dy=1, const unsigned int dz=1, const unsigned int dv=1)
 Create an image of size (dx,dy,dz,dv) with pixels of type T.
 CImg (const unsigned int dx, const unsigned int dy, const unsigned int dz, const unsigned int dv, const T &val)
 Create an image of size (dx,dy,dz,dv) with pixels of type T, and set the image pixels to the value val.
template<typename t>
 CImg (const CImg< t > &img)
 Copy constructor.
template<typename t>
 CImg (const CImg< t > &img, const bool pixel_copy)
 Copy constructor.
 CImg (const char *filename)
 Create an image by loading a file.
 CImg (const T *const data_buffer, unsigned int dx, unsigned int dy=1, unsigned int dz=1, unsigned int dv=1)
 Create an image from a data buffer.
 ~CImg ()
 Destructor.
CImgempty ()
 Empty image.

Access to image dimensions and pixel values

const unsigned int size () const
 Return the number of pixels of an image.
const int dimx () const
 Return the number of columns of the instance image (size along the X-axis).
const int dimy () const
 Return the number of rows of the instance image (size along the Y-axis).
const int dimz () const
 Return the number of slices of the instance image (size along the Z-axis).
const int dimv () const
 Return the number of vector channels of the instance image (size along the V-axis).
const int offset (const int x=0, const int y=0, const int z=0, const int v=0) const
 Return the offset corresponding to the location of the pixel value located at (x,y,z,v).
T * ptr (const unsigned int x=0, const unsigned int y=0, const unsigned int z=0, const unsigned int v=0) const
 Return a pointer to the pixel value located at (x,y,z,v).
T & operator() (const unsigned int x, const unsigned int y=0, const unsigned int z=0, const unsigned int v=0) const
 Access to pixel value for reading or writing, without boundary checking.
T & operator[] (const unsigned int off) const
 Access to pixel buffer value for reading or writing.
dirichlet_pix4d (const int x, const int y=0, const int z=0, const int v=0, const T out_val=(T) 0) const
 Pixel access with Dirichlet boundary conditions for all coordinates (x,y,z,v).
dirichlet_pix3d (const int x, const int y=0, const int z=0, const int v=0, const T out_val=(T) 0) const
 Pixel access with Dirichlet boundary conditions for the three first coordinates (x,y,z).
dirichlet_pix2d (const int x, const int y=0, const int z=0, const int v=0, const T out_val=(T) 0) const
 Pixel access with Dirichlet boundary conditions for the two first coordinates (x,y).
dirichlet_pix1d (const int x, const int y=0, const int z=0, const int v=0, const T out_val=(T) 0) const
 Pixel access with Dirichlet boundary conditions for the first coordinate x.
const T & neumann_pix4d (const int x, const int y=0, const int z=0, const int v=0) const
 Pixel access with Neumann boundary conditions for all coordinates (x,y,z,v).
const T & neumann_pix3d (const int x, const int y=0, const int z=0, const int v=0) const
 Pixel access with Neumann boundary conditions for the three first coordinates (x,y,z).
const T & neumann_pix2d (const int x, const int y=0, const int z=0, const int v=0) const
 Pixel access with Neumann boundary conditions for the two first coordinates (x,y).
const T & neumann_pix1d (const int x, const int y=0, const int z=0, const int v=0) const
 Pixel access with Neumann boundary conditions for the first coordinate x.
double linear_pix4d (const float ffx, const float ffy=0, const float ffz=0, const float ffv=0) const
 Pixel access with Neumann boundary conditions and linear interpolation for all coordinates (x,y,z,v).
double linear_pix3d (const float ffx, const float ffy=0, const float ffz=0, const int v=0) const
 Pixel access with Neumann boundary conditions and linear interpolation for the three first coordinates (x,y,z).
double linear_pix2d (const float ffx, const float ffy=0, const int z=0, int v=0) const
 Pixel access with Neumann boundary conditions and linear interpolation for the two first coordinates (x,y).
double linear_pix1d (const float ffx, const int y=0, const int z=0, int v=0) const
 Pixel access with Neumann boundary conditions and linear interpolation for the first coordinate x.
double cubic_pix2d (const float pfx, const float pfy=0, const int z=0, int v=0) const
 Pixel access with Neumann boundary conditions and cubic interpolation for the two first coordinates (x,y).
double cubic_pix1d (const float pfx, const int y=0, const int z=0, int v=0) const
 Pixel access with Neumann boundary conditions and cubic interpolation for all coordinates x.
CImgStats get_stats (const bool compute_variance=true) const
 Compute and return statistics on the image.
const CImgprint (const char *title=NULL, const unsigned int print_flag=1) const
 Print image information on the standart error output.
const CImgprint (const unsigned int print_flag) const
 Print image information on the standart error output.
const char * pixel_type ()
 Return the type of the pixel values.

Common arithmetics and boolean operators

template<typename t>
CImg< T > & operator= (const CImg< t > &img)
 Copy an image to the instance image.
CImgoperator= (const T &val)
 Assign a scalar value to all pixels of the instance image.
CImgoperator= (const T *buf)
 Copy the content of a C-array to the pixel buffer of the instance image.
CImgoperator+= (const T &val)
 Operator+=.
CImgoperator-= (const T &val)
 Operator-=.
CImgoperator%= (const T &val)
 Operator%=.
CImgoperator &= (const T &val)
 Operator&=.
CImgoperator|= (const T &val)
 Operator|=.
CImgoperator^= (const T &val)
 Operator^=.
CImg operator+ (const T &val) const
 Operator+.
CImg operator- (const T &val) const
 Operator-.
CImg operator% (const T &val) const
 Operator%.
CImg operator & (const T &val) const
 Operator&.
CImg operator| (const T &val) const
 Operator|.
CImg operator^ (const T &val) const
 Operator^.
CImg operator! () const
 Operator!
CImg operator~ () const
 Operator~.
template<typename t>
CImgoperator+= (const CImg< t > &img)
 Operator+=.
template<typename t>
CImgoperator-= (const CImg< t > &img)
 Operator-=.
CImgoperator%= (const CImg &img)
 Operator%=.
CImgoperator &= (const CImg &img)
 Operator&=.
CImgoperator|= (const CImg &img)
 Operator|=.
CImgoperator^= (const CImg &img)
 Operator^=.
template<typename t>
CImg operator+ (const CImg< t > &img) const
 Operator+.
template<typename t>
CImg operator- (const CImg< t > &img) const
 Operator-.
CImg operator% (const CImg &img) const
 Operator%.
CImg operator & (const CImg &img) const
 Operator&.
CImg operator| (const CImg &img) const
 Operator|.
CImg operator^ (const CImg &img) const
 Operator^.
CImgoperator *= (const double val)
 Operator*=.
CImgoperator/= (const double val)
 Operator/=.
CImg operator * (const double val) const
 Operator*.
CImg operator/ (const double val) const
 Operator/.
template<typename t>
const bool operator== (const CImg< t > &img) const
 Operator==.
template<typename t>
const bool operator!= (const CImg< t > &img) const
 Operator!=.
CImg operator+ (const T &val, const CImg &img)
 Operator+.
CImg operator * (const double val, const CImg &img)
 Operator*.
CImg operator- (const T &val, const CImg &img)
 Operator-.

Usual mathematical operations

template<typename t>
CImgmul (const CImg< t > &img)
 Replace the image by the pointwise multiplication between *this and img.
template<typename t>
CImg get_mul (const CImg< t > &img) const
 Return the image corresponding to the pointwise multiplication between *this and img.
template<typename t>
CImgdiv (const CImg< t > &img)
 Replace the image by the pointwise division between *this and img.
template<typename t>
CImg get_div (const CImg< t > &img) const
 Return an image from a pointwise division between *this and img.
template<typename t>
CImgmax (const CImg< t > &img)
 Replace the image by the pointwise max operator between *this and img.
template<typename t>
CImg get_max (const CImg< t > &img) const
 Return the image corresponding to the max value for each pixel.
template<typename t>
CImgmin (const CImg< t > &img)
 Replace the image by the pointwise min operator between *this and img.
template<typename t>
CImg get_min (const CImg< t > &img) const
 Return the image corresponding to the min value for each pixel.
CImgsqrt ()
 Replace each image pixel by its square root.
CImg get_sqrt () const
 Return the image of the square root of the pixel values.
CImglog ()
 Replace each image pixel by its log.
CImg get_log () const
 Return the image of the log of the pixel values.
CImglog10 ()
 Replace each image pixel by its log10.
CImg get_log10 () const
 Return the image of the log10 of the pixel values.
CImgpow (const double p)
 Replace each image pixel by its power by p.
CImg get_pow (const double p) const
 Return the image of the square root of the pixel values.
CImgabs ()
 Replace each pixel value by its absolute value.
CImg get_abs () const
 Return the image of the absolute value of the pixel values.
CImgcos ()
 Replace each image pixel by its cosinus.
CImg get_cos () const
 Return the image of the cosinus of the pixel values.
CImgsin ()
 Replace each image pixel by its sinus.
CImg get_sin () const
 Return the image of the sinus of the pixel values.
CImgtan ()
 Replace each image pixel by its tangent.
CImg get_tan () const
 Return the image of the tangent of the pixel values.

Usual image transformation

CImgfill (const T &val)
 Fill all pixel values with value val.
CImgfill (const T &val0, const T &val1)
 Fill sequentially all pixel values with values val0 and val1.
CImgfill (const T &val0, const T &val1, const T &val2)
 Fill sequentially all pixel values with values val0 and val1 and val2.
CImgfill (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.
CImgfill (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.
CImgfill (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.
CImgfill (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 values val0 and val1 and val2 and val3 and ... and val7.
CImgfill (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 values val0 and val1 and val2 and val3 and ... and val8.
CImgfill (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 values val0 and val1 and val2 and val3 and ... and val9.
CImgfill (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 values val0 and val1 and val2 and val3 and ... and val11.
CImgfill (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 values val0 and val1 and val2 and val3 and ... and val15.
CImgnormalize (const T &a, const T &b)
 Linear normalization of the pixel values between a and b.
CImg get_normalize (const T &a, const T &b) const
 Return the image of normalized values.
CImgcut (const T &a, const T &b)
 Cut pixel values between a and b.
CImg get_cut (const T &a, const T &b) const
 Return the image of cutted values.
CImgquantify (const unsigned int n=256)
 Quantify pixel values into
levels.
CImg get_quantify (const unsigned int n=256) const
 Return a quantified image, with
levels.
CImgthreshold (const T &thres)
 Threshold the image.
CImg get_threshold (const T &thres) const
 Return a thresholded image.
CImg get_rotate (const float angle, const unsigned int cond=2) const
 Return a rotated image.
CImgrotate (const float angle, const unsigned int cond=2)
 Rotate the image.
CImg get_rotate (const float angle, const float cx, const float cy, const float zoom=1, const unsigned int cond=2) const
 Return a rotated image around the point (cx,cy).
CImgrotate (const float angle, const float cx, const float cy, const float zoom=1, const unsigned int cond=2)
 Rotate the image around the point (cx,cy).
CImg get_resize (const int pdx=-100, const int pdy=-100, const int pdz=-100, const int pdv=-100, const unsigned int interp=1) const
 Return a resized image.
template<typename t>
CImg get_resize (const CImg< t > &src, const unsigned int interp=1) const
 Return a resized image.
CImg get_resize (const CImgDisplay &disp, const unsigned int interp=1) const
 Return a resized image.
CImgresize (const int pdx=-100, const int pdy=-100, const int pdz=-100, const int pdv=-100, const unsigned int interp=1)
 Resize the image.
template<typename t>
CImgresize (const CImg< t > &src, const unsigned int interp=1)
 Resize the image.
CImgresize (const CImgDisplay &disp, const unsigned int interp=1)
 Resize the image.
CImg get_resize_halfXY () const
 Return an half-resized image, using a special filter.
CImgresize_halfXY ()
 Half-resize the image, using a special filter.
CImg get_crop (const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int v0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int v1) const
 Return a square region of the image, as a new image.
CImg get_crop (const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int x1, const unsigned int y1, const unsigned int z1) const
 Return a square region of the image, as a new image.
CImg get_crop (const unsigned int x0, const unsigned int y0, const unsigned int x1, const unsigned int y1) const
 Return a square region of the image, as a new image.
CImg get_crop (const unsigned int x0, const unsigned int x1) const
 Return a square region of the image, as a new image.
CImgcrop (const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int v0, const unsigned int x1, const unsigned int y1, const unsigned int z1, const unsigned int v1)
 Replace the image by a square region of the image.
CImgcrop (const unsigned int x0, const unsigned int y0, const unsigned int z0, const unsigned int x1, const unsigned int y1, const unsigned int z1)
 Replace the image by a square region of the image.
CImgcrop (const unsigned int x0, const unsigned int y0, const unsigned int x1, const unsigned int y1)
 Replace the image by a square region of the image.
CImgcrop (const unsigned int x0, const unsigned int x1)
 Replace the image by a square region of the image.
CImg get_channel (const unsigned int v0=0) const
 Get the channel v of the current image, as a new image.
CImg get_slice (const unsigned int z0=0) const
 Get the z-slice z of *this, as a new image.
CImg get_plane (const unsigned int z0=0, const unsigned int v0=0) const
 Get the z-slice z of the channel v of the current image, as a new image.
CImgROI< T > ref_pointset (const unsigned int xmin, const unsigned int xmax, const unsigned int y0=0, const unsigned int z0=0, const unsigned int v0=0) const
 Return a reference to a set of points (x0->x1,y0,z0,v0) of the image. Use it carefully !
CImgROI< T > ref_lineset (const unsigned int ymin, const unsigned int ymax, const unsigned int z0=0, const unsigned int v0=0) const
 Return a reference to a set of lines (y0->y1,z0,v0) of the image. Use it carefully !
CImgROI< T > ref_planeset (const unsigned int zmin, const unsigned int zmax, const unsigned int v0=0) const
 Return a reference to a set of planes (z0->z1,v0) of the image. Use it carefully !
CImgROI< T > ref_channelset (const unsigned int vmin, const unsigned int vmax) const
 Return a reference to a set of channels (v0->v1) of the image. Use it carefully !
CImgROI< T > ref_line (const unsigned int y0, const unsigned int z0=0, const unsigned int v0=0) const
 Return a reference to a line (y0,z0,v0) of the image. Use it carefully !
CImgROI< T > ref_plane (const unsigned int z0, const unsigned int v0=0) const
 Return a reference to a plane (z0,v0) of the image. Use it carefully !
CImgROI< T > ref_channel (const unsigned int v0) const
 Return a reference to a channel (v0) of the image. Use it carefully !
CImgchannel (const unsigned int v0=0)
 Replace the image by one of its channel.
CImgslice (const unsigned int z0=0)
 Replace the image by one of its z-slice.
CImgplane (const unsigned int z0=0, const unsigned int v0=0)
 Replace the image by one of its plane.
CImgflip (const char axe='x')
 Flip an image along the specified axis.
CImg get_flip (const char axe='x')
 Get a flipped version of the image, along the specified axis.
CImg get_3dplanes (const unsigned int px0, const unsigned int py0, const unsigned int pz0) const
 Return a 2D representation of a 3D image, with three slices.
CImg< float > get_histogram (const unsigned int nblevels=256, const T val_min=(T) 0, const T val_max=(T) 0) const
 Return the histogram of the image.
CImgequalize_histogram (const unsigned int nblevels=256)
 Equalize the image histogram.
CImg get_equalize_histogram (const unsigned int nblevels=256) const
 Return the histogram-equalized version of the current image.
CImg< float > get_norm_pointwise (int ntype=2) const
 Return the image of the vector norms of the current image.
CImgnorm_pointwise ()
 Replace each pixel value with its vector norm.
CImg get_orientation_pointwise () const
 Return an image of the normalized vectors.
CImgorientation_pointwise ()
 Replace each pixel value with its normalized vector component.
CImgl< T > get_split (const char Axe='v') const
 Return a list of images, corresponding to a split of the current image into a specific axis.
CImgl< T > get_gradientXY (const int scheme=0) const
 Return a list of images, corresponding to the XY-gradients of an image.
CImgl< T > get_gradientXYZ (const int scheme=0) const
 Return a list of images, corresponding to the XYZ-gradients of an image.

Color conversion functions

CImgRGBtoXYZ ()
 Convert (R,G,B) pixels of a color image into the (X,Y,Z)_709 color space.
CImg get_RGBtoXYZ () const
 Get a new image with (X,Y,Z) color-based pixels from a (R,G,B) image.
CImgXYZtoRGB ()
 Convert (X,Y,Z)_709 pixels of a color image into the (R,G,B) color space.
CImg get_XYZtoRGB () const
 Get a new image with (R,G,B) color-based pixels from a (X,Y,Z) image.
CImgXYZtoLab ()
 Convert (X,Y,Z)_709 pixels of a color image into the (L*,a*,b*) color space.
CImg get_XYZtoLab () const
 Get a new image with (L,a,b) color-based pixels from a (X,Y,Z) image.

Drawing functions

CImgdraw_point (const int x0, const int y0, const int z0, const T *const color, const float opacity=1)
 Draw a colored point in the instance image, at coordinates (x0,y0,z0).
CImgdraw_point (const int x0, const int y0, const T *const color, const float opacity=1)
 Draw a colored point in the instance image, at coordinates (x0,y0).
CImgdraw_line (const int x0, const int y0, const int x1, const int y1, const T *const color, const unsigned long pattern=~0L, const float opacity=1)
 Draw a 2D colored line in the instance image, at coordinates (x0,y0)-(x1,y1).
CImgdraw_line (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const T *const color, const unsigned long pattern=~0L, const float opacity=1)
 Draw a 3D colored line in the instance image, at coordinates (x0,y0,z0)-(x1,y1,z1).
template<typename t>
CImgdraw_line (const int x0, const int y0, const int x1, const int y1, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const float opacity=1)
 Draw a 2D textured line in the instance image, at coordinates (x0,y0)-(x1,y1).
CImgdraw_arrow (const int x0, const int y0, const int x1, const int y1, const T *const color, const float angle=30, const float length=-10, const unsigned long pattern=~0L, const float opacity=1)
 Draw a 2D colored arrow in the instance image, at coordinates (x0,y0)->(x1,y1).
template<typename t>
CImgdraw_image (const CImg< t > &sprite, const int x0=0, const int y0=0, const int z0=0, const int v0=0, const float opacity=1)
 Draw a sprite image in the instance image, at coordinates (x0,y0,z0,v0).
template<typename ti, typename tm>
CImgdraw_image (const CImg< ti > &sprite, const CImg< tm > &mask, const int x0=0, const int y0=0, const int z0=0, const int v0=0, const tm mask_valmax=1, const float opacity=1)
 Draw a masked sprite image in the instance image, at coordinates (x0,y0,z0,v0).
CImgdraw_rectangle (const int x0, const int y0, const int z0, const int v0, const int x1, const int y1, const int z1, const int v1, const T &val, float opacity=1)
 Draw a 4D filled rectangle in the instance image, at coordinates (x0,y0,z0,v0)-(x1,y1,z1,v1).
CImgdraw_rectangle (const int x0, const int y0, const int z0, const int x1, const int y1, const int z1, const T *const color, const float opacity=1)
 Draw a 3D filled colored rectangle in the instance image, at coordinates (x0,y0,z0)-(x1,y1,z1).
CImgdraw_rectangle (const int x0, const int y0, const int x1, const int y1, const T *const color, const float opacity=1)
 Draw a 2D filled colored rectangle in the instance image, at coordinates (x0,y0)-(x1,y1).
CImgdraw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const T *const color, const float opacity=1)
 Draw a 2D filled colored triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).
template<typename t>
CImgdraw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const CImg< t > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const float opacity=1)
 Draw a 2D textured triangle in the instance image, at coordinates (x0,y0)-(x1,y1)-(x2,y2).
template<typename t1, typename t2>
CImgdraw_triangle (const int x0, const int y0, const int x1, const int y1, const int x2, const int y2, const CImg< t1 > &texture, const int tx0, const int ty0, const int tx1, const int ty1, const int tx2, const int ty2, const CImg< t2 > &displacement, const int mx0, const int my0, const int mx1, const int my1, const int mx2, const int my2, const float opacity=1)
 Draw a textured triangle in a 2D image, with a displacement map (bump mapping).
CImgdraw_ellipse (const int x0, const int y0, const float r1, const float r2, const float ru, const float rv, const T *const color, const float opacity=1)
 Draw a filled ellipse on the instance image.
CImgdraw_circle (const int x0, const int y0, float r, const T *const color, const float opacity=1)
 Draw a filled circle on the instance image.
template<typename t>
CImgdraw_text (const char *const text, const int x0, const int y0, const T *const fgcolor, const T *const bgcolor, const CImgl< t > &font, const float opacity=1)
 Draw a text into the instance image.
CImgdraw_text (const char *const text, const int x0, const int y0, const T *const fgcolor=NULL, const T *const bgcolor=NULL, const float opacity=1)
 Draw a text into the instance image.
CImgdraw_text (const int x0, const int y0, const T *const fgcolor, const T *const bgcolor, const float opacity, const char *format,...)
 Draw a text into the instance image.
template<typename t>
CImgdraw_quiver (const CImg< t > &flow, const T *const color, const unsigned int sampling=25, const float factor=-20, const int quiver_type=0, const float opacity=1)
 Draw a vector field in the instance image.
template<typename t1, typename t2>
CImgdraw_quiver (const CImg< t1 > &flow, const CImg< t2 > &color, const unsigned int sampling=25, const float factor=-20, const int quiver_type=0, const float opacity=1)
 Draw a vector field in the instance image, using a colormap.
template<typename t>
CImgdraw_graph (const CImg< t > &data, const T *const color, const unsigned int gtype=0, const double ymin=0, const double ymax=0, const float opacity=1)
 Draw a 1D graph on the instance image.
CImgdraw_axeX (const double x0, const double x1, const int y, const T *const color, const double precision=0, const float opacity=1)
 Draw a labelled horizontal axis on the instance image.
CImgdraw_axeY (const int x, const double y0, const double y1, const T *const color, const double precision=0, const float opacity=1)
 Draw a labelled vertical axis on the instance image.
CImgdraw_axeXY (const double x0, const double x1, const double y0, const double y1, const T *const color, const double precisionx=0, const double precisiony=0, const float opacity=1)
 Draw a labelled coordinate system (X,Y) on the instance image.
template<typename t>
CImgdraw_fill (const int x, const int y, const int z, const T *const color, CImg< t > &region, const float sigma=0, const float opacity=1)
 Draw a 3D filled region starting from a point (x,y,\ z) in the instance image.
CImgdraw_fill (const int x, const int y, const int z, const T *const color, const float sigma=0, const float opacity=1)
 Draw a 3D filled region starting from a point (x,y,\ z) in the instance image.
CImgdraw_fill (const int x, const int y, const T *const color, const float sigma=0, const float opacity=1)
 Draw a 2D filled region starting from a point (x,y) in the instance image.
CImgdraw_plasma (const int x0, const int y0, const int x1, const int y1, const double alpha=1.0, const double beta=1.0, const float opacity=1)
 Draw a plasma square in the instance image.
CImgdraw_plasma (const double alpha=1.0, const double beta=1.0, const float opacity=1)
 Draw a plasma in the instance image.
template<typename t>
CImgdraw_gaussian (const float xc, const double sigma, const T *const color, const float opacity=1)
 Draw a 1D gaussian kernel in the instance image.
template<typename t>
CImgdraw_gaussian (const float xc, const float yc, const double sigma, const CImg< t > tensor, const T *const color, const float opacity=1)
 Draw a gaussian in a 2d image.
template<typename t>
CImgdraw_gaussian (const float xc, const float yc, const float zc, const double sigma, const CImg< t > tensor, const T *const color, const float opacity=1)
 Draw a gaussian in a 3d image.
CImgl< T > get_font7x11 (const bool fixed_size=false)
 Return a copy of the default 7x11 CImg font as a list of images and masks.

Filtering functions

template<typename t>
CImg get_correlate (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_correl=false) const
 Return the correlation of the image by a mask.
template<typename t>
CImgcorrelate (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_correl=false)
 Correlate the image by a mask.
template<typename t>
CImg get_convolve (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_convol=false) const
 Return the convolution of the image by a mask.
template<typename t>
CImgconvolve (const CImg< t > &mask, const unsigned int cond=1, const bool weighted_convol=false)
 Convolve the image by a mask.
CImgnoise (const double psigma=-20, const unsigned int ntype=0)
 Add noise to the image.
CImg get_noise (const double sigma=-20, const unsigned int ntype=0) const
 Return a noisy image.
CImgderiche (const float sigma=1, const int order=0, const char axe='x', const unsigned int cond=1)
 Apply a deriche filter on the image.
CImg get_deriche (const float sigma=1, const int order=0, const char axe='x', const unsigned int cond=1) const
 Return the result of the Deriche filter.
CImgblur (const float sigma=1, const unsigned int cond=1)
 Blur the image with a Deriche filter (quasi-gaussian filter).
CImg get_blur (const float sigma=1, const unsigned int cond=1) const
 Return a blurred version of the image, using a Deriche filter (quasi gaussian filter).
CImg get_erode (const unsigned int n=1)
 Return a eroded image (times erosion).
CImgerode (const unsigned int n=1)
 Erode the image n times.
CImg get_dilate (const unsigned int n=1)
 Return an dilated image (times dilatation).
CImgdilate (const unsigned int n=1)
 Dilate the image n times.

Matrix computation

template<typename t>
CImg operator * (const CImg< t > &img) const
 Operator* (matrix product).
template<typename t>
CImgoperator *= (const CImg< t > &img)
 Operator*= (matrix product).
CImg get_vector (const unsigned int x=0, const unsigned int y=0, const unsigned int z=0) const
 Return a new image corresponding to the vector located at (x,y,z) of the current vector-valued image.
CImg get_matrix (const unsigned int x=0, const unsigned int y=0, const unsigned int z=0) const
 Return a new image corresponding to the square matrix located at (x,y,z) of the current vector-valued image.
CImg get_tensor (const unsigned int x=0, const unsigned int y=0, const unsigned int z=0) const
 Return a new image corresponding to the diffusion tensor located at (x,y,z) of the current vector-valued image.
CImgset_vector (const CImg &vec, const unsigned int x=0, const unsigned int y=0, const unsigned int z=0)
 Set the image vec as the vector valued pixel located at (x,y,z) of the current vector-valued image.
CImgset_matrix (const CImg &mat, const unsigned int x=0, const unsigned int y=0, const unsigned int z=0)
 Set the image vec as the square matrix-valued pixel located at (x,y,z) of the current vector-valued image.
CImgset_tensor (const CImg &ten, const unsigned int x=0, const unsigned int y=0, const unsigned int z=0)
 Set the image vec as the tensor valued pixel located at (x,y,z) of the current vector-valued image.
CImgidentity_matrix ()
 Set the current matrix to be the identity matrix.
CImg get_transpose () const
 Return the transpose version of the current matrix.
CImgtranspose ()
 Replace the current matrix by its transpose.
CImg get_diagonal () const
 Get a diagonal matrix, whose diagonal coefficients are the coefficients of the input image.
CImgdiagonal ()
 Replace a vector by a diagonal matrix containing the original vector coefficients.
CImginverse ()
 Inverse the current matrix.
CImg get_inverse () const
 Return the inverse of the current matrix.
double trace () const
 Return the trace of the current matrix.
double dot (const CImg &img) const
 Return the dot product of the current vector/matrix with the vector/matrix img.
CImgcross (const CImg &img)
 Return the cross product between two 3d vectors.
CImg get_cross (const CImg &img) const
 Return the cross product between two 3d vectors.
double det () const
 Return the determinant of the current matrix.
double norm (const int ntype=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.
template<typename t>
const CImg< T > & eigen (CImg< t > &val, CImg< t > &vec) const
 Compute the eigenvalues and eigenvectors of a general matrix.
template<typename t>
const CImg< T > & eigen (CImg< t > &val) const
 Compute the eigenvalues of a general matrix.
template<typename t>
const CImg< T > & symeigen (CImg< t > &val, CImg< t > &vec) const
 Compute the eigenvalues and eigenvectors of a symmetric matrix.
template<typename t>
const CImg< T > & symeigen (CImg< t > &val) const
 Compute the eigenvalues of a symmetric matrix.
CImg get_identity_matrix (const unsigned int dim)
 Return a matrix dim * dim equal to factor * Identity.

Display functions

CImgDisplaynew_display (const char *title="", const int normalize=1, const unsigned int attributes=3) const
 Open a Window with the specified image and return a pointer to the corresponding CImgDisplay structure.
const CImgdisplay (CImgDisplay &disp, const unsigned int ymin=0, const unsigned int ymax=~0) const
 Display an image into a CImgDisplay window.
const CImgwait (const unsigned int milliseconds) const
 Same as cimg::wait().
const CImgdisplay (const char *title, const int min_size=128, const int max_size=1024) const
 Display an image in a window with a title title, and wait a 'closed' or 'keyboard' event.
Parameters min_size and max_size set the minimum and maximum dimensions of the display window. If negative, they corresponds to a percentage of the original image size.
const CImgdisplay (const int min_size=128, const int max_size=1024) const
 Display an image in a window, with a default title. See also display() for details on parameters.
const CImgfeature_selection (int *const selection, const int feature_type, CImgDisplay &disp, unsigned int *const XYZ=NULL, const unsigned char *const color=NULL) const
 High-level interface to select features from images.
const CImgfeature_selection (int *const selection, const int feature_type, unsigned int *const XYZ=NULL, const unsigned char *const color=NULL) const
 High-level interface to select features in images.

Input-Output functions

const CImgsave (const char *filename, const int number=-1) const
 Save the image as a file. The used file format is defined by the file extension in the filename filename.
Parameter number can be used to add a 6-digit number to the filename before saving.
If normalize is true, a normalized version of the image (between [0,255]) is saved.
const CImgsave_ascii (const char *filename) const
 Save the image as an ASCII file.
const CImgsave_dlm (const char *filename) const
 Save the image as a DLM file.
const CImgsave_pnm (const char *filename) const
 Save the image as a PNM file.
const CImgsave_analyze (const char *filename, const float *const voxsize=NULL) const
 Save the image as an ANALYZE7.5 file.
const CImgsave_raw (const char *filename) const
 Save the image as a RAW file.
const CImgsave_convert (const char *filename) const
 Function that saves the image for other file formats that are not natively handled by CImg, using the tool 'convert' from the ImageMagick package.
This is the case for all compressed image formats (GIF,PNG,JPG,TIF,...). You need to install the ImageMagick package in order to get this function working properly (see http://www.imagemagick.org ).
const CImgsave_inr (const char *filename, const float *const voxsize=NULL) const
 Save the image as an INRIMAGE-4 file.
const CImgsave_pandore (const char *filename) const
 Save the image as a PANDORE-5 file.
CImg load (const char *filename)
 Load the image from a file. The used file format is defined by the file extension in the filename filename.
CImg load_inr (const char *filename, float *voxsize=NULL)
 Load the image from an INRIMAGE-4 file.
CImg load_pandore (const char *filename)
 Load the image from a PANDORE file.
CImg load_pnm (const char *filename)
 Load the image from a PNM file.
CImg load_ascii (const char *filename)
 Load the image from an ASCII file.
CImg load_dlm (const char *filename)
 Load the image from a DLM file.
CImg load_analyze (const char *filename, float *voxsize=NULL)
 Load the image from an ANALYZE7.5 file.
CImg load_raw (const char *filename, const char axe='v', const char align='p')
 Load the image from a RAW file.
CImg load_convert (const char *filename)
 Function that loads the image for other file formats that are not natively handled by CImg, using the tool 'convert' from the ImageMagick package.
This is the case for all compressed image formats (GIF,PNG,JPG,TIF,...). You need to install the ImageMagick package in order to get this function working properly (see http://www.imagemagick.org ).

Public Attributes

unsigned int width
 Number of columns in the instance image (size along the X-axis).
unsigned int height
 Number of rows in the instance image (size along the Y-axis).
unsigned int depth
 Number of slices in the instance image (size along the Z-axis).
unsigned int dim
 Number of vector channels in the instance image (size along the V-axis).
T * data
 Pointer to pixel values (array of elements T).

Detailed Description

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

This structure represents an image (up to 4 dimensions wide), with pixels of type T.

This is the main structure of the CImg Library. It allows to define an image, access its pixel values, and perform various operations on it.

* Image structure

A CImg<T> structure contains only five fields :

You can access these fields publicly although it is recommended to use dedicated functions dimx(), dimy(), dimz(), dimv() and ptr() to do so. Image dimensions are not limited to a specific range (as long as you got enough RAM). A value of 1 usually means that the corresponding dimension is 'flat'. If one dimension is 0, the image is considered as an empty image. Empty images do not contain pixel data and thus, are not processed by most of CImg member functions. Most of the CImg<T> member functions are designed to work on images with general dimensions.

* Image declaration

Declaration of an image uses one of the several available constructors. Below is a list of the most used :

More constructors are available (copy constructor,...). Please look at the constructor list for more informations.

A CImg image is defined as a template class CImg<T> containing a pixel data field with a maximum of 4 dimensions : the 3 first dimensions are usually used to describe the spatial coordinates (x,y,z) in the image, while the last one is often used as a vector-valued pixel dimension (color channel for instance). Then, this class can handle the case of 3D volumes of vector-valued pixels, and all images that requires less dimensions (gray-valued or color 2D images for instance). It also means that (almost) all member functions of the class CImg<T> are designed to handle the maximum case of these (3+1) dimensions.

Moreover, the pixel type is given by the template parameter T, which means that you can define images with different pixel types T. Fully supported template types are the basic C++ types : unsigned char, char, short, unsigned int, int, float, double, ... Using your own template types is possible however, but you will have to redefine the complete set of arithmetic and logical operators. Typically, fast image display would be done using CImg<unsigned char> images, while complex image processing algorithms would be coded using CImg<float> or CImg<double> images which have floating-point pixel values. Only two others classes are defined in the CImg.h file : CImgStats that is used to represent image statistics, and CImgDisplay used to open windows where images are displayed, and handle keyboard and mouse events.

CImg has been designed to be 'user-friendly', meaning that the underlying structure of the classes is always quite basic to understand. For instance, the CImg<T> class members (which are defined as public) are only the dimensions width, height, depth, dim, and the pixel data data. Very useful when you want to access the raw pixel buffer for calling with functions of other libraries, or when you want to convert your raw data buffer into a CImg, in order to visualize it for instance. Moreover, most of the classical arithmetic and logical operators have been redefined in the CImg<T> class, which means that accessing a pixel is as simple as image(x,y) or image(x,y,z,v) (in 4D), and beautiful things are possible such as (img1+3*img2).display();

See also:
Introduction to the CImg Library

Definition at line 2941 of file CImg.h.


Constructor & Destructor Documentation

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

Create an image of size (dx,dy,dz,dv) with pixels of type T.

Parameters:
dx = number of columns of the created image (size along the X-axis).
dy = number of rows of the created image (size along the Y-axis).
dz = number of slices of the created image (size along the Z-axis).
dv = number of vector channels of the created image (size along the V-axis).
Note:
  • Pixel values are not initialized by this constructor.
  • If invoked without parameters, this constructor creates an empty image (default constructor).

Definition at line 3016 of file CImg.h.

CImg const unsigned int  dx,
const unsigned int  dy,
const unsigned int  dz,
const unsigned int  dv,
const T &  val
[explicit]
 

Create an image of size (dx,dy,dz,dv) with pixels of type T, and set the image pixels to the value val.

Parameters:
dx = number of columns of the created image (size along the X-axis).
dy = number of rows of the created image (size along the Y-axis).
dz = number of slices of the created image (size along the Z-axis).
dv = number of vector channels of the created image (size along the V-axis).

Definition at line 3030 of file CImg.h.

CImg const CImg< t > &  img  ) 
 

Copy constructor.

Parameters:
img = the image to copy.

Definition at line 3040 of file CImg.h.

CImg const CImg< t > &  img,
const bool  pixel_copy
 

Copy constructor.

Parameters:
img = the image to copy.
pixel_copy = tells the constructor if the pixel data of the original image are copied into the created image. This may be useful when one wants to create an image with same size than other image, but without same pixel data :
       CImg<float> source("image.jpg");
       CImg<unsigned char> destination(source,false);
is equivalent to
       CImg<float> source("image.jpg");
       CImg<unsigned char> destination(source.dimx(),source.dimy(),source.dimz(),source.dimv());

Definition at line 3072 of file CImg.h.

CImg const char *  filename  ) 
 

Create an image by loading a file.

Parameters:
filename = the filename of the image file. filename extension is used to guess the image type.
See also:
CImg<T>::load().

Definition at line 3082 of file CImg.h.

CImg const T *const   data_buffer,
unsigned int  dx,
unsigned int  dy = 1,
unsigned int  dz = 1,
unsigned int  dv = 1
 

Create an image from a data buffer.

Parameters:
data_buffer = pointer T* to a buffer of pixel values T.
dx = number of columns of the created image (size along the X-axis).
dy = number of rows of the created image (size along the Y-axis).
dz = number of slices of the created image (size along the Z-axis).
dv = number of vector channels of the created image (size along the V-axis).
See also:
cimg_storage

Definition at line 3093 of file CImg.h.

~CImg  ) 
 

Destructor.

Note:
The destructor frees the memory eventually used by the image pixels.

Definition at line 3106 of file CImg.h.


Member Function Documentation

const char* pixel_type  )  [static]
 

Return the type of the pixel values.

Returns:
a string describing the type of the image pixels (template parameter T).

Definition at line 3124 of file CImg.h.

const unsigned int size  )  const
 

Return the number of pixels of an image.

Returns:
dimx()*dimy()*dimz()*dimv()
See also:
dimx(), dimy(), dimz(), dimv()

Definition at line 3131 of file CImg.h.

const int dimx  )  const
 

Return the number of columns of the instance image (size along the X-axis).

Returns:
this->width
See also:
dimy(),dimz(),dimv(),size()

Definition at line 3138 of file CImg.h.

const int dimy  )  const
 

Return the number of rows of the instance image (size along the Y-axis).

Returns:
this->height
See also:
dimx(),dimz(),dimv(),size()

Definition at line 3145 of file CImg.h.

const int dimz  )  const
 

Return the number of slices of the instance image (size along the Z-axis).

Returns:
this->depth
See also:
dimx(),dimy(),dimv(),size()

Definition at line 3152 of file CImg.h.

const int dimv  )  const
 

Return the number of vector channels of the instance image (size along the V-axis).

Returns:
this->dim
See also:
dimx(),dimy(),dimz(),size()

Definition at line 3159 of file CImg.h.

const int offset const int  x = 0,
const int  y = 0,
const int  z = 0,
const int  v = 0
const
 

Return the offset corresponding to the location of the pixel value located at (x,y,z,v).

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel

Definition at line 3169 of file CImg.h.

T* ptr const unsigned int  x = 0,
const unsigned int  y = 0,
const unsigned int  z = 0,
const unsigned int  v = 0
const
 

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

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel

Definition at line 3178 of file CImg.h.

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

Access to pixel value for reading or writing, without boundary checking.

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel
Note:
if cimg_debug==2, a boundary checking is performed (also slow down the code considerably).

Definition at line 3198 of file CImg.h.

T& operator[] const unsigned int  off  )  const
 

Access to pixel buffer value for reading or writing.

Parameters:
off = offset in the pixel buffer
Note:
if cimg_debug==2, a out-of-buffer checking is performed (also slow down the code considerably).

Definition at line 3216 of file CImg.h.

T dirichlet_pix4d const int  x,
const int  y = 0,
const int  z = 0,
const int  v = 0,
const T  out_val = (T)0
const
 

Pixel access with Dirichlet boundary conditions for all coordinates (x,y,z,v).

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel
out_val = returned value if pixel coordinates is out of the image range.

Definition at line 3236 of file CImg.h.

T dirichlet_pix3d const int  x,
const int  y = 0,
const int  z = 0,
const int  v = 0,
const T  out_val = (T)0
const
 

Pixel access with Dirichlet boundary conditions for the three first coordinates (x,y,z).

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel
out_val = returned value if pixel coordinates is out of the image range.

Definition at line 3248 of file CImg.h.

T dirichlet_pix2d const int  x,
const int  y = 0,
const int  z = 0,
const int  v = 0,
const T  out_val = (T)0
const
 

Pixel access with Dirichlet boundary conditions for the two first coordinates (x,y).

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel
out_val = returned value if pixel coordinates is out of the image range.

Definition at line 3259 of file CImg.h.

T dirichlet_pix1d const int  x,
const int  y = 0,
const int  z = 0,
const int  v = 0,
const T  out_val = (T)0
const
 

Pixel access with Dirichlet boundary conditions for the first coordinate x.

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel
out_val = returned value if pixel coordinates is out of the image range.

Definition at line 3271 of file CImg.h.

const T& neumann_pix4d const int  x,
const int  y = 0,
const int  z = 0,
const int  v = 0
const
 

Pixel access with Neumann boundary conditions for all coordinates (x,y,z,v).

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel

Definition at line 3282 of file CImg.h.

const T& neumann_pix3d const int  x,
const int  y = 0,
const int  z = 0,
const int  v = 0
const
 

Pixel access with Neumann boundary conditions for the three first coordinates (x,y,z).

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel

Definition at line 3295 of file CImg.h.

const T& neumann_pix2d const int  x,
const int  y = 0,
const int  z = 0,
const int  v = 0
const
 

Pixel access with Neumann boundary conditions for the two first coordinates (x,y).

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel

Definition at line 3308 of file CImg.h.

const T& neumann_pix1d const int  x,
const int  y = 0,
const int  z = 0,
const int  v = 0
const
 

Pixel access with Neumann boundary conditions for the first coordinate x.

Parameters:
x = x-coordinate of the pixel
y = y-coordinate of the pixel
z = z-coordinate of the pixel
v = v-coordinate of the pixel

Definition at line 3319 of file CImg.h.

double linear_pix4d const float  ffx,
const float  ffy = 0,
const float  ffz = 0,
const float  ffv = 0
const
 

Pixel access with Neumann boundary conditions and linear interpolation for all coordinates (x,y,z,v).

Parameters:
x = x-coordinate of the pixel (float value)
y = y-coordinate of the pixel (float value)
z = z-coordinate of the pixel (float value)
v = v-coordinate of the pixel (float value)

Definition at line 3330 of file CImg.h.

double linear_pix3d const float  ffx,
const float  ffy = 0,
const float  ffz = 0,
const int  v = 0
const
 

Pixel access with Neumann boundary conditions and linear interpolation for the three first coordinates (x,y,z).

Parameters:
x = x-coordinate of the pixel (float value)
y = y-coordinate of the pixel (float value)
z = z-coordinate of the pixel (float value)
v = v-coordinate of the pixel (integer value)

Definition at line 3361 of file CImg.h.

double linear_pix2d const float  ffx,
const float  ffy = 0,
const int  z = 0,
int  v = 0
const
 

Pixel access with Neumann boundary conditions and linear interpolation for the two first coordinates (x,y).

Parameters:
x = x-coordinate of the pixel (float value)
y = y-coordinate of the pixel (float value)
z = z-coordinate of the pixel (integer value)
v = v-coordinate of the pixel (integer value)

Definition at line 3383 of file CImg.h.

double linear_pix1d const float  ffx,
const int  y = 0,
const int  z = 0,
int  v = 0
const
 

Pixel access with Neumann boundary conditions and linear interpolation for the first coordinate x.

Parameters:
x = x-coordinate of the pixel (float value)
y = y-coordinate of the pixel (integer value)
z = z-coordinate of the pixel (integer value)
v = v-coordinate of the pixel (integer value)

Definition at line 3401 of file CImg.h.

double cubic_pix2d const float  pfx,
const float  pfy = 0,
const int  z = 0,
int  v = 0
const
 

Pixel access with Neumann boundary conditions and cubic interpolation for the two first coordinates (x,y).

Parameters:
x = x-coordinate of the pixel (float value)
y = y-coordinate of the pixel (float value)
z = z-coordinate of the pixel (integer value)
v = v-coordinate of the pixel (integer value)

Definition at line 3416 of file CImg.h.

double cubic_pix1d const float  pfx,
const int  y = 0,
const int  z = 0,
int  v = 0
const
 

Pixel access with Neumann boundary conditions and cubic interpolation for all coordinates x.

Parameters:
x = x-coordinate of the pixel (float value)
y = y-coordinate of the pixel (integer value)
z = z-coordinate of the pixel (integer value)
v = v-coordinate of the pixel (integer value)

Definition at line 3442 of file CImg.h.

CImgStats get_stats const bool  compute_variance = true  )  const
 

Compute and return statistics on the image.

Parameters:
compute_variance = - : compute complete statistics, including the variance of the pixel values.
  • : compute only minimum, maximum and average value of the pixel values (faster).
Returns:
a CImgStats instance representing statistics of the instance image.

Definition at line 3456 of file CImg.h.

const CImg& print const char *  title = NULL,
const unsigned int  print_flag = 1
const
 

Print image information on the standart error output.

Parameters:
title = name of your printed variable.
print_flag = - 0 : print only informations about image size and pixel buffer.
  • 1 : print also statistics on the image pixels.
  • 2 : print also the pixel buffer content, in a matlab-style.

Definition at line 3465 of file CImg.h.

const CImg& print const unsigned int  print_flag  )  const
 

Print image information on the standart error output.

Parameters:
print_flag = - 0 : print only informations about image size and pixel buffer.
  • 1 : print also statistics on the image pixels.
  • 2 : print also the pixel buffer content, in a matlab-style.

Definition at line 3486 of file CImg.h.

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

Copy an image to the instance image.

Parameters:
img = image to copy.
Note:
If pixel types are different, a type cast is performed.

Definition at line 3502 of file CImg.h.

CImg& operator= const T &  val  ) 
 

Assign a scalar value to all pixels of the instance image.

Parameters:
val = the value to assign.

Definition at line 3509 of file CImg.h.

CImg& operator= const T *  buf  ) 
 

Copy the content of a C-array to the pixel buffer of the instance image.

Parameters:
buf = pointer to a C-array, with a size of (at least) this->size().

Definition at line 3515 of file CImg.h.

CImg& operator+= const T &  val  ) 
 

Operator+=.

Parameters:
val = value to add to each pixel value of the instance image.

Definition at line 3525 of file CImg.h.

CImg& operator-= const T &  val  ) 
 

Operator-=.

Parameters:
val = value to sub to each pixel value of the instance image.

Definition at line 3531 of file CImg.h.

CImg& operator%= const T &  val  ) 
 

Operator%=.

Parameters:
val = value of the modulo applied to each pixel value of the instance image.

Definition at line 3537 of file CImg.h.

CImg& operator &= const T &  val  ) 
 

Operator&=.

Parameters:
val = value of the bitwise AND applied to each pixel value of the instance image.

Definition at line 3543 of file CImg.h.

CImg& operator|= const T &  val  ) 
 

Operator|=.

Parameters:
 

Definition at line 3549 of file CImg.h.

CImg& mul const CImg< t > &  img  ) 
 

Replace the image by the pointwise multiplication between *this and img.

Parameters:
img = argument of the multiplication.
Note:
if *this and img have different size, the multiplication is applied only on possible values.
See also:
div(),get_mul(),get_div().

Definition at line 3694 of file CImg.h.

CImg get_mul const CImg< t > &  img  )  const
 

Return the image corresponding to the pointwise multiplication between *this and img.

Parameters:
img = argument of the multiplication.
Note:
if *this and img have different size, the multiplication is applied only on possible values.
See also:
get_div(),mul(),div()

Definition at line 3708 of file CImg.h.

CImg& div const CImg< t > &  img  ) 
 

Replace the image by the pointwise division between *this and img.

Parameters:
img = argument of the division.
Note:
if *this and img have different size, the division is applied only on possible values.
See also:
mul(),get_mul(),get_div().

Definition at line 3717 of file CImg.h.

CImg get_div const CImg< t > &  img  )  const
 

Return an image from a pointwise division between *this and img.

Parameters:
img = argument of the division.
Note:
if *this and img have different size, the division is applied only on possible values.
See also:
get_mul(),mul(),div()

Definition at line 3731 of file CImg.h.

CImg& max const CImg< t > &  img  ) 
 

Replace the image by the pointwise max operator between *this and img.

Parameters:
img = second argument of the max operator (the first one is *this).
See also:
get_max(), min(), get_min()

Definition at line 3738 of file CImg.h.

CImg get_max const CImg< t > &  img  )  const
 

Return the image corresponding to the max value for each pixel.

Parameters:
img = second argument of the max operator (the first one is *this).
See also:
max(), min(), get_min()

Definition at line 3749 of file CImg.h.

CImg& min const CImg< t > &  img  ) 
 

Replace the image by the pointwise min operator between *this and img.

Parameters:
img = second argument of the min operator (the first one is *this).
See also:
get_min(), max(), get_max()

Definition at line 3756 of file CImg.h.

CImg get_min const CImg< t > &  img  )  const
 

Return the image corresponding to the min value for each pixel.

Parameters:
img = second argument of the min operator (the first one is *this).
See also:
min(), max(), get_max()

Definition at line 3767 of file CImg.h.

CImg& sqrt  ) 
 

Replace each image pixel by its square root.

See also:
get_sqrt()

Definition at line 3773 of file CImg.h.

CImg get_sqrt  )  const
 

Return the image of the square root of the pixel values.

See also:
sqrt()

Definition at line 3782 of file CImg.h.

CImg& log  ) 
 

Replace each image pixel by its log.

See also:
get_log(), log10(), get_log10()

Definition at line 3788 of file CImg.h.

CImg get_log  )  const
 

Return the image of the log of the pixel values.

See also:
log(), log10(), get_log10()

Definition at line 3797 of file CImg.h.

CImg& log10  ) 
 

Replace each image pixel by its log10.

See also:
get_log10(), log(), get_log()

Definition at line 3803 of file CImg.h.

CImg get_log10  )  const
 

Return the image of the log10 of the pixel values.

See also:
log10(), log(), get_log()

Definition at line 3812 of file CImg.h.

CImg& pow const double  p  ) 
 

Replace each image pixel by its power by p.

Parameters:
p = power
See also:
get_pow(), sqrt(), get_sqrt()

Definition at line 3819 of file CImg.h.

CImg get_pow const double  p  )  const
 

Return the image of the square root of the pixel values.

Parameters:
p = power
See also:
pow(), sqrt(), get_sqrt()

Definition at line 3829 of file CImg.h.

CImg& abs  ) 
 

Replace each pixel value by its absolute value.

See also:
get_abs()

Definition at line 3835 of file CImg.h.

CImg get_abs  )  const
 

Return the image of the absolute value of the pixel values.

See also:
abs()

Definition at line 3844 of file CImg.h.

CImg& cos  ) 
 

Replace each image pixel by its cosinus.

See also:
get_cos(), sin(), get_sin(), tan(), get_tan()

Definition at line 3850 of file CImg.h.

CImg get_cos  )  const
 

Return the image of the cosinus of the pixel values.

See also:
cos(), sin(), get_sin(), tan(), get_tan()

Definition at line 3859 of file CImg.h.

CImg& sin  ) 
 

Replace each image pixel by its sinus.

See also:
get_sin(), cos(), get_cos(), tan(), get_tan()

Definition at line 3865 of file CImg.h.

CImg get_sin  )  const
 

Return the image of the sinus of the pixel values.

See also:
sin(), cos(), get_cos(), tan(), get_tan()

Definition at line 3874 of file CImg.h.

CImg& tan  ) 
 

Replace each image pixel by its tangent.

See also:
get_tan(), cos(), get_cos(), sin(), get_sin()

Definition at line 3880 of file CImg.h.

CImg get_tan  )  const
 

Return the image of the tangent of the pixel values.

See also:
tan(), cos(), get_cos(), sin(), get_sin()

Definition at line 3889 of file CImg.h.

CImg& fill const T &  val  ) 
 

Fill all pixel values with value val.

Parameters:
val = fill value
See also:
operator=()

Definition at line 3906 of file CImg.h.

CImg& fill const T &  val0,
const T &  val1
 

Fill sequentially all pixel values with values val0 and val1.

Parameters:
val0 = fill value 1
val1 = fill value 2

Definition at line 3918 of file CImg.h.

CImg& fill const T &  val0,
const T &  val1,
const T &  val2
 

Fill sequentially all pixel values with values val0 and val1 and val2.

Parameters:
val0 = fill value 1
val1 = fill value 2
val2 = fill value 3

Definition at line 3931 of file CImg.h.

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

Parameters:
val0 = fill value 1
val1 = fill value 2
val2 = fill value 3
val3 = fill value 4

Definition at line 3946 of file CImg.h.

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

Parameters:
val0 = fill value 1
val1 = fill value 2
val2 = fill value 3
val3 = fill value 4
val4 = fill value 5

Definition at line 3963 of file CImg.h.

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

Parameters:
val0 = fill value 1
val1 = fill value 2
val2 = fill value 3
val3 = fill value 4
val4 = fill value 5
val5 = fill value 6

Definition at line 3982 of file CImg.h.

CImg& 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 values val0 and val1 and val2 and val3 and ... and val7.

Parameters:
val0 = fill value 1
val1 = fill value 2
val2 = fill value 3
val3 = fill value 4
val4 = fill value 5
val5 = fill value 6
val6 = fill value 7

Definition at line 4003 of file CImg.h.

CImg& 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 values val0 and val1 and val2 and val3 and ... and val8.

Parameters:
val0 = fill value 1
val1 = fill value 2
val2 = fill value 3
val3 = fill value 4
val4 = fill value 5
val5 = fill value 6
val6 = fill value 7
val7 = fill value 8

Definition at line 4027 of file CImg.h.

CImg& 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 values val0 and val1 and val2 and val3 and ... and val9.

Parameters:
val0 = fill value 1
val1 = fill value 2
val2 = fill value 3
val3 = fill value 4
val4 = fill value 5
val5 = fill value 6
val6 = fill value 7
val7 = fill value 8
val8 = fill value 9
val9 = fill value 10

Definition at line 4054 of file CImg.h.

CImg& 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 values val0 and val1 and val2 and val3 and ... and val11.

Parameters:
val0 = fill value 1
val1 = fill value 2
val2 = fill value 3
val3 = fill value 4
val4 = fill value 5
val5 = fill value 6
val6 = fill value 7
val7 = fill value 8
val8 = fill value 9
val9 = fill value 10
val10 = fill value 11
val11 = fill value 12

Definition at line 4085 of file CImg.h.

CImg& 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 values val0 and val1 and val2 and val3 and ... and val15.

Parameters:
val0 = fill value 1
val1 = fill value 2
val2 = fill value 3
val3 = fill value 4
val4 = fill value 5
val5 = fill value 6
val6 = fill value 7
val7 = fill value 8
val8 = fill value 9
val9 = fill value 10
val10 = fill value 11
val11 = fill value 12
val12 = fill value 13
val13 = fill value 14
val14 = fill value 15
val15 = fill value 16

Definition at line 4121 of file CImg.h.

CImg& normalize const T &  a,
const T &  b
 

Linear normalization of the pixel values between a and b.

Parameters:
a = minimum pixel value after normalization.
b = maximum pixel value after normalization.
See also:
get_normalize(), cut(), get_cut().

Definition at line 4151 of file CImg.h.

CImg get_normalize const T &  a,
const T &  b
const
 

Return the image of normalized values.

Parameters:
a = minimum pixel value after normalization.
b = maximum pixel value after normalization.
See also:
normalize(), cut(), get_cut().

Definition at line 4165 of file CImg.h.

CImg& cut const T &  a,
const T &  b
 

Cut pixel values between a and b.

Parameters:
a = minimum pixel value after cut.
b = maximum pixel value after cut.
See also:
get_cut(), normalize(), get_normalize().

Definition at line 4173 of file CImg.h.

CImg get_cut const T &  a,
const T &  b
const
 

Return the image of cutted values.

Parameters:
a = minimum pixel value after cut.
b = maximum pixel value after cut.
See also:
cut(), normalize(), get_normalize().

Definition at line 4185 of file CImg.h.

CImg& quantify const unsigned int  n = 256  ) 
 

Quantify pixel values into
levels.

Parameters:
n = number of quantification levels
See also:
get_quantify().

Definition at line 4192 of file CImg.h.

CImg get_quantify const unsigned int  n = 256  )  const
 

Return a quantified image, with
levels.

Parameters:
n = number of quantification levels
See also:
quantify().

Definition at line 4205 of file CImg.h.

CImg& threshold const T &  thres  ) 
 

Threshold the image.

Parameters:
thres = threshold
See also:
get_threshold().

Definition at line 4212 of file CImg.h.

CImg get_threshold const T &  thres  )  const
 

Return a thresholded image.

Parameters:
thres = threshold.
See also:
threshold().

Definition at line 4223 of file CImg.h.

CImg get_rotate const float  angle,
const unsigned int  cond = 2
const
 

Return a rotated image.

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

Definition at line 4235 of file CImg.h.

CImg& rotate const float  angle,
const unsigned int  cond = 2
 

Rotate the image.

Parameters:
angle = rotation angle (in degrees).
cond = rotation type. can be :
  • 0 = zero-value at borders
  • 1 = repeat image at borders
  • 2 = zero-value at borders and linear interpolation
See also:
get_rotate()

Definition at line 4301 of file CImg.h.

CImg get_rotate const float  angle,
const float  cx,
const float  cy,
const float  zoom = 1,
const unsigned int  cond = 2
const
 

Return a rotated image around the point (cx,cy).

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

Definition at line 4314 of file CImg.h.

CImg& rotate const float  angle,
const float  cx,
const float  cy,
const float  zoom = 1,
const unsigned int  cond = 2
 

Rotate the image around the point (cx,cy).

Parameters:
angle = rotation angle (in degrees).
cx = X-coordinate of the rotation center.
cy = Y-coordinate of the rotation center.
cond = rotation type. can be :
  • 0 = zero-value at borders
  • 1 = repeat image at borders
  • 2 = zero-value at borders and linear interpolation
Note:
Rotation does not change the image size. If you want to get an image with a new size, use get_rotate() instead.
See also:
get_rotate()

Definition at line 4386 of file CImg.h.

CImg get_resize const int  pdx = -100,
const int  pdy = -100,
const int  pdz = -100,
const int  pdv = -100,
const unsigned int  interp = 1
const
 

Return a resized image.

Parameters:
pdx = Number of columns (new size along the X-axis).
pdy = Number of rows (new size along the Y-axis).
pdz = Number of slices (new size along the Z-axis).
pdv = Number of vector-channels (new size along the V-axis).
interp = Resizing type :
  • 0 = no interpolation : additionnal space is filled with 0.
  • 1 = bloc interpolation (nearest point).
  • 2 = mosaic : image is repeated if necessary.
  • 3 = linear interpolation.
  • 4 = grid interpolation.
  • 5 = bi-cubic interpolation.
Note:
If pd[x,y,z,v]<0, it corresponds to a percentage of the original size (the default value is -100).

Definition at line 4405 of file CImg.h.

CImg get_resize const CImg< t > &  src,
const unsigned int  interp = 1
const
 

Return a resized image.

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

Definition at line 4503 of file CImg.h.

CImg get_resize const CImgDisplay disp,
const unsigned int  interp = 1
const
 

Return a resized image.

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

Definition at line 4519 of file CImg.h.

CImg& resize const int  pdx = -100,
const int  pdy = -100,
const int  pdz = -100,
const int  pdv = -100,
const unsigned int  interp = 1
 

Resize the image.

Parameters:
pdx = Number of columns (new size along the X-axis).
pdy = Number of rows (new size along the Y-axis).
pdz = Number of slices (new size along the Z-axis).
pdv = Number of vector-channels (new size along the V-axis).
interp = Resizing type :
  • 0 = no interpolation : additionnal space is filled with 0.
  • 1 = bloc interpolation (nearest point).
  • 2 = mosaic : image is repeated if necessary.
  • 3 = linear interpolation.
  • 4 = grid interpolation.
  • 5 = bi-cubic interpolation.
Note:
If pd[x,y,z,v]<0, it corresponds to a percentage of the original size (the default value is -100).

Definition at line 4538 of file CImg.h.

CImg& resize const CImg< t > &  src,
const unsigned int  interp = 1
 

Resize the image.

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

Definition at line 4560 of file CImg.h.

CImg& resize const CImgDisplay disp,
const unsigned int  interp = 1
 

Resize the image.

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

Definition at line 4576 of file CImg.h.

CImg get_resize_halfXY  )  const
 

Return an half-resized image, using a special filter.

See also:
resize_halfXY(), resize(), get_resize().

Definition at line 4584 of file CImg.h.

CImg& resize_halfXY  ) 
 

Half-resize the image, using a special filter.

See also:
get_resize_halfXY(), resize(), get_resize().

Definition at line 4600 of file CImg.h.

CImg get_crop const unsigned int  x0,
const unsigned int  y0,
const unsigned int  z0,
const unsigned int  v0,
const unsigned int  x1,
const unsigned int  y1,
const unsigned int  z1,
const unsigned int  v1
const
 

Return a square region of the image, as a new image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
y0 = Y-coordinate of the upper-left crop rectangle corner.
z0 = Z-coordinate of the upper-left crop rectangle corner.
v0 = V-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
y1 = Y-coordinate of the lower-right crop rectangle corner.
z1 = Z-coordinate of the lower-right crop rectangle corner.
v1 = V-coordinate of the lower-right crop rectangle corner.
See also:
crop()

Definition at line 4614 of file CImg.h.

CImg get_crop const unsigned int  x0,
const unsigned int  y0,
const unsigned int  z0,
const unsigned int  x1,
const unsigned int  y1,
const unsigned int  z1
const
 

Return a square region of the image, as a new image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
y0 = Y-coordinate of the upper-left crop rectangle corner.
z0 = Z-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
y1 = Y-coordinate of the lower-right crop rectangle corner.
z1 = Z-coordinate of the lower-right crop rectangle corner.
See also:
crop()

Definition at line 4668 of file CImg.h.

CImg get_crop const unsigned int  x0,
const unsigned int  y0,
const unsigned int  x1,
const unsigned int  y1
const
 

Return a square region of the image, as a new image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
y0 = Y-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
y1 = Y-coordinate of the lower-right crop rectangle corner.
See also:
crop()

Definition at line 4681 of file CImg.h.

CImg get_crop const unsigned int  x0,
const unsigned int  x1
const
 

Return a square region of the image, as a new image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
See also:
crop()

Definition at line 4692 of file CImg.h.

CImg& crop const unsigned int  x0,
const unsigned int  y0,
const unsigned int  z0,
const unsigned int  v0,
const unsigned int  x1,
const unsigned int  y1,
const unsigned int  z1,
const unsigned int  v1
 

Replace the image by a square region of the image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
y0 = Y-coordinate of the upper-left crop rectangle corner.
z0 = Z-coordinate of the upper-left crop rectangle corner.
v0 = V-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
y1 = Y-coordinate of the lower-right crop rectangle corner.
z1 = Z-coordinate of the lower-right crop rectangle corner.
v1 = V-coordinate of the lower-right crop rectangle corner.
See also:
get_crop()

Definition at line 4706 of file CImg.h.

CImg& crop const unsigned int  x0,
const unsigned int  y0,
const unsigned int  z0,
const unsigned int  x1,
const unsigned int  y1,
const unsigned int  z1
 

Replace the image by a square region of the image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
y0 = Y-coordinate of the upper-left crop rectangle corner.
z0 = Z-coordinate of the upper-left crop rectangle corner.
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.
See also:
get_crop()

Definition at line 4721 of file CImg.h.

CImg& crop const unsigned int  x0,
const unsigned int  y0,
const unsigned int  x1,
const unsigned int  y1
 

Replace the image by a square region of the image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
y0 = Y-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
y1 = Y-coordinate of the lower-right crop rectangle corner.
See also:
get_crop()

Definition at line 4734 of file CImg.h.

CImg& crop const unsigned int  x0,
const unsigned int  x1
 

Replace the image by a square region of the image.

Parameters:
x0 = X-coordinate of the upper-left crop rectangle corner.
x1 = X-coordinate of the lower-right crop rectangle corner.
See also:
get_crop()

Definition at line 4743 of file CImg.h.

CImg get_channel const unsigned int  v0 = 0  )  const
 

Get the channel v of the current image, as a new image.

Parameters:
v0 = vector-channel to return.
See also:
channel(), get_slice(), slice(), get_plane(), plane().

Definition at line 4750 of file CImg.h.

CImg get_slice const unsigned int  z0 = 0  )  const
 

Get the z-slice z of *this, as a new image.

Parameters:
z0 = Z-slice to return.
See also:
slice(), get_channel(), channel(), get_plane(), plane().

Definition at line 4757 of file CImg.h.

CImg get_plane const unsigned int  z0 = 0,
const unsigned int  v0 = 0
const
 

Get the z-slice z of the channel v of the current image, as a new image.

Parameters:
z0 = Z-slice of the plane to return.
v0 = V-channel of the plane to return.
See also:
plane(), get_channel(), channel(), get_slice(), slice().

Definition at line 4765 of file CImg.h.

CImg& draw_point const int  x0,
const int  y0,
const int  z0,
const T *const   color,
const float  opacity = 1
 

Draw a colored point in the instance image, at coordinates (x0,y0,z0).

Parameters:
x0 = X-coordinate of the vector-valued pixel to plot.
y0 = Y-coordinate of the vector-valued pixel to plot.
z0 = Z-coordinate of the vector-valued pixel to plot.
color = a C-array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5147 of file CImg.h.

CImg& draw_point const int  x0,
const int  y0,
const T *const   color,
const float  opacity = 1
 

Draw a colored point in the instance image, at coordinates (x0,y0).

Parameters:
x0 = X-coordinate of the vector-valued pixel to plot.
y0 = Y-coordinate of the vector-valued pixel to plot.
color = a C-array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5170 of file CImg.h.

CImg& draw_line const int  x0,
const int  y0,
const int  x1,
const int  y1,
const T *const   color,
const unsigned long  pattern = ~0L,
const float  opacity = 1
 

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

Parameters:
x0 = X-coordinate of the starting point of the line.
y0 = Y-coordinate of the starting point of the line.
x1 = X-coordinate of the ending point of the line.
y1 = Y-coordinate of the ending point of the line.
color = a C-array of dimv() values of type T, defining the drawing color.
pattern = A long integer whose bits describes the line pattern.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5185 of file CImg.h.

CImg& draw_line const int  x0,
const int  y0,
const int  z0,
const int  x1,
const int  y1,
const int  z1,
const T *const   color,
const unsigned long  pattern = ~0L,
const float  opacity = 1
 

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

Parameters:
x0 = X-coordinate of the starting point of the line.
y0 = Y-coordinate of the starting point of the line.
z0 = Z-coordinate of the starting point of the line.
x1 = X-coordinate of the ending point of the line.
y1 = Y-coordinate of the ending point of the line.
Z1 = Z-coordinate of the ending point of the line.
color = a C-array of dimv() values of type T, defining the drawing color.
pattern = A long integer whose bits describes the line pattern.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5237 of file CImg.h.

CImg& draw_line const int  x0,
const int  y0,
const int  x1,
const int  y1,
const CImg< t > &  texture,
const int  tx0,
const int  ty0,
const int  tx1,
const int  ty1,
const float  opacity = 1
 

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

Parameters:
x0 = X-coordinate of the starting point of the line.
y0 = Y-coordinate of the starting point of the line.
x1 = X-coordinate of the ending point of the line.
y1 = Y-coordinate of the ending point of the line.
texture = a colored texture image used to draw the line color.
tx0 = X-coordinate of the starting point of the texture.
ty0 = Y-coordinate of the starting point of the texture.
tx1 = X-coordinate of the ending point of the texture.
ty1 = Y-coordinate of the ending point of the texture.
color = a C-array of dimv() values of type T, defining the drawing color.
pattern = a long integer whose bits describes the line pattern.
opacity = opacity of the drawing.
Note:
Clipping is supported, but texture coordinates do not support clipping.

Definition at line 5296 of file CImg.h.

CImg& draw_arrow const int  x0,
const int  y0,
const int  x1,
const int  y1,
const T *const   color,
const float  angle = 30,
const float  length = -10,
const unsigned long  pattern = ~0L,
const float  opacity = 1
 

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

Parameters:
x0 = X-coordinate of the starting point of the arrow (tail).
y0 = Y-coordinate of the starting point of the arrow (tail).
x1 = X-coordinate of the ending point of the arrow (head).
y1 = Y-coordinate of the ending point of the arrow (head).
color = a C-array of dimv() values of type T, defining the drawing color.
angle = aperture angle of the arrow head
length = length of the arrow head. If <0, described as a percentage of the arrow length.
pattern = a long integer whose bits describes the line pattern.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5347 of file CImg.h.

CImg& draw_image const CImg< t > &  sprite,
const int  x0 = 0,
const int  y0 = 0,
const int  z0 = 0,
const int  v0 = 0,
const float  opacity = 1
 

Draw a sprite image in the instance image, at coordinates (x0,y0,z0,v0).

Parameters:
sprite = sprite image.
x0 = X-coordinate of the sprite position in the instance image.
y0 = Y-coordinate of the sprite position in the instance image.
z0 = Z-coordinate of the sprite position in the instance image.
v0 = V-coordinate of the sprite position in the instance image.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5375 of file CImg.h.

CImg& draw_image const CImg< ti > &  sprite,
const CImg< tm > &  mask,
const int  x0 = 0,
const int  y0 = 0,
const int  z0 = 0,
const int  v0 = 0,
const tm  mask_valmax = 1,
const float  opacity = 1
 

Draw a masked sprite image in the instance image, at coordinates (x0,y0,z0,v0).

Parameters:
sprite = sprite image.
mask = mask image.
x0 = X-coordinate of the sprite position in the instance image.
y0 = Y-coordinate of the sprite position in the instance image.
z0 = Z-coordinate of the sprite position in the instance image.
v0 = V-coordinate of the sprite position in the instance image.
mask_valmax = Maximum pixel value of the mask image mask.
opacity = opacity of the drawing.
Note:
Pixel values of mask set the opacity of the corresponding pixels in sprite.

Clipping is supported.

Dimensions along x,y and z of sprite and mask must be the same.

Definition at line 5456 of file CImg.h.

CImg& draw_rectangle const int  x0,
const int  y0,
const int  z0,
const int  v0,
const int  x1,
const int  y1,
const int  z1,
const int  v1,
const T &  val,
float  opacity = 1
 

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

Parameters:
x0 = X-coordinate of the upper-left rectangle corner in the instance image.
y0 = Y-coordinate of the upper-left rectangle corner in the instance image.
z0 = Z-coordinate of the upper-left rectangle corner in the instance image.
v0 = V-coordinate of the upper-left rectangle corner in the instance image.
x1 = X-coordinate of the lower-right rectangle corner in the instance image.
y1 = Y-coordinate of the lower-right rectangle corner in the instance image.
z1 = Z-coordinate of the lower-right rectangle corner in the instance image.
v1 = V-coordinate of the lower-right rectangle corner in the instance image.
val = scalar value used to fill the rectangle area.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5513 of file CImg.h.

CImg& draw_rectangle const int  x0,
const int  y0,
const int  z0,
const int  x1,
const int  y1,
const int  z1,
const T *const   color,
const float  opacity = 1
 

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

Parameters:
x0 = X-coordinate of the upper-left rectangle corner in the instance image.
y0 = Y-coordinate of the upper-left rectangle corner in the instance image.
z0 = Z-coordinate of the upper-left rectangle corner in the instance image.
x1 = X-coordinate of the lower-right rectangle corner in the instance image.
y1 = Y-coordinate of the lower-right rectangle corner in the instance image.
z1 = Z-coordinate of the lower-right rectangle corner in the instance image.
color = a C-array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5555 of file CImg.h.

CImg& draw_rectangle const int  x0,
const int  y0,
const int  x1,
const int  y1,
const T *const   color,
const float  opacity = 1
 

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

Parameters:
x0 = X-coordinate of the upper-left rectangle corner in the instance image.
y0 = Y-coordinate of the upper-left rectangle corner in the instance image.
x1 = X-coordinate of the lower-right rectangle corner in the instance image.
y1 = Y-coordinate of the lower-right rectangle corner in the instance image.
color = a C-array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5573 of file CImg.h.

CImg& draw_triangle const int  x0,
const int  y0,
const int  x1,
const int  y1,
const int  x2,
const int  y2,
const T *const   color,
const float  opacity = 1
 

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

Parameters:
x0 = X-coordinate of the first corner in the instance image.
y0 = Y-coordinate of the first corner in the instance image.
x1 = X-coordinate of the second corner in the instance image.
y1 = Y-coordinate of the second corner in the instance image.
x2 = X-coordinate of the third corner in the instance image.
y2 = Y-coordinate of the third corner in the instance image.
color = a C-array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 5591 of file CImg.h.

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

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

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

Definition at line 5672 of file CImg.h.

CImg& draw_ellipse const int  x0,
const int  y0,
const float  r1,
const float  r2,
const float  ru,
const float  rv,
const T *const   color,
const float  opacity = 1
 

Draw a filled ellipse on the instance image.

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

Definition at line 5932 of file CImg.h.

CImg& draw_circle const int  x0,
const int  y0,
float  r,
const T *const   color,
const float  opacity = 1
 

Draw a filled circle on the instance image.

Parameters:
x0 = X-coordinate of the circle center.
y0 = Y-coordinate of the circle center.
r = radius of the circle.
color = an array of dimv() values of type T, defining the drawing color.
opacity = opacity of the drawing.

Definition at line 5994 of file CImg.h.

CImgl<T> get_font7x11 const bool  fixed_size = false  )  [static]
 

Return a copy of the default 7x11 CImg font as a list of images and masks.

Parameters:
fixed_size = compute fixed or variable character size

Definition at line 6017 of file CImg.h.

CImg& draw_text const char *const   text,
const int  x0,
const int  y0,
const T *const   fgcolor,
const T *const   bgcolor,
const CImgl< t > &  font,
const float  opacity = 1
 

Draw a text into the instance image.

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

Definition at line 6040 of file CImg.h.

CImg& draw_text const char *const   text,
const int  x0,
const int  y0,
const T *const   fgcolor = NULL,
const T *const   bgcolor = NULL,
const float  opacity = 1
 

Draw a text into the instance image.

Parameters:
text = a C-string containing the text to display.
x0 = X-coordinate of the text in the instance image.
y0 = Y-coordinate of the text in the instance image.
fgcolor = an array of dimv() values of type T, defining the foreground color (NULL means 'transparent').
bgcolor = an array of dimv() values of type T, defining the background color (NULL means 'transparent').
opacity = opacity of the drawing.
Note:
Clipping is supported.
See also:
get_font7x11().

Definition at line 6078 of file CImg.h.

CImg& draw_text const int  x0,
const int  y0,
const T *const   fgcolor,
const T *const   bgcolor,
const float  opacity,
const char *  format,
  ...
 

Draw a text into the instance image.

Parameters:
x0 = X-coordinate of the text in the instance image.
y0 = Y-coordinate of the text in the instance image.
fgcolor = an array of dimv() values of type T, defining the foreground color (NULL means 'transparent').
bgcolor = an array of dimv() values of type T, defining the background color (NULL means 'transparent').
opacity = opacity of the drawing.
format = a 'printf'-style format, followed by arguments.
Note:
Clipping is supported.
See also:
get_font7x11().

Definition at line 6099 of file CImg.h.

CImg& draw_quiver const CImg< t > &  flow,
const T *const   color,
const unsigned int  sampling = 25,
const float  factor = -20,
const int  quiver_type = 0,
const float  opacity = 1
 

Draw a vector field in the instance image.

Parameters:
flow = a 2d image of 2d vectors used as input data.
color = an array of dimv() values of type T, defining the drawing color.
sampling = length (in pixels) between each arrow.
factor = length factor of each arrow (if <0, computed as a percentage of the maximum length).
quiver_type = type of plot. Can be 0 (arrows) or 1 (segments).
opacity = opacity of the drawing.
Note:
Clipping is supported.

Definition at line 6127 of file CImg.h.

CImg& draw_quiver const CImg< t1 > &  flow,
const CImg< t2 > &  color,
const unsigned int  sampling = 25,
const float  factor = -20,
const int  quiver_type = 0,
const float  opacity = 1
 

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

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

Definition at line 6167 of file CImg.h.

CImg& draw_graph const CImg< t > &  data,
const T *const   color,
const unsigned int  gtype = 0,
const double  ymin = 0,
const double  ymax = 0,
const float  opacity = 1
 

Draw a 1D graph on the instance image.

Parameters:
data = an image containing the graph values I = f(x).
color = an array of dimv() values of type T, defining the drawing color.
gtype = define the type of the plot :
  • 0 = Plot using linear interpolation (segments).
  • 1 = Plot with bars.
  • 2 = Plot using cubic interpolation (3-polynomials).
ymin = lower bound of the y-range.
ymax = upper bound of the y-range.
opacity = opacity of the drawing.
Note:
  • if ymin==ymax==0, the y-range is computed automatically from the input sample.
See also:
draw_axeX(), draw_axeY(), draw_axeXY().

Definition at line 6215 of file CImg.h.

CImg& draw_axeX const double  x0,
const double  x1,
const int  y,
const T *const   color,
const double  precision = 0,
const float  opacity = 1
 

Draw a labelled horizontal axis on the instance image.

Parameters:
x0 = lower bound of the x-range.
x1 = upper bound of the x-range.
y = Y-coordinate of the horizontal axis in the instance image.
color = an array of dimv() values of type T, defining the drawing color.
precision = precision of the labels.
opacity = opacity of the drawing.
Note:
if precision==0, precision of the labels is automatically computed.
See also:
draw_graph(), draw_axeY(), draw_axeXY().

Definition at line 6266 of file CImg.h.

CImg& draw_axeY const int  x,
const double  y0,
const double  y1,
const T *const   color,
const double  precision = 0,
const float  opacity = 1
 

Draw a labelled vertical axis on the instance image.

Parameters:
x = X-coordinate of the vertical axis in the instance image.
y0 = lower bound of the y-range.
y1 = upper bound of the y-range.
color = an array of dimv() values of type T, defining the drawing color.
precision = precision of the labels.
opacity = opacity of the drawing.
Note:
if precision==0, precision of the labels is automatically computed.
See also:
draw_graph(), draw_axeX(), draw_axeXY().

Definition at line 6302 of file CImg.h.

CImg& draw_axeXY const double  x0,
const double  x1,
const double  y0,
const double  y1,
const T *const   color,
const double  precisionx = 0,
const double  precisiony = 0,
const float  opacity = 1
 

Draw a labelled coordinate system (X,Y) on the instance image.

Parameters:
x0 = lower bound of the x-range.
x1 = upper bound of the x-range.
y0 = lower bound of the y-range.
y1 = upper bound of the y-range.
color = an array of dimv() values of type T, defining the drawing color.
precisionx = precision of the labels along the X-axis.
precisiony = precision of the labels along the Y-axis.
opacity = opacity of the drawing.
Note:
if precision==0, precision of the labels along the specified axix is automatically computed.
See also:
draw_graph(), draw_axeX(), draw_axeY().

Definition at line 6340 of file CImg.h.

CImg& draw_fill const int  x,
const int  y,
const int  z,
const T *const   color,
CImg< t > &  region,
const float  sigma = 0,
const float  opacity = 1
 

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

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

Definition at line 6426 of file CImg.h.

CImg& draw_fill const int  x,
const int  y,
const int  z,
const T *const   color,
const float  sigma = 0,
const float  opacity = 1
 

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

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

Definition at line 6444 of file CImg.h.

CImg& draw_fill const int  x,
const int  y,
const T *const   color,
const float  sigma = 0,
const float  opacity = 1
 

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

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

Definition at line 6457 of file CImg.h.

CImg& draw_plasma const int  x0,
const int  y0,
const int  x1,
const int  y1,
const double  alpha = 1.0,
const double  beta = 1.0,
const float  opacity = 1
 

Draw a plasma square in the instance image.

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

Definition at line 6472 of file CImg.h.

CImg& draw_plasma const double  alpha = 1.0,
const double  beta = 1.0,
const float  opacity = 1
 

Draw a plasma in the instance image.

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

Definition at line 6518 of file CImg.h.


Member Data Documentation

unsigned int width
 

Number of columns in the instance image (size along the X-axis).

Note:
  • Prefer using CImg<T>::dimx() to get the width of the instance image.
  • Should be considered as read-only. Modifying directly CImg<T>::width would probably result in a crash.
  • This value can be modified through the CImg<T>::resize() function.
  • If CImg<T>::width==0, the image is empty and contains no pixel data.

Definition at line 2952 of file CImg.h.

unsigned int height
 

Number of rows in the instance image (size along the Y-axis).

Note:

Definition at line 2963 of file CImg.h.

unsigned int depth
 

Number of slices in the instance image (size along the Z-axis).

Note:
  • Prefer using CImg<T>::dimz() to get the depth of the instance image.
  • Should be considered as read-only. Modifying directly CImg<T>::depth would probably result in a crash.
  • This value can be modified through the CImg<T>::resize() function.
  • If CImg<T>::depth==0, the image is empty and contains no pixel data.

Definition at line 2974 of file CImg.h.

unsigned int dim
 

Number of vector channels in the instance image (size along the V-axis).

Note:
  • Prefer using CImg<T>::dimv() to get the depth of the instance image.
  • Should be considered as read-only. Modifying directly CImg<T>::dim would probably result in a crash.
  • This value can be modified through the CImg<T>::resize() function.
  • If CImg<T>::dim==0, the image is empty and contains no pixel data.

Definition at line 2985 of file CImg.h.

T* data
 

Pointer to pixel values (array of elements T).

Note:
  • Prefer using CImg<T>::ptr() to get a pointer to the pixel buffer.
  • Should be considered as read-only. Modifying directly CImg<T>::data would probably result in a crash.
  • If CImg<T>::data==NULL, the image is empty and contains no pixel data.
See also:
cimg_storage

Definition at line 2996 of file CImg.h.


Generated on Thu Dec 2 11:26:18 2004 for The CImg Library by  doxygen 1.3.9.1