This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
Vehicle detection and classification of vehicles play an important role in decision making for the purpose of traffic control and management. In this paper we propose a novel and efficient algorithm based on image processing using aerial cameras for vehicle detection and classification especially in highways. The algorithm is mainly based on a sequence of morphological methods being applied on an image taken by an aerial camera of a road segment. The algorithm also uses thresholding and edge detection techniques for vehicle detection. Experiments are carried out over a wide range of vehicles, road segments and camera heights. A success rate of more than 85% and proper vehicle classification is achieved.
Image processing plays an important role in various real time applications ranging from medical imaging to pattern and object recognition for different purposes. One such application is object detection of mobile targets in a particular environment . Vehicle detection on roads is an example of such object detection which is used for traffic analysis, monitor and control. Hence, an initial step for traffic controlling is vehicle detection and classification using traffic measuring techniques. Image processing based techniques are one of the most widely used techniques which achieve this objective. Many algorithms have been proposed connected with vehicle detection and classification. In , image segmentation and edge detection methods are employed. In , background extraction and estimation techniques are used to isolate the vehicles of interest. Similarly vehicle detection can be achieved with the help of vehicle shadows . This approach becomes difficult if shadows of other objects like overhead bridges overlap with the shadows of vehicles. Morphological process can also be used for vehicle classification. Classification of vehicles based on their sizes or shapes plays an importation role in traffic management and flow control . Irrespective of the algorithm or technique being employed, camera positioning and the quality of camera play an important and critical role in vehicle detection. High altitude aerial camera is an example of camera positioning which is often used due to its wide area coverage .
In our paper, we have proposed a technique through which the vehicles are detected and classified based on their sizes. The algorithm is based on sequence of morphological steps, image differencing and thresholding. The experiments are carried out on frames (still images) of road segments using near vertical positioned cameras. Using the proposed algorithm, a success rate of more than 85% is achieved.
Rest of the paper is organized as follows: in section 2, brief descriptions of the experimental scenario along with the initial preprocessing steps are discussed. In section 3, the actual algorithm based on edge detection and morphological process is proposed along with vehicle classification. Finally conclusion is given in section 4.
2. Pre-processing algorithm
As indicated in the previous section, camera position plays an important role in vehicle detection process. In our case, as we are concerned with the counting and classification of vehicles on road vertical or near vertical camera position is chosen to cover the whole region of interest. Some camera positions and the corresponding images taken by these locations are shown in Figure 1.
Video cameras are used to monitor a road for a specific duration. The obtained video is broken into frames at fixed intervals. The resultant images are processed individually to obtain information regarding the number of vehicles and their classification at a particular instant of time. Figure 2 shows a block diagram of the proposed system for vehicle detection and classification.
The frames are passed through two phases, pre-processing phase and then vehicle extraction phase.
Figure 1. Camera position from different heights
Figure 2. Camera position from different heights
The flow diagram of pre-processing is shown in Fig. 3(a). The steps are as follows: for a particular road segment on which we want to detect vehicles, two images are taken, one without vehicles and the other with vehicles. We call the former image the reference image and the latter one the current image. Both images are converted into grayscale images as shown in Figure 4 (a,b). A mask is used on both images to isolate region of interest (i.e. roads on which the vehicles are located) and remove unwanted details (e.g. paths and fixed objects). A mask and an image with mask being applied on are shown in Figure 4 (c,d). Both these images are displayed as binary images since applying a mask is done as binary operation. To convert both images into binary forms, a series of thresholding is applied on both images. The threshold value is chosen properly according to the brightness of the image to be processed. The threshold factor can be chosen with the help of histogram characteristic of an image. A series of thresholding is applied one after the other on both images which results in multiple binary images. The addition of all the images gives a complete refined binary image. This process is shown in Figure 5 and the obtained images are shown in Figure 6. Four threshold values are used: 0.2, 0.4, 0.6 and 0.8 respectively. Figure 6 (e) shows the resultant image after the addition of all threshold images. After applying the mask on both images, image differencing takes place which is followed by filtering the resultant image using a median filter to remove noise generated by image differencing. Finally this image is fed into the vehicle detection system and further classified. The final output image obtained from the pre processing system is shown in Figure 7.
Figure 3. Flow diagram of the system: (a) Pre-processing and (b) Vehicle detection
Figure 4. (a) Gray scale reference image (b) Gray scale current image (c) Mask (d) Mask applied on current image
Figure 5. Series of image thresholding using different threshold factors
Figure 6. (a) to (d) Series thresholding sub-images (e) Addition of all sub-images
Figure 7. Output of the pre-processing algorithm
3. Vehicle detection algorithm
In this section the actual processing for vehicle detection is performed. The steps are shown in Figure 3 (b) as follows: first, edge detection is applied on the image obtained from the preprocessed algorithm as shown in Figure 8 (a). The reason for using edge detection technique is to obtain contour of the vehicles. We have used the â€˜Sobelâ€™ edge detection to create minimum number of edges as our goal is to have the outer edges of the vehicle since the inner edges are irrelevant for overall vehicle detection . Second, series of linear binary morphological dilations in three directions horizontally, vertically and through 45 degrees are performed. The result of the three dilations is shown in Figure 8 (b). It is obvious that the vehicles are becoming more prominent but at the same time, some noise objects are becoming larger. Hence these unwanted objects can give false detection. Furthermore, binary filling of the holes is performed as shown in Figure 8 (c). Holes are defined as a set of background pixels that cannot be reached by filling in the background from the edge of image. Note that the unwanted small objects did not increase in size as result of the filling operation. In order to reduce the complexity of algorithm, those objects touching the border of the image are removed as shown in Fig 8(d).
Figure 8. (a) Edge detection (b) First dilation (c) Filling (d) Border object removal (e) Second dilation (f) Opening
In some cases, when a single vehicle is broken into adjacent parts due to the previous processing steps, it is required to connect them otherwise they could be detected as separate vehicles and gives false detection. Thus, a second level dilation ensures the connectivity of such disconnected parts. The structure element used for this dilation is the diamond structure which is one of the most efficient structures in morphological dilation and erosion. The affect of this dilation is evident another frame shown in Figure 9. The blue bus on the extreme right lane in Figure 9 (a) has black roof at three different places. Before applying the second level of dilation as indicated by Figure 9 (b), the bus is divided into three parts. Clearly after applying the second level dilation as shown in Figure 9 (c), these parts are connected as a single vehicle. Although the second level dilations results in an increase of size of the unwanted objects, the proportion of increase in the size of target vehicles and unwanted objects is same. Hence unwanted objects could be easily detected.
Figure 9. (a) Original image (b) Before applying second level dilation (c) After applying second level dilation
The operation we have used to remove small unwanted objects is the binary open operation based on the size of the objects. The range of sizes of such objects depends on the camera height. For different heights we have selected different opening sizes. Objects that are 8-connected neighborhood and having sizes smaller than the defined threshold are removed using binary opening. Figure 8 (e,f) shows the resultant images after the second level dilation and the removal of unwanted objects. At this point the vehicle objects are prominent without noise or unwanted objects and ready to be classified.
Vehicle classification process starts with isolating each object and reshaping it into a near polygon shape so that it reflects the actual vehicleâ€™s dimensions from an aerial camera. The objects are isolated using 8-connectivity neighborhood. Each detected object is assigned a label indicating the location of each vehicle. Further, the Convex Hull of each object is calculated and the objects are reshaped into near polygon shape. To perform classification, each vehicle type (e.g. small, medium and big) is assigned a measurement range of sizes. This measurement is based on the area and circumference of the vehicles. The object falling within any of these ranges will be classified as small, medium or big vehicle. The final result is shown in Figure 10 after detection and classification of the vehicles. The detected vehicles are indicated by rectangular boundaries around them.
In this paper, we have developed a novel algorithm for vehicle detection and classification based on image processing. By combining methods of thresholding, image differencing, edge detection and various morphological processes, the proposed algorithm gives a success rate of more than 85% in both vehicle detection and classification which in turn can be very useful for traffic analysis and management.
Figure 10. (a) Original image (b) Detected vehicles (c) Image obtained using the proposed algorithm