A Project By Bo and Kexiong
Our whole system can be used at the entrance of the highway. The infrastructure can be divided into two parts. For the first part, we used a Raspberry Pi to control the vehicle for the sake of simulating the real-world traffic. For the second part, we use another Raspberry Pi so as to displaying the vehicle information, including the tag of the vehicle and whether the vehicle has been charged or not. It seems like a tollbooth real-world. When the car is approaching the tollbooth, piCamera can take a photo of the vehicle. In this way, the Raspberry Pi can process the image using the knowledge of openCV. In addition, the system can also recognize the number or letter on the tag by using OCR. After that, the system can match whether the tag has been stored in the “txt” file. If the tag can match the information in “txt” file, it means the vehicle has been charged.
What our previously plan is to design a traffic light system, however we think that the system is a little bit monotonous， we have discussed for long that what method we should take to recognize the traffic light, is it solely by color, by some special signature or just by words. It is a totally computer vision problem, and it is way amphibolous. After talking we decided to focus on recognize the recognization of characters and strings. To highlight our idea and technology related to image identification，we decided to change our application scene. That’s say, we design a system, by two Rpi, one of which to control the car and the other of which severed as the brain of computer vision processing. The system, to be exactly is the latter Rpi, is a notification system that offer information to who are inside a tollbooth. It could be applied in parking lot, the enterance of a highway, to better manage if a vehicle is legal or not. Image recognition is sometimes not easy. Especially when we are trying to read a given part(the plate) of a vehicle. We will have to define the range first so that we could import the OCR library. To better realize it, we made some black frames that surrounding the vehicle information, also we use loop to do some iteration, the iteration will not end until the Pi find the real contour of the plate, which largely boost the efficience of recognition. The connection between the camera and the IR sensors could be not easy sometimes. On rarely cases, to ensure that the camera can take pictures on time, we call the sleep function in the camera as a clock, so that the picture can be produced as expect.
(1)Camera: 1. The library: from picamera import PiCamera from time import sleep 2. The opening and shut down of carema camera = PiCamera() camera.start_preview() sleep(5) camera.stop_preview() To make the camera take the image pictures, the sleep() function should be exists. Also, the time could be adjust based on the distance and the vehicle tag size. (2)The OCR library: Tesseract Introduction: Tesseract is an optical character recognition engine for various operating systems. It is free software, released under the Apache License Which contains: 1. Installing Tesseract 2. Running Tesseract The command line of it is: tesseract imagename outputbase [-l lang] [--oem ocrenginemode] [--psm pagesegmode] [configfiles...] 3. Using Tesseracg from PIL import image import sys column = Image.open(sys.argv) gray = column.convert('L') blackwhite = gray.point(lambda x: 0 if x < 200 else 255, '1') blackwhite.save("code_bw.jpg") Above code is a basic example for how to using command-line to call a Python file. Also, to process a single image, we use the helper function below: Import tesserocr images = ['sample1.jpg', 'sample2.jpg', 'sample3.jpg', 'sample4.jpg'] for img in images: print(tesserocr.file_to_text(img， lang='eng', path='C:/path/to/tessdata/.') This is a way to call python file without calling API.
Expected results has been realized in most of the parts. During the project, we have had many thoughts and ideas far beyond the bound of the game. Time permit, the vehicle could be improved as a automatic tracking vehicle, and then the application scenarios could be wider. It could be a luggage carrier in the airport, so that those traverlers can be free from taking heavy things. By now the second Pi is solely a computer vision processor, it could only process the static image. So if time permitted, it could be expand to realize the streaming processing, the real-time analyzing and the dynamic capture.
Design hardware system and test software system.
Design software system and test hardware system.