Simd Library Documentation.

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

Other image filters. More...

Functions

SIMD_API void SimdAbsGradientSaturatedSum (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride)
 Calculates saturated sum of horizontal and vertical absolute gradients for each pixel of 8-bit gray image. More...
 
SIMD_API void SimdLbpEstimate (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride)
 Calculates LBP (Local Binary Pattern) codes for an 8-bit gray image. More...
 
SIMD_API void SimdMeanFilter3x3 (const uint8_t *src, size_t srcStride, size_t width, size_t height, size_t channelCount, uint8_t *dst, size_t dstStride)
 Performs 3x3 mean filtering of an 8-bit interleaved image. More...
 
template<template< class > class A>
SIMD_INLINE void AbsGradientSaturatedSum (const View< A > &src, View< A > &dst)
 Puts to destination 8-bit gray image saturated sum of absolute gradient for every point of source 8-bit gray image. More...
 
template<template< class > class A>
SIMD_INLINE void GaussianBlur3x3 (const View< A > &src, View< A > &dst)
 Performs Gaussian blur filtration with window 3x3. More...
 
template<template< class > class A>
SIMD_INLINE void LbpEstimate (const View< A > &src, View< A > &dst)
 Calculates LBP (Local Binary Patterns) for 8-bit gray image. More...
 
template<template< class > class A>
SIMD_INLINE void MeanFilter3x3 (const View< A > &src, View< A > &dst)
 Performs an averaging with window 3x3. More...
 

Detailed Description

Other image filters.

Function Documentation

◆ SimdAbsGradientSaturatedSum()

void SimdAbsGradientSaturatedSum ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
uint8_t *  dst,
size_t  dstStride 
)

Calculates saturated sum of horizontal and vertical absolute gradients for each pixel of 8-bit gray image.

Both images must have the same width and height.

For border pixels:

dst[x, y] = 0;

For non-border pixels:

dx = abs(src[x + 1, y] - src[x - 1, y]);
dy = abs(src[x, y + 1] - src[x, y - 1]);
dst[x, y] = min(dx + dy, 255);
Note
This function has a C++ wrapper Simd::AbsGradientSaturatedSum(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of source 8-bit gray image.
[in]srcStride- a row size of source image.
[in]width- an image width.
[in]height- an image height.
[out]dst- a pointer to pixels data of destination 8-bit gray image.
[in]dstStride- a row size of destination image.

◆ SimdLbpEstimate()

void SimdLbpEstimate ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
uint8_t *  dst,
size_t  dstStride 
)

Calculates LBP (Local Binary Pattern) codes for an 8-bit gray image.

The first and last rows and columns of dst are set to zero. For every inner pixel, the center value is used as threshold and eight neighbor comparisons are packed clockwise starting from the top-left neighbor:

t = src[x, y];
dst[x, y] =
    (src[x - 1, y - 1] >= t ? 0x01 : 0) |
    (src[x,     y - 1] >= t ? 0x02 : 0) |
    (src[x + 1, y - 1] >= t ? 0x04 : 0) |
    (src[x + 1, y    ] >= t ? 0x08 : 0) |
    (src[x + 1, y + 1] >= t ? 0x10 : 0) |
    (src[x,     y + 1] >= t ? 0x20 : 0) |
    (src[x - 1, y + 1] >= t ? 0x40 : 0) |
    (src[x - 1, y    ] >= t ? 0x80 : 0);
Note
This function has a C++ wrapper: Simd::LbpEstimate(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of input 8-bit gray image.
[in]srcStride- a row size of src image (in bytes).
[in]width- an image width.
[in]height- an image height.
[out]dst- a pointer to pixels data of output 8-bit gray image with LBP codes.
[in]dstStride- a row size of dst image (in bytes).

◆ SimdMeanFilter3x3()

void SimdMeanFilter3x3 ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
size_t  channelCount,
uint8_t *  dst,
size_t  dstStride 
)

Performs 3x3 mean filtering of an 8-bit interleaved image.

The filter is applied independently to every channel. Border pixels are handled by nearest-pixel replication. For every channel of every pixel:

sum = Sum of the 9 samples in the 3x3 window;
dst[x, y, c] = (sum + 5) / 9;
Note
This function has a C++ wrapper Simd::MeanFilter3x3(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of source image.
[in]srcStride- a row size of the src image (in bytes).
[in]width- an image width.
[in]height- an image height.
[in]channelCount- a number of 8-bit channels per pixel.
[out]dst- a pointer to pixels data of destination image.
[in]dstStride- a row size of the dst image (in bytes).

◆ AbsGradientSaturatedSum()

void AbsGradientSaturatedSum ( const View< A > &  src,
View< A > &  dst 
)

Puts to destination 8-bit gray image saturated sum of absolute gradient for every point of source 8-bit gray image.

Both images must have the same width and height.

For border pixels:

dst[x, y] = 0;

For other pixels:

dx = abs(src[x + 1, y] - src[x - 1, y]);
dy = abs(src[x, y + 1] - src[x, y - 1]);
dst[x, y] = min(dx + dy, 255);
Note
This function is a C++ wrapper for function SimdAbsGradientSaturatedSum.
Parameters
[in]src- a source 8-bit gray image.
[out]dst- a destination 8-bit gray image.

◆ GaussianBlur3x3()

void GaussianBlur3x3 ( const View< A > &  src,
View< A > &  dst 
)

Performs Gaussian blur filtration with window 3x3.

For every point:

dst[x, y] = (src[x-1, y-1] + 2*src[x, y-1] + src[x+1, y-1] +
            2*(src[x-1, y] + 2*src[x, y] + src[x+1, y]) +
            src[x-1, y+1] + 2*src[x, y+1] + src[x+1, y+1] + 8) / 16;

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 SimdGaussianBlur3x3.
Parameters
[in]src- a source image.
[out]dst- a destination image.

◆ LbpEstimate()

void LbpEstimate ( const View< A > &  src,
View< A > &  dst 
)

Calculates LBP (Local Binary Patterns) for 8-bit gray image.

All images must have the same width and height.

Note
This function is a C++ wrapper for function SimdLbpEstimate.
Parameters
[in]src- an input 8-bit gray image.
[out]dst- an output 8-bit gray image with LBP.

◆ MeanFilter3x3()

void MeanFilter3x3 ( const View< A > &  src,
View< A > &  dst 
)

Performs an averaging with window 3x3.

For every point:

dst[x, y] = (src[x-1, y-1] + src[x, y-1] + src[x+1, y-1] +
             src[x-1, y] + src[x, y] + src[x+1, y] +
             src[x-1, y+1] + src[x, y+1] + src[x+1, y+1] + 4) / 9;

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 SimdMeanFilter3x3.
Parameters
[in]src- a source image.
[out]dst- a destination image.