Simd Library Documentation.

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

Sobel image filters. More...

Functions

SIMD_API void SimdSobelDx (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride)
 Calculates the horizontal Sobel derivative of an 8-bit gray image. More...
 
SIMD_API void SimdSobelDxAbs (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride)
 Calculates the absolute horizontal Sobel derivative of an 8-bit gray image. More...
 
SIMD_API void SimdSobelDy (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride)
 Calculates the vertical Sobel derivative of an 8-bit gray image. More...
 
SIMD_API void SimdSobelDyAbs (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride)
 Calculates the absolute vertical Sobel derivative of an 8-bit gray image. More...
 
template<template< class > class A>
SIMD_INLINE void SobelDx (const View< A > &src, View< A > &dst)
 Calculates Sobel's filter along x axis. More...
 
template<template< class > class A>
SIMD_INLINE void SobelDxAbs (const View< A > &src, View< A > &dst)
 Calculates absolute value of Sobel's filter along x axis. More...
 
template<template< class > class A>
SIMD_INLINE void SobelDy (const View< A > &src, View< A > &dst)
 Calculates Sobel's filter along y axis. More...
 
template<template< class > class A>
SIMD_INLINE void SobelDyAbs (const View< A > &src, View< A > &dst)
 Calculates absolute value of Sobel's filter along y axis. More...
 

Detailed Description

Sobel image filters.

Function Documentation

◆ SimdSobelDx()

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

Calculates the horizontal Sobel derivative of an 8-bit gray image.

Input image must have 8-bit gray format, output image must have signed 16-bit integer format. All images must have the same width and height, and width must be greater than 1. At image borders the nearest valid source row or column is reused.

For every point:

x0 = Max(x - 1, 0); x2 = Min(x + 1, width - 1);
y0 = Max(y - 1, 0); y2 = Min(y + 1, height - 1);
dst[x, y] = (src[x2, y0] + 2*src[x2, y] + src[x2, y2]) -
            (src[x0, y0] + 2*src[x0, y] + src[x0, y2]);
Note
This function has a C++ wrappers: Simd::SobelDx(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the input image.
[in]srcStride- a row size of the input image in bytes.
[in]width- an image width.
[in]height- an image height.
[out]dst- a pointer to pixels data of the signed 16-bit output image.
[in]dstStride- a row size of the output image in bytes. It must be a multiple of sizeof(int16_t).

◆ SimdSobelDxAbs()

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

Calculates the absolute horizontal Sobel derivative of an 8-bit gray image.

Input image must have 8-bit gray format, output image must have signed 16-bit integer format. All images must have the same width and height, and width must be greater than 1. At image borders the nearest valid source row or column is reused.

For every point:

x0 = Max(x - 1, 0); x2 = Min(x + 1, width - 1);
y0 = Max(y - 1, 0); y2 = Min(y + 1, height - 1);
dst[x, y] = Abs((src[x2, y0] + 2*src[x2, y] + src[x2, y2]) -
                (src[x0, y0] + 2*src[x0, y] + src[x0, y2]));
Note
This function has a C++ wrappers: Simd::SobelDxAbs(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the input image.
[in]srcStride- a row size of the input image in bytes.
[in]width- an image width.
[in]height- an image height.
[out]dst- a pointer to pixels data of the signed 16-bit output image.
[in]dstStride- a row size of the output image in bytes. It must be a multiple of sizeof(int16_t).

◆ SimdSobelDy()

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

Calculates the vertical Sobel derivative of an 8-bit gray image.

Input image must have 8-bit gray format, output image must have signed 16-bit integer format. All images must have the same width and height, and width must be greater than 1. At image borders the nearest valid source row or column is reused.

For every point:

x0 = Max(x - 1, 0); x2 = Min(x + 1, width - 1);
y0 = Max(y - 1, 0); y2 = Min(y + 1, height - 1);
dst[x, y] = (src[x0, y2] + 2*src[x, y2] + src[x2, y2]) -
            (src[x0, y0] + 2*src[x, y0] + src[x2, y0]);
Note
This function has a C++ wrappers: Simd::SobelDy(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the input image.
[in]srcStride- a row size of the input image in bytes.
[in]width- an image width.
[in]height- an image height.
[out]dst- a pointer to pixels data of the signed 16-bit output image.
[in]dstStride- a row size of the output image in bytes. It must be a multiple of sizeof(int16_t).

◆ SimdSobelDyAbs()

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

Calculates the absolute vertical Sobel derivative of an 8-bit gray image.

Input image must have 8-bit gray format, output image must have signed 16-bit integer format. All images must have the same width and height, and width must be greater than 1. At image borders the nearest valid source row or column is reused.

For every point:

x0 = Max(x - 1, 0); x2 = Min(x + 1, width - 1);
y0 = Max(y - 1, 0); y2 = Min(y + 1, height - 1);
dst[x, y] = Abs((src[x0, y2] + 2*src[x, y2] + src[x2, y2]) -
                (src[x0, y0] + 2*src[x, y0] + src[x2, y0]));
Note
This function has a C++ wrappers: Simd::SobelDyAbs(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the input image.
[in]srcStride- a row size of the input image in bytes.
[in]width- an image width.
[in]height- an image height.
[out]dst- a pointer to pixels data of the signed 16-bit output image.
[in]dstStride- a row size of the output image in bytes. It must be a multiple of sizeof(int16_t).

◆ SobelDx()

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

Calculates Sobel's filter along x axis.

All images must have the same width and height. Input image must have 8-bit gray format, output image must have 16-bit integer format.

For every point:

dst[x, y] = (src[x+1,y-1] + 2*src[x+1, y] + src[x+1, y+1]) - (src[x-1,y-1] + 2*src[x-1, y] + src[x-1, y+1]).
Note
This function is a C++ wrapper for function SimdSobelDx.
Parameters
[in]src- an input image.
[out]dst- an output image.

◆ SobelDxAbs()

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

Calculates absolute value of Sobel's filter along x axis.

All images must have the same width and height. Input image must have 8-bit gray format, output image must have 16-bit integer format.

For every point:

dst[x, y] = abs((src[x+1,y-1] + 2*src[x+1, y] + src[x+1, y+1]) - (src[x-1,y-1] + 2*src[x-1, y] + src[x-1, y+1])).
Note
This function is a C++ wrapper for function SimdSobelDxAbs.
Parameters
[in]src- an input image.
[out]dst- an output image.

◆ SobelDy()

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

Calculates Sobel's filter along y axis.

All images must have the same width and height. Input image must have 8-bit gray format, output image must have 16-bit integer format.

For every point:

dst[x, y] = (src[x-1,y+1] + 2*src[x, y+1] + src[x+1, y+1]) - (src[x-1,y-1] + 2*src[x, y-1] + src[x+1, y-1]);
Note
This function is a C++ wrapper for function SimdSobelDy.
Parameters
[in]src- an input image.
[out]dst- an output image.

◆ SobelDyAbs()

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

Calculates absolute value of Sobel's filter along y axis.

All images must have the same width and height. Input image must have 8-bit gray format, output image must have 16-bit integer format.

For every point:

dst[x, y] = abs((src[x-1,y+1] + 2*src[x, y+1] + src[x+1, y+1]) - (src[x-1,y-1] + 2*src[x, y-1] + src[x+1, y-1]));
Note
This function is a C++ wrapper for function SimdSobelDyAbs.
Parameters
[in]src- an input image.
[out]dst- an output image.