# Standard and probabilistic Hough transform

It is said that Hough transform can detect almost any shape if it can be mathematically described. This property is very useful, although adjusting the default algorithm to work well on every image can be challenging.

Here we see a photo that might have a lot of edges in it. There are buildings with many windows, garage, road and so on. We would like to observe what kind of results we could obtain from the application of Hough transform on it. There are two diffrent kinds of Hough transforms: regular and probabilistic. The regular one is easier to use as it has fewer adjustable parameters, but its results are relatively rough. We obtain only lines that go through the entire image.

We notice several straight lines here, most of which are parallel. As least from our perspective, the angle of construction seems to be right. The boundaries of the roads are also easily distinguishable. Since we can see the line at the top of the garage and we know the slope of the road, we could eventually estimate how much road there is left or how long the distance is before the next house can be seen. Similarly, if we used the regular Hough transform on a photo of a beach, we would be able to tell in which areas the water reaching the sand has gone further than some imaginary line, which is interesting to observe.

The probabilistic Hough transform gives us more flexibility and the possibility for more accurate edge detection if we spend more time on tuning the result. There are lots of parameters - rho, theta, a threshold, minimum line length and maximum line gap (in addition to the parameters for the Canny edge detector, used as a preprocessing step).

Here we see more, but much shorter edges. If many such lines follow the same direction, we can assume that there is an edge with relatively high probability. Now we are able to notice two edges perpendicular to the road, with direction from the viewer towards the house. One of the boundaries of the road hasn't been detected very well, but there is still a hint on the yellow line. Most edges of the houses, the windows, the stairs, the roofs have been either detected or emphasized.