Your problem is quite different than the vein extraction one. In fact, it is much mucg easier to solve with the "geometric" definition of the Hough Transform.
The Hough Transform is used exactly to detect lines in an image. It achieves this by integrating the brightness values of an image towards some angle $\theta$. So, for example, for angle $\theta = 0 ^ \circ$, the Hough Transform produces the sum of each row in the image, for angle $theta = 90 ^ \circ$, the Hough transform produces the sum of each column in the image...and so on.
The combined result of this is that points map to arcs, lines map to points and polygons map to specific configurations of points in the Hough Space.
The way to pick up a line in the image, in the Hough Space, is ultra simple. You just pick a maximum. But, that would give you an infinite line, not a line segment, which is what you have in your application.
The most straightforward way to pick up a line segment by the Hough Transform is to "mark" the pixels that are "responsible" for a particular accumulation. So, later on, when you pick up a maximum peak, you can "look" at the pixels that formed that sum and then connect them with a simple distance based rule. If distance is smaller than 4 pixels between any two pixels, then consider them as part of one line, otherwise create a new line.
For more information about all this, please see this link.
We now come to your case, you have two problems:
- Detect line segments from GPS points
- Connect line segments to form roads.
To solve #1, you can use the "geometric" definition of the Hough Transform WITHOUT having to work on the pixels of an image. Here is how this works:
- Find the centroid of all GPS points. Call this the centre of your region.
- Find the bounding box of all of your GPS points. These two steps define your "image space".
- Run a Hough Transform with the center and over the bounding box of the points. As you are shooting "rays" down each different bearing, make sure that you also store the points that are responsible for the sum. The sum is simple: Shoot a ray down a direction, whenever it hits a point increase a counter and store its location.
- Do a histogram of your Hough Space. It will help you in determining the threshold you have to apply so that you select the peaks that result in lines.
- Apply the Threshold by selecting peaks that are above the thrshold value. You now have a bunch of infinite strong lines in your hands.
- Look at the lists of points accumulated in each one of the directions and "integrate" them in lines if their distance is smaller than some threshold. You now have a bunch of line segments in your hands. These are your roads OR your road segments. The good thing about them is that they share a common point when they are connected (the junction). The bad thing about them is that they are unconnected when there is a "turn" or "curve".
You now have to solve problem number 2. Unfortunately, it is impossible to solve problem #2 without yet another application of a threshold. The philosophy here is simple:
- Pick up a line, call it $a$.
- Pick up all of the lines $a$ shares a common point with, call them $C$.
- Calculate all angles between $a$ and the lines in the set $C$.
- Merge two lines into one "road" if the angle is greater than some threshold. Obviously, if two lines form a $180^\circ$ angle, they are the same "road" but if they form a $90^\circ$ angle then they probably are not EXCEPT if set $C$ only has 1 element (1 line).
At the end of this process, you will have all connected segments that form roads.
It is not a difficult problem but it sure is a messy one.
Hope this helps.