Syntax
sod_pts * sod_hough_lines_detect(sod_img input, int threshold, int *nPts);
Description
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()
After Processing via sod_hough_lines_detect()
Parameters
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.
Example
Checkout the introduction course, the C/C++ samples on the download page or refer to the SOD Github Repository.
See also
sod_sobel_image • sod_image_draw_bbox • sod_image_find_blobs • sod_canny_edge_image • sod_crop_image • sod_hilditch_thin.
Back