交通标志识别项目 putsi/tsaraisa · GitHub
问:识别交通标志,怎么确定图片里有交通标志,具体在哪里?答:这个应该算目标识别和物体识别,CV的经典教程都有object recognition的内容可以参考。具体到交通标志识别,Github上有些开源代码 Matlab C++ Java的都有
Tsaraisa was run with "./tsaraisa.py -s -g -c lbpCascade.xml -M" on demo screenshot.
What does it do?
- Detect traffic signs.
- Recognize speed limits in signs.
- (optional) Compare GPS-speed to speed limit.
- (optional) Run user command when overspeeding.
How?
GPS-class
- Uses threading to update GPS-info automatically.
- Gets speed from GPS-daemon using python bindings.
Frame handling
- Reads frame from webcam.
- Converts frame to grayscale with cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY).
- (optional) Morphological Open/close.
- (optional) Equalizes histograms with cv2.equalizeHist().
- Downscale frame with multiplier n.
Traffic sign detection
- Uses LBP- or HAAR-cascade to detect speed signs.
- LBP-cascade was trained with 2000 positive and 1000 negative images.
- Negative image is image of road without speed limit sign.
- Positive image is image of road with speed limit sign.
- LBP- and HAAR-detection allows great differences in lightning.
- LBP- and HAAR-detection works great on low performance machines.
Recognizing speed limits
- Uses Fast Approximate Nearest Neighbor Search Library feature matching.
- Creates "keypoints" of detected sign and compares them to all known speed limits (files in data-folder).
- Keypoint match distances need to be inside a threshold.
- Match with biggest proper keypoint amount will be returned.
- It is fast and pretty accurate with different lightning conditions.
Speed assist
- When new speed limit is detected it is added as current speed limit.
- After every frame script compares current speed to current speed limit.
- Script runs specified command when overspeeding (e.g. "beep").
Requirements
Required software
- OpenCV >=3.0.0
- Python >=2.7.3
- LibAV >=0.8.10
- (optional) gpsd && python-gps
- (optional) V4L2 1.0.1
Required hardware
- Webcam or some other video-source.
- (optional) GPS Module BU-353