Simd Library Documentation.

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

Functions for image shifting. More...

Enumerations

enum  SimdShiftDetectorTextureType {
  SimdShiftDetectorTextureGray ,
  SimdShiftDetectorTextureGrad
}
 
enum  SimdShiftDetectorDifferenceType {
  SimdShiftDetectorAbsDifference ,
  SimdShiftDetectorSquaredDifference
}
 

Functions

SIMD_API void SimdShiftBilinear (const uint8_t *src, size_t srcStride, size_t width, size_t height, size_t channelCount, const uint8_t *bkg, size_t bkgStride, const double *shiftX, const double *shiftY, size_t cropLeft, size_t cropTop, size_t cropRight, size_t cropBottom, uint8_t *dst, size_t dstStride)
 Performs shifting of input image with using bilinear interpolation. More...
 
SIMD_API void * SimdShiftDetectorInitBuffers (size_t bkgWidth, size_t bkgHeight, size_t levelCount, SimdShiftDetectorTextureType textureType, SimdShiftDetectorDifferenceType differenceType)
 
SIMD_API void SimdShiftDetectorSetBackground (void *context, const uint8_t *bkg, size_t bkgStride, SimdBool makeCopy)
 
SIMD_API SimdBool SimdShiftDetectorEstimate (void *context, const uint8_t *curr, size_t currStride, size_t currWidth, size_t currHeight, size_t initShiftX, size_t initShiftY, size_t maxShiftX, size_t maxShiftY, const double *hiddenAreaPenalty, ptrdiff_t regionAreaMin)
 
template<template< class > class A>
SIMD_INLINE void ShiftBilinear (const View< A > &src, const View< A > &bkg, const Point< double > &shift, const Rectangle< ptrdiff_t > &crop, View< A > &dst)
 Performs shifting of input image with using bilinear interpolation. More...
 

Detailed Description

Functions for image shifting.

Enumeration Type Documentation

◆ SimdShiftDetectorTextureType

Describes types of texture which used to find correlation between background and current image in function SimdShiftDetectorInitBuffers.

Enumerator
SimdShiftDetectorTextureGray 

Original grayscale image.

SimdShiftDetectorTextureGrad 

Saturated sum of absolute gradients along X and Y axes.

◆ SimdShiftDetectorDifferenceType

Describes types of function which used to find correlation between background and current image in function SimdShiftDetectorInitBuffers.

Enumerator
SimdShiftDetectorAbsDifference 

Sum of absolute differences of points of two images.

SimdShiftDetectorSquaredDifference 

Sum of squared differences of points of two images.

Function Documentation

◆ SimdShiftBilinear()

void SimdShiftBilinear ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
size_t  channelCount,
const uint8_t *  bkg,
size_t  bkgStride,
const double *  shiftX,
const double *  shiftY,
size_t  cropLeft,
size_t  cropTop,
size_t  cropRight,
size_t  cropBottom,
uint8_t *  dst,
size_t  dstStride 
)

Performs shifting of input image with using bilinear interpolation.

All images must have the same width, height and format (8-bit gray, 16-bit UV, 24-bit BGR or 32-bit BGRA).

Note
This function has a C++ wrappers: Simd::ShiftBilinear(const View<A> & src, const View<A> & bkg, const Point<double> & shift, const Rectangle<ptrdiff_t> & crop, View<A> & dst).
Parameters
[in]src- a pointer to pixels data of the foreground input image.
[in]srcStride- a row size of the input image.
[in]width- an image width.
[in]height- an image height.
[in]channelCount- a channel count.
[in]bkg- a pointer to pixels data of the background input image.
[in]bkgStride- a row size of the background image.
[in]shiftX- an image shift along x axis.
[in]shiftY- an image shift along y axis.
[in]cropLeft- a crop left side.
[in]cropTop- a crop top side.
[in]cropRight- a crop right side.
[in]cropBottom- a crop bottom side.
[out]dst- a pointer to pixels data of the output image.
[in]dstStride- a row size of the output image.

◆ SimdShiftDetectorInitBuffers()

void * SimdShiftDetectorInitBuffers ( size_t  bkgWidth,
size_t  bkgHeight,
size_t  levelCount,
SimdShiftDetectorTextureType  textureType,
SimdShiftDetectorDifferenceType  differenceType 
)

Initializes internal buffers of shift detector.

Note
This function used in class Simd::ShiftDetector.
Parameters
[in]bkgWidth- a width of background image.
[in]bkgHeight- a height of background image.
[in]levelCount- the number of levels in the internal image pyramids used to find shift.
[in]textureType- type of textures used to detect shift (see SimdShiftDetectorTextureType).
[in]differenceType- type of correlation functions used to detect shift (see SimdShiftDetectorDifferenceType).
Returns
a pointer to shift detector context. On error it returns NULL. This pointer is used in functions SimdShiftDetectorSetBackground, SimdShiftDetectorEstimate. It must be released with using of function SimdRelease.

◆ SimdShiftDetectorSetBackground()

void SimdShiftDetectorSetBackground ( void *  context,
const uint8_t *  bkg,
size_t  bkgStride,
SimdBool  makeCopy 
)

Sets a background image. Size of background image is set by function SimdShiftDetectorInitBuffers.

Note
This function used in class Simd::ShiftDetector.
Parameters
[in]context- a shift detector context. It must be created by function SimdShiftDetectorInitBuffers and released by function SimdRelease.
[in]bkg- a pointer to pixels data of background image.
[in]bkgStride- a row size of the background image.
[in]makeCopy- if true, copy of the background will be created.

◆ SimdShiftDetectorEstimate()

SimdBool SimdShiftDetectorEstimate ( void *  context,
const uint8_t *  curr,
size_t  currStride,
size_t  currWidth,
size_t  currHeight,
size_t  initShiftX,
size_t  initShiftY,
size_t  maxShiftX,
size_t  maxShiftY,
const double *  hiddenAreaPenalty,
ptrdiff_t  regionAreaMin 
)

Estimates shift of current image relative to background image. Background image must be set before by function SimdShiftDetectorSetBackground.

Note
This function used in class Simd::ShiftDetector.
Parameters
[in]context- a shift detector context. It must be created by function SimdShiftDetectorInitBuffers and released by function SimdRelease.
[in]curr- a pointer to pixels data of current image.
[in]currStride- a row size of the current image.
[in]currWidth- a width of current image.
[in]currHeight- a height of current image.
[in]initShiftX- an initial shift X position to start search.
[in]initShiftY- an initial shift Y position to start search.
[in]maxShiftX- maximal possible shift alogn X axis.
[in]maxShiftY- maximal possible shift alogn Y axis.
[in]hiddenAreaPenalty- a parameter used to restrict searching of the shift at the border of background image. Can be NULL (no restriction).
[in]regionAreaMin- a parameter used to set minimal area of region use for shift estimation.
Returns
a result of shift estimation (true or false). In positive case use function SimdShiftDetectorGetShift to get shift and other parameters.

◆ ShiftBilinear()

void ShiftBilinear ( const View< A > &  src,
const View< A > &  bkg,
const Point< double > &  shift,
const Rectangle< ptrdiff_t > &  crop,
View< A > &  dst 
)

Performs shifting of input image with using bilinear interpolation.

All images must have the same width, height and format (8-bit gray, 16-bit UV, 24-bit BGR or 32-bit BGRA).

Note
This function is a C++ wrapper for function SimdShiftBilinear.
Parameters
[in]src- a foreground input image.
[in]bkg- a background input image.
[in]shift- an image shift.
[in]crop- a crop rectangle.
[out]dst- an output image.