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

Detailed Description

Function Documentation

◆ 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]ImgInHandle of input image.
[in]IndexPlane index of image to work on.
[in]leftLeft edge of the area of interest.
[in]topTop edge of the area of interest.
[in]rightRight edge of the area of interest.
[in]bottomBottom edge of the area of interest.
[out]MomentsPointer 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]CalcModeComputation 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]MomentsMoments object that contains intermediate image moments.
[in]XOrderPotential of x defining the moment order.
These arguments must satisfy the condition 0 <= XOrder + YOrder <= 3.
[in]YOrderPotential of y defining the moment order.
These arguments must satisfy the condition 0 <= XOrder + YOrder <= 3.
[in]NormalizedTRUE specifies that the result moment is normalized,
FALSE means that the moment is unnormalized to get the unnormalized moments.
[out]MomentCalculated 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]MomentsMoments object that contains intermediate image moments.
[out]M1Hu moment 1.
[out]M2Hu moment 2.
[out]M3Hu moment 3.
[out]M4Hu moment 4.
[out]M5Hu moment 5.
[out]M6Hu moment 6.
[out]M7Hu 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]MomentsMoments object that contains intermediate image moments.
[in]XOrderPotential of x defining the moment order.
These arguments must satisfy the condition 0 <= XOrder + YOrder <= 3.
[in]YOrderPotential of y defining the moment order.
These arguments must satisfy the condition 0 <= XOrder + YOrder <= 3.
[in]OffsetXX-offset in pixels of the area of interest origin (top left corner) from the image origin.
[in]OffsetYY-offset in pixels of the area of interest origin (top left corner) from the image origin.
[in]NormalizedTRUE specifies that the result moment is normalized,
FALSE means that the moment is unnormalized to get the unnormalized moments.
[out]MomentCalculated 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]ImgInHandle of input image.
[in]IndexPlane index of image to work on.
[in]leftLeft edge of the area of interest. May be -1 to set the left edge of the image.
[in]topTop edge of the area of interest. May be -1 to set the top edge of the image.
[in]rightRight edge of the area of interest. May be -1 to set the right edge of the image.
[in]bottomBottom edge of the area of interest. May be -1 to set the bottom edge of the image.
[in]NormalizeTRUE indicates that the result is normalized in the range 0 to 1, FALSE otherwise.
[out]ValueThe 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]ImgInHandle of input image.
[in]IndexPlane index of image to work on.
[in]leftLeft edge of the area of interest. May be -1 to set the left edge of the image.
[in]topTop edge of the area of interest. May be -1 to set the top edge of the image.
[in]rightRight edge of the area of interest. May be -1 to set the right edge of the image.
[in]bottomBottom edge of the area of interest. May be -1 to set the bottom edge of the image.
[in]NormalizeTRUE indicates that the result is normalized in the range 0 to 1, FALSE otherwise.
[out]ValueThe 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]ImgInHandle of input image.
[in]IndexPlane index of image to work on.
[in]leftLeft edge of the area of interest. May be -1 to set the left edge of the image.
[in]topTop edge of the area of interest. May be -1 to set the top edge of the image.
[in]rightRight edge of the area of interest. May be -1 to set the right edge of the image.
[in]bottomBottom edge of the area of interest. May be -1 to set the bottom edge of the image.
[in]NormalizeTRUE indicates that the result is normalized in the range 0 to 1, FALSE otherwise.
[out]ValueThe 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]MomentsMoments 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 Sigma ab



Sigma a


Sigma b


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]ImgIn1Handle of first input image.
[in]Index1Plane index of first image to work on.
[in]ImgIn2Handle of second input image.
[in]Index2Plane index of second image to work on.
[out]ValueComputed 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