Estimation of various image statistic. More...
Functions | |
| SIMD_API void | SimdLaplaceAbsSum (const uint8_t *src, size_t stride, size_t width, size_t height, uint64_t *sum) |
| Calculates sum of absolute value of Laplace's filter. More... | |
| SIMD_API void | SimdGetStatistic (const uint8_t *src, size_t stride, size_t width, size_t height, uint8_t *min, uint8_t *max, uint8_t *average) |
| Finds minimal, maximal and average pixel values for given image. More... | |
| SIMD_API void | SimdGetMoments (const uint8_t *mask, size_t stride, size_t width, size_t height, uint8_t index, uint64_t *area, uint64_t *x, uint64_t *y, uint64_t *xx, uint64_t *xy, uint64_t *yy) |
| Calculate statistical characteristics (moments) of pixels with given index. More... | |
| SIMD_API void | SimdGetObjectMoments (const uint8_t *src, size_t srcStride, size_t width, size_t height, const uint8_t *mask, size_t maskStride, uint8_t index, uint64_t *n, uint64_t *s, uint64_t *sx, uint64_t *sy, uint64_t *sxx, uint64_t *sxy, uint64_t *syy) |
| Calculate statistical characteristics (moments) of given object. More... | |
| SIMD_API void | SimdValueSum (const uint8_t *src, size_t stride, size_t width, size_t height, uint64_t *sum) |
| Gets sum of value of pixels for gray 8-bit image. More... | |
| SIMD_API void | SimdSquareSum (const uint8_t *src, size_t stride, size_t width, size_t height, uint64_t *sum) |
| Gets sum of squared value of pixels for gray 8-bit image . More... | |
| SIMD_API void | SimdValueSquareSum (const uint8_t *src, size_t stride, size_t width, size_t height, uint64_t *valueSum, uint64_t *squareSum) |
| Gets sum and squared sum of value of pixels for gray 8-bit image. More... | |
| SIMD_API void | SimdValueSquareSums (const uint8_t *src, size_t stride, size_t width, size_t height, size_t channels, uint64_t *valueSums, uint64_t *squareSums) |
| Gets image channels value sums and squared value sums for image. The image must have 8-bit depth per channel. More... | |
| SIMD_API void | SimdCorrelationSum (const uint8_t *a, size_t aStride, const uint8_t *b, size_t bStride, size_t width, size_t height, uint64_t *sum) |
| Gets sum of pixel correlation for two gray 8-bit images. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | LaplaceAbsSum (const View< A > &src, uint64_t &sum) |
| Calculates sum of absolute value of Laplace's filter. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | GetStatistic (const View< A > &src, uint8_t &min, uint8_t &max, uint8_t &average) |
| Finds minimal, maximal and average pixel values for given image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | GetMoments (const View< A > &mask, uint8_t index, uint64_t &area, uint64_t &x, uint64_t &y, uint64_t &xx, uint64_t &xy, uint64_t &yy) |
| Calculate statistical characteristics (moments) of pixels with given index. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | GetObjectMoments (const View< A > &src, const View< A > &mask, uint8_t index, uint64_t &n, uint64_t &s, uint64_t &sx, uint64_t &sy, uint64_t &sxx, uint64_t &sxy, uint64_t &syy) |
| Calculate statistical characteristics (moments) of given object. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | ValueSum (const View< A > &src, uint64_t &sum) |
| Gets sum of value of pixels for gray 8-bit image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | SquareSum (const View< A > &src, uint64_t &sum) |
| Gets sum of squared value of pixels for gray 8-bit image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | ValueSquareSum (const View< A > &src, uint64_t &valueSum, uint64_t &squareSum) |
| Gets sum and sum of squared value of pixels for gray 8-bit image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | ValueSquareSums (const View< A > &src, uint64_t *valueSums, uint64_t *squareSums) |
| Gets image channels value sums and squared value sums for image. The image must have 8-bit depth per channel. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | CorrelationSum (const View< A > &a, const View< A > &b, uint64_t &sum) |
| Gets sum of pixel correlation for two gray 8-bit images. More... | |
Detailed Description
Estimation of various image statistic.
Function Documentation
◆ SimdLaplaceAbsSum()
| void SimdLaplaceAbsSum | ( | const uint8_t * | src, |
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint64_t * | sum | ||
| ) |
Calculates sum of absolute value of Laplace's filter.
Input image must has 8-bit gray format.
For every point:
sum += abs(
- src[x-1, y-1] - src[x, y-1] - src[x+1, y-1]
- src[x-1, y] + 8*src[x, y] - src[x+1, y]
- src[x-1, y+1] - src[x, y+1] - src[x+1, y+1]).
- Note
- This function has a C++ wrappers: Simd::LaplaceAbsSum(const View<A>& src, uint64_t & sum).
- Parameters
-
[in] src - a pointer to pixels data of the input image. [in] stride - a row size of the input image. [in] width - an image width. [in] height - an image height. [out] sum - a pointer to result sum.
◆ SimdGetStatistic()
| void SimdGetStatistic | ( | const uint8_t * | src, |
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint8_t * | min, | ||
| uint8_t * | max, | ||
| uint8_t * | average | ||
| ) |
Finds minimal, maximal and average pixel values for given image.
The image must has 8-bit gray format.
- Note
- This function has a C++ wrappers: Simd::GetStatistic(const View<A>& src, uint8_t & min, uint8_t & max, uint8_t & average).
- Parameters
-
[in] src - a pointer to pixels data of the input image. [in] stride - a row size of the image. [in] width - an image width. [in] height - an image height. [out] min - a pointer to unsigned 8-bit integer value with found minimal pixel value. [out] max - a pointer to unsigned 8-bit integer value with found maximal pixel value. [out] average - a pointer to unsigned 8-bit integer value with found average pixel value.
◆ SimdGetMoments()
| void SimdGetMoments | ( | const uint8_t * | mask, |
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint8_t | index, | ||
| uint64_t * | area, | ||
| uint64_t * | x, | ||
| uint64_t * | y, | ||
| uint64_t * | xx, | ||
| uint64_t * | xy, | ||
| uint64_t * | yy | ||
| ) |
Calculate statistical characteristics (moments) of pixels with given index.
The image must has 8-bit gray format.
For every point:
if(mask[X, Y] == index)
{
area += 1.
x += X.
y += Y.
xx += X*X.
xy += X*Y.
yy += Y*Y.
}
- Note
- This function has a C++ wrappers: Simd::GetMoments(const View<A>& mask, uint8_t index, uint64_t & area, uint64_t & x, uint64_t & y, uint64_t & xx, uint64_t & xy, uint64_t & yy).
- Parameters
-
[in] mask - a pointer to pixels data of the mask image. [in] stride - a row size of the mask image. [in] width - an image width. [in] height - an image height. [in] index - a mask index. [out] area - a pointer to unsigned 64-bit integer value with found area (number of pixels with given index). [out] x - a pointer to unsigned 64-bit integer value with found first-order moment x. [out] y - a pointer to unsigned 64-bit integer value with found first-order moment y. [out] xx - a pointer to unsigned 64-bit integer value with found second-order moment xx. [out] xy - a pointer to unsigned 64-bit integer value with found second-order moment xy. [out] yy - a pointer to unsigned 64-bit integer value with found second-order moment yy.
◆ SimdGetObjectMoments()
| void SimdGetObjectMoments | ( | const uint8_t * | src, |
| size_t | srcStride, | ||
| size_t | width, | ||
| size_t | height, | ||
| const uint8_t * | mask, | ||
| size_t | maskStride, | ||
| uint8_t | index, | ||
| uint64_t * | n, | ||
| uint64_t * | s, | ||
| uint64_t * | sx, | ||
| uint64_t * | sy, | ||
| uint64_t * | sxx, | ||
| uint64_t * | sxy, | ||
| uint64_t * | syy | ||
| ) |
Calculate statistical characteristics (moments) of given object.
The images must has 8-bit gray format and equal size. One of them can be empty.
For every point:
if(mask[X, Y] == index || mask == 0)
{
S = src ? src[X, Y] : 1;
n += 1.
s += S;
sx += S*X.
sy += S*Y.
sxx += S*X*X.
sxy += S*X*Y.
syy += S*Y*Y.
}
- Note
- This function has a C++ wrappers: Simd::GetObjectMoments(const View<A> & src, const View<A> & mask, uint8_t index, uint64_t & n, uint64_t & s, uint64_t & sx, uint64_t & sy, uint64_t & sxx, uint64_t & sxy, uint64_t & syy).
- Parameters
-
[in] src - a pointer to pixels data of the input image. Can be NULL (its behaviour is equal to function SimdGetMoments). [in] srcStride - a row size of the input image. [in] width - an image width. [in] height - an image height. [in] mask - a pointer to pixels data of the mask image. Can be NULL (the moments will be collected over whole image). [in] maskStride - a row size of the mask image. [in] index - a mask index. [out] n - a pointer to unsigned 64-bit integer value with found area of given object. [out] s - a pointer to unsigned 64-bit integer value with sum of image values of given object. [out] sx - a pointer to unsigned 64-bit integer value with found first-order moment x of given object. [out] sy - a pointer to unsigned 64-bit integer value with found first-order moment y of given object. [out] sxx - a pointer to unsigned 64-bit integer value with found second-order moment xx of given object. [out] sxy - a pointer to unsigned 64-bit integer value with found second-order moment xy of given object. [out] syy - a pointer to unsigned 64-bit integer value with found second-order moment yy of given object.
◆ SimdValueSum()
| void SimdValueSum | ( | const uint8_t * | src, |
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint64_t * | sum | ||
| ) |
Gets sum of value of pixels for gray 8-bit image.
- Note
- This function has a C++ wrappers: Simd::ValueSum(const View<A>& src, uint64_t & sum).
- Parameters
-
[in] src - a pointer to pixels data of the image. [in] stride - a row size of the image. [in] width - an image width. [in] height - an image height. [out] sum - the result sum.
◆ SimdSquareSum()
| void SimdSquareSum | ( | const uint8_t * | src, |
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint64_t * | sum | ||
| ) |
Gets sum of squared value of pixels for gray 8-bit image .
- Note
- This function has a C++ wrappers: Simd::SquareSum(const View<A>& src, uint64_t & sum).
- Parameters
-
[in] src - a pointer to pixels data of the image. [in] stride - a row size of the image. [in] width - an image width. [in] height - an image height. [out] sum - the result sum.
◆ SimdValueSquareSum()
| void SimdValueSquareSum | ( | const uint8_t * | src, |
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint64_t * | valueSum, | ||
| uint64_t * | squareSum | ||
| ) |
Gets sum and squared sum of value of pixels for gray 8-bit image.
- Note
- This function has a C++ wrappers: Simd::ValueSquareSum(const View<A>& src, uint64_t & valueSum, uint64_t & squareSum).
- Parameters
-
[in] src - a pointer to pixels data of the image. [in] stride - a row size of the image. [in] width - an image width. [in] height - an image height. [out] valueSum - the result value sum. [out] squareSum - the result square sum.
◆ SimdValueSquareSums()
| void SimdValueSquareSums | ( | const uint8_t * | src, |
| size_t | stride, | ||
| size_t | width, | ||
| size_t | height, | ||
| size_t | channels, | ||
| uint64_t * | valueSums, | ||
| uint64_t * | squareSums | ||
| ) |
Gets image channels value sums and squared value sums for image. The image must have 8-bit depth per channel.
for(c = 0; c < channels; c++)
{
valueSums[c] = 0;
squareSums[c] = 0;
}
for(y = 0; y < height; y++)
for(x = 0; x < width; x++)
for(c = 0; c < channels; c++)
{
value = src[y * stride + x * channels + c];
valueSums[c] += value;
squareSums[c] += value * value;
}
- Note
- This function has a C++ wrappers: Simd::ValueSquareSums(const View<A>& src, uint64_t * valueSums, uint64_t * squareSums).
- Parameters
-
[in] src - a pointer to pixels data of the image. [in] stride - a row size of the image. [in] width - an image width. [in] height - an image height. [in] channels - an image channels count. It my be equal to 1, 2, 3 or 4. [out] valueSums - the pointer to output buffer with value sums. Size of the buffer must be at least channels count. [out] squareSums - the pointer to output buffer with square sums. Size of the buffer must be at least channels count.
◆ SimdCorrelationSum()
| void SimdCorrelationSum | ( | const uint8_t * | a, |
| size_t | aStride, | ||
| const uint8_t * | b, | ||
| size_t | bStride, | ||
| size_t | width, | ||
| size_t | height, | ||
| uint64_t * | sum | ||
| ) |
Gets sum of pixel correlation for two gray 8-bit images.
For all points:
sum += a[i]*b[i];
All images must have the same width and height and 8-bit gray pixel format.
- Note
- This function has a C++ wrappers: Simd::CorrelationSum(const View<A> & a, const View<A> & b, uint64_t & sum).
- Parameters
-
[in] a - a pointer to pixels data of the first image. [in] aStride - a row size of the first image. [in] b - a pointer to pixels data of the second image. [in] bStride - a row size of the second image. [in] width - an images width. [in] height - an images height. [out] sum - a pointer to result sum.
◆ LaplaceAbsSum()
| void LaplaceAbsSum | ( | const View< A > & | src, |
| uint64_t & | sum | ||
| ) |
Calculates sum of absolute value of Laplace's filter.
Input image must has 8-bit gray format.
For every point:
sum += abs(
- src[x-1, y-1] - src[x, y-1] - src[x+1, y-1]
- src[x-1, y] + 8*src[x, y] - src[x+1, y]
- src[x-1, y+1] - src[x, y+1] - src[x+1, y+1]).
- Note
- This function is a C++ wrapper for function SimdLaplaceAbsSum.
- Parameters
-
[in] src - an input image. [out] sum - a result sum.
◆ GetStatistic()
| void GetStatistic | ( | const View< A > & | src, |
| uint8_t & | min, | ||
| uint8_t & | max, | ||
| uint8_t & | average | ||
| ) |
Finds minimal, maximal and average pixel values for given image.
The image must has 8-bit gray format.
- Note
- This function is a C++ wrapper for function SimdGetStatistic.
- Parameters
-
[in] src - an input image. [out] min - a reference to unsigned 8-bit integer value with found minimal pixel value. [out] max - a reference to unsigned 8-bit integer value with found maximal pixel value. [out] average - a reference to unsigned 8-bit integer value with found average pixel value.
◆ GetMoments()
| void GetMoments | ( | const View< A > & | mask, |
| uint8_t | index, | ||
| uint64_t & | area, | ||
| uint64_t & | x, | ||
| uint64_t & | y, | ||
| uint64_t & | xx, | ||
| uint64_t & | xy, | ||
| uint64_t & | yy | ||
| ) |
Calculate statistical characteristics (moments) of pixels with given index.
The image must has 8-bit gray format.
For every point:
if(mask[X, Y] == index)
{
area += 1.
x += X.
y += Y.
xx += X*X.
xy += X*Y.
yy += Y*Y.
}
- Note
- This function is a C++ wrapper for function SimdGetMoments.
- Parameters
-
[in] mask - a mask image. [in] index - a mask index. [out] area - a reference to unsigned 64-bit integer value with found area (number of pixels with given index). [out] x - a reference to unsigned 64-bit integer value with found first-order moment x. [out] y - a reference to unsigned 64-bit integer value with found first-order moment y. [out] xx - a reference to unsigned 64-bit integer value with found second-order moment xx. [out] xy - a reference to unsigned 64-bit integer value with found second-order moment xy. [out] yy - a reference to unsigned 64-bit integer value with found second-order moment yy.
◆ GetObjectMoments()
| void GetObjectMoments | ( | const View< A > & | src, |
| const View< A > & | mask, | ||
| uint8_t | index, | ||
| uint64_t & | n, | ||
| uint64_t & | s, | ||
| uint64_t & | sx, | ||
| uint64_t & | sy, | ||
| uint64_t & | sxx, | ||
| uint64_t & | sxy, | ||
| uint64_t & | syy | ||
| ) |
Calculate statistical characteristics (moments) of given object.
The images must has 8-bit gray format and equal size. One of them can be empty.
For every point:
if(mask[X, Y] == index || mask == 0)
{
S = src ? src[X, Y] : 1;
n += 1.
s += S;
sx += S*X.
sy += S*Y.
sxx += S*X*X.
sxy += S*X*Y.
syy += S*Y*Y.
}
- Note
- This function is a C++ wrapper for function SimdGetObjectMoments.
- Parameters
-
[in] src - an input image. [in] mask - a mask image. Can be empty. [in] index - an object index. [out] n - a reference to unsigned 64-bit integer value with found are of given object. [out] s - a reference to unsigned 64-bit integer value with sum of image values of given object. [out] sx - a reference to unsigned 64-bit integer value with found first-order moment x of given object. [out] sy - a reference to unsigned 64-bit integer value with found first-order moment y of given object. [out] sxx - a reference to unsigned 64-bit integer value with found second-order moment xx of given object. [out] sxy - a reference to unsigned 64-bit integer value with found second-order moment xy of given object. [out] syy - a reference to unsigned 64-bit integer value with found second-order moment yy of given object.
◆ ValueSum()
| void ValueSum | ( | const View< A > & | src, |
| uint64_t & | sum | ||
| ) |
Gets sum of value of pixels for gray 8-bit image.
- Note
- This function is a C++ wrapper for function SimdValueSum.
- Parameters
-
[in] src - an input image. [out] sum - a result sum.
◆ SquareSum()
| void SquareSum | ( | const View< A > & | src, |
| uint64_t & | sum | ||
| ) |
Gets sum of squared value of pixels for gray 8-bit image.
- Note
- This function is a C++ wrapper for function SimdSquareSum.
- Parameters
-
[in] src - an input image. [out] sum - a result sum.
◆ ValueSquareSum()
| void ValueSquareSum | ( | const View< A > & | src, |
| uint64_t & | valueSum, | ||
| uint64_t & | squareSum | ||
| ) |
Gets sum and sum of squared value of pixels for gray 8-bit image.
- Note
- This function is a C++ wrapper for function SimdValueSquareSum.
- Parameters
-
[in] src - an input image. [out] valueSum - a result value sum. [out] squareSum - a result square sum.
◆ ValueSquareSums()
| void ValueSquareSums | ( | const View< A > & | src, |
| uint64_t * | valueSums, | ||
| uint64_t * | squareSums | ||
| ) |
Gets image channels value sums and squared value sums for image. The image must have 8-bit depth per channel.
- Note
- This function is a C++ wrapper for function SimdValueSquareSums.
- Parameters
-
[in] src - an input image. [out] valueSums - the pointer to output buffer with value sums. Size of the buffer must be equal to count of image channels. [out] squareSums - the pointer to output buffer with square sums. Size of the buffer must be equal to count of image channels.
◆ CorrelationSum()
Gets sum of pixel correlation for two gray 8-bit images.
For all points:
sum += a[i]*b[i];
All images must have the same width and height and 8-bit gray pixel format.
- Note
- This function is a C++ wrapper for function SimdCorrelationSum.
- Parameters
-
[in] a - a first image. [in] b - a second image. [out] sum - a result sum.
