The Hough Transformation is a great way to detect lines in an image. You will find here https://www.keymolen.com/2013/05/hough-transformation-c-implementation.html a very nice explanation of the method. Thanks to Bruno Keymolen for sharing his C++ code. With Red language we have two ways for using the Hough transformation. First is to call OpenCV method as illustrated in %OpenCV3-red/samples_gui.red/hough samples.
A second way is to use the code in %RedCV/samples/image_detectors. hough1.red and hough2.red illustrate the implementation in RedCV. Hough1 only uses a Canny filter for edges detection. Hough2 includes a series of edges filters to creates a BW image with lines and points representing the edges. The program gives the number of detected lines, here 9, which are visualised in the original image.
As usual, this kind of algorithm requires a fine tuning of parameters that must be adapted to your needs. Enjoy 😀