Recursive bilateral image filters. More...
Functions | |
| SIMD_API void * | SimdRecursiveBilateralFilterInit (size_t width, size_t height, size_t channels, const float *sigmaSpatial, const float *sigmaRange, SimdRecursiveBilateralFilterFlags flags) |
| Creates a recursive bilateral filter context for 8-bit images. More... | |
| SIMD_API void | SimdRecursiveBilateralFilterRun (const void *filter, const uint8_t *src, size_t srcStride, uint8_t *dst, size_t dstStride) |
| Runs a recursive bilateral filter for one 8-bit image. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | RecursiveBilateralFilter (const View< A > &src, View< A > &dst, float sigmaSpatial, float sigmaRange, SimdRecursiveBilateralFilterFlags flags=SimdRecursiveBilateralFilterFast) |
| Performs image recursive bilateral filtering. More... | |
Detailed Description
Recursive bilateral image filters.
Enumeration Type Documentation
◆ SimdRecursiveBilateralFilterFlags
Describes Recursive Bilateral Filter flags. This type used in function SimdRecursiveBilateralFilterInit.
Function Documentation
◆ SimdRecursiveBilateralFilterInit()
| void * SimdRecursiveBilateralFilterInit | ( | size_t | width, |
| size_t | height, | ||
| size_t | channels, | ||
| const float * | sigmaSpatial, | ||
| const float * | sigmaRange, | ||
| SimdRecursiveBilateralFilterFlags | flags | ||
| ) |
Creates a recursive bilateral filter context for 8-bit images.
The context stores image size, channel count, spatial sigma, range sigma and implementation flags. It is then reused by SimdRecursiveBilateralFilterRun to filter images with the same width, height and number of channels. The filter supports 1, 2, 3 or 4 channels. The spatial and range sigma values are normalized to the 8-bit range internally. The flags argument selects fast or precise processing and the color-difference mode (see SimdRecursiveBilateralFilterFlags).
Usage example:
float sigmaSpatial = 0.2f, sigmaRange = 0.2f;
void* filter = SimdRecursiveBilateralFilterInit(width, height, channels, &sigmaSpatial, &sigmaRange, SimdRecursiveBilateralFilterFast);
if (filter)
{
SimdRecursiveBilateralFilterRun(filter, src, srcStride, dst, dstStride);
SimdRelease(filter);
}
- Parameters
-
[in] width - a width of input and output images. [in] height - a height of input and output images. [in] channels - a number of channels in input and output images. It must be in range [1..4]. [in] sigmaSpatial - a pointer to the spatial sigma parameter. [in] sigmaRange - a pointer to the range sigma parameter. [in] flags - algorithm flags (see SimdRecursiveBilateralFilterFlags).
- Returns
- a pointer to filter context. On error it returns NULL. This pointer is used by function SimdRecursiveBilateralFilterRun. It must be released with function SimdRelease.
◆ SimdRecursiveBilateralFilterRun()
| void SimdRecursiveBilateralFilterRun | ( | const void * | filter, |
| const uint8_t * | src, | ||
| size_t | srcStride, | ||
| uint8_t * | dst, | ||
| size_t | dstStride | ||
| ) |
Runs a recursive bilateral filter for one 8-bit image.
The input and output images must have the width, height and channel count that were used to create filter. The source and destination buffers may have different strides. The filter performs horizontal and vertical recursive passes and writes the final smoothed image to dst.
- Parameters
-
[in] filter - a filter context. It must be created by function SimdRecursiveBilateralFilterInit and released by function SimdRelease. [in] src - a pointer to pixels data of the original input image. [in] srcStride - a row size (in bytes) of the input image. [out] dst - a pointer to pixels data of the filtered output image. [in] dstStride - a row size (in bytes) of the output image.
◆ RecursiveBilateralFilter()
| void RecursiveBilateralFilter | ( | const View< A > & | src, |
| View< A > & | dst, | ||
| float | sigmaSpatial, | ||
| float | sigmaRange, | ||
| SimdRecursiveBilateralFilterFlags | flags = SimdRecursiveBilateralFilterFast |
||
| ) |
Performs image recursive bilateral filtering.
All images must have the same width, height and pixel format.
- Note
- This function is a C++ wrapper for function SimdRecursiveBilateralFilterInit and SimdRecursiveBilateralFilterRun.
- Parameters
-
[in] src - an original input image. [out] dst - a filtered output image. [in] sigmaSpatial - a sigma spatial parameter. [in] sigmaRange - a sigma range parameter. [in] flags - a flags of algorithm parameters. By default it is equal to SimdRecursiveBilateralFilterFast.