## Finding lanes and eyes in images with a few lines of Python code

Posted May 26, 2020

Today we will learn how to detect lines and circles in an image, with the help of a technique called Hough transform.

## What is Hough space?

Before we start applying Hough transform to images, we need to understand what a Hough space is, and we will learn that in the way of an example.

### Parameter space

When we work with images, we can imagine the image being a 2d matrix over some x and y coordinates, under which a line could be described as `y = mx + b`

But in parameter space, which we will call Hough space, I can represent that same line as `m`

vs `b`

instead, so the characterization of a line on image space, will be a single point at the position `m-b`

in Hough space.

But we have a problem though, with `y = mx + b`

, we cannot represent a vertical line, as the slope is infinite. So we need a better way parametrization, polar coordinates (rho and theta).

#opencv #python