2-Dimentional Object Extraction by using Color feature and KNN Classification

DOI : 10.17577/IJERTV3IS100954

Download Full-Text PDF Cite this Publication

Text Only Version

2-Dimentional Object Extraction by using Color feature and KNN Classification

K. Eranna

M.Tech. Dept. Of ECE Madanapalle Institute of Technology and Science,

Madanapalle, Andhra Pradesh, India.

D. Girishkumar

M.Tech. Assistant professor.Dept.Of ECE Madanapalle Institute of Technology and Science, Madanapalle, Andhra Pradesh, India.

Abstract- In the present day technology extraction of two dimensional shapes of objects is important task. It plays a vital role in robotics, medicine, automatic driving vehicle, navigation systems and military applications. Many methods are there for identifying the objects and it is the one of the method for identifying objects by using KNN algorithm. This method includes three steps 1.color segmentation 2.By using region props find out the each object parameters, 3. KNN Classification fit algorithm. In the color segmentation the image segmented based on particular threshold value of color, from the extracted color objects for extracting the particular shape of object by using the KNN Classification fit algorithm.

Keywords: Color segmentation, Region props, and KNN Classification fit algorithm.


      Image processing plays important role in the robotics, navigation system, medicine, military, material science, film industry, printing industry, computer vision task…etc. The image processing steps are image acquisition, image restoration, image enhancement, image compression, image segmentation, image representation and object extraction. Object extraction is one of the major area in the advanced automated technology. It is the one of the difficult task in the image processing. Object extraction is the process of extracting the object from the processed image by using different techniques. The object extraction applications are for identifying the object, disease detection, satellite image object extraction, similarity measure, robotics, military applications.

      Object database

      Object extracted from the image by using color and KNN Classication fit algorithm. In the first step identify the objects by using color segmentation. But the extracted image contains different shapes of objects. So for particular object extraction KNN Classification fit algorithm used.

      Second step:

      a).Extract the constraint of color objects from original image.

      b).Measure the each object Eccentricity, Extent, Euler number, Orientation and Solidity.

      c).Predict particular shape of the object by using KNN Classification fit algorithm.

      For extracting the objects before going to algorithm collect the database (Eccentricity, Extent, Euler number, Orientation and Solidity) for some standard two dimensional objects. For colleting the database region props can be used. In this method Eccentricity, Extent, Euler number, Orientation and Solidity used as a database of each object.

      For collecting database first the input image converted into gray level image after the gray level image converted into binary image. By using region props measure require parameters. store the total database in the workspace. In this methodology for classifying purpose ClassificationKNN.fit algorithm used.

      Input image

      Color objects identification

      Region based segmentation

      KNN Classification algorithm


        In proposed method for object extraction uses color feature and K-Nearest Neighbor Algorithm for image classification. Algorithm consists of two parts:

        First step:

        a).Take the some standard objects database by using region props (the database is Eccentricity, Extent, Euler number, Orientation and Solidity.).

        Extracted objects

        Object shape identification

        Fig: Flowchart diagram for proposed algorithm

          1. Color objects extraction:

            The input image contains different objects with different colors. For direct classifying the objects difficult. So for this first extract same color objects. For extracting the same color objects region based segmentation used.

          2. Region based segmentation:


        Segmentation stats that the process of input image sub divided into constituent parts or objects that means original image divided into sub images based on application. The segmentation used to object identification, moving object detection, recognition purpose, traffic control systems, medical systems; machine vision .The image segmentation classifies two ways based pixel value changes:

        Region growing:

        Region based segmentation one of the technique in the image segmentation. In this method the original image segmented similarity based approach. In this methodology object extracted based on color means the same color objects extracted by using region based segmentation, because of this reduces the complexity in the object identification.

        2.2 Region props:

        Region props can be used to measure the properties of image by using region props get the information about the each object. In this step find every object properties. By using each object properties we should extract object easily.


        S=regionprops (l, properties)

        It can be used to measuring the required properties for each object.

        In this paper mainly five parameters are used the five parameters are Area, Extrema, Extent, Orientation,

        Solidity. 2.3KNNClassification: Classification:

        Classification is one important task in the object extraction. After extracting the features each object from the image classified the objects based features. Classification and segmentation closely related. But classification leads to segmentation, and vice versa. Classifying can be done by two ways

        1).Supervised classification

        2).Nonsupervised classification Supervised classification:

        Supervised classification does not require knowledge of any priori probability distribution functions and are based on resoning and heuristics. Decision tree classification and KNN classifications are example of supervised classification techniques.

        Nonsupervised classification:

        Nonsupervised classification attempt to identify clusters or groupings in the feature space. Similarity based approach classification is one of the Nonsupervised classification technique.

        KNN Classification (k nearest neighbors) is one of the technique for extracting object or pattern recognition. It is a nonparametric method. In this based on the majority vote of its neighbors the objects are classified. For single nearest neighbor k=1.k is always positive.


        KNN = ClassificationKNN.fit(X,Y) returns a KNN classification model for predictors X and class labels Y. X must be an N-by-P matrix of predictors with one row per observation and one column per predictor. Y must be an array of N class labels. Y can be a categorical array (nominal or ordinal), character array, logical vector, numeric vector, or cell array of strings. If Y is a character array, it must have one class label per row.

        KNN is a KNN classification model. If you use one of the following five options, KNN is of class Classification Partitioned Model: CrossVal, kfold, holdout, leaveout or cvpartition. Otherwise, KNN is of class ClassificationKNN.

        KNN=ClassificationKNN.fit(x,y,parm1,val1,par m2,val2) specifies optional parameter name/value pairs:

        Classification using K nearest neighbors:

        Classifying the objects by using k-nearest neighbors is simple way. In this technique first for classifying purpose standardized euclidean distance or euclidea distance used. Calculate the distance between the query data point and training dataset.

        Euclidean distance:

        dst 2 = (xs yt)(xs yt)

        Standardized Euclidean distance:

        dst 2 = (xs yt)V1(xs yt)

        The query point data match or nearest with training dataset then nearest (minimum distance) object extracted.

      2. RESULTS

        Tes t ima ges

        Total no. Of object s

        Color base extract ed

        Extract ed Color (%)

        Shape base objects extracted

        Extracte d true shape object
































        Input image:

        Output cyan color objects

        Extracted output image:

        Maganta color objects:

        Extracted circle:

        Extracted square:

        Example 2:Input image

        Yellow color objects:

        Extracted triangle:

        Example 3:Input image

        Green color objects:

        Extracted circular objects:

        Rectangular objects:

        Square objects:

        Red color objects:

        Extracted individual object: Square objects:

        Rectangular objects:

        Circular object:


2-dimensional Object was extracted by using color feature and KNN classification. The algorithm is simple and effective. It gives the satisfactory results comparative in the previous methods. In this the object extracted without knowing the image database. So complexity decreases.


[1].D. Chitra, T. Manigandan, N.Devarajan Shape Matching and Object Recognition Using Dissimilarity Measures with Hungarian Algorithm. Proceedings of IcoMMS 11-13 October 2009, Batu Firranghi, Penang, MLASIYA.

[2].Y. Raghavender Rao, Nikhil Prathapani, E.Nagabhooshanam Application of normalized cross correlation to image registration image correspondence and registration. Vol-03,sacial issue:05- may-2014,NCEITCS-2014.

[3].Bhavya R , VijayV Edge Detection and Object Extraction Using Unbalanced Weights for Foreground and Background Edges. Volume 2,issue 12 December 2012,ISSN 2250-3153.

[4].Shikha Garg, Gianetan Singh Sekhon Shape Analysis and Recognition Based on Over segmentation Technique.Volume- 1,Issue-3,August2012,ISSN:2277-3878.

[5]. Sanket Reg, Rajendra Memane, Mihir Phatak, Parag Agarwal Geometric Shape and Color Recognition using digital image processing. Vol-2,Issue-6, june 2013,ISSN: 2278-8875

[6]. Ms. Pragati ashok deole, prof. rushi longadge Content based image retrieval using color feature extraction with knn classification. Volune-3,Issue-5, May 2014, pg.1274-1280.

[7]. Machine learning for function approximation using Radial Basis Functions (RBF) is adapted to the task, which shows a significant improvement over the naive method.

Leave a Reply