Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

International Journal of Computer Science and Information Security (IJCSIS),

Vol. 13, No. 9, September 2015

VEHICLE SEGMENTATION USING K-MEANS WITH FUZZY LOGIC

1
Shakila basher, 2Purushothaman S., and 3Rajeswari P.
1
Research Scholar, Department of MCA, VELS University, Chennai, India.
2
Associate Professor,
3
Lecturer, Department of Electrical and Computer Science Engineering,
23
Institute of Technology, Haramaya University, DireDawa, Ethiopia

Abstract:
This paper presents methods for vehicle segmentation. The camera can be fixed or moving which can
be used to capture the moving vehicle. During this process, the orientation of the vehicle captured can be in any
direction. Many segmentation methods available. However, K-Means with Fuzzy logic can be still more
appropriate in segmenting the vehicles moving on the road.

1. Introduction
Vehicle segmentation is an important process in the image processing domain. Only after proper
segmentation of the vehicle from the road and other sceneries background, the segmented image can be further
used for template matching, tracking and identifying the type of vehicle.
Kong, 1998, implement the motion segmentation algorithm based on Galilean wavelets. These wavelets behave
as matched filters and perform minimum mean-squared error estimations of velocity, orientation, scale and
spatio-temporal positions. This information is finally used for tracking and segmenting the objects. They
claimed that the algorithm is robust, it can deal with temporary occlusions and by tuning a threshold it can
estimate the number of moving objects in the scene.
Tsai et al, 2007, implement a color transform model to detect vehicles using color and edges. The color
transform model identifies the pixels from the background and the corner, edge map. The wavelet transforms
construct an cascade multichannel classifier. This approach eliminates most background pixels in advance to
make easy to detect the vehicles.
Chen, 2006, exploit the wavelet decomposition in order to reduce the typical noise problem of image difference
based approaches. The image difference is computed on the low frequency sub-image of the third level of the
discrete wavelet transform (DWT). On the extracted blobs they perform morphological operations and extract
the color and some spatial information. Each blob is associated with a descriptor that is used to track the objects
through the sequence.
Ahad Karimi Moridani et al., 2015, present a powerful algorithm of computer vision methods to traffic flow
monitoring, vehicle detection and traffic analysis, which intend to develop the vehicle count system using an
image processing technique in CCTV video outputs. This software-based vehicle counter can detect all vehicles
through images instead of using expensive electronic sensors or cameras embedded in the sidewalks. This
system processes captured video, detects vehicles in each frame, classifies the vehicles into four types and
counts all of them, all by image/video processing techniques.

72 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 13, No. 9, September 2015

2. Problem statement
Many image processing techniques still find difficulties in segmentation of images. The segmentation is
becomes clear only when the image is taken in a controlled condition. However, in case of vehicle tracking,
there is no controlled condition of lighting, and hence a clear image is always a difficult job. It is difficult task to
segment such image clearly.

3. System setup
a. Acquire image
b. Create contrast in the image
c. Segment the image using K-Means with Fuzzy Logic
d. Compare with the template and identify the type of vehicle.

4. Description and Results


a) Acquiring image: Image has to be acquired with good quality camera. The various information in the image
has to be separated from the background of the image. In order to achieve this, there should be a clear contrast
among objects against the background in the image. Mostly a clear contrast does not present in the image.
Hence, contrast has to be created in the image.
b) Contrast: A contrast in the image can be changed by first obtaining the histogram of the image horizontally
and vertically.
a. 250

200

150

100

50

0 50 100 150 200 250

b. 5000

4500

4000

3500

3000

2500

2000

1500

1000

500

0 50 100 150 200 250

73 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 13, No. 9, September 2015

In the table shown the first row has an image with good contrast where in the vehicle object is clearly visible
against the background. The histogram image is properly bell shaped and the major portion of the histogram is
cantered. However for the image shown in the second row, the image is not having good contrast. Hence the
corresponding histogram has three locations where the intensities are concentrated. This has to be contrast
enhanced so that, the objects are clearly visible against the background. The image is contrast adjusted and
presented in the third row. The corresponding change in the histogram is shown.

C) K-means algorithm

Fig.1 K-Means algorithm


K-Means is a statistical method that uses distance concept in clustering group of adjacent pixels with
very close similar intensity values. In general, the intensity values and their pixel locations are considered for
grouping. A manual centre initialization procedure is used for segmenting the image. Only when the number of
group of objects and the object centres are clearly known in advance, then a better segmentation can be
achieved.

D) Fuzzy logic with K-Means (FLKM)


Vehicle images have different brightness and contrast and different clarity. These variations are
considered to be fuzzy and hence, the pixels representing the objects are considered fuzzy. Hence, fuzzy logic
with K-Means has been combined to segment the image.
Fuzzy Logic (FL) is a multi-valued logic that allows intermediate values to be defined between
conventional evaluations like true/false, yes/no, high/low. Fuzzy systems are an alternative to traditional notions
of set membership and logic.
The training and testing fuzzy logic with K-Means is to map the input pattern with target output data.
For this, the inbuilt function has to prepare membership table and finally a set of number is stored. During
testing, the membership function is used to test the pattern.
Figure 2 presents a schematic architecture for training and testing FLK-Means or segmenting a texture
image. Training FLKM involves inputting feature patterns from CC and target values for segmenting texture
image. The sugeno type inference system available in the Matlab software generates inference rules using
subtractive clustering. The final sets of trained values are stored in a file. In the testing process of FLKM, the
image is input to FLKM module. The final weights are processed with features and an output is obtained. This
output is compared with a threshold to assign segmentation values to the image.
Training FLKM
Step 1: Input the k-Means segmented image.
Step 2: Create Fuzzy membership function.

74 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 13, No. 9, September 2015

Step 3: Create clustering using K-Means algorithm.


Step 4: Process with target values.
Step 5: Obtain final weights.
Testing FLKM for texture segmentation
Step 1: Input the k-Means segmented image.
Step 2: Process with Fuzzy membership function.
Step 3: Find the cluster to which the pattern belongs.
Step 4: Obtain estimated target values.
Step 5: Segment the image
RADII specifies the range of influence of the cluster centre for each input and output dimension, assuming the
data falls within a unit hyperbox (range [0 1]). Specifying a smaller cluster radius will usually yield more,
smaller clusters in the data, and hence more rules. When RADII is a scalar it is applied to all input and output
dimensions.

Fig.2a Training and Testing FLKM for segmenting the image

75 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 13, No. 9, September 2015

Fig.2b Training and Testing FLKM for segmenting the image

input FCKM segmented image

Fig.3 Uncontrasted image segmented

input FCKM segmented image

Fig.4 Contrasted image segmented


Figure 3 shows the vehicle image ( less contrast) segmented by FCKM. There is no clear visibility of the vehicle
in the segmented image. Figure 4 presents the well contrasted image. The segmented image shows the presence
of a vehicle.

76 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 13, No. 9, September 2015

5. Conclusion
This paper presents methods of normalizing and segmenting vehicle images with better clarity. K-
Means algorithm is used for initial segmentation of the vehicle image. Subsequently, the segmented image is
input to the Fuzzy logic module for getting the final segmented image. From the segmented image, the presence
of a vehicle is identified using template matching.

References
[1] Ahad Karimi Moridani, et al., 2015, Vehicle Detection and Tracking in Roadway Traffic Analysis
using Kalman Filter, International Journal of Imaging and Robotics, Vol,15; Issue No.2,
[2] Chen C.E., Wang H., Ali A., Hudson R.E., and Yao K., 2006, Particle filtering approach to localization
and tracking of a moving acoustic source in a reverberant room, IEEE, pp.849-852.
[3] Kong M., Leduc J.P., Ghosh B., and Wickerhauser V., 1998, Spatio-temporal continuous wavelet
transforms for motion-based segmentation in real image sequences, Proceedings of the International
Conference on Image Processing, Vol.2, pp.662-666.
[4] Tsai L.W., Hsieh J.W., and Fan K.C., 2007, Vehicle detection using normalized color and edge map,
IEEE Transactions on Image Processing, Vol.16, No.3, pp.850–864.

77 http://sites.google.com/site/ijcsis/
ISSN 1947-5500

You might also like