LI Shi-guang,ZHANG Xiao-jing,GAO Xiang,SUN Hong
(College of Electrical Engineering and Automation,Shandong University of Science and Technology,Qingdao 266590,China)
Among the camera image data processing modules of smart car races,the most critical module is the path identification module. Compared with the photoelectric sensor which has smaller prospect distance and can only obtain limited point information,the line hunting sensor with cameras[1]has the advantages of having greater foresight distance and enabling the camera to better apperceive the changes of the farther track,so that the smart car can make judgment earlier and travel along the track faster. Effective processing of the video signal extracted from camera is the focal point for the fast travel of smart cars as well as one of the difficulties of the design.
The competition venue is the black lines on white background. Track requirements: smart cars travel along fixed black tracks,among which there are both straight tracks and bends. The smallS-shaped bends are comprised of a number of arcs,and dotted line tracks are also arranged on the smallS-shaped bends[2].
There are two kinds of analog cameras on the market mainly: CCD and CMOS. The comparisons of CCD and CMOS are shown in Fig.1. In order to study well,OV5116 is selected to be camera model.
Fig.1 Comparisons of CCD and CMOS cameras
The output signal of the dynamic integrated camera OV5116 is NTSC system. Its working principle is that scaning in the way of interlacing at a certain resolution ratio,the corresponding analog voltage value will be output via the video signal end when a certain point is reached[3].
Each image is divided into two fields which are odd field and even field. The camera scans the odd field first. While scanning,the camera can output the corresponding voltage video signal. After scanning a line,it outputs a low parallel synchronization pulse. Until the whole field has been scanned,a section of field blanking area including more than a composite blanking pulse is output. The relatively wide pulse marks the field shifting of scanning,which is known as field synchronization pulse. The video signal is shown in Fig.2.
Fig.2 Diagram of video signal
The dynamic integrated camera OV5116 integrates the LM1881 video separation chip and it can output the VS field sync signal,the HS line synchronization signal and ODEV parity field identification signal directly,which makes it easy to use in practical application. Meanwhile,it also integrates the level signal of LM393 (LM series of comparators) which can concert the analog signal to digital signal[4]. Hardware binarization circuit output by the camera video is shown in Fig.3 and the line separation and output binarization of video signal are shown in Fig.4.
Fig.3 Diagram of camera video output hardware binarization circuit
Fig.4 Line separation and output binarization of video signal
The line synchronizing signal refers to the beginning signal of line scanning in Fig.4. In combination with the processed binarization image,the time oft1when the line synchronizing signal reaches the first detected black line can be figured out and the first black line can be located. The time oft2can be figured out at the same time. The difference betweent2andt1is the width of the first black line. Using the same timing method,the difference between the two black lines (t3andt4) is the timed time of white track width.
According to the track requirements,there are straight track,theS-shaped track as well as cross track. The track bending can be got by calculating the curvature of the first detected black line. If the curvature is zero,it denotes that the track is the straight and needs to accelerate; if the curvature is positive,smart car can transfer to the left corner; if the curvature is negative,smart car can transfer to the right corner. The greater the curvature is,the bigger the angle of the bend will be,and the smart car needs to decelerate to enter the bend[5].
Parsing the track requirements,there are several positions of the smart car in the track[6]. The positions of smart car in the track are shown in Fig.5.
Fig.5 The positions of smart car in the track
1) Traveling along the middle of the straight track: the output image from camera binarized port is the binarization signal image of Figs.1-4. Two black lines can be detected,which are two low-level signal. The time between the two black lines is the width of white track. When smart car is located in the straight track,the time of each line,namelyt1,is almost the same.
2) Deviating from the straight track: the output images from camera binarization port can only detect low level signal,indicating that the smart car gets away from the track. The servo should be controlled to make smart car straight. The time difference between the time of track centerline andt1is Δt. If Δtis positive,it shows that the smart car is left-skewed; if Δtis negative,it indicates that the smart car is right-skewed. And the time of each line,namelyt1,is also almost the same.
3) Entering into theS-shaped bend: from camera binarization port of the images,the increasing value oft1indicates that the smart car enters intoS-shaped bend. In the multi-line data acquisition,from detecting the black line low to finding no low-level output,then to detecting a low-level signal,the video signal indicates that the smart car enters into the dash line segments of theS-shaped bend.
4) Entering into the cross track: from camera binarization port of the images output,there is a process that the low-level black line is undetected,which indicates that there is no low-level signal ouput. Long duration and high-level output between composite signal indicates that the car enters into cross track.
With over 320 lines in a field,the timing data volume is relatively large. According to the experiment results,only part of line image information is needed to meet the judging requirement of the tracks. The design method is as follows:pre-writing an array,collecting the line numbers of the lines stored,and setting a line counter. Every time there is an interrupt line,and one number is added to the counter. When the counter number is equal to a number pre-stored in the array,it means that the information of the line will be collected. A total of 80 line information is needed[7].
The camera binarization video signal is inserted in the microcontroller interrupts,with the pin assignments as follows:
TIN0: binarization signalD2,to capture the falling edge.
TIN3: binarization signalD2,to capture the rising edge.
Specifically,the process of collecting the information in a field is as follows: ① Field synchronizing signal separated from the LM1881 generates interrupts in thet0port; ② Line synchronizing signal separated from the LM1881 generates interrupts in thet1port. Opening the line channel and allowing interrupts,and when a line number counter is equal to the number of the line stored in the array,the information of the line should be collected,then the counter is increased by one; ③ TIN0 captures the falling edge and time oft1; TIN3 captures the rising edge and time oft2; ④ To detect the field synchronizing signal and turn off the interrupt,the data will be stored in RAM; ⑤ When the next interrupt comes,it should begin to collect the image information,store new data and analyze them of the next field. The software program can extract the data information of 80 lines effectively.Crepresents the number of capturing times,and the values of theCcan determine the type of the track[8].
The flow chart of image acquisition is shown in Fig.6.
Fig.6 Flow chart of image acquisition
Effective processing of the collected data is important to ensure the rapid control of the smart car. The data processing method is as follows[9]:
1) Determining whetherC=0. If it is,it shows that all the output is high level,and the smart car deviates or the track is dotted line or cross blank area. The data of the line has no need to be processed.
2) Determining whetherC>3. If it is,it indicates that the camera detects two black lines; if not,it shows that the camera detects one black line.
3) Setting the time of the track centerline astwhich serves as a dynamic reference value via experiments. Ift1-t<0,the smart car is left-deviated; Otherwise,the smart car is right-deviated.
4) Usingt1to calculate the curvature,it can determin the track category,control the intelligent vehicle steering gear effectively and make the smart car move fast along the track.
The paper discusses a processing method of smart car camera black-and-white images. The selection of dynamic integrated camera OV5116 can effectively separate the field and line sync pulse. Integrated LM393 can do the analog-to-digital conversion. Simultaneously,by processing the collected data,extracting the valid data and calculating its curvature,we can distinguish the kinds of tracks and get the turning angle to lay the foundation for the fast driving of smart car. Experiments show that the method is simple and feasible. It solves the tracking problem of intelligent vehicles effectively. At the same time,it provides an important reference for smart car competition.
[1] ZHUO Qing,WANG Jin,WANG Lei. The detection of path parameters based on matrix CCD. EEPW,2006,(4): 27-35.
[2] LIU Ming,WANG Hong-jun,LI Yong-ke. Research of image collection of CCD based on smart car. Electronic Design Engineering,2012,(17): 158-160.
[3] SHEN Li-qin,MA Cai-wen,TIAN Xin-feng,et al. Research on CCD image acquisition system based on network. Modern Electronic Technique,2009(2): 151-153.
[4] WU Huai-yu,CHENG Lei,ZHANG zheng. College students' smart car design basis and the practice. Beijing: Publishing House of Electronics Industry,2008.
[5] GUAN Jun,WU Zhong-yi,HU Chen-hui. The first national college student intelligent car competition technical report. Shanghai: Shanghai Jiaotong University,2006.
[6] ZHUO Qing,HUANG Kai-sheng,SHAO Bei-bei,et al. Learn to do smart car: “freescale” cup of challenge. Beijing: Beijing University of Aeronautics and Astronautics Press,2007.
[7] LIU Lin,YANG Li-long,YE Hong. The second session intelligence car competition. Chongqing: Chongqing University of Post and Telecommunications,2007.
[8] ZHAO Ma-xing,ZHU Li,WANG Li. The seventh freescale cup national undergraduate smart car competition. 2012.
[9] Racing disciplinary rules of the game and the stadium of The 8th National Undergraduate Freescale Cup Intelligent Car Rally.http:∥baike.baidu.com/link?url=rEZDfU25ExruOskX8gUGdPunvY6QW01jciL6LVN3xMexjoU Pr-dBb7G7nkxmiTgyZSoJ8Ry8gIM7XowS8rW7A_.
Journal of Measurement Science and Instrumentation2014年2期