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

## 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 1731 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 1746 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 1763 of file CImg.h.