Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub | SourceForge
Background Updating

Functions for background updating. More...

Functions

SIMD_API void SimdBackgroundGrowRangeSlow (const uint8_t *value, size_t valueStride, size_t width, size_t height, uint8_t *lo, size_t loStride, uint8_t *hi, size_t hiStride)
 Performs background update (initial grow, slow mode). More...
 
SIMD_API void SimdBackgroundGrowRangeFast (const uint8_t *value, size_t valueStride, size_t width, size_t height, uint8_t *lo, size_t loStride, uint8_t *hi, size_t hiStride)
 Performs background update (initial grow, fast mode). More...
 
SIMD_API void SimdBackgroundIncrementCount (const uint8_t *value, size_t valueStride, size_t width, size_t height, const uint8_t *loValue, size_t loValueStride, const uint8_t *hiValue, size_t hiValueStride, uint8_t *loCount, size_t loCountStride, uint8_t *hiCount, size_t hiCountStride)
 Performs collection of background statistic. More...
 
SIMD_API void SimdBackgroundAdjustRange (uint8_t *loCount, size_t loCountStride, size_t width, size_t height, uint8_t *loValue, size_t loValueStride, uint8_t *hiCount, size_t hiCountStride, uint8_t *hiValue, size_t hiValueStride, uint8_t threshold)
 Performs adjustment of background range. More...
 
SIMD_API void SimdBackgroundAdjustRangeMasked (uint8_t *loCount, size_t loCountStride, size_t width, size_t height, uint8_t *loValue, size_t loValueStride, uint8_t *hiCount, size_t hiCountStride, uint8_t *hiValue, size_t hiValueStride, uint8_t threshold, const uint8_t *mask, size_t maskStride)
 Performs adjustment of background range with using adjust range mask. More...
 
SIMD_API void SimdBackgroundShiftRange (const uint8_t *value, size_t valueStride, size_t width, size_t height, uint8_t *lo, size_t loStride, uint8_t *hi, size_t hiStride)
 Shifts background range. More...
 
SIMD_API void SimdBackgroundShiftRangeMasked (const uint8_t *value, size_t valueStride, size_t width, size_t height, uint8_t *lo, size_t loStride, uint8_t *hi, size_t hiStride, const uint8_t *mask, size_t maskStride)
 Shifts background range with using shift range mask. More...
 
SIMD_API void SimdBackgroundInitMask (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t index, uint8_t value, uint8_t *dst, size_t dstStride)
 Creates background update mask. More...
 
template<template< class > class A>
SIMD_INLINE void BackgroundGrowRangeSlow (const View< A > &value, View< A > &lo, View< A > &hi)
 Performs background update (initial grow, slow mode). More...
 
template<template< class > class A>
SIMD_INLINE void BackgroundGrowRangeFast (const View< A > &value, View< A > &lo, View< A > &hi)
 Performs background update (initial grow, fast mode). More...
 
template<template< class > class A>
SIMD_INLINE void BackgroundIncrementCount (const View< A > &value, const View< A > &loValue, const View< A > &hiValue, View< A > &loCount, View< A > &hiCount)
 Performs collection of background statistic. More...
 
template<template< class > class A>
SIMD_INLINE void BackgroundAdjustRange (View< A > &loCount, View< A > &loValue, View< A > &hiCount, View< A > &hiValue, uint8_t threshold)
 Performs adjustment of background range. More...
 
template<template< class > class A>
SIMD_INLINE void BackgroundAdjustRange (View< A > &loCount, View< A > &loValue, View< A > &hiCount, View< A > &hiValue, uint8_t threshold, const View< A > &mask)
 Performs adjustment of background range with using adjust range mask. More...
 
template<template< class > class A>
SIMD_INLINE void BackgroundShiftRange (const View< A > &value, View< A > &lo, View< A > &hi)
 Shifts background range. More...
 
template<template< class > class A>
SIMD_INLINE void BackgroundShiftRange (const View< A > &value, View< A > &lo, View< A > &hi, const View< A > &mask)
 Shifts background range with using shift range mask. More...
 
template<template< class > class A>
SIMD_INLINE void BackgroundInitMask (const View< A > &src, uint8_t index, uint8_t value, View< A > &dst)
 Creates background update mask. More...
 

Detailed Description

Functions for background updating.

Function Documentation

◆ SimdBackgroundGrowRangeSlow()

void SimdBackgroundGrowRangeSlow ( const uint8_t *  value,
size_t  valueStride,
size_t  width,
size_t  height,
uint8_t *  lo,
size_t  loStride,
uint8_t *  hi,
size_t  hiStride 
)

Performs background update (initial grow, slow mode).

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

For every point:

lo[i] -= value[i] < lo[i] ? 1 : 0;
hi[i] += value[i] > hi[i] ? 1 : 0;

This function is used for background updating in motion detection algorithm.

Note
This function has a C++ wrapper Simd::BackgroundGrowRangeSlow(const View<A>& value, View<A>& lo, View<A>& hi).
Parameters
[in]value- a pointer to pixels data of current feature value.
[in]valueStride- a row size of the value image.
[in]width- an image width.
[in]height- an image height.
[in,out]lo- a pointer to pixels data of feature lower bound of dynamic background.
[in]loStride- a row size of the lo image.
[in,out]hi- a pointer to pixels data of feature upper bound of dynamic background.
[in]hiStride- a row size of the hi image.

◆ SimdBackgroundGrowRangeFast()

void SimdBackgroundGrowRangeFast ( const uint8_t *  value,
size_t  valueStride,
size_t  width,
size_t  height,
uint8_t *  lo,
size_t  loStride,
uint8_t *  hi,
size_t  hiStride 
)

Performs background update (initial grow, fast mode).

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

For every point:

lo[i] = value[i] < lo[i] ? value[i] : lo[i];
hi[i] = value[i] > hi[i] ? value[i] : hi[i];

This function is used for background updating in motion detection algorithm.

Note
This function has a C++ wrapper Simd::BackgroundGrowRangeFast(const View<A>& value, View<A>& lo, View<A>& hi).
Parameters
[in]value- a pointer to pixels data of current feature value.
[in]valueStride- a row size of the value image.
[in]width- an image width.
[in]height- an image height.
[in,out]lo- a pointer to pixels data of feature lower bound of dynamic background.
[in]loStride- a row size of the lo image.
[in,out]hi- a pointer to pixels data of feature upper bound of dynamic background.
[in]hiStride- a row size of the hi image.

◆ SimdBackgroundIncrementCount()

void SimdBackgroundIncrementCount ( const uint8_t *  value,
size_t  valueStride,
size_t  width,
size_t  height,
const uint8_t *  loValue,
size_t  loValueStride,
const uint8_t *  hiValue,
size_t  hiValueStride,
uint8_t *  loCount,
size_t  loCountStride,
uint8_t *  hiCount,
size_t  hiCountStride 
)

Performs collection of background statistic.

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

Updates background statistic counters for every point:

loCount[i] += (value[i] < loValue[i] && loCount[i] < 255) ? 1 : 0;
hiCount[i] += (value[i] > hiValue[i] && hiCount[i] < 255) ? 1 : 0;

This function is used for background updating in motion detection algorithm.

Note
This function has a C++ wrapper Simd::BackgroundIncrementCount(const View<A>& value, const View<A>& loValue, const View<A>& hiValue, View<A>& loCount, View<A>& hiCount).
Parameters
[in]value- a pointer to pixels data of current feature value.
[in]valueStride- a row size of the value image.
[in]width- an image width.
[in]height- an image height.
[in]loValue- a pointer to pixels data of value of feature lower bound of dynamic background.
[in]loValueStride- a row size of the loValue image.
[in]hiValue- a pointer to pixels data of value of feature upper bound of dynamic background.
[in]hiValueStride- a row size of the hiValue image.
[in,out]loCount- a pointer to pixels data of count of feature lower bound of dynamic background.
[in]loCountStride- a row size of the loCount image.
[in,out]hiCount- a pointer to pixels data of count of feature upper bound of dynamic background.
[in]hiCountStride- a row size of the hiCount image.

◆ SimdBackgroundAdjustRange()

void SimdBackgroundAdjustRange ( uint8_t *  loCount,
size_t  loCountStride,
size_t  width,
size_t  height,
uint8_t *  loValue,
size_t  loValueStride,
uint8_t *  hiCount,
size_t  hiCountStride,
uint8_t *  hiValue,
size_t  hiValueStride,
uint8_t  threshold 
)

Performs adjustment of background range.

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

Adjusts background range for every point:

loValue[i] -= (loCount[i] > threshold && loValue[i] > 0) ? 1 : 0;
loValue[i] += (loCount[i] < threshold && loValue[i] < 255) ? 1 : 0;
loCount[i] = 0;
hiValue[i] += (hiCount[i] > threshold && hiValue[i] < 255) ? 1 : 0;
hiValue[i] -= (hiCount[i] < threshold && hiValue[i] > 0) ? 1 : 0;
hiCount[i] = 0;

This function is used for background updating in motion detection algorithm.

Note
This function has a C++ wrapper Simd::BackgroundAdjustRange(View<A>& loCount, View<A>& loValue, View<A>& hiCount, View<A>& hiValue, uint8_t threshold).
Parameters
[in,out]loCount- a pointer to pixels data of count of feature lower bound of dynamic background.
[in]loCountStride- a row size of the loCount image.
[in]width- an image width.
[in]height- an image height.
[in,out]hiCount- a pointer to pixels data of count of feature upper bound of dynamic background.
[in]hiCountStride- a row size of the hiCount image.
[in,out]loValue- a pointer to pixels data of value of feature lower bound of dynamic background.
[in]loValueStride- a row size of the loValue image.
[in,out]hiValue- a pointer to pixels data of value of feature upper bound of dynamic background.
[in]hiValueStride- a row size of the hiValue image.
[in]threshold- a count threshold.

◆ SimdBackgroundAdjustRangeMasked()

void SimdBackgroundAdjustRangeMasked ( uint8_t *  loCount,
size_t  loCountStride,
size_t  width,
size_t  height,
uint8_t *  loValue,
size_t  loValueStride,
uint8_t *  hiCount,
size_t  hiCountStride,
uint8_t *  hiValue,
size_t  hiValueStride,
uint8_t  threshold,
const uint8_t *  mask,
size_t  maskStride 
)

Performs adjustment of background range with using adjust range mask.

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

Adjusts background range for every point:

if(mask[i])
{
    loValue[i] -= (loCount[i] > threshold && loValue[i] > 0) ? 1 : 0;
    loValue[i] += (loCount[i] < threshold && loValue[i] < 255) ? 1 : 0;
    loCount[i] = 0;
    hiValue[i] += (hiCount[i] > threshold && hiValue[i] < 255) ? 1 : 0;
    hiValue[i] -= (hiCount[i] < threshold && hiValue[i] > 0) ? 1 : 0;
    hiCount[i] = 0;
}

This function is used for background updating in motion detection algorithm.

Note
This function has a C++ wrapper Simd::BackgroundAdjustRange(View<A>& loCount, View<A>& loValue, View<A>& hiCount, View<A>& hiValue, uint8_t threshold, const View<A>& mask).
Parameters
[in,out]loCount- a pointer to pixels data of count of feature lower bound of dynamic background.
[in]loCountStride- a row size of the loCount image.
[in]width- an image width.
[in]height- an image height.
[in,out]hiCount- a pointer to pixels data of count of feature upper bound of dynamic background.
[in]hiCountStride- a row size of the hiCount image.
[in,out]loValue- a pointer to pixels data of value of feature lower bound of dynamic background.
[in]loValueStride- a row size of the loValue image.
[in,out]hiValue- a pointer to pixels data of value of feature upper bound of dynamic background.
[in]hiValueStride- a row size of the hiValue image.
[in]threshold- a count threshold.
[in]mask- a pointer to pixels data of adjust range mask.
[in]maskStride- a row size of the mask image.

◆ SimdBackgroundShiftRange()

void SimdBackgroundShiftRange ( const uint8_t *  value,
size_t  valueStride,
size_t  width,
size_t  height,
uint8_t *  lo,
size_t  loStride,
uint8_t *  hi,
size_t  hiStride 
)

Shifts background range.

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

For every point:

if (value[i] > hi[i])
{
    lo[i] = min(lo[i] + value[i] - hi[i], 255);
    hi[i] = value[i];
}
if (lo[i] > value[i])
{
    lo[i] = value[i];
    hi[i] = max(hi[i] - lo[i] + value[i], 0);
}

This function is used for fast background updating in motion detection algorithm.

Note
This function has a C++ wrapper Simd::BackgroundShiftRange(const View<A>& value, View<A>& lo, View<A>& hi).
Parameters
[in]value- a pointer to pixels data of current feature value.
[in]valueStride- a row size of the value image.
[in]width- an image width.
[in]height- an image height.
[in,out]lo- a pointer to pixels data of feature lower bound of dynamic background.
[in]loStride- a row size of the lo image.
[in,out]hi- a pointer to pixels data of feature upper bound of dynamic background.
[in]hiStride- a row size of the hi image.

◆ SimdBackgroundShiftRangeMasked()

void SimdBackgroundShiftRangeMasked ( const uint8_t *  value,
size_t  valueStride,
size_t  width,
size_t  height,
uint8_t *  lo,
size_t  loStride,
uint8_t *  hi,
size_t  hiStride,
const uint8_t *  mask,
size_t  maskStride 
)

Shifts background range with using shift range mask.

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

For every point:

if(mask[i])
{
    if (value[i] > hi[i])
    {
        lo[i] = min(lo[i] + value[i] - hi[i], 255);
        hi[i] = value[i];
    }
    if (lo[i] > value[i])
    {
        lo[i] = value[i];
        hi[i] = max(hi[i] - lo[i] + value[i], 0);
    }
}

This function is used for fast background updating in motion detection algorithm.

Note
This function has a C++ wrapper Simd::BackgroundShiftRange(const View<A>& value, View<A>& lo, View<A>& hi, const View<A>& mask).
Parameters
[in]value- a pointer to pixels data of current feature value.
[in]valueStride- a row size of the value image.
[in]width- an image width.
[in]height- an image height.
[in,out]lo- a pointer to pixels data of feature lower bound of dynamic background.
[in]loStride- a row size of the lo image.
[in,out]hi- a pointer to pixels data of feature upper bound of dynamic background.
[in]hiStride- a row size of the hi image.
[in]mask- a pointer to pixels data of shift range mask.
[in]maskStride- a row size of the mask image.

◆ SimdBackgroundInitMask()

void SimdBackgroundInitMask ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
uint8_t  index,
uint8_t  value,
uint8_t *  dst,
size_t  dstStride 
)

Creates background update mask.

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

For every point:

if(mask[i] == index)
    dst[i] = value;

This function is used for background updating in motion detection algorithm.

Note
This function has a C++ wrapper Simd::BackgroundInitMask(const View<A>& src, uint8_t index, uint8_t value, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of input mask image.
[in]srcStride- a row size of input mask image.
[in]width- an image width.
[in]height- an image height.
[in]index- a mask index into input mask.
[in]value- a value to fill the output mask.
[out]dst- a pointer to pixels data of output mask image.
[in]dstStride- a row size of output mask image.

◆ BackgroundGrowRangeSlow()

void BackgroundGrowRangeSlow ( const View< A > &  value,
View< A > &  lo,
View< A > &  hi 
)

Performs background update (initial grow, slow mode).

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

For every point:

lo[i] -= value[i] < lo[i] ? 1 : 0;
hi[i] += value[i] > hi[i] ? 1 : 0;

This function is used for background updating in motion detection algorithm.

Note
This function is a C++ wrapper for function SimdBackgroundGrowRangeSlow.
Parameters
[in]value- a current feature value.
[in,out]lo- a feature lower bound of dynamic background.
[in,out]hi- a feature upper bound of dynamic background.

◆ BackgroundGrowRangeFast()

void BackgroundGrowRangeFast ( const View< A > &  value,
View< A > &  lo,
View< A > &  hi 
)

Performs background update (initial grow, fast mode).

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

For every point:

lo[i] = value[i] < lo[i] ? value[i] : lo[i];
hi[i] = value[i] > hi[i] ? value[i] : hi[i];

This function is used for background updating in motion detection algorithm.

Note
This function is a C++ wrapper for function SimdBackgroundGrowRangeFast.
Parameters
[in]value- a current feature value.
[in,out]lo- a feature lower bound of dynamic background.
[in,out]hi- a feature upper bound of dynamic background.

◆ BackgroundIncrementCount()

void BackgroundIncrementCount ( const View< A > &  value,
const View< A > &  loValue,
const View< A > &  hiValue,
View< A > &  loCount,
View< A > &  hiCount 
)

Performs collection of background statistic.

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

Updates background statistic counters for every point:

loCount[i] += (value[i] < loValue[i] && loCount[i] < 255) ? 1 : 0;
hiCount[i] += (value[i] > hiValue[i] && hiCount[i] < 255) ? 1 : 0;

This function is used for background updating in motion detection algorithm.

Note
This function is a C++ wrapper for function SimdBackgroundIncrementCount.
Parameters
[in]value- a current feature value.
[in]loValue- a value of feature lower bound of dynamic background.
[in]hiValue- a value of feature upper bound of dynamic background.
[in,out]loCount- a count of feature lower bound of dynamic background.
[in,out]hiCount- a count of feature upper bound of dynamic background.

◆ BackgroundAdjustRange() [1/2]

void BackgroundAdjustRange ( View< A > &  loCount,
View< A > &  loValue,
View< A > &  hiCount,
View< A > &  hiValue,
uint8_t  threshold 
)

Performs adjustment of background range.

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

Adjusts background range for every point:

loValue[i] -= (loCount[i] > threshold && loValue[i] > 0) ? 1 : 0;
loValue[i] += (loCount[i] < threshold && loValue[i] < 255) ? 1 : 0;
loCount[i] = 0;
hiValue[i] += (hiCount[i] > threshold && hiValue[i] < 255) ? 1 : 0;
hiValue[i] -= (hiCount[i] < threshold && hiValue[i] > 0) ? 1 : 0;
hiCount[i] = 0;

This function is used for background updating in motion detection algorithm.

Note
This function is a C++ wrapper for function SimdBackgroundAdjustRange.
Parameters
[in,out]loCount- a count of feature lower bound of dynamic background.
[in,out]hiCount- a count of feature upper bound of dynamic background.
[in,out]loValue- a value of feature lower bound of dynamic background.
[in,out]hiValue- a value of feature upper bound of dynamic background.
[in]threshold- a count threshold.

◆ BackgroundAdjustRange() [2/2]

void BackgroundAdjustRange ( View< A > &  loCount,
View< A > &  loValue,
View< A > &  hiCount,
View< A > &  hiValue,
uint8_t  threshold,
const View< A > &  mask 
)

Performs adjustment of background range with using adjust range mask.

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

Adjusts background range for every point:

if(mask[i])
{
    loValue[i] -= (loCount[i] > threshold && loValue[i] > 0) ? 1 : 0;
    loValue[i] += (loCount[i] < threshold && loValue[i] < 255) ? 1 : 0;
    loCount[i] = 0;
    hiValue[i] += (hiCount[i] > threshold && hiValue[i] < 255) ? 1 : 0;
    hiValue[i] -= (hiCount[i] < threshold && hiValue[i] > 0) ? 1 : 0;
    hiCount[i] = 0;
}

This function is used for background updating in motion detection algorithm.

Note
This function is a C++ wrapper for function SimdBackgroundAdjustRangeMasked.
Parameters
[in,out]loCount- a count of feature lower bound of dynamic background.
[in,out]hiCount- a count of feature upper bound of dynamic background.
[in,out]loValue- a value of feature lower bound of dynamic background.
[in,out]hiValue- a value of feature upper bound of dynamic background.
[in]threshold- a count threshold.
[in]mask- an adjust range mask.

◆ BackgroundShiftRange() [1/2]

void BackgroundShiftRange ( const View< A > &  value,
View< A > &  lo,
View< A > &  hi 
)

Shifts background range.

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

For every point:

if (value[i] > hi[i])
{
    lo[i] = min(lo[i] + value[i] - hi[i], 255);
    hi[i] = value[i];
}
if (lo[i] > value[i])
{
    lo[i] = value[i];
    hi[i] = max(hi[i] - lo[i] + value[i], 0);
}

This function is used for fast background updating in motion detection algorithm.

Note
This function is a C++ wrapper for function SimdBackgroundShiftRange.
Parameters
[in]value- a current feature value.
[in,out]lo- a feature lower bound of dynamic background.
[in,out]hi- a feature upper bound of dynamic background.

◆ BackgroundShiftRange() [2/2]

void BackgroundShiftRange ( const View< A > &  value,
View< A > &  lo,
View< A > &  hi,
const View< A > &  mask 
)

Shifts background range with using shift range mask.

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

For every point:

if(mask[i])
{
    if (value[i] > hi[i])
    {
        lo[i] = min(lo[i] + value[i] - hi[i], 255);
        hi[i] = value[i];
    }
    if (lo[i] > value[i])
    {
        lo[i] = value[i];
        hi[i] = max(hi[i] - lo[i] + value[i], 0);
    }
}

This function is used for fast background updating in motion detection algorithm.

Note
This function is a C++ wrapper for function SimdBackgroundShiftRangeMasked.
Parameters
[in]value- a current feature value.
[in,out]lo- a feature lower bound of dynamic background.
[in,out]hi- a feature upper bound of dynamic background.
[in]mask- a shift range mask.

◆ BackgroundInitMask()

void BackgroundInitMask ( const View< A > &  src,
uint8_t  index,
uint8_t  value,
View< A > &  dst 
)

Creates background update mask.

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

For every point:

if(mask[i] == index)
    dst[i] = value;

This function is used for background updating in motion detection algorithm.

Note
This function is a C++ wrapper for function SimdBackgroundInitMask.
Parameters
[in]src- an input mask image.
[in]index- a mask index into input mask.
[in]value- a value to fill the output mask.
[out]dst- an output mask image.