Computer Vision

Understanding & Implementing Shape Detection using Hough Transform with OpenCV & Python

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

Juan Cruz Martinez
6 min readMay 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

Parameter space

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.

--

--

Juan Cruz Martinez

I stream, blog, and make youtube videos about tech stuff. I love coding, I love React, and I love building stuff!