SOD C/C++ API Reference - Image Processing


Syntax

float sod_img_get_pixel(sod_img input, int x, int y, int c);

Description

Retrieve pixel value at a given location.

Parameters

sod_img    input

The input image to be examined. 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    x

The x-coordinate, in logical units, of the pixel to be examined.

int    y

The y-coordinate, in logical units, of the pixel to be examined.

int    c

The target color channel to examine 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

The pixel value at the given location. If the coordinate is out-of-range then 0 (zero) is returned.

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_img_set_pixelsod_hough_lines_detectsod_hilditch_thin_imagesod_make_image.



Back