Functions for estimation of correlation. More...
Functions | |
SIMD_API void | SimdAbsDifferenceSum (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 absolute difference of two gray 8-bit images. More... | |
SIMD_API void | SimdAbsDifferenceSumMasked (const uint8_t *a, size_t aStride, const uint8_t *b, size_t bStride, const uint8_t *mask, size_t maskStride, uint8_t index, size_t width, size_t height, uint64_t *sum) |
Gets sum of absolute difference of two gray 8-bit images based on gray 8-bit mask. More... | |
SIMD_API void | SimdAbsDifferenceSums3x3 (const uint8_t *current, size_t currentStride, const uint8_t *background, size_t backgroundStride, size_t width, size_t height, uint64_t *sums) |
Gets 9 sums of absolute difference of two gray 8-bit images with various relative shifts in neighborhood 3x3. More... | |
SIMD_API void | SimdAbsDifferenceSums3x3Masked (const uint8_t *current, size_t currentStride, const uint8_t *background, size_t backgroundStride, const uint8_t *mask, size_t maskStride, uint8_t index, size_t width, size_t height, uint64_t *sums) |
Gets 9 sums of absolute difference of two gray 8-bit images with various relative shifts in neighborhood 3x3 based on gray 8-bit mask. More... | |
SIMD_API void | SimdCosineDistance32f (const float *a, const float *b, size_t size, float *distance) |
Calculates cosine distance of two 32-bit float arrays. More... | |
SIMD_API void | SimdSquaredDifferenceSum (const uint8_t *a, size_t aStride, const uint8_t *b, size_t bStride, size_t width, size_t height, uint64_t *sum) |
Calculates sum of squared differences for two 8-bit gray images. More... | |
SIMD_API void | SimdSquaredDifferenceSumMasked (const uint8_t *a, size_t aStride, const uint8_t *b, size_t bStride, const uint8_t *mask, size_t maskStride, uint8_t index, size_t width, size_t height, uint64_t *sum) |
Calculates sum of squared differences for two images with using mask. More... | |
SIMD_API void | SimdSquaredDifferenceSum32f (const float *a, const float *b, size_t size, float *sum) |
Calculates sum of squared differences for two 32-bit float arrays. More... | |
SIMD_API void | SimdSquaredDifferenceKahanSum32f (const float *a, const float *b, size_t size, float *sum) |
Calculates sum of squared differences for two 32-bit float arrays with using Kahan summation algorithm. More... | |
template<template< class > class A> | |
SIMD_INLINE void | AbsDifferenceSum (const View< A > &a, const View< A > &b, uint64_t &sum) |
Gets sum of absolute difference of two gray 8-bit images. More... | |
template<template< class > class A> | |
SIMD_INLINE void | AbsDifferenceSum (const View< A > &a, const View< A > &b, const View< A > &mask, uint8_t index, uint64_t &sum) |
Gets sum of absolute difference of two gray 8-bit images based on gray 8-bit mask. More... | |
template<template< class > class A> | |
SIMD_INLINE void | AbsDifferenceSums3x3 (const View< A > ¤t, const View< A > &background, uint64_t *sums) |
Gets 9 sums of absolute difference of two gray 8-bit images with various relative shifts in neighborhood 3x3. More... | |
template<template< class > class A> | |
SIMD_INLINE void | AbsDifferenceSums3x3 (const View< A > ¤t, const View< A > &background, const View< A > &mask, uint8_t index, uint64_t *sums) |
Gets 9 sums of absolute difference of two gray 8-bit images with various relative shifts in neighborhood 3x3 based on gray 8-bit mask. More... | |
template<template< class > class A> | |
SIMD_INLINE void | SquaredDifferenceSum (const View< A > &a, const View< A > &b, uint64_t &sum) |
Calculates sum of squared differences for two 8-bit gray images. More... | |
template<template< class > class A> | |
SIMD_INLINE void | SquaredDifferenceSum (const View< A > &a, const View< A > &b, const View< A > &mask, uint8_t index, uint64_t &sum) |
Calculates sum of squared differences for two images with using mask. More... | |
Detailed Description
Functions for estimation of correlation.
Function Documentation
◆ SimdAbsDifferenceSum()
void SimdAbsDifferenceSum | ( | 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 absolute difference of two gray 8-bit images.
Both images must have the same width and height.
- Note
- This function has a C++ wrapper Simd::AbsDifferenceSum(const View<A> & a, const View<A> & b, uint64_t & sum).
- Parameters
-
[in] a - a pointer to pixels data of first image. [in] aStride - a row size of first image. [in] b - a pointer to pixels data of second image. [in] bStride - a row size of second image. [in] width - an image width. [in] height - an image height. [out] sum - the result sum of absolute difference of two images.
◆ SimdAbsDifferenceSumMasked()
void SimdAbsDifferenceSumMasked | ( | const uint8_t * | a, |
size_t | aStride, | ||
const uint8_t * | b, | ||
size_t | bStride, | ||
const uint8_t * | mask, | ||
size_t | maskStride, | ||
uint8_t | index, | ||
size_t | width, | ||
size_t | height, | ||
uint64_t * | sum | ||
) |
Gets sum of absolute difference of two gray 8-bit images based on gray 8-bit mask.
Gets the absolute difference sum for all points when mask[i] == index. Both images and mask must have the same width and height.
- Note
- This function has a C++ wrapper Simd::AbsDifferenceSum(const View<A>& a, const View<A>& b, const View<A>& mask, uint8_t index, uint64_t & sum).
- Parameters
-
[in] a - a pointer to pixels data of first image. [in] aStride - a row size of first image. [in] b - a pointer to pixels data of second image. [in] bStride - a row size of second image. [in] mask - a pointer to pixels data of mask image. [in] maskStride - a row size of mask image. [in] index - a mask index. [in] width - an image width. [in] height - an image height. [out] sum - the result sum of absolute difference of two images.
◆ SimdAbsDifferenceSums3x3()
void SimdAbsDifferenceSums3x3 | ( | const uint8_t * | current, |
size_t | currentStride, | ||
const uint8_t * | background, | ||
size_t | backgroundStride, | ||
size_t | width, | ||
size_t | height, | ||
uint64_t * | sums | ||
) |
Gets 9 sums of absolute difference of two gray 8-bit images with various relative shifts in neighborhood 3x3.
Both images must have the same width and height. The image height and width must be equal or greater 3. The sums are calculated with central part (indent width = 1) of current image and with part of background image with corresponding shift. The shifts are lain in the range [-1, 1] for axis x and y.
- Note
- This function has a C++ wrapper Simd::AbsDifferenceSums3x3(const View<A>& current, const View<A>& background, uint64_t * sums).
- Parameters
-
[in] current - a pointer to pixels data of current image. [in] currentStride - a row size of the current image. [in] background - a pointer to pixels data of the background image. [in] backgroundStride - a row size of the background image. [in] width - an image width. [in] height - an image height. [out] sums - the pointer to buffer with result sums. Buffer size must be equal or greater 9.
◆ SimdAbsDifferenceSums3x3Masked()
void SimdAbsDifferenceSums3x3Masked | ( | const uint8_t * | current, |
size_t | currentStride, | ||
const uint8_t * | background, | ||
size_t | backgroundStride, | ||
const uint8_t * | mask, | ||
size_t | maskStride, | ||
uint8_t | index, | ||
size_t | width, | ||
size_t | height, | ||
uint64_t * | sums | ||
) |
Gets 9 sums of absolute difference of two gray 8-bit images with various relative shifts in neighborhood 3x3 based on gray 8-bit mask.
Gets the absolute difference sums for all points when mask[i] == index. Both images and mask must have the same width and height. The image height and width must be equal or greater 3. The sums are calculated with central part (indent width = 1) of current image and with part of background image with corresponding shift. The shifts are lain in the range [-1, 1] for axis x and y.
- Note
- This function has a C++ wrapper Simd::AbsDifferenceSums3x3(const View<A>& current, const View<A>& background, const View<A>& mask, uint8_t index, uint64_t * sums).
- Parameters
-
[in] current - a pointer to pixels data of current image. [in] currentStride - a row size of the current image. [in] background - a pointer to pixels data of the background image. [in] backgroundStride - a row size of the background image. [in] mask - a pointer to pixels data of mask image. [in] maskStride - a row size of mask image. [in] index - a mask index. [in] width - an image width. [in] height - an image height. [out] sums - the pointer to buffer with result sums. Buffer size must be equal or greater 9.
◆ SimdCosineDistance32f()
void SimdCosineDistance32f | ( | const float * | a, |
const float * | b, | ||
size_t | size, | ||
float * | distance | ||
) |
Calculates cosine distance of two 32-bit float arrays.
All arrays must have the same size.
Algorithm description:
distance = 1 - Sum(a[i]*b[i])/Sqrt(Sum(a[i]*a[i])*Sum(b[i]*b[i]));
- Parameters
-
[in] a - a pointer to the first 32-bit float array. [in] b - a pointer to the second 32-bit float array. [in] size - a size of arrays. [out] distance - a pointer to 32-bit float with cosine distance.
◆ SimdSquaredDifferenceSum()
void SimdSquaredDifferenceSum | ( | const uint8_t * | a, |
size_t | aStride, | ||
const uint8_t * | b, | ||
size_t | bStride, | ||
size_t | width, | ||
size_t | height, | ||
uint64_t * | sum | ||
) |
Calculates sum of squared differences for two 8-bit gray images.
All images must have the same width and height.
For every point:
sum += (a[i] - b[i])*(a[i] - b[i]);
- Note
- This function has a C++ wrappers: Simd::SquaredDifferenceSum(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 image width. [in] height - an image height. [out] sum - a pointer to unsigned 64-bit integer value with result sum.
◆ SimdSquaredDifferenceSumMasked()
void SimdSquaredDifferenceSumMasked | ( | const uint8_t * | a, |
size_t | aStride, | ||
const uint8_t * | b, | ||
size_t | bStride, | ||
const uint8_t * | mask, | ||
size_t | maskStride, | ||
uint8_t | index, | ||
size_t | width, | ||
size_t | height, | ||
uint64_t * | sum | ||
) |
Calculates sum of squared differences for two images with using mask.
All images must have the same width, height and format (8-bit gray).
For every point:
if(mask[i] == index) sum += (a[i] - b[i])*(a[i] - b[i]);
- Note
- This function has a C++ wrappers: Simd::SquaredDifferenceSum(const View<A>& a, const View<A>& b, const View<A>& mask, uint8_t index, 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] mask - a pointer to pixels data of the mask image. [in] maskStride - a row size of the mask image. [in] index - a mask index. [in] width - an image width. [in] height - an image height. [out] sum - a pointer to unsigned 64-bit integer value with result sum.
◆ SimdSquaredDifferenceSum32f()
void SimdSquaredDifferenceSum32f | ( | const float * | a, |
const float * | b, | ||
size_t | size, | ||
float * | sum | ||
) |
Calculates sum of squared differences for two 32-bit float arrays.
All arrays must have the same size.
For every element:
sum += (a[i] - b[i])*(a[i] - b[i]);
- Parameters
-
[in] a - a pointer to the first array. [in] b - a pointer to the second array. [in] size - a size of arrays. [out] sum - a sum of squared differences.
◆ SimdSquaredDifferenceKahanSum32f()
void SimdSquaredDifferenceKahanSum32f | ( | const float * | a, |
const float * | b, | ||
size_t | size, | ||
float * | sum | ||
) |
Calculates sum of squared differences for two 32-bit float arrays with using Kahan summation algorithm.
All arrays must have the same size.
Algorithm pseudo code:
sum = 0; corr = 0; for(i = 0; i < size; ++i) { diff = (a[i] - b[i])*(a[i] - b[i]) - corr; temp = sum + diff; corr = (temp - sum) - diff; sum = temp; }
- Parameters
-
[in] a - a pointer to the first array. [in] b - a pointer to the second array. [in] size - a size of arrays. [out] sum - a sum of squared differences.
◆ AbsDifferenceSum() [1/2]
Gets sum of absolute difference of two gray 8-bit images.
Both images must have the same width and height.
- Note
- This function is a C++ wrapper for function SimdAbsDifferenceSum.
- Parameters
-
[in] a - a first image. [in] b - a second image. [out] sum - the result sum of absolute difference of two images.
◆ AbsDifferenceSum() [2/2]
void AbsDifferenceSum | ( | const View< A > & | a, |
const View< A > & | b, | ||
const View< A > & | mask, | ||
uint8_t | index, | ||
uint64_t & | sum | ||
) |
Gets sum of absolute difference of two gray 8-bit images based on gray 8-bit mask.
Gets the absolute difference sum for all points when mask[i] == index. Both images and mask must have the same width and height.
- Note
- This function is a C++ wrapper for function SimdAbsDifferenceSumMasked.
- Parameters
-
[in] a - a first image. [in] b - a second image. [in] mask - a mask image. [in] index - a mask index. [out] sum - the result sum of absolute difference of two images.
◆ AbsDifferenceSums3x3() [1/2]
void AbsDifferenceSums3x3 | ( | const View< A > & | current, |
const View< A > & | background, | ||
uint64_t * | sums | ||
) |
Gets 9 sums of absolute difference of two gray 8-bit images with various relative shifts in neighborhood 3x3.
Both images must have the same width and height. The image height and width must be equal or greater 3. The sums are calculated with central part (indent width = 1) of current image and with part of background image with corresponding shift. The shifts are lain in the range [-1, 1] for axis x and y.
- Note
- This function is a C++ wrapper for function SimdAbsDifferenceSums3x3.
- Parameters
-
[in] current - a current image. [in] background - a background image. [out] sums - the pointer to buffer with result sums. Buffer size must be equal or greater 9.
◆ AbsDifferenceSums3x3() [2/2]
void AbsDifferenceSums3x3 | ( | const View< A > & | current, |
const View< A > & | background, | ||
const View< A > & | mask, | ||
uint8_t | index, | ||
uint64_t * | sums | ||
) |
Gets 9 sums of absolute difference of two gray 8-bit images with various relative shifts in neighborhood 3x3 based on gray 8-bit mask.
Gets the absolute difference sums for all points when mask[i] == index. Both images and mask must have the same width and height. The image height and width must be equal or greater 3. The sums are calculated with central part (indent width = 1) of current image and with part of background image with corresponding shift. The shifts are lain in the range [-1, 1] for axis x and y.
- Note
- This function is a C++ wrapper for function SimdAbsDifferenceSums3x3Masked.
- Parameters
-
[in] current - a current image. [in] background - a background image. [in] mask - a mask image. [in] index - a mask index. [out] sums - the pointer to buffer with result sums. Buffer size must be equal or greater 9.
◆ SquaredDifferenceSum() [1/2]
Calculates sum of squared differences for two 8-bit gray images.
All images must have the same width and height.
For every point:
sum += (a[i] - b[i])*(a[i] - b[i]);
- Note
- This function is a C++ wrapper for function SimdSquaredDifferenceSum.
- Parameters
-
[in] a - a first image. [in] b - a second image. [out] sum - a reference to unsigned 64-bit integer value with result sum.
◆ SquaredDifferenceSum() [2/2]
void SquaredDifferenceSum | ( | const View< A > & | a, |
const View< A > & | b, | ||
const View< A > & | mask, | ||
uint8_t | index, | ||
uint64_t & | sum | ||
) |
Calculates sum of squared differences for two images with using mask.
All images must have the same width, height and format (8-bit gray).
For every point:
if(mask[i] == index) sum += (a[i] - b[i])*(a[i] - b[i]);
- Note
- This function is a C++ wrapper for function SimdSquaredDifferenceSumMasked.
- Parameters
-
[in] a - a first image. [in] b - a second image. [in] mask - a mask image. [in] index - a mask index. [out] sum - a reference to unsigned 64-bit integer value with result sum.