Simd Library Documentation.

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

Laplace image filters. More...

Functions

SIMD_API void SimdLaplace (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride)
 Calculates a signed 3x3 Laplace filter for an 8-bit gray image. More...
 
SIMD_API void SimdLaplaceAbs (const uint8_t *src, size_t srcStride, size_t width, size_t height, uint8_t *dst, size_t dstStride)
 Calculates the absolute value of a 3x3 Laplace filter for an 8-bit gray image. More...
 
template<template< class > class A>
SIMD_INLINE void Laplace (const View< A > &src, View< A > &dst)
 Calculates Laplace's filter. More...
 
template<template< class > class A>
SIMD_INLINE void LaplaceAbs (const View< A > &src, View< A > &dst)
 Calculates absolute value of Laplace's filter. More...
 

Detailed Description

Laplace image filters.

Function Documentation

◆ SimdLaplace()

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

Calculates a signed 3x3 Laplace filter for an 8-bit gray image.

The destination image stores signed 16-bit values. The dst pointer is typed as uint8_t for ABI compatibility, but dstStride is measured in bytes and must be compatible with int16_t rows. Border pixels are handled by nearest-pixel replication:

sx0 = Max(x - 1, 0);
sx1 = x;
sx2 = Min(x + 1, width - 1);
sy0 = Max(y - 1, 0);
sy1 = y;
sy2 = Min(y + 1, height - 1);

dst[x, y] = 8*src[sx1, sy1] -
    (src[sx0, sy0] + src[sx1, sy0] + src[sx2, sy0] +
     src[sx0, sy1]                  + src[sx2, sy1] +
     src[sx0, sy2] + src[sx1, sy2] + src[sx2, sy2]);
Note
This function has a C++ wrapper: Simd::Laplace(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the input 8-bit gray image.
[in]srcStride- a row size of the input image (in bytes).
[in]width- an image width. It must be greater than 1.
[in]height- an image height.
[out]dst- a pointer to pixels data of the output 16-bit signed integer image.
[in]dstStride- a row size of the output image (in bytes).

◆ SimdLaplaceAbs()

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

Calculates the absolute value of a 3x3 Laplace filter for an 8-bit gray image.

The destination image stores signed 16-bit values containing Abs(Laplace(src)). Border pixels are handled by nearest-pixel replication as in SimdLaplace.

Note
This function has a C++ wrapper: Simd::LaplaceAbs(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the input 8-bit gray image.
[in]srcStride- a row size of the input image (in bytes).
[in]width- an image width. It must be greater than 1.
[in]height- an image height.
[out]dst- a pointer to pixels data of the output 16-bit signed integer image.
[in]dstStride- a row size of the output image (in bytes).

◆ Laplace()

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

Calculates Laplace's filter.

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] -   src[x, y-1] - src[x+1, y-1]
    - src[x-1, y]   + 8*src[x, y]   - src[x+1, y]
    - src[x-1, y+1] -   src[x, y+1] - src[x+1, y+1].
Note
This function is a C++ wrapper for function SimdLaplace.
Parameters
[in]src- an input image.
[out]dst- an output image.

◆ LaplaceAbs()

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

Calculates absolute value of Laplace's filter.

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] -   src[x, y-1] - src[x+1, y-1]
    - src[x-1, y]   + 8*src[x, y]   - src[x+1, y]
    - src[x-1, y+1] -   src[x, y+1] - src[x+1, y+1]).
Note
This function is a C++ wrapper for function SimdLaplaceAbs.
Parameters
[in]src- an input image.
[out]dst- an output image.