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

# CImgStats Struct Reference

This class is used to compute basics statistics of a `CImg<T>` image. More...

List of all members.

## Public Member Functions

| CImgStats ()
| Empty constructor.
| CImgStats (const CImgStats &stats)
| Copy constructor.
template<typename T>
| CImgStats (const CImg< T > &img, const bool compute_variance=true)
| Constructor that compute statistics of an image `img`.
template<typename T>
| CImgStats (const CImgl< T > &list, const bool compute_variance=true)
| Constructor that compute statistics of an image list `list`.
CImgStats & | operator= (const CImgStats stats)
| Assignement operator.
const CImgStats & | print (const char *title=NULL) const
| Print the current statistics on the standart error output.

## Public Attributes

double | min
| Minimum of the pixel values after statistics computation.
double | max
| Maximum of the pixel values after statistics computation.
double | mean
| Mean of the pixel values after statistics computation.
double | variance
| Variance of the pixel values after statistics computation.
int | xmin
| X-coordinate of the minimum pixel value.
int | ymin
| Y-coordinate of the minimum pixel value.
int | zmin
| Z-coordinate of the minimum pixel value.
int | vmin
| V-coordinate of the minimum pixel value.
int | lmin
| Image number of the list where the minimum is reached.
int | xmax
| X-coordinate of the maximum pixel value.
int | ymax
| Y-coordinate of the maximum pixel value.
int | zmax
| Z-coordinate of the maximum pixel value.
int | vmax
| V-coordinate of the maximum pixel value.
int | lmax
| Image number of the list where the maximum is reached.

## Detailed Description

This class is used to compute basics statistics of a `CImg<T>` image.

Constructing a CImgStats instance by passing an image CImg<T> or an image list CImgl<T> as a parameter, will compute the minimum, the maximum and the average pixel values of the given object, and optionally the variance of the pixel values. Use it to retrieve basic statistics of an image, or an image list, like this :

          const CImg<float> img("my_image.jpg");
          const CImgStats stats(img);
          stats.print("My statistics");
          std::printf("Max-Min = %lf",stats.max-stats.min);

Note that statistics are computed for all scalar values of a CImg<T> or a CImgl<T>. No vector-valued statistics are performed.

Definition at line 1624 of file CImg.h.

## Constructor & Destructor Documentation

CImgStats | ( | const CImg< T > & | img,
|  | const bool | compute_variance = `true`
| ) |

| Constructor that compute statistics of an image `img`. If `compute_variance` = true, the variance field of the CImgStats structure is computed, else it is set to 0. Definition at line 1652 of file CImg.h.

CImgStats | ( | const CImgl< T > & | list,
|  | const bool | compute_variance = `true`
| ) |

| Constructor that compute statistics of an image list `list`. Statistics are computed for all pixels of all images of the list. If `compute_variance` = true, the variance field of the CImgStats structure is computed, else it is undefined. Definition at line 1679 of file CImg.h.