![]() |
Version: 1.0 |
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. | |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
Radius | A radius in pixels to use for calculation, >= 0 |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
Radius | A radius in pixels to use for calculation, >= 0 |
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)
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
Radius | Controls the cutoff frequency - larger values will remove more low frequency content, resulting in a more pronounced high pass effect. Range [1 - 512] |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
PhotometricStandardDeviation | Controls the broadness of the range filter. The larger the value, the more obvious the blur. Range [1 - 255] |
SpatialDecay | Spatial standard deviation. The larger the value, the more obvious the blur. Range [0.01 - 0.250] |
RangeFilter | The type of range filter to use. [0, 1 or 2] [Gaussian|Hyperbolic Secant|Euler Constant] |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
sigmaSpatial | The 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] |
sigmaRange | Control 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] |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
GaussianSigma | The blur radius of the underlying Gaussian blur. |
intensity | The strength of the sharpening kernel. Range [0.0-4.0]. |
threshold | Pixels with a difference greater than this value will be sharpened. Represented as a percentage of the difference. Range [0-100%]. |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
Strength | The strength of the sharpening kernel. Range [0.0 - 10.0]. |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
smoothingLevel | The amount of skin denoising to apply. |
applySkinFilter | Apply filtering to non-skin areas after initial denoising. |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Channels | The number of color channels in the image. |
kernel | The kernel matrix to apply. Width and height must be odd. This expects a 1D array. |
filterW | The kernel matrix width. |
cfactor | The sum of all values greater than 0 in the kernel. |
bias | Used to increase/decrease all values greater than 0 in the 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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
blockSize | The width and height of the desired pixelation block (in pixels). |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
radius | The radius of the effect. Range >= 1. |
intensity | The smoothness of the effect. Smaller values indicate less smoothness (less bins are used to calculate luminance). |
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.
Input | The input image data. |
Output | The output image data. |
Height | The height of the image. |
Width | The width of the image. |
Channels | The number of channels in the image. |
Radius | The radius of the blur. Recommend keeping this value around 2. |
Range | Controls the range of random pixel displacement. Greater values will produce a more pronounced effect, making the image more distorted. Range [1 - 20] |
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.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Channels | The number of color channels in the image. |
Strength | The intensity of the grain. Range [0.0 - 100.0]. |
Softness | The softness of the grain. Range [0.0 - 25.0]. |