Edge detection on achromatic images written in pure C,
based on the algorithm created by John F. Canny
The algorithm works by performing matrix convolutions in a few steps:
- Noise reduction - 5x5 Gaussian filter
- Finding intensity gradient - vertical and horizontal Sobel kernel
- Non-maximum suppression
- Hysteresis thresholding
Thresholding is defined by two parameters - lower and upper threshold
Canny edge detector algorithm uses two thresholds. I concluded that it is difficult to find these values, having to tweak them for each image and still getting unsatisfactory results. For now, the program in this form works quite well for straight lines, mainly architecture or car designs. It's effectiveness falls of when it comes to pictures with nature or animals.
If you wish to try the program, follow these steps
edge_detection_c.exe
--images/
----input/
----output/
-
-
Note: For now, the only supported image extension is .jpg
-
Images with detected edges are placed into the output folder with the same name and extension
This project is a free and open-source software licensed under the MIT license
Used STB library developed by nothings for loading and saving to jpegs