SOD C/C++ API Reference - Image Processing


Syntax

sod_img sod_grayscale_image(sod_img input);

Description

Convert a given image to gray color model. A grayscale (or graylevel) image is simply one in which the only colors are shades of gray. Grayscale images are very common & entirely sufficient for many tasks such as face detection and so there is no need to use more complicated and harder-to-process color images. A typical input image should look like the following after processing:

Input Picture

Nature before processing

After Processing via sod_grayscale_image()

Nature after processing

Parameters

sod_img    input

The input image to be processed. This function is a no-op if the input image is a single channel (i.e. already grayscaled). 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().

Return Value

Grayscale single channel 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(). 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_canny_edge_imagesod_image_draw_bboxsod_equalize_histogramsod_hough_lines_detectsod_crop_image.



Back