International Journal of Computer Science & Communication
Vol. 1, No. 2, July-December 2010, pp. 255-257
Vehicle Detection Using Image Processing and Fuzzy Logic
Isha Jain
& Babita Rani
Department of Electronics & Communication Engineering, B.M.I.E.T., Sonepat, IndiaEmail:
Vehicles moving on road are of importance because problems like traffic congestion, economic waste, jamming onthe underpasses and over-bridges (if the vehicle passing through is not of the permissible size) are associated withthem. These problems can be dealt with; by using various morphological processes based image processing techniquesto detect the vehicles. In this paper, the images of moving and still vehicles have been taken and an algorithm is usedfor vehicle detection which is based on image processing techniques and classification of vehicles in the form ofnatural description( in linguistic terms) based on fuzzy logic.
Thresholding, Sobel Edge Detection, Erosion, Dilation, Membership Function
Classification based on the sizes and shapes of vehiclesis very useful in traffic management [1]. Imageprocessing plays an important role in various real timeapplications ranging from medical imaging to patternand object recognition for different purposes [2].Thresholding and preprocessing steps are used as imagesegmentation techniques [3]. [4] It is proposed that edgedetection is an important step for vehicle typerecognition, especially Sobel Edge detection. Fuzzy logiccontrol is well suited for classification of vehicles becauseit is capable of making inferences even under uncertainty[5]. It assists rules generation and decision-making. Ituses set of linguistic Fuzzy rules to implement expertknowledge under various situations [6].
The various steps used in the present vehicle detectionand classification are discussed below:
2.1. Pre-processing
Reference image is the image taken once for the roadwithout vehicles on it where no traffic is present. Currentimage is the actual image on which we want to detectthe vehicles.
Gray Scale Conversion Using Thresholding 
a.Each pixel of a color sample has three numericalRGB components to present the color by three8-bit numbers for each pixel and thus three 8-bit bytes is called 24-bit color. But each pixel isonly stored as one 8-byte in gray-scale image,so gray scale conversion is done.b.A series of thresholding is applied one after theother on the reference and the current images.
A median filter is used to remove noise if present on thegenerated image. At this point the image is ready to befurther processed for vehicle detection after differencingand filtering.
2.2. Vehicle Detection Algorithm
Edge Detection 
Sobel edge detection technique is used to create minimumnumber of edges and to connect boundary of the vehicleto bring it to a proper shape since the inner edges areirrelevant.
Binary Dilations and Filling of Holes 
A series of linear binary morphological dilations areperformed in three directions, horizontally, vertically andthrough 45 degrees. The result is that the vehicles becomemore prominent but at the same time, some noise objectsbecome larger. Binary filling of the holes is performedbecause proper solid objects are needed for properclassification. Holes are a set of background pixels thatcannot be reached by filling in the background from theedge of the image. Unwanted small objects did notincrease in size as result of the filling operation.Sometimes, a
second level dilation
is also required toensure the connectivity of disconnected parts (if any) ofthe vehicles with the help of a diamond structuringelement, which is one of the most efficient structures inmorphological dilation and erosion.
International Journal of Computer Science & Communication (IJCSC)
Fig. 1: Designing Steps of the AlgorithmFig. 2: Reference and Current Image (Input to the Pre-processing Phase)
Binary Opening 
Binary open operation based on the size of the objects isused to remove small unwanted objects and the size ofsuch objects depends on the camera height.
2.3. Vehicle Classification
Isolation of Objects by Blob Analysis and Calculationof Convex Hull:
The vehicle classification startswith isolating each object and reshaping it intoa near polygon shape so that it reflects the actualvehicle’s dimensions from an aerial camera. TheConvex Hull of each object is calculated and theobjects are reshaped into near polygon shape andmore structured than they were before this step.b.
Classification based on Area and CircumferenceUsing Fuzzy Logic:
To perform classification,fuzzification of area and circumference is doneand each vehicle type (e.g. small, medium andbig) is assigned a measurement range of valuesby designing fuzzy rules and finallydefuzzification is done.
The work has been implemented using MATLABversion 7.6.0 (R2008a). There are srcinally 12 vehicles:2 small, 4 medium and 6 big. After cropping, the topsmall car is discarded as a result of touching theboundary of the image beside the medium car on theright side of the road.
Fig. 3: Output (a) Pre-processing ; ( b) Vehicle Detection Algorithm; (c) Vehicle Classification
Hence, the total number of remaining vehicles is 9: 1small, 2 medium and 5 big vehicles which are properlydetected and indicated using red, green and bluerectangular boxes around them for small, medium andbig vehicles respectively.
In this paper, we have developed an algorithmicapproach to vehicle detection and classificationusingfuzzy logic. This not only reduces the complexity of thesystem but enhances its use in the areas which are too
Vehicle Detection Using Image Processing and Fuzzy Logic
difficult to be detected by normal means. Further it isproposed that after detection objects can be classifiedusing techniques like neuro-fuzzy etc so as supervisedand unsupervised learning can be used to train thesystem. This algorithm can be applied on real timeprojects and further improvement can be the techniquesmentioned above.
[1]Gupte, S.; Masoud, O.; Martin, R.F.K.; Papanikolopoulos,N.P, “Detection and Classification of Vehicles”,
IEEETransactions on Intelligent Transportation Systems
, No.1, Mar 2002.[2]Hossain M. Julius, Dewan M. Ali Akber and CHAEOksam, “Moving Object Detection for Real Time VideoSurveillance: An Edge Based Approach”,
IEICETransactions on Communications
, No. 12.[3]Gonzales C. Rafael, Woods E. Richard, “Digital ImageProcessing”, 1998, Second Edition, Prentice HallPublications pp. 567–634.[4]Weihua Wang, “Reach on Sobel Operator for VehicleRecognition”,
in proc. IEEE
International Joint Conferenceon Artificial Intelligence 2009, July 2009, California, USA.[5]Alper PAHSA, Ankara University, Computer Eng.Dept.,” Morphological Image Processing with FuzzyLogic “.[6]Nedeljkovic, “Image Classification based on FuzzyLogic“, Map Soft Ltd, Zahumska 26 11000 Belgrade,Serbia and Montenegro.[7]Matlab,
of 3