Measuring the Distance between the Two Vehicles Using Stereo Vision with Optical Axes Cross

We will see smart cars on the street in future that has got ability to recognize the car, and has the ability to estimate the direction and distance from other vehicles or pedestrians and they can implement operations corresponding to the track for the navigation. In this paper by using stereo vision with the optical axis intersecting, by using two cameras, a camera has got rotation around on the Y-axis and using modern methods of image processing and focusing on the area of 1/5 m and using MATLAB software to estimate the distance between the vehicles. In this paper the whole process of stereo vision from image acquisition distortion compensation, image smoothing, stereo correspondence, and finally measure the distance is handled. The method used in this paper for calibration has got flexible more than other methods. The main advantage of the used method for calibration is its easy setup so that just by creating a calibration page anyone can use it. The results shows at day and in the laboratory conditions that has got acceptable accuracy %89/9.


Introduction
About ninety percent of human perception of its surroundings through the visual sense.Since that the amount of information is transmitted to the brain through the eyes and processed are several times the volume of information that reaches the brain through other sensory organs.Whereas the visual sense, has the Stereo processing power.In other words, having two eyes gives humans the opportunity to estimate the position and direction of objects.The volume of CPU's data are doubled compared to the other senses.In fact after the first operation on each of the two images, in the second phase, the brain using a certain point of the object in the reached two image, the position of the point in the mass are estimated.Using these principles and adding some constraints, we can understand the human visual system for modeling and simulation of three-dimensional space around the machine.This method which is called stereo vision.In many applications such as intelligent cars, navigation based on machine vision, robot guidance, quality control, reverse engineering, aerial mapping using aerial photographs, medicine, etc. has been used (Bakos, 2002).One of the most common applications of machine vision, inspection and evaluation of goods are including semiconductors, automobiles, food and medicines (Hapgood, 2007).Such as human resources with the naked eye in the product line to determine the quality and type of products that are reviewing, uses machine vision digital cameras, smart cameras and image processing software (Hornberg, 2006;Hantao, 2005).The corresponding devices to perform specific tasks such as counting objects on a conveyor, reading serial numbers, searching for surface defects are used.Now the industry uses much from machine vision systems for objects that require high speed, high precision, video review, work 24 hours a day and require the repeating the above calculations.Although humans have better performance and capability to more matching for new errors in a short time but according to the specifications that stated.These devices over the time instead of manpower due to the deviation and bad conditions have the errors, fill in the industry.Although some machine vision algorithms have been developed to mimic the human visual system, a few ways to identify the characteristics associated images have been developed and proven effective.Machine and computer vision systems capable to analyze images consistently, but computer-based image processing in general are designed to perform repetitive tasks.Despite advances in the field, no machine and computer vision system cannot match with some of the characteristics of the human visual system in terms of image comprehension, tolerance to changes in light, undermine the power of the image and change the components.In this paper the whole process of stereo vision from image acquisition distortion compensation, image smoothing, stereo correspondence, and finally measure the distance is handled.The method used in this paper for calibration has got flexible more than other methods.The main advantage of the used method for calibration is its easy setup so that just by creating a calibration page anyone can use it.The results shows at day and in the laboratory conditions that has got acceptable accuracy %89/9.

Proposed Method
We intend to provide the hardware for measurement and estimate the distance from the car ahead of pay and follow the course of events that happen in our software.

Hardware
The hardware consists of two webcam is designed to be installed on structures.First, with respect to geometric models proposed for the camera and calibration methods the model offered to mount the camera on the mechanical structure.

Camera
Suitable camera for stereo vision application, must have appropriate resolution, comfortable viewing angle, high image quality, have the glass lens and without zoom.One of the important properties in cameras used for stereo vision, capability to coordinate them.This must be done either based on hardware way by sending a signal or based on software way by selecting the appropriate time frames.However this possibility should be considered for the camera and otherwise, cameras lose their effectiveness.The benefits of used camera can be noted as cheap, small, modest-size sensor and limiting.But the fundamental problems of wide viewing USB and easy use due to the camera interface that we encountered while working with it can be used for long-term warming, mismatch of two camera sensors, the same lack of exposure in the camera, a plastic lens, resulting in poor image quality and finally very slowly over the camera's response be noted.Low quality images makes that the calibration is not possible with reasonable accuracy performance.As a result, there will be no possibility of exploiting it.
To create a better accuracy in the system, location-nest-cameras on this page organic glass, drawn on the map, has been established.To create a parallelism between the axes of the cameras, first, the image on the display simultaneously taken from the camera are estimated and then, after aligning images manually, cameras with instant glue, are fixed in place.

Structures
After initial tests on the system that was designed before, the design requirements are as follows respectively: 1. Make clear the camera position relative to each other with high accuracy.2. Structures be designed to minimize calculations to obtain the required depth.3. The same camera with clear images and appropriate process, with almost equal intensity.4. Covering the appropriate ranges.5. Having the ability to perform accurate processing and processing imprecise size and low speed, high speed and extent.
Due to heavy calculations cross of the camera relative to each other, for calibration and finally aligning images, the structure has the following characteristics 1. Cameras are fixed relative to each other and during the time any move relative to one another.
2. With regard to the scope of work, placement of cameras is designed to create differences with respect to the whole system work, is reasonable.
In this design two cameras on a Plexiglas plate Glass, the rigidity is good, at the height of the floors have been installed.

Camera Calibration
Images required for calibration camera of taken from Caltech University (Bouguet, 2010).After performing all phases of calibration for each camera according to the instructions provided in the used tools the images used are presented for each camera, results have been obtained.
Figure 2. Images used in the test for camera calibration (Maryum, 2006) 2.6 Wrapping Method of Cameras and Relations

Era a camera around Y axis
Assuming both cameras are located on the XZ and just the right camera has been era around Y axis, in the size of φ (Yaw).(1)

The Definition of Point of View
For enforcing compliance stereo, the left image, as the original image is considered.Finally, the resulting difference is calculated for each pixel on the left image, the depth mapping provides for us.Depth mapping can be turned into three-dimensional map.Three-dimensional reconstruction to the process of obtaining the three-dimensional depth of the mapping is called.If having depth mapping, Reconstruction and a few very simple mathematical operation is simple.Tailored to the needs of problem to obtain the point of view of the center of the plate of cars can be used in two images.To do this work must be done in the image a plaque identifying.Assume that the resulting image from one camera to be as fig ( 4).First color image is converted to gray figure ( 5), then at this stage there are two strategies edge detection or filter fig ( 6).The next step is gradually analysis figure (7) and smoothing figure (8) and at the end streamline and finally extracting the center of the plate in the camera coordinate system (9).First, calibration process and results have been presented, the results of aligning images recorded by the camera.In addition, the production of three-dimensional points and estimating the distance from the vehicle in front is expressed.

Calibration
To run the calibration process the toolbox that has been designed in MATLAB be used.For perform this task, first images of a specific model should be prepared for calibration.The images by the camera, from a checkerboard pattern, has been prepared.Since the calibration process, corners location, very accurate calibration is effective, all images were prepared with dimensions of 640 x 480 pixels.Obviously, because the camera matrix based on the number of pixels is formed, by changing the resolution in order to increase processing speed, a coefficient of proportionality can be used for internal matrix.Since the camera will not move relative to each other, this calibration will be maintained until the appropriate time.For stereo and single camera calibration can be performed simultaneously, images provide of checkered pattern in pairs and have been coordinated after the calibration of each of the cameras, stereo calibration structure is designed also took place.
For calibration camera images taken from Caltech (Bouguet, 2010).After performing all phases of each camera calibration in accordance with the instructions provided in the toolbox used with the images that provided for each camera, obtained results are as follows.

Estimating the Distance
Based on equations which are derived in the Stereo Vision crossover method with era a camera around Y axis, the results are obtained.It should be noted that the initial estimated due to the lack of appropriate structures and fixed cameras and lack of internal parameters estimation error was about 60 cm that after structural optimization for better facing camera and ensure that the change camera angles and estimating internal parameters by trial and error, after many tests, we were able to accurately estimate an average of 20 inches possible.It should be noted at closer distances due to the better camera resolution, accuracy reaches to 10 centimeters and vice versa with distancing more car from the cameras, for example, the top 5 m, this error close to 30 cm.However, due to the application is considered by applying an estimator distance traffic do not need to estimate distances greater than 5 meters.

Simulation and Evaluation of Proposed Method
Sample test in laboratory conditions are proposed in figure (21):

Full Test Sample of Program Execution
In this position the following stages are performed.
A) First the left camera started taking pictures and then the right camera starts.
B) In the next step photos taken by the left camera were processed and then the right camera image is processed.
C) At this point the middle of the plate in both photos and the distance between the two vehicles is determined.

Results Table
The following table is a sample of the various tests in various conditions according to the results that can be realized the ambient lighting conditions in gap detection and fault tolerance is very impressive, can be found that even moving in a horizontal orientation is also effective in detecting distance.

Conclusion
The equations were derived for Stereo Vision crossover method with era a camera around X axis, the results are obtained.It should be noted at the initial estimated.Because of problems in the structure and dynamics of the appropriate camera and lack of internal parameters estimation error was about 60 cm.After optimization of the structure to stabilize the camera better and ensure that the change camera angles and internal parameters after much trial and error method of testing able to accurately estimate an average of 20 inches possible.it should be noted at closer distances Because of the better resolution camera resolution reaches up to 10 cm and, in contrast with most cars away from the camera For example, this error is higher than 5 meters and 30 centimeters closer together.However, due to the application is considered by applying an estimator distance traffic we do not need to estimate distances greater than 5 meters.

Calibration Results of the Left Camera before the Optimization
Focal Length: fc = [875.59972 871.44235]Principal point: cc = [341.08578 196.17768 ]

Figure 3 .
Figure 3. right camera's era around Y axis As a result, the three-dimensional coordinates obtained from the following relationships.

Figure 4 .Figure 5 Figure 9 .
Figure 4.The original image input to detect plaques cycle

Figure 10 .
Figure 10.The relationship between image and camera coordinate system

Figure 13 .
Figure 13.Images used for the calibration of the left camera

Figure 21 .
Figure 21.Tests on special plaque in laboratory condition

Figure 22 .
Figure 22.Tests on plate with the angle Figure 23.Photo of left camera and the processing performed on it

Table 1 .
Specifications of Camera

Table 2 .
Specifications and size of the designed structure

Table 3 .
The specifications of images that generated for each camera calibration

Table 4 .
The results of the actions of the different tests in various conditions