SOD C/C++ API Reference - Image Processing


sod_pts * sod_hough_lines_detect(sod_img input, int threshold, int *nPts);


Perform hough line detection on an input image. The target image must be processed via sod_canny_edge_image() before this call. When done, you can draw the detected lines via sod_image_draw_line() and you must release the sod_pts array returned by this call via sod_hough_lines_release() to avoid memory leaks. A typical input image after processing should look like the following:

Input Picture via sod_canny_edge_image()

pic via canny_edge

After Processing via sod_hough_lines_detect()

pic after hough line detection


sod_img    input

The input image which must be processed via sod_canny_edge_image() before. 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    threshold

Threshold value that trigger a line detection. Set this parameter to 0 for the default behavior.

int    *nPts

OUT: Total number of detected points. Divide this number by two to get the total number of detected lines (See example below).

Return Value

A sod_pts array holding the starting & ending position for each detected line is returned in an instance of sod_pts on success. if something goes wrong during processing, NULL is returned instead. Once done, you must release the memory allocated to this array via sod_hough_lines_release() to avoid memory leaks.


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

See also