Full text
1 QingDao HuangHai College,Qingdao 266427,China,
2 Laedon Associates incorporated
Abstract: Abstract: The college student smart car competition provides a variety of design concepts based on image recognition of The college student smart car competition provides a variety of design concepts based on image recognition of competitive smart cars. Taking the Freescale smart car contest as an example, the overall framework of the smart car work, image competitive smart cars. Taking the Freescale smart car contest as an example, the overall framework of the smart car work, image acquisition and image processing and recognition control algorithms are introduced.In the smart car control system, the OV7725 acquisition and image processing and recognition control algorithms are introduced.In the smart car control system, the OV7725 hardware binarized COMS camera module is selected for path recognition, and the captured video data is image processed, and then hardware binarized COMS camera module is selected for path recognition, and the captured video data is image processed, and then the center position of the black edge on both sides of the track is extracted, and used as the direction guide line of the car, combined The the center position of the black edge on both sides of the track is extracted, and used as the direction guide line of the car, combined The PID closed-loop control algorithm controls the steering of the steering gear, enabling the car to travel at high speeds while maintaining PID closed-loop control algorithm controls the steering of the steering gear, enabling the car to travel at high speeds while maintaining stability.stability.
Keywords: Keywords: Smart car; Edge detection; PID algorithmSmart car; Edge detection; PID algorithm Received 26 October 2020, Revised 22 November 2020, Accepted 28 December 2020Received 26 October 2020, Revised 22 November 2020, Accepted 28 December 2020
1.Introduction
In the game, the two aspects of image processing and track recognition are especially important, which affects the final control of the car.Through the timer, the rotation speed is collected every 50ms, and the image is acquired in real time in the main function. After each frame of image is acquired, the image processing is performed and the position of the center line is determined.When the position of the center line of the acquisition is different from the actual center line position, the steering gear is turned and judged whether it is centered. If it is centered, the next cycle is continued, otherwise the steering gear is turned.The PWM control wave is used to control the motor by the PID algorithm after each acquisition of the speed.When the end point is detected, the system stops running and stops.
2.Cmera Selection And Working Principle
The camera model used in this design is the OV7725 hardware binarized COMS camera module.Send the processed binarized image to the single through 8 image data lines The DMA channel of the tablet.(8 data lines send one byte of image information at a time, where each bit represents one dot in the image, that is, one byte represents 8 pixels) compared to one of the conventional cameras. At the pixel point, the acquisition and transmission speed of the camera is increased by eight times[Chen Yue, 2017].At the same time, the time for software binarization processing is reduced, and the processing efficiency is greatly improved.
After the OV7725[Li Jun, et. al.,2017] camera is successfully initialized, it starts scanning image information. For example, the initial setting of one frame is 80*60, which means that the frame has a total of 80*60 pixels.It is equivalent to dividing the picture seen by the current camera into 4800 points. Each pixel point gets one byte of data according to the different imaging colors.This one-byte (8-bit) data represents information such as the current pixel position and RGB value.The camera has a hardware binarization function, and each byte of data is converted into 1 bit data by hardware processing, with data 1 indicating black and data 0 indicating white.Binarization principle: When the RGB value is greater than a variable threshold, the data of this byte becomes 1 bit data 1 and vice versa.This variable threshold can be set by software.Thus, changing the image data of one frame of 4800 bytes into 600 bytes improves the image capturing speed.The captured images are only black and white.The track is white and the rest are black.This will distinguish between the track and the non-track.The captured image is shown in Figure 1.
Figure 1 Camera capture image
3.Track Edge Extractino Alogrithm
3.1 Extraction algorithm
Each line of the camera captures a line interrupt signal, and a field interrupt signal is generated for each frame of image captured.The design resolution of this design is 80*60, that is, the pixels of one frame image have 60 lines, and each line has 80 pixels.A total of one frame has 4800 pixels.Each pixel uses the numbers 0 and 1 to indicate black and white points in the figure, and the white point indicates that the track black dots indicate non-track parts.Through the edge extraction function, two arrays of length 60, that is, the positions of two edges[Li Wanmin, et. al.,2017] are obtained.This algorithm is suitable for extracting the edges up to the position. Until then, the camera can see the edges on both sides, so no line is needed.With the forward-looking optimum state and the edge position, the deviation between the body and the track can be calculated: offset=(Lx+Rx)/2-40, and the deviation amount can be obtained, and then the speed can be controlled.This four-point extraction jump edge algorithm is not only simple to implement, but also uses the extracted edge to be adapted to the light environment of the track, and can be known when the OV7725 loses the line.
It is the side that loses the line, so that the car model can be controlled to return quickly.Straight track collected image information as shown in Figure 2. The black vertical line in the middle of the bottom of the image is the starting line of the tape.The car can automatically stop and stop by the algorithm identifying the starting line of the track.
Acquisition process: start collecting, collect a frame of image and then patrol the image, and cycle through the line from the first line to the 60th line to find the position of the track boundary line in the figure.The lineof-sight method is to find the position of the boundary point of the white-to-black transition point from the middle to the two sides.
3.2 Ordinary track lift
The basic idea of the edge extraction algorithm is as follows: (1)Set the forward-looking range corresponding to the current speed, that is, the number of lines that are most suitable for use at this speed; (2) Look for the jump point of the track from the middle to the side of the track, and determine the midline; (3) When the line is lost on the side of the track, the position of the center line is half of the width of the track on the other side.The left border should be added and the right border should be reduced; (4) Starting point zebra crossing detection Find the number of jumps of black and white points from left to right.
3.3 Characteristics of the original image
After the image signal is acquired by the MCU, it needs to be processed to extract the main track information. At the same time, due to the existence of the cross and the starting line, the image of the light Figure 2 Straight track acquisition image Figure 3 acquisition flow chart
and the distant track is unclear, and the image will be distorted.Therefore, the software must eliminate interference factors, effectively identify the track, and provide as much track information as possible for decision making. The track information we extracted in image signal processing mainly includes: the position of the edge points on both sides of the track, the original pixel value near the edge of the track, and the track type.
Due to the characteristics of the camera itself, the image will produce trapezoidal deformation, and the cylindrical distortion, especially in the upper and lower left and right corners of the OV7725, the barrel distortion and trapezoidal distortion superimposed, resulting in serious image distortion, so we only collect half of the image during data acquisition. That is, the image at the top and bottom of the center, so that there is almost no cylinder shape.
On the sideline extraction of the track, we divided the track into two categories, one is ordinary corners, straight roads, up and down slopes, etc., and the other is the cross ring and small s.The track image is shown in figure 4: 3.4special track lift line The basic ideas of the special track extraction algorithm are as follows: (1) The special track is generally less curved, and the width of each line is approximately equal to the width of the straight line; (2) Due to image distortion and other effects, it may be difficult to separately extract small S edges; (3) When entering the small S or the small S, since the ordinary edge extraction program can refer to the far line, the track judgment is wrong, and the normal line of the small S cannot be performed, so the line and the latch state should be considered; (4) The circular track judges whether it enters the circular track by the feature of widening the sideline, and then replenishes the center line through a specific line-up algorithm.
4.Calculation Of Deviation Amount
When the line is lost, the actual center line position needs to be calculated from the track width.The track width here is called the deviation amount and is also called the middle line cheap amount.Since the camera has barrel distortion, the actual width of the track corresponding to each line is different.The width of the actual track should be equal width until the actual track, but the closer the track is to the camera position in the image captured by the camera, the wider (barrel distortion).So I placed the car at the center of the straight road and collected a frame.Calculate the corresponding acquisition width for each row.Divide each line width by 2 and store it in an array. Each time you drop a line, you need to add or subtract the offset amount and take it in the corresponding array.This will give you a more realistic midline position.
In the corner, due to the curvature, the two edges corresponding to a midpoint are not in the same row of a frame. Therefore, only the curvature needs to be Figure 4 Curved image Figure 4 Cross Track Figure 4 Ring track
calculated to find the error between the centerline and the centerline. Make compensation.
5. Path Selection
Because there are rings and crosses throughout the track.In order to run faster and more efficiently, it is necessary to select the driving route.In the ring circuit, the circular track needs to be processed in order to avoid the car returning to the starting point in the circular track.At the same time, in order to save time, you need to choose the shortest path when entering the ring circuit.In the loop, the circular track can be judged according to the width of the track from the near to the far and then narrowed and the width of the track is larger than the actual track width.The exit position of the circular track can be judged by the line loss condition, and the ring-turning at this time is the shortest path near the exit direction side.When entering the cross corner, avoid entering the entrance and causing the car to run backwards. Therefore, you need to go straight ahead in the cross curve [Liu Tao, et. al.,2016].
6.Speed Control
When setting a constant speed, the car will naturally decelerate in the corner and cause the corner to be very slow.In order to run the full course better, you need to set the dynamic target speed, that is, the curve should be accelerated.In order to prevent the speed from being too fast, it is necessary to decelerate according to the curve of the curve.The real-time target speed is obtained through reasonable calculation. When the target speed is given, the required PWM waveform is calculated by the PID operation.First, the actual speed of the car is collected by the encoder, and then compared with the calibrated speed.If acquisition speed is greater than the target speed, deceleration is required.Deceleration is to reduce the PWM duty value of forward rotation. If the speed difference is too large, you need to give the inverted PWM wave[Zhong Longjian, et. al.,2016]. The speed control process is shown in figure 5: Speed PID control principle[Stepan Ozana, et. Speed PID control principle[Stepan Ozana, et. al.,2016]: start, set a desired speed, collect the speed al.,2016]: start, set a desired speed, collect the speed of the current wheel, make the difference between the of the current wheel, make the difference between the collected speed and the desired speed, and get an error collected speed and the desired speed, and get an error value, and the error value of three consecutive times ex-value, and the error value of three consecutive times exists in an array, and the three error values Bring the PID ists in an array, and the three error values Bring the PID control function to get the controlcontrol function to get the control Control motor speed.It is judged whether it needs to Control motor speed.It is judged whether it needs to stop. When the stop signal is detected, PWM controls stop. When the stop signal is detected, PWM controls the car brake and ends the operation, otherwise it contin-the car brake and ends the operation, otherwise it continues to cycle control the motor speed.ues to cycle control the motor speed.
7.Conclusion
This design adopts the algorithms of binarization processing, median filtering and edge detection in the intelligent vehicle control system. It has the advantages of strong anti-interference ability and good dynamics. The image processing technology and recognition algorithm involved are fast in image data conversion.
It has a good effect in information extraction, noise elimination and image enhancement, and plays a significant role in the driving control of smart cars.The stable and high-speed operation of the smart car needs to pay attention to the comprehensive adjustment and optimization of machinery, hardware and software.To do this well, only interest and passion are not enough, and there must be perseverance and hard work.
Figures

