<a id="easyimage-image-statistics"></a>

# Computing and Using Image Statistics

**EasyImage** provides multiple ways of extracting and computing statistics from an image. These returned statistics can either be:

* Another image, this is the case for statistics that are expressed through filtering.
* One or more values, this is the case when computing the maximum or minimum pixel values for example.

<a id="easyimage-image-statistics-sliding-window"></a>

## Sliding Window

The average and standard deviation of gray-level values can be computed in a sliding window, that is, computed for every position of a rectangular window centered on every pixel. The window size is arbitrary.

#### NOTE
The computing time of these functions does not depend on the window size.

* The result of the operation is another image.
* The **local average**, [`EasyImage::LocalAverage`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#aa17546b11107cb211ed1106b19aac99a) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a6c5c8864373a1304e74dbedbd1b8cf70) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a09334870d7ba8afc90605a47af062d9f), corresponds to a strong low-pass filtering.

![](assets/images/easyimage/image_statistics/localaverage_output.webp)![](assets/images/easyimage/image_statistics/localaverage_graph.webp)
* The **local standard deviation**, [`EasyImage::LocalDeviation`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#ac5a7f59ed095f1d169b075595ec85791) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a6f7ff7c8ce5fd1df5f8e5b2731c59ea6) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#ac14b7a9e0e18e3e3593d0cc2faa29d9d) enhances the regions with a high frequency contents, such as noisy or textured areas.

![](assets/images/easyimage/image_statistics/localstandarddeviation_output.webp)![](assets/images/easyimage/image_statistics/localstandarddeviation_graph.webp)

<a id="easyimage-image-statistics-histogram"></a>

## Histogram Computation and Analysis (and LUT Creation)

A histogram is a statistical summary of an image: it shows the number of occurrences for every gray-level value in an image, and its shape reveals characteristics of the image. For instance, peaks in the histogram curve correspond to dominant colors in the image. If the histogram is bi-modal, a large peak for the dark values corresponding to the background, and smaller peaks in the light values.

![](assets/images/easyimage/image_statistics/markingonacdrom.webp)![](assets/images/easyimage/image_statistics/markingonacdrom_histogram.webp)

<a id="easyimage-image-statistics-histogram-computation"></a>

### Histogram Computation

* [`EasyImage::Histogram`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a844bd52f1e6c61fe0264412ed74d15de) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#ab9c24a850843e901bd1dc7fc360376b5) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#ad1a8be6eacbbef1eef655ebdfc015aa9) computes the histogram of an image. A [`ERegion`](../../../doxygen_cpp/classeVision_1_1ERegion.html) or a mask (using a binary [`EImageBW8`](../../../doxygen_cpp/classeVision_1_1EImageBW8.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageBW8.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageBW8.html)) can be used to reduce or more precisely define the calculation area of the histogram.
* You can compute the cumulative histogram of an image, i.e. the count of pixels below a given threshold value, by calling [`EasyImage::CumulateHistogram`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a4b6b12cb272c337e33452bb0cf9df71a) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#abcdc74093b41ea348e59a1e0e1c659c2) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#ac33813bcf1ead29526a46d056949a1ec) after [`EasyImage::Histogram`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a844bd52f1e6c61fe0264412ed74d15de) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#ab9c24a850843e901bd1dc7fc360376b5) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#ad1a8be6eacbbef1eef655ebdfc015aa9).

<a id="easyimage-image-statistics-histogram-analysis"></a>

### Histogram Analysis

* [`EasyImage::AnalyseHistogram`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a75bc97a0b9edcd2200bf5041e431e993) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#abfe77a0ab52c05af84c56b6a630e84d6) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a7e34e79e1e27369c4551fe555e6128a4) and [`EasyImage::AnalyseHistogramBW16`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a9b160e1c72d57ca9c97f6ebabbac83a1) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a76f0b8755f34a93b9309118b109972ca) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a7950eced32afccfbe15ac181a41dcc35) allows to operate on a computed histogram. Multiple operations are available and are defined using [`eVision::EHistogramFeature`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision.html#ab2fe623170bd65ea406fc3ae57cafa9e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EHistogramFeature.html)
  * Total number of pixels, using [`eVision::EHistogramFeature_PixelCount`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2af09a20a23a7d007782ca1297aa50ff30).
  * Smallest and largest pixel value (gray-level range), using [`eVision::EHistogramFeature_SmallestPixelValue`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2a81afba431718d7bcf3cdb0fd0d298881) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision.html#ab2fe623170bd65ea406fc3ae57cafa9e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EHistogramFeature.html#a4d1f47b50a1cb911f65d85128b3cd467) and [`eVision::EHistogramFeature_GreatestPixelValue`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2af998ef3e12f9baf38063af8fea48525f) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision.html#ab2fe623170bd65ea406fc3ae57cafa9e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EHistogramFeature.html#ac12097c87034940868fc19bba5555a63).
  * Average and standard deviation of the pixel values, using [`eVision::EHistogramFeature_AveragePixelValue`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2aed9c24c0ac1ddb2cf2a9c101686bcf18) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision.html#ab2fe623170bd65ea406fc3ae57cafa9e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EHistogramFeature.html#ae9f11707ef3ff1cf9baca973a010cafa) and [`eVision::EHistogramFeature_PixelValueStdDev`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2a9e716bc410de21bfe535fed8b823f311) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision.html#ab2fe623170bd65ea406fc3ae57cafa9e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EHistogramFeature.html#a6b0a5f34943dff6c8af7fc7c43027fea).
  * Value and frequency of the most frequent pixel, using [`eVision::EHistogramFeature_MostFrequentPixelValue`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2a8401215786656519a8acb053bda099ac) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision.html#ab2fe623170bd65ea406fc3ae57cafa9e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EHistogramFeature.html#a33d9b738f05aeed7afbc30583a6e07bf) and [`eVision::EHistogramFeature_MostFrequentPixelFrequency`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2af8652d1f22c2058c28cc0974c865c8fa) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision.html#ab2fe623170bd65ea406fc3ae57cafa9e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EHistogramFeature.html#a24d808538358b123dd185ae322ed95cf).
  * Value and frequency of the least frequent pixel, using [`eVision::EHistogramFeature_LeastFrequentPixelValue`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2a5af07b2b25531a626d58e60995590748) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision.html#ab2fe623170bd65ea406fc3ae57cafa9e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EHistogramFeature.html#a4f33d084db032ab5cff7971ec23d79f3) and [`eVision::EHistogramFeature_LeastFrequentPixelFrequency`](../../../doxygen_cpp/namespaceeVision.html#a96351e1a58dd9c29bf15b58b92b620b2a45bdc85bb8d8ed23c4a710d2690aca2c) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision.html#ab2fe623170bd65ea406fc3ae57cafa9e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EHistogramFeature.html#adbe875fff7226cce50afe6d696ca7467).

<a id="easyimage-image-statistics-equalization"></a>

## Histogram Equalization

* [`EasyImage::Equalize`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a124cdbcecfc0b533bed3ff85b0a7c04b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a1d9dbcb58b9fc6cf38ee061cf2b119de) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a3d76745e0ffb6d027962350cd2b7e160) re-maps the gray levels so that the histogram fills in the whole dynamic range as uniformly as possible.
* This may be useful to maximize image contrast, or to reveal details in dark parts of the image.

![](assets/images/easyimage/image_statistics/equalization_input.webp)![](assets/images/easyimage/image_statistics/equalization_input_graph.webp)![](assets/images/easyimage/image_statistics/equalization_output.webp)![](assets/images/easyimage/image_statistics/equalization_output_graph.webp)

<a id="easyimage-image-statistics-equalization-lut"></a>

### Set Up a Lookup Table

* [`EasyImage::SetupEqualize`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a83dd5276340b53acf457a4bd92a4e0fd) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a39f45b67f900e682c9e828653f2ebfc2) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a7f14f71957675b26d5efe0a3213f20ef) prepares a lookup-table for image equalization, using an image histogram. To apply the equalization, [`EasyImage::Lut()`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a9760d9a0411555f716fbae96a2b7034a) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a3a3e2d078ad4178f9e44784ef6a5a947) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#aa2fee63b3dac911748263c3915b0abf6) should be called afterward with the returned histogram.

![image](assets/images/easyimage/image_statistics/lookup_graph.webp)

<a id="easyimage-image-statistics-focus"></a>

## Image Focus

[`EasyImage::Focusing()`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#a68838058207802ab49f55e67ad3d9f88) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a2adc835147e433785d2ffaf393d35190) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a58f4cac15d0d77082e508a56384585e8) returns a measure of how well-focused an image is, by computing its **total gradient energy**. Calling it repeatedly on images captured at different focus positions gives you the basis of an auto-focus routine: the position that yields the highest value is the sharpest.

The measure relies on image gradients, which highlight the edges of structures in the image. A well-focused image has sharp edges and therefore strong gradient values; a poorly focused image has soft edges and weaker gradient values.

To compute the total gradient energy, **eVision**:

1. Computes the horizontal and vertical gradient images, and squares their pixel values.
2. Averages the squared pixel values, separately, over each gradient image.
3. Sums the two averages.
4. Takes the square root of the result.

#### HINT
The resulting value is highest when the image is well-focused, and decreases as focus quality drops.

![image](assets/images/easyimage/image_statistics/easyimage_focusing_1.webp)![image](assets/images/easyimage/image_statistics/easyimage_focusing_2.webp)

<a id="easyimage-image-statistics-functions"></a>

## EasyImage Statistics Functions

The class responsible for computing the statistics depends on the image type:

* For [`EImageBW8`](../../../doxygen_cpp/classeVision_1_1EImageBW8.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageBW8.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageBW8.html) images, use [`EImageStatisticsBW8`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html).
* For [`EImageBW16`](../../../doxygen_cpp/classeVision_1_1EImageBW16.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageBW16.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageBW16.html) images, use [`EImageStatisticsBW16`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW16.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW16.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW16.html).
* For [`EImageC24`](../../../doxygen_cpp/classeVision_1_1EImageC24.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageC24.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageC24.html) images, use [`EImageStatisticsC24`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsC24.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsC24.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsC24.html).

The next section explains the method using [`EImageStatisticsBW8`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html) to ease the reading. The target image and its optional region have to be set before calling the getters using [`EImageStatisticsBW8::SetImage()`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a54b3a67c9ca3915925ca36049d03add8) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#aa6d8ef7dfcdaa67475f55c983df95666) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a42a52bb2e050a5651d5fe7afc21adb0b).

<a id="easyimage-image-statistics-binary-moments"></a>

### Binary and Weighted Moments

[`EImageStatisticsBW8::GetBinaryMoments()`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#aa00c2e3049116fb6b27b8b00184e6e93) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#aa4ae87627bc51702b5bf71c486b621a3) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a4a9f737cccda85826f7f3207be2346fb) computes the binary moments of pixels above or equal to [`EImageStatisticsBW8::SetHighThreshold()`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a892c107ac44dd14d197839e8e979bc94) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#ac8a0059e32ee308dafc6efdc34353934) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a5a95ebef06a6e0781ad57204789287ac) up to the requested order on the image.

Returns a vector containing the moments in the following order (up to the maxOrder given):

* `returnedArray[0]` is the area (0th order moment).
* `returnedArray[1]` is the sum of abscissas (1st order, uncentered moment).
* `returnedArray[2]` is the sum of ordinates (1st order, uncentered moment).
* `returnedArray[3]` is the sum of squared abscissas (2nd order, uncentered moment).
* `returnedArray[4]` is the sum of product of abscissas and ordinates (2nd order, uncentered moment).
* `returnedArray[5]` is the sum of squared ordinates (2nd order, uncentered moment).

<a id="easyimage-image-statistics-gravity-center"></a>

### Gravity Center (Average Pixel Coordinates Above/On Threshold)

[`EImageStatisticsBW8::GetGravityCenterOfPixelsAboveHighThreshold`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a23b0a7e94d17444a05903841724313d4) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#ad4d0bcf928fdc6a1a8cc3ca6dbd8953e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#af1affe7ffb01a5962475628f2867ddc6) computes the coordinates of the gravity center of an image. The gravity center is computed on the pixels whose value are above the set high threshold (set using [`EImageStatisticsBW8::SetHighThreshold()`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a892c107ac44dd14d197839e8e979bc94)).

<a id="easyimage-image-statistics-pixel-count"></a>

### Pixel Count (Between 2 Thresholds)

High and low threshold can be set using [`EImageStatisticsBW8::SetLowThreshold()`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#af6a5159295f6674511bc3aaf605baf84) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#a0bb4ae957db1177fb23ebe9ba86834f4) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#af506b49a2457440067634071de219ce2) and [`EImageStatisticsBW8::SetHighThreshold()`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a892c107ac44dd14d197839e8e979bc94) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#ac8a0059e32ee308dafc6efdc34353934) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a5a95ebef06a6e0781ad57204789287ac)

* [`EImageStatisticsBW8::GetNumberOfPixelsBetweenThresholds`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a2b4eda0c389fee68d528bcace6070fa1) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#af6d4013dae0ca791c3066cc8ca7797a1) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a9864c280048a22f64d7f7cd7f3bcb77e) counts the pixels between low and high threshold.
* [`EImageStatisticsBW8::GetNumberOfPixelsBelowLowThreshold`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a49092b254a42a746ca0daa936eeda431) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#af517256ce552da12417ce8c5a900044d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a02439559605db726e660a2f032818b4f) counts the pixels below the low threshold.
* [`EImageStatisticsBW8::GetNumberOfPixelsAboveHighThreshold`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a05dea71b5cda0b628b4653d1df2c6aa1) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#a255fc76bf4324ef01de8848c0e5eeb64) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a0dc0f6ac2fd3dfb7e2e9f5f68f6b3084) counts the pixels above the high threshold.

<a id="easyimage-image-statistics-min-max-avg"></a>

### Minimum, Maximum and Average Gray-Level Value

* [`EImageStatisticsBW8::GetPixelMax`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#acbd2ea0216d9d0d0164d6711bb64b7ad) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#ac9a4f63b1618241600132dfc03f47364) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a5e67192c60f3ba8c782dd66343a50045) computes the maximum value in an image.
* [`EImageStatisticsBW8::GetPixelMin`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#afc767fe2c0d0456050f55780442eb828) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#ad66161d62d2aa5f643cd99a94193c275) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a58cb580b84b41bd0ca33a45afc0d9017) computes the minimum value in an image.
* [`EImageStatisticsBW8::GetPixelAverage`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#aad93fe63e7fd6096da43e17faaefe188) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#a9d8a0682304650af42717e3f4ae305d1) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#a19ad9b2181a33cc50cd2af32367d30e2) computes the average pixel value. For a color image, it computes the means of the three pixel color components, the variances of the components and the covariances between pairs of components.

#### WARNING
`GetPixelMax` and `GetPixelMin` are the only methods that aren’t implemented for [`EImageC24`](../../../doxygen_cpp/classeVision_1_1EImageC24.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageC24.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageC24.html) images. Therefore, they do not exist in [`EImageStatisticsC24`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsC24.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsC24.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsC24.html).

<a id="easyimage-image-statistics-variance"></a>

### Variance and Standard Deviation

* [`EImageStatisticsBW8::GetPixelVariance`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a0c64fb5781fdd78de468a240aa3eefe9) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#a98726e0dce49ef1df50165f171c786c4) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#ad3f584baa3d861f3cac44d133ffdb16b) computes average and variance of pixel values.
* [`EImageStatisticsBW8::GetPixelStdDev`](../../../doxygen_cpp/classeVision_1_1EImageStatisticsBW8.html#a7a7128da45dbc7c1064bfcedd6c25fcd) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EImageStatisticsBW8.html#ac7565056a7164eaffc8690b93f31f868) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EImageStatisticsBW8.html#af8070e7a9e5e0a5a5454764aa8311054) computes average and standard deviation of pixel values. For a color image, it computes the standard deviations and correlation coefficients (covariance over the product of standard deviations) of the pairs of pixel component values.

<a id="easyimage-image-statistics-pixel-compare"></a>

## Number of Different Pixels by Comparing 2 Images

* [`EasyImage::PixelCompare`](../../../doxygen_cpp/classeVision_1_1EasyImage.html#afa1cba648179ef200919bbc8f9225888) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyImage.html#a70214a64ea3e4b580ad89a28d88eabf8) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyImage.html#a7baa5bbe6d7e65313731048dc7cb7e11) counts the number of different pixels between two images.

<a id="easyimage-image-statistics-supported-types"></a>

## Supported Types

| Method                                                                | Supported Types                                                          |
|-----------------------------------------------------------------------|--------------------------------------------------------------------------|
| Sliding Window (`LocalAverage`, `LocalDeviation`)                     | BW8, BW16                                                                |
| Histogram (`Histogram`)                                               | BW8, BW16, BW32                                                          |
| Histogram Equalization (`Equalize`)                                   | BW8, BW16                                                                |
| Image Focus (`Focusing`)                                              | BW8, BW16, C24                                                           |
| Image Statistics (moments, pixel count, min/max/avg, variance/stddev) | BW8, BW16, C24 (note: `GetPixelMax`/`GetPixelMin` not available for C24) |
| Pixel Compare (`PixelCompare`)                                        | BW8, BW16, C24                                                           |

<a id="easyimage-image-statistics-quick-links"></a>

## See Also

Easy to understand, ready to copy code snippets.

Use computed histograms to select and apply thresholds to an image.
