Canny Edge Detection

Canny Edge Detection

First Published 18th Feb 2016

Canny Edge Detection is a common method of detecting and refining the edges in an image. Further processing is required to turn those edges into vectors or shapes to allow for object recognition. The example here is only the initial edge detection and refinement using the John F. Canny algorithm (1986).

I started this thread initially just as a Python example, I felt like implementing it in Python because it is easy to read and can run on any platform that supports Python without the need to recompile it etc.

After writing the Python version I decided to port the same code to C++ just for the sake of comparison and the fact that the C++ version would be much more useful to many people if they wanted to experiment with basic computer image processing/vision.

Non Optimised Implementations

Python >

C++ >

Optimisations

I had other things to do but felt like doing some simple optimisations to the C++ implementation. If you are interested, check out;

C++ Optimisations >


Note: I have not gone through and checked everything is working perfectly as the point of this exercise is more about performance optimisation. When I get time I will review each of the optimisations and specifics of the porting to ensure they are 100% accurate implementations of the Canny Edge Detection algorithm.