SOD C/C++ API Reference - Image Processing


Syntax

sod_img sod_gaussian_blur_image(sod_img input, int radius, double sigma);

Description

Apply Gaussian Blur effect to a given three-dimensional colrospace (RGB/BGR/YUV, etc.) image. Gaussian blur is often used in image processing to reduce image noise and detail, which can be useful in various contexts such as digital photography, computer graphics, and machine vision. The underlying principle of a Gaussian blur is the use of a Gaussian function, which when applied to an image, creates a smoothing effect. The API achieves this by convolving the image with a Gaussian filter, also known as a kernel. A typical input image after processing should look like the following:

Input Picture

flower before gaussian blur

After Processing via sod_gaussian_blur_image()

flower after gaussian blur


Please note that this particular implementation of Gaussian Blur is designed to be easy to use and efficient, but it's important to note that the Gaussian blur operation is inherently computationally intensive, especially for larger images or larger blur radius. It is recommended to use this API with care when processing large amounts of images or particularly large individual images to prevent potential performance issues.

Parameters

sod_img    input

The input image to be processed which must be three-dimensional colrospace (RGB/BGR/YUV, etc). The image can be loaded from disk using sod_img_load_from_file(), from memory (i.e. network socket) via sod_img_load_from_mem() or dynamically created via sod_make_image().

int    radius

The radius of the Gaussian blur. This determines the extent of the blur. A larger radius will result in a more blurred image. The radius is defined in pixels and must be a positive integer.

double    sigma

standard deviation of the Gaussian distribution that is used to create the Gaussian kernel, which in turn is used to perform the blur. The sigma parameter essentially controls the extent of the blur. A larger sigma implies a larger standard deviation, and therefore a wider spreading blur: the blur effect will reach out to more distant pixels.

Return Value

Gaussian blurred image is returned in an instance of the sod_img object. if something goes wrong during processing, then an empty image is returned via sod_make_empty_image() instead. Once done, you must release the memory allocated to this object via sod_free_image() to avoid memory leaks.

Example

Checkout the introduction course, the C/C++ samples on the download page or refer to the SOD Github Repository.

See also

sod_image_sepia_filtersod_canny_edge_imagesod_image_draw_bboxsod_image_find_blobssod_hough_lines_detectsod_crop_imagesod_hilditch_thin.

Back