Canny Edge Detection Algorithm with Python

Doğan Can MAVUZER
5 min readApr 22, 2022

When do we think about edge detection and why it is so important? With edge detection, we can determine the objects on the image without other details. Then we can identify the objects easily.

Applied Canny Edge Detection to Gray Image

And the Canny Edge Detection Algorithm is the most commonly used algorithm for the edge detection objects. The beauty of this algorithm actually has basically 5 steps.

Gaussian Filter (Noise Reduction)

The first step is Gaussian Filter (also known as Gaussian smoothing), the result of applying Gaussian Filter on the image is blurring and reducing the noise from the image.

The Gaussian function formula is used for generating a Gaussian filter mask. In this formula, ϭ (sigma) controls the width of the filter which is impact averaging over the neighborhood. (ps: ϭ should be greater than 0)

Let's see how to generate a mask by using the Gaussian Function.

3x3 kernel matrix by using gaussian function

--

--

Doğan Can MAVUZER

Doğan Can Mavuzer is a software developer who works with Autonomous Driving, Computer Vision and DL. Automotive Software Engineering- TU Chemnitz — Germany