Version: 1.0
Loading...
Searching...
No Matches
Image Processing Filters

Detailed Description

The functions in this section cover a pretty broad range of image processing and categorized further once more features are available. They cover blurring, sharpening, de-noising, edge detection and artistic effects.

Functions

OC_STATUS ocularErodeFilter (unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, int Radius)
 Performs a minimum rank filter that replaces the central pixel with the darkest one in the radius.
 
OC_STATUS ocularDilateFilter (unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, int Radius)
 Performs a maximum rank filter that replaces the central pixel with the lightest one in the radius.
 
OC_STATUS ocularHighPassFilter (unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, int Radius)
 Perform a high pass filter that emphasizes high-frequency components (edges and details) while reducing low-frequency components (smooth areas)
 
OC_STATUS ocularBEEPSFilter (const unsigned char *Input, unsigned char *Output, int width, int height, int Stride, float PhotometricStandardDeviation, float SpatialDecay, int RangeFilter)
 Performs a Bi-Exponential Edge-Perserving Smoothing filter that removes irrelevant details while preserving strong edges. It is faster than a bilateral filter and uses a range akin to the one found in bilateral.
 
OC_STATUS ocularBilateralFilter (unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, float sigmaSpatial, float sigmaRange)
 Performs a non-linear, edge-preserving and noise-reducing smoothing of an image. This is a fast implementation, like gaussian blur, that performs vertical/horizontal passes independently.
 
OC_STATUS ocularUnsharpMaskFilter (unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, float GaussianSigma, float intensity, float threshold)
 A better sharpening effect using a gaussian blur as a mask for enhancing edges.
 
OC_STATUS ocularSharpenFilter (unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, float Strength)
 Enhances the contrast between pixels to make details and edges more pronounced.
 
OC_STATUS ocularSkinSmoothingFilter (unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, int smoothingLevel, bool applySkinFilter)
 Applies denoising smoothing filter on detected skin region while retaining other details.
 
OC_STATUS ocularConvolution2DFilter (unsigned char *Input, unsigned char *Output, int Width, int Height, int Channels, float *kernel, unsigned char filterW, unsigned char cfactor, unsigned char bias)
 Applies a 2D convolution to an image using a kernel.
 
OC_STATUS ocularPixelateFilter (const unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, int blockSize)
 Applies a pixelate effect (sometimes called "mosaic") to an image.
 
OC_STATUS ocularOilPaintFilter (const unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, int radius, int intensity)
 Applies an "oil painting" effect to an image.
 
OC_STATUS ocularFrostedGlassEffect (unsigned char *Input, unsigned char *Output, int Width, int Height, int Stride, int Radius, int Range)
 Simulates the image being observed through a layer of frosted glass by applying random pixel disturbance.
 
OC_STATUS ocularFilmGrainEffect (unsigned char *Input, unsigned char *Output, int Width, int Height, int Channels, float Strength, float Softness)
 Applies a film grain effect to an image.
 

Function Documentation

◆ ocularErodeFilter()

OC_STATUS ocularErodeFilter ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
int Radius )

Performs a minimum rank filter that replaces the central pixel with the darkest one in the radius.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
RadiusA radius in pixels to use for calculation, >= 0
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularDilateFilter()

OC_STATUS ocularDilateFilter ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
int Radius )

Performs a maximum rank filter that replaces the central pixel with the lightest one in the radius.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
RadiusA radius in pixels to use for calculation, >= 0
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularHighPassFilter()

OC_STATUS ocularHighPassFilter ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
int Radius )

Perform a high pass filter that emphasizes high-frequency components (edges and details) while reducing low-frequency components (smooth areas)

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
RadiusControls the cutoff frequency - larger values will remove more low frequency content, resulting in a more pronounced high pass effect. Range [1 - 512]
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularBEEPSFilter()

OC_STATUS ocularBEEPSFilter ( const unsigned char * Input,
unsigned char * Output,
int width,
int height,
int Stride,
float PhotometricStandardDeviation,
float SpatialDecay,
int RangeFilter )

Performs a Bi-Exponential Edge-Perserving Smoothing filter that removes irrelevant details while preserving strong edges. It is faster than a bilateral filter and uses a range akin to the one found in bilateral.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
PhotometricStandardDeviationControls the broadness of the range filter.
The larger the value, the more obvious the blur. Range [1 - 255]
SpatialDecaySpatial standard deviation. The larger the value, the more obvious the blur. Range [0.01 - 0.250]
RangeFilterThe type of range filter to use. [0, 1 or 2] [Gaussian|Hyperbolic Secant|Euler Constant]
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularBilateralFilter()

OC_STATUS ocularBilateralFilter ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
float sigmaSpatial,
float sigmaRange )

Performs a non-linear, edge-preserving and noise-reducing smoothing of an image. This is a fast implementation, like gaussian blur, that performs vertical/horizontal passes independently.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
sigmaSpatialThe size of the Gaussian bilateral filter window to use. A larger value means that farther pixels will influence each other as long as their colors are close enough. Range [0 - 1.0]
sigmaRangeControl how much an adjacent pixel is down-weighted because of the intensity difference. A larger value means that farther colors within the pixel neighborhood will be mixed together. Range [0 - 1.0]
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularUnsharpMaskFilter()

OC_STATUS ocularUnsharpMaskFilter ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
float GaussianSigma,
float intensity,
float threshold )

A better sharpening effect using a gaussian blur as a mask for enhancing edges.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
GaussianSigmaThe blur radius of the underlying Gaussian blur.
intensityThe strength of the sharpening kernel. Range [0.0-4.0].
thresholdPixels with a difference greater than this value will be sharpened. Represented as a percentage of the difference. Range [0-100%].
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularSharpenFilter()

OC_STATUS ocularSharpenFilter ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
float Strength )

Enhances the contrast between pixels to make details and edges more pronounced.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
StrengthThe strength of the sharpening kernel. Range [0.0 - 10.0].
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularSkinSmoothingFilter()

OC_STATUS ocularSkinSmoothingFilter ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
int smoothingLevel,
bool applySkinFilter )

Applies denoising smoothing filter on detected skin region while retaining other details.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
smoothingLevelThe amount of skin denoising to apply.
applySkinFilterApply filtering to non-skin areas after initial denoising.
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularConvolution2DFilter()

OC_STATUS ocularConvolution2DFilter ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Channels,
float * kernel,
unsigned char filterW,
unsigned char cfactor,
unsigned char bias )

Applies a 2D convolution to an image using a kernel.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
ChannelsThe number of color channels in the image.
kernelThe kernel matrix to apply. Width and height must be odd. This expects a 1D array.
filterWThe kernel matrix width.
cfactorThe sum of all values greater than 0 in the kernel.
biasUsed to increase/decrease all values greater than 0 in the kernel.
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularPixelateFilter()

OC_STATUS ocularPixelateFilter ( const unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
int blockSize )

Applies a pixelate effect (sometimes called "mosaic") to an image.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
blockSizeThe width and height of the desired pixelation block (in pixels).
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularOilPaintFilter()

OC_STATUS ocularOilPaintFilter ( const unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
int radius,
int intensity )

Applies an "oil painting" effect to an image.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
radiusThe radius of the effect. Range >= 1.
intensityThe smoothness of the effect. Smaller values indicate less smoothness (less bins are used to calculate luminance).
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularFrostedGlassEffect()

OC_STATUS ocularFrostedGlassEffect ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Stride,
int Radius,
int Range )

Simulates the image being observed through a layer of frosted glass by applying random pixel disturbance.

Parameters
InputThe input image data.
OutputThe output image data.
HeightThe height of the image.
WidthThe width of the image.
ChannelsThe number of channels in the image.
RadiusThe radius of the blur. Recommend keeping this value around 2.
RangeControls the range of random pixel displacement. Greater values will produce a more pronounced effect, making the image more distorted. Range [1 - 20]
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularFilmGrainEffect()

OC_STATUS ocularFilmGrainEffect ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Channels,
float Strength,
float Softness )

Applies a film grain effect to an image.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
ChannelsThe number of color channels in the image.
StrengthThe intensity of the grain. Range [0.0 - 100.0].
SoftnessThe softness of the grain. Range [0.0 - 25.0].
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)