SOD C/C++ API Reference - Image Processing


Syntax

sod_img sod_img_get_layer(sod_img input, int layer);

Description

Extract a color channel from a given image.

Parameters

sod_img    input

The input image to be processed. 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    layer

The target color channel to be extracted starting from 0 for Red, 1 for Green and 2 for Blue in a typical RGB colorspace. Note that in a grayscale image, this value must be set to 0.

Return Value

Target color channel pixels are returned in an instance of the sod_img object. 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_grayscale_imagesod_copy_imagesod_hough_lines_detectsod_hilditch_thin_imagesod_make_image.



Back