Speed traffic sign (+ complementary board) detection and recognition algorithm
Uses:
- C++
- OpenCV 3.2
- Canny edge detection
- Ellipse detection with conditions:
- valid size
- x, y axis comparison
- ellipse, contour comparison
- Ellipse interior rectification (using affine transform)
- Number detection using a NN + filtering:
- size filtering
- gibberish NN result filtering
- Complementary board detection and rectification under the speed sign:
- aproximation of contours with polygons
- finding proper 4 point polygons
- rectification
- Cropping of the speed sign and its complementary board(s), printing of detected speed limit
There's also a "backup" procedure doing dilation on Canny edges, which works when the sign is quite close to the camera but the picture quality is bad.
The NN was trained on digits from The Chars74K dataset by T. de Campos, with 1016 samples per digit (total of 10160 samples). Accuracy on the learning dataset was 99.94 %.
Topology:
- layer 1: 784 neurons (28x28 img size)
- layer 2: 160 neurons
- layer 3: 10 neurons (10 output digits)
On a i7 4700MQ, processing for 1 frame requires 9-23 ms for video with downsizing to 1000xN or Nx1000, where N <= 1000.
The real-life speed limit detection accuracy is quite good.
input image:
output image:
Detected speed limit: 30