Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub
Conditional

Functions for conditional estimation of image statistic. More...

Functions

SIMD_API void SimdConditionalCount8u (const uint8_t *src, size_t stride, size_t width, size_t height, uint8_t value, SimdCompareType compareType, uint32_t *count)
 Calculates number of points satisfying certain condition for 8-bit gray image. More...
 
SIMD_API void SimdConditionalCount16i (const uint8_t *src, size_t stride, size_t width, size_t height, int16_t value, SimdCompareType compareType, uint32_t *count)
 Calculates number of points satisfying certain condition for 16-bit signed integer image. More...
 
SIMD_API void SimdConditionalSum (const uint8_t *src, size_t srcStride, size_t width, size_t height, const uint8_t *mask, size_t maskStride, uint8_t value, SimdCompareType compareType, uint64_t *sum)
 Calculates sum of image points when mask points satisfying certain condition. More...
 
SIMD_API void SimdConditionalSquareSum (const uint8_t *src, size_t srcStride, size_t width, size_t height, const uint8_t *mask, size_t maskStride, uint8_t value, SimdCompareType compareType, uint64_t *sum)
 Calculates sum of squared image points when mask points satisfying certain condition. More...
 
SIMD_API void SimdConditionalSquareGradientSum (const uint8_t *src, size_t srcStride, size_t width, size_t height, const uint8_t *mask, size_t maskStride, uint8_t value, SimdCompareType compareType, uint64_t *sum)
 Calculates sum of squared gradient of image points when mask points satisfying certain condition. More...
 
SIMD_API void SimdConditionalFill (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t threshold, SimdCompareType compareType, uint8_t value, uint8_t *dst, size_t dstStride)
 Fills pixels of 8-bit gray image by given value if corresponding pixels of input 8-bit gray image satisfy certain condition. More...
 
template<template< class > class A>
SIMD_INLINE void ConditionalCount8u (const View< A > &src, uint8_t value, SimdCompareType compareType, uint32_t &count)
 Calculates number of points satisfying certain condition for 8-bit gray image. More...
 
template<template< class > class A>
SIMD_INLINE void ConditionalCount16i (const View< A > &src, int16_t value, SimdCompareType compareType, uint32_t &count)
 Calculates number of points satisfying certain condition for 16-bit signed integer image. More...
 
template<template< class > class A>
SIMD_INLINE void ConditionalSum (const View< A > &src, const View< A > &mask, uint8_t value, SimdCompareType compareType, uint64_t &sum)
 Calculates sum of image points when mask points satisfying certain condition. More...
 
template<template< class > class A>
SIMD_INLINE void ConditionalSquareSum (const View< A > &src, const View< A > &mask, uint8_t value, SimdCompareType compareType, uint64_t &sum)
 Calculates sum of squared image points when mask points satisfying certain condition. More...
 
template<template< class > class A>
SIMD_INLINE void ConditionalSquareGradientSum (const View< A > &src, const View< A > &mask, uint8_t value, SimdCompareType compareType, uint64_t &sum)
 Calculates sum of squared gradient of image points when mask points satisfying certain condition. More...
 
template<template< class > class A>
SIMD_INLINE void ConditionalFill (const View< A > &src, uint8_t threshold, SimdCompareType compareType, uint8_t value, View< A > &dst)
 Fills pixels of 8-bit gray image by given value if corresponding pixels of input 8-bit gray image satisfy certain condition. More...
 

Detailed Description

Functions for conditional estimation of image statistic.

Function Documentation

◆ SimdConditionalCount8u()

void SimdConditionalCount8u ( const uint8_t *  src,
size_t  stride,
size_t  width,
size_t  height,
uint8_t  value,
SimdCompareType  compareType,
uint32_t *  count 
)

Calculates number of points satisfying certain condition for 8-bit gray image.

For every point:

if(compare(src[i], value))
    count++;

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function has a C++ wrapper Simd::ConditionalCount8u(const View<A> & src, uint8_t value, SimdCompareType compareType, uint32_t & count).
Parameters
[in]src- a pointer to pixels data of input 8-bit gray image (first value for compare operation).
[in]stride- a row size of the src image.
[in]width- an image width.
[in]height- an image height.
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]count- a pointer to result unsigned 32-bit value.

◆ SimdConditionalCount16i()

void SimdConditionalCount16i ( const uint8_t *  src,
size_t  stride,
size_t  width,
size_t  height,
int16_t  value,
SimdCompareType  compareType,
uint32_t *  count 
)

Calculates number of points satisfying certain condition for 16-bit signed integer image.

For every point:

if(compare(src[i], value))
    count++;

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function has a C++ wrapper Simd::ConditionalCount16i(const View<A> & src, int16_t value, SimdCompareType compareType, uint32_t & count).
Parameters
[in]src- a pointer to pixels data of input 16-bit signed integer image (first value for compare operation).
[in]stride- a row size of the src image.
[in]width- an image width.
[in]height- an image height.
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]count- a pointer to result unsigned 32-bit value.

◆ SimdConditionalSum()

void SimdConditionalSum ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
const uint8_t *  mask,
size_t  maskStride,
uint8_t  value,
SimdCompareType  compareType,
uint64_t *  sum 
)

Calculates sum of image points when mask points satisfying certain condition.

All images must have 8-bit gray format and must have the same width and height.

For every point:

if(compare(mask[i], value))
    sum += src[i];

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function has a C++ wrapper Simd::ConditionalSum(const View<A> & src, const View<A> & mask, uint8_t value, SimdCompareType compareType, uint64_t & sum).
Parameters
[in]src- a pointer to pixels data of input 8-bit gray image.
[in]srcStride- a row size of the src image.
[in]width- an image width.
[in]height- an image height.
[in]mask- a pointer to pixels data of 8-bit gray mask (first value for compare operation).
[in]maskStride- a row size of the mask image.
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]sum- a pointer to result unsigned 64-bit value.

◆ SimdConditionalSquareSum()

void SimdConditionalSquareSum ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
const uint8_t *  mask,
size_t  maskStride,
uint8_t  value,
SimdCompareType  compareType,
uint64_t *  sum 
)

Calculates sum of squared image points when mask points satisfying certain condition.

All images must have 8-bit gray format and must have the same width and height.

For every point:

if(compare(mask[i], value))
    sum += src[i]*src[i];

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function has a C++ wrapper Simd::ConditionalSquareSum(const View<A> & src, const View<A> & mask, uint8_t value, SimdCompareType compareType, uint64_t & sum).
Parameters
[in]src- a pointer to pixels data of input 8-bit gray image.
[in]srcStride- a row size of the src image.
[in]width- an image width.
[in]height- an image height.
[in]mask- a pointer to pixels data of 8-bit gray mask (first value for compare operation).
[in]maskStride- a row size of the mask image.
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]sum- a pointer to result unsigned 64-bit value.

◆ SimdConditionalSquareGradientSum()

void SimdConditionalSquareGradientSum ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
const uint8_t *  mask,
size_t  maskStride,
uint8_t  value,
SimdCompareType  compareType,
uint64_t *  sum 
)

Calculates sum of squared gradient of image points when mask points satisfying certain condition.

All images must have 8-bit gray format and must have the same width and height. The image height and width must be equal or greater 3.

For every point except border:

if(compare(mask[x, y], value))
{
    dx = src[x + 1, y] - src[x - 1, y];
    dy = src[x, y + 1] - src[x, y - 1];
    sum += dx*dx + dy*dy;
}

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function has a C++ wrapper Simd::ConditionalSquareGradientSum(const View<A> & src, const View<A> & mask, uint8_t value, SimdCompareType compareType, uint64_t & sum).
Parameters
[in]src- a pointer to pixels data of input 8-bit gray image.
[in]srcStride- a row size of the src image.
[in]width- an image width.
[in]height- an image height.
[in]mask- a pointer to pixels data of 8-bit gray mask (first value for compare operation).
[in]maskStride- a row size of the mask image.
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]sum- a pointer to result unsigned 64-bit value.

◆ SimdConditionalFill()

void SimdConditionalFill ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
uint8_t  threshold,
SimdCompareType  compareType,
uint8_t  value,
uint8_t *  dst,
size_t  dstStride 
)

Fills pixels of 8-bit gray image by given value if corresponding pixels of input 8-bit gray image satisfy certain condition.

All images must have the same width and height.

For every point:

if(compare(src[i], threshold))
    dst[i] = value;

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function has a C++ wrapper Simd::ConditionalFill(const View<A> & src, uint8_t threshold, SimdCompareType compareType, uint8_t value, View<A> & dst).
Parameters
[in]src- a pointer to pixels data of input 8-bit gray image.
[in]srcStride- a row size of input image.
[in]width- an image width.
[in]height- an image height.
[in]threshold- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[in]value- a value for fill operation.
[in,out]dst- a pointer to pixels data of the output 8-bit gray image.
[in]dstStride- a row size of output image.

◆ ConditionalCount8u()

void ConditionalCount8u ( const View< A > &  src,
uint8_t  value,
SimdCompareType  compareType,
uint32_t &  count 
)

Calculates number of points satisfying certain condition for 8-bit gray image.

For every point:

if(compare(src[i], value))
    count++;

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function is a C++ wrapper for function SimdConditionalCount8u.
Parameters
[in]src- an input 8-bit gray image (first value for compare operation).
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]count- a pointer to result unsigned 32-bit value.

◆ ConditionalCount16i()

void ConditionalCount16i ( const View< A > &  src,
int16_t  value,
SimdCompareType  compareType,
uint32_t &  count 
)

Calculates number of points satisfying certain condition for 16-bit signed integer image.

For every point:

if(compare(src[i], value))
    count++;

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function is a C++ wrapper for function SimdConditionalCount16i.
Parameters
[in]src- an input 16-bit signed integer image (first value for compare operation).
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]count- a pointer to result unsigned 32-bit value.

◆ ConditionalSum()

void ConditionalSum ( const View< A > &  src,
const View< A > &  mask,
uint8_t  value,
SimdCompareType  compareType,
uint64_t &  sum 
)

Calculates sum of image points when mask points satisfying certain condition.

All images must have 8-bit gray format and must have the same width and height.

For every point:

if(compare(mask[i], value))
    sum += src[i];

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function is a C++ wrapper for function SimdConditionalSum.
Parameters
[in]src- an input 8-bit gray image.
[in]mask- a 8-bit gray mask (first value for compare operation).
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]sum- a pointer to result unsigned 64-bit value.

◆ ConditionalSquareSum()

void ConditionalSquareSum ( const View< A > &  src,
const View< A > &  mask,
uint8_t  value,
SimdCompareType  compareType,
uint64_t &  sum 
)

Calculates sum of squared image points when mask points satisfying certain condition.

All images must have 8-bit gray format and must have the same width and height.

For every point:

if(compare(mask[i], value))
    sum += src[i]*src[i];

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function is a C++ wrapper for function SimdConditionalSquareSum.
Parameters
[in]src- an input 8-bit gray image.
[in]mask- a 8-bit gray mask (first value for compare operation).
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]sum- a pointer to result unsigned 64-bit value.

◆ ConditionalSquareGradientSum()

void ConditionalSquareGradientSum ( const View< A > &  src,
const View< A > &  mask,
uint8_t  value,
SimdCompareType  compareType,
uint64_t &  sum 
)

Calculates sum of squared gradient of image points when mask points satisfying certain condition.

All images must have 8-bit gray format and must have the same width and height. The image height and width must be equal or greater 3.

For every point except border:

if(compare(mask[x, y], value))
{
    dx = src[x + 1, y] - src[x - 1, y];
    dy = src[x, y + 1] - src[x, y - 1];
    sum += dx*dx + dy*dy;
}

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function is a C++ wrapper for function SimdConditionalSquareGradientSum.
Parameters
[in]src- an input 8-bit gray image.
[in]mask- a 8-bit gray mask (first value for compare operation).
[in]value- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[out]sum- a pointer to result unsigned 64-bit value.

◆ ConditionalFill()

void ConditionalFill ( const View< A > &  src,
uint8_t  threshold,
SimdCompareType  compareType,
uint8_t  value,
View< A > &  dst 
)

Fills pixels of 8-bit gray image by given value if corresponding pixels of input 8-bit gray image satisfy certain condition.

All images must have the same width and height.

For every point:

if(compare(src[i], threshold))
    dst[i] = value;

where compare(a, b) depends from compareType (see SimdCompareType).

Note
This function is a C++ wrapper for function SimdConditionalFill
Parameters
[in]src- an input 8-bit gray image.
[in]threshold- a second value for compare operation.
[in]compareType- a compare operation type (see SimdCompareType).
[in]value- a value for fill operation.
[in,out]dst- an output 8-bit gray image.