Foundation (CVFoundation.dll) 14.1
Statistics Functions

## Functions

cvbres_t CalculateMoments (IMG ImgIn, long Index, long left, long top, long right, long bottom, IMGMOMENTS Moments)
Calculates intermediate moments of the input image (or a sub-rectangle of it). More...

IMGMOMENTS CreateImageMoments (TMomentsCalculation CalcMode)
Create a moments calculator object. More...

cvbres_t GetCentralImageMoment (IMGMOMENTS Moments, long XOrder, long YOrder, cvbbool_t Normalized, double &Moment)
Retrieves one of the central image moments calculated by CalculateMoments. More...

cvbres_t GetHuImageMoments (IMGMOMENTS Moments, double &M1, double &M2, double &M3, double &M4, double &M5, double &M6, double &M7)
Retrieves the seven Hu moment invariants computed by CalculateMoments. More...

cvbres_t GetSpatialImageMoment (IMGMOMENTS Moments, cvbval_t XOrder, cvbval_t YOrder, cvbdim_t OffsetX, cvbdim_t OffsetY, cvbbool_t Normalized, double &Moment)
Retrieves one of the central image moments calculated by CalculateMoments. More...

cvbres_t ImageNormL1 (IMG ImgIn, cvbdim_t Index, cvbdim_t left, cvbdim_t top, cvbdim_t right, cvbdim_t bottom, cvbbool_t Normalize, double &Value)
Computes the L1-norm of image pixel values. More...

cvbres_t ImageNormL2 (IMG ImgIn, cvbdim_t Index, cvbdim_t left, cvbdim_t top, cvbdim_t right, cvbdim_t bottom, cvbbool_t Normalize, double &Value)
Computes the L2-norm of image pixel values. More...

cvbres_t ImageNormLInf (IMG ImgIn, cvbdim_t Index, cvbdim_t left, cvbdim_t top, cvbdim_t right, cvbdim_t bottom, cvbbool_t Normalize, double &Value)
Computes the infinity norm of image pixel values. More...

BOOL IsImageMoments (IMGMOMENTS Moments)
Checks if a handle points to a moments object. More...

cvbres_t WangImageQuality (IMG ImgIn1, long Index1, IMG ImgIn2, long Index2, double &Value)
Computes the universal image quality index after a method proposed by Z. Wang and A. C. Bovik. More...

## ◆ CalculateMoments()

 cvbres_t CalculateMoments ( IMG ImgIn, long Index, long left, long top, long right, long bottom, IMGMOMENTS Moments )

Calculates intermediate moments of the input image (or a sub-rectangle of it).

Parameters
 [in] ImgIn Handle of input image. [in] Index Plane index of image to work on. [in] left Left edge of the area of interest. [in] top Top edge of the area of interest. [in] right Right edge of the area of interest. [in] bottom Bottom edge of the area of interest. [out] Moments Pointer to the IMGMOMENTS object storing intermediate moment values.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
CreateImageMoments, GetCentralImageMoment, GetSpatialImageMoment, GetHuImageMoments

## ◆ CreateImageMoments()

 IMGMOMENTS CreateImageMoments ( TMomentsCalculation CalcMode )

Create a moments calculator object.

The current computation algorithm is specified by the \ref TMomentsCalculation argument, giving you the opportunity to choose between accuracy and speed.

Attention
Dispose of the moments object once you don't need it any longer by calling ReleaseObject for it.
Parameters
 [in] CalcMode Computation algorithm. See TMomentsCalculation for possible algorithm.
Returns
IMGMOMENTS handle or NULL if creation failed.
Supported platforms:
Win32
Win64
Related Topics:
TMomentsCalculation, IsImageMoments

## ◆ GetCentralImageMoment()

 cvbres_t GetCentralImageMoment ( IMGMOMENTS Moments, long XOrder, long YOrder, cvbbool_t Normalized, double & Moment )

Retrieves one of the central image moments calculated by CalculateMoments.

The moment order is specified by the integer exponents XOrder, YOrder.

Parameters
 [in] Moments Moments object that contains intermediate image moments. [in] XOrder Potential of x defining the moment order. These arguments must satisfy the condition 0 <= XOrder + YOrder <= 3. [in] YOrder Potential of y defining the moment order. These arguments must satisfy the condition 0 <= XOrder + YOrder <= 3. [in] Normalized TRUE specifies that the result moment is normalized, FALSE means that the moment is unnormalized to get the unnormalized moments. [out] Moment Calculated central image moment.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
CalculateMoments

## ◆ GetHuImageMoments()

 cvbres_t GetHuImageMoments ( IMGMOMENTS Moments, double & M1, double & M2, double & M3, double & M4, double & M5, double & M6, double & M7 )

Retrieves the seven Hu moment invariants computed by CalculateMoments.

Parameters
 [in] Moments Moments object that contains intermediate image moments. [out] M1 Hu moment 1. [out] M2 Hu moment 2. [out] M3 Hu moment 3. [out] M4 Hu moment 4. [out] M5 Hu moment 5. [out] M6 Hu moment 6. [out] M7 Hu moment 7.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
CalculateMoments

## ◆ GetSpatialImageMoment()

 cvbres_t GetSpatialImageMoment ( IMGMOMENTS Moments, cvbval_t XOrder, cvbval_t YOrder, cvbdim_t OffsetX, cvbdim_t OffsetY, cvbbool_t Normalized, double & Moment )

Retrieves one of the central image moments calculated by CalculateMoments.

All spatial moment values are relative to the image ROI origin.
You may also obtain spatial moment values relative to different point in the image, using the appropriate OffsetX, OffsetY settings.
The moment order is specified by the integer exponents XOrder, YOrder.

Parameters
 [in] Moments Moments object that contains intermediate image moments. [in] XOrder Potential of x defining the moment order. These arguments must satisfy the condition 0 <= XOrder + YOrder <= 3. [in] YOrder Potential of y defining the moment order. These arguments must satisfy the condition 0 <= XOrder + YOrder <= 3. [in] OffsetX X-offset in pixels of the area of interest origin (top left corner) from the image origin. [in] OffsetY Y-offset in pixels of the area of interest origin (top left corner) from the image origin. [in] Normalized TRUE specifies that the result moment is normalized, FALSE means that the moment is unnormalized to get the unnormalized moments. [out] Moment Calculated central image moment.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
CalculateMoments

## ◆ ImageNormL1()

 cvbres_t ImageNormL1 ( IMG ImgIn, cvbdim_t Index, cvbdim_t left, cvbdim_t top, cvbdim_t right, cvbdim_t bottom, cvbbool_t Normalize, double & Value )

Computes the L1-norm of image pixel values.

The L1- norm is defined as the sum of absolute pixel values in an image:
<img class="ToDisplay" src="L1.gif" align="left"  alt="L1 norm">\n\n

Parameters
 [in] ImgIn Handle of input image. [in] Index Plane index of image to work on. [in] left Left edge of the area of interest. May be -1 to set the left edge of the image. [in] top Top edge of the area of interest. May be -1 to set the top edge of the image. [in] right Right edge of the area of interest. May be -1 to set the right edge of the image. [in] bottom Bottom edge of the area of interest. May be -1 to set the bottom edge of the image. [in] Normalize TRUE indicates that the result is normalized in the range 0 to 1, FALSE otherwise. [out] Value The computed L1 norm of the pixel values.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
ImageNormL2, ImageNormLInf

## ◆ ImageNormL2()

 cvbres_t ImageNormL2 ( IMG ImgIn, cvbdim_t Index, cvbdim_t left, cvbdim_t top, cvbdim_t right, cvbdim_t bottom, cvbbool_t Normalize, double & Value )

Computes the L2-norm of image pixel values.

This norm is defined as the square root of the sum of squared pixel values in an image:
<img class="ToDisplay" src="L2.gif" align="left"  alt="L2 norm">\n\n\n

Parameters
 [in] ImgIn Handle of input image. [in] Index Plane index of image to work on. [in] left Left edge of the area of interest. May be -1 to set the left edge of the image. [in] top Top edge of the area of interest. May be -1 to set the top edge of the image. [in] right Right edge of the area of interest. May be -1 to set the right edge of the image. [in] bottom Bottom edge of the area of interest. May be -1 to set the bottom edge of the image. [in] Normalize TRUE indicates that the result is normalized in the range 0 to 1, FALSE otherwise. [out] Value The computed L2 norm of the pixel values.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
ImageNormL1, ImageNormLInf

## ◆ ImageNormLInf()

 cvbres_t ImageNormLInf ( IMG ImgIn, cvbdim_t Index, cvbdim_t left, cvbdim_t top, cvbdim_t right, cvbdim_t bottom, cvbbool_t Normalize, double & Value )

Computes the infinity norm of image pixel values.

This norm is defined as the largest absolute pixel value in an image:
<img class="ToDisplay" src="LInf.gif" align="left"  alt="LInf norm">\n\n

Parameters
 [in] ImgIn Handle of input image. [in] Index Plane index of image to work on. [in] left Left edge of the area of interest. May be -1 to set the left edge of the image. [in] top Top edge of the area of interest. May be -1 to set the top edge of the image. [in] right Right edge of the area of interest. May be -1 to set the right edge of the image. [in] bottom Bottom edge of the area of interest. May be -1 to set the bottom edge of the image. [in] Normalize TRUE indicates that the result is normalized in the range 0 to 1, FALSE otherwise. [out] Value The computed infinity norm of the pixel values.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
ImageNormL1, ImageNormL2

## ◆ IsImageMoments()

 BOOL IsImageMoments ( IMGMOMENTS Moments )

Checks if a handle points to a moments object.

Parameters
 [in] Moments Moments pointer to an IMGMOMENTS object.
Returns
TRUE indicates that the handle is a valid pointer to an IMGMOMENTS object, FALSE otherwise.
Supported platforms:
Win32
Win64
Related Topics:
IMGMOMENTS

## ◆ WangImageQuality()

 cvbres_t WangImageQuality ( IMG ImgIn1, long Index1, IMG ImgIn2, long Index2, double & Value )

Computes the universal image quality index after a method proposed by Z. Wang and A. C. Bovik.

The method was published in IEEE Signal Processing Letters, vol. 9, no. 3, pp. 81-84, March 2002.
This quality index gives a measure of similarity between an image and a reference image that is based on a product of
<ul>
<li> correlation between those images </li>
<li> similarity of luminance in those images  </li>
<li> similarity of contrast in those images  </li>
</ul>
according to the following formula:
<img class="ToDisplay" src="WangQuality.gif" align="left"  alt="Wang Quality">\n\n\n\n


with

a and b refer to the two images involved (in their indexed appearance they denote an individual pixel, in their version with a horizontal bar they mean the average brightness of the image), N corresponds to the number of pixels in the image.

Parameters
 [in] ImgIn1 Handle of first input image. [in] Index1 Plane index of first image to work on. [in] ImgIn2 Handle of second input image. [in] Index2 Plane index of second image to work on. [out] Value Computed quality index in the range between -1 and 1 (where 1 can only appear if the images are completely identical).
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64