Partial Erosion-Based Feature Extraction Approach for Plastic Bottle Shape Classification

In order to utilize or to extract the shape information of objects in an image for recognition, classification or retrieval, a method for representing a shape is needed. In this paper, a work on representing plastic bottle shape using morphological based approach for an automated classification is reported. Morphological operations are used to describe the structure or form of an image. There are three primary morphological functions: erosion, dilation, and hit-or-miss. By using the two-dimensional description of plastic bottle silhouettes, we perform edge detection of the object silhouette followed by the erosion process. This work will compare two versions of erosion which are regular erosion, the matlab function imerode and the improved version of erosion which is called partial erosion. The erosion technique involves defining a set of flat and linear structuring elements and specifying the angle at 1 apart to obtain the maximum number of elements of 180 degrees. This is followed by a normalization procedure in which we divide the sum pixel value after erosion by the sum pixel of the whole silhouette. The normalized values are grouped into histograms of 9 bins and find the maximum number of the 9 histogram bin of sum pixel value (9HbSPV) obtained forms a set of feature set and is then used as inputs to train a neural network for plastic bottle shape classification. Both feature sets from the two types of erosion were tested on their uniqueness to represent the shape. Results obtained showed that the proposed feature extraction method can be applied to discriminate plastic bottles according to shape, either slim or broad bottles, efficiently.


Introduction
Image classification is an active area of research with many applications, including object recognition for sorting, content-based image retrieval, and surveillance.Images can be classified based on the presence of a specific object or on certain global properties of object patterns present in the image.Size and shape descriptors are computed from the contour or the area of the objects.Often, these descriptors require considerable computing time.Even worse, many of them are not scale and rotation invariant, which further complicates processing.Object contours contain detailed information about the shape of objects.In many cases, it is possible, given an object, to determine the parts that compose a shape, identify their local orientation and rough aspect ratio, and detect convex and concave sections of the boundaries.When an object is sufficiently detailed, people can readily identify the object or judge its similarity to other shapes (see examples in Figure 1-imej botol).Computer vision systems may use similar information to classify objects.Silhouettes may be available to these systems as a result of segmentation.Simple thresholding can be applied in applications involving fairly isolated objects, such as objects placed on a conveyer belt or characters in a document.
In this work, we propose a new approach to classify plastic bottle shape by implementing the viability of imaging technology for automated sorting.Automated plastic bottle sorting systems always employ a detection system or a combination of detection systems to identify the types of plastic recyclable.In shape based sorting activities, which involve massive amount of plastic bottles, the shapes of the bottles can vary enormously.For the purposes of this initial study, plastic bottle were identified and classified into two main classes of bottle shape which are slim and broad shape class.In view of that, a study has been proposed to determine the viability of using computer vision for automated classification of plastic bottles based on shape properties of a single object, or on patterns of objects present in the image.Previously, plastic sorting or classification has been based on the type of material used -(3).This procedure can be considered as two stages; a) a feature vector is extracted from the analysis of partial erosion based technique and structure element used, and b) a classification technique is applied to that input vector in order to provide a meaningful categorization of the data content.

Previous Works
A common task in computer vision is to recognize and classify the input images accordingly.To do this, most computer vision systems start with the extraction of edges as primitives of pictures (Marr's primal sketch).Alessandra and Loris (M.I. Rajab, M. S. Woolfson & S. P. Morgan, 2004) suggested that the edge-based structural features be employed in their work in order to capture the luminance information carried by the edge map of an image.Specifically, they utilized the edge direction histogram (EDH) to characterize the structural and texture information of each block, similar to that of Jain and Vailaya (Maragos P., 1996).The Canny edge detector Canny (H.Tang, et al., 2000) was used to extract the edges in an image.In the experiments, Jain and Vailaya (Maragos P., 1996) used a total of 37 bins to represent the edge direction histogram in which 36 bins represented the count of edge points of each block with edge directions quantized at 10_ intervals, and the last bin represents the count of the number of pixels that do not contribute to an edge.Wang and Zhang (J.Serra, 1982) extracted edge-based structural features and color moment features.These two sources of information are incorporated into a recognition system in order to provide complimentary information for robust image orientation detection.Support vector machines (SVMs) based classifiers were utilized for recognition.In Lee et al. (1987) the author proposed an automated method based on the boosting algorithm to estimate image orientation.A more recent work is by Neetanain et al., (2002) where they presented a novel method for edge and corner detection in images.The approach involved extracting edges of the input image using morphological operator and then sending it for Chain Encoding.However, up to today no such work relating to plastic bottles classification has been reported.Therefore, this paper intends to discuss and present details relating to the development of a classification algorithm for plastic bottle based on a shape characteristic analysis.In this work a new morphological edge detector have proposed in which returns a one pixel thick m-connected binary boundary image.All the shape representation techniques described above adopted the feature based approach which has proven to be effective in their target applications.As such, we have adopted the feature based approach to represent the shape of plastic bottles using TMBA and produced a set of feature vectors for representing the 2D bottle silhouette known as the maximum of 9HbSPV, short for 9 histogram bin of sum pixel value.

Methodology
There are many types of bottle shapes available and classifying bottles according to shape can be a very complex and difficult task.For that reason, this work will only focus on categorizing the bottles as general as possible by classifying them in two different classes namely the slim and broad bottle classes.This will lead us to focus only on the 2-categorical pattern recognition task.In describing the image classification system, we distinguished between three different operations of preprocessing, feature extraction and classification.Preprocessing is performed to normalize and standardize the images used.Feature extraction section discusses the proposed MTBA algorithm for plastic bottle shape consists of two type of erosion process, regular and partial erosion.The two algorithms will derive feature vectors for the classification task.The proposed MTBA algorithm for plastic bottle shape is summarized below: The goal of digital image pre-processing is to increase both the accuracy and the interpretability of the digital data during the image processing phase.To obtain the 9SHbSPV set of feature vectors, plastic bottle image has to go through the pre-processing stage.The image pre-processor module performs the following operations: image filtering, thresholding and edge detection process.Image filtering will filter all the noise due to lighting and also perform background subtraction.Thresholding is a non-linear operation that converts a gray-scale image into a binary image where the two levels are assigned to pixels that are below or above the specified threshold value.Upon obtaining the plastic bottle silhouette, the edges of the silhouette need to be computed.

Feature Extraction
In pattern recognition and in image processing, feature extraction is a special form of dimensionality reduction.When the input data to an algorithm is too large to be processed and it is suspected to be notoriously redundant (much data, but not much information) then the input data will be transformed into a reduced representation set of features (also named features vector).Transforming the input data into the set of features is called features extraction.If the features extracted are carefully chosen it is expected that the features set will extract the relevant information from the input data in order to perform the desired task using this reduced representation instead of the full size input.Feature extraction involves simplifying the amount of resources required to describe a large set of data accurately.Morphological operation and erosion process are the two main techniques involved and will discuss detailed on the next section.

Morphological Operation
Mathematical morphology is a new mathematical theory which can be used to process and analyze the images (Maragos P., 1996;Ortiz F. & Torres F. 2004;Jing X. J., Yu N. & Shang Y., 2004;Richard A. P., 2004;Chen T., et al., 2002;Rivest J., 2004).In the mathematical morphology theory, images are treated as sets, and morphological transformations which derived from Minkowski addition and subtraction are defined to extract features in images.Mathematical morphology is developed from set theory.It was introduced by Matheron (J.Serra, 1982) as a technique for analyzing geometric structure of metallic and geologic samples.It was extended to image analysis by Serra (J.Serra, 1982).Based on set theory, mathematical morphology is a very important theory, whose operation must be defined by set arithmetic.Therefore, the image which will be processed by mathematical morphology theory must be changed into a set.Mathematical morphology uses structuring element, which is characteristics of certain structure and feature, to measure the shape of image and then carry out image processing.Based on a set theory, mathematical morphology is the operation which transforms one set to another.The aim of this transformation is to search the special set structure of original set.The transformed set includes the information of the special set structure and the transformation is realized by special structuring element.Therefore, the result is correlative to some characteristics of structuring element.The basic mathematical morphological operators are dilation and erosion and the other morphological operations are the synthesization of the two basic operations such as opening and closing.Erosion is a transformation of shrinking, which decreases the binary value of the image, while dilation is a transformation of expanding, which increases the binary value of the image.Erosion filters the inner image while dilation filters the outer image.

Erosion Process
Erosion of a binary image A by structure element B, denoted by A Ө B, is defined as: Which, in words, says that the erosion of A by B is the set of all points p such that B, translated by p, is contained in A. Example below shows the effect of erosion process using 3 x 3 square structuring element.
The structuring element is sometimes called the kernel.It consists of a pattern specified as the coordinates of a number of discrete points relative to some origin.Example of structuring element se=strel ('line', 10, 45), which define flat structuring element object consist of seven neighbors are: A flat, linear structuring element, where '10' specifies the length, and 45o specifies the angle (in degrees) of the line, as measured in a counterclockwise direction from the horizontal axis.
This work proposed an algorithm that selects appropriate structuring element of the processed image and makes use morphological operator such as erosion operation to extract useful features for classification.In the process, erosion operation reflects the relation between the processed image and the selection of structuring element decides the effect and precision and the result.Therefore, the keys of morphological operation can be generalized for the design of morphological filter structure and the selection of structuring element.Commonly morphological operation is used as segmentation tools for image but here proposed an improved version of the erosion operation that we call partial erosion.This type of erosion will give a few partial operations which can be set at 100% or 50% effect of the erosion process.In the feature extraction module, linear structuring element was implemented using the strel defined function; SE=strel('line',LEN,DEG).( 7).This function creates a flat, linear structuring element, where LEN specifies the length, and DEG specifies the angle (in degrees) of the line, as measured in a counter-clock wise direction from the horizontal axis.Partial erosion also changed the position of the kernel.Here the kernel will be the first in the structuring element.LEN is approximately the distance between the first element of structuring element members and its neighbor.
In the experiment, the angle according to every 1 o to 180 o to get a maximum number of pixel value that can occur after the erosion process is specified.Two different size of structuring element, of LEN by setting it to 5 and 10 is tested.By using the predefined structuring element the image edges were eroded and the sum of all the pixels that exist after the erosion process is computed.This procedure yields 180 elements of sum-pixel values that represent each angle at 1 o apart.Next, the results are normalized by dividing the sum pixel obtained after erosion with the sum pixel of the whole silhouette.To derive the feature vector, the normalized values are grouped into histograms of 9 bins of sum pixel values.Maximum number of 9SHbSPV is used as the feature vector in classification task.

Classification
A popular classifier, which can be applied to supervise and un-supervise classification are artificial neural network (ANN).In a classification operation, perceptron training namely MLP will be involved.Training is accomplished by sending a given set of inputs through the network and comparing the results with a set of target outputs.If there is a difference between the actual and the target outputs, the weight are adjusted on the adaptive layer to produce a set of outputs closer to target values.From training, an output of '0' denotes the broad bottle type whereas a '+1' represents the slim bottle.In principle, MLP model permits the network to define more complex regions of feature space and thus perform much more precise feature recognition tasks.The multilayer feed-forward ANN model as shown in figure 1 was used.In general, the BP-MLP ANN architecture used in this work consists of input layer, one hidden layer and one output layer.The hidden layer consists of seven hidden nodes.The output layer has one output node only.During training process, 200 samples of plastic bottle images were introduced to the net, which consist of 100 broad and 100 slim bottles.All these samples were preprocessed and their features extracted and then presented to the net so that it can learn and recognize the patterns accordingly.The log sigmoid is used as the activation function at the output node where as the activation function of the hidden nodes is computed using linear transfer function.The simulation result of MLP can display two clusters of plastic bottle as shown in Table 2 below.

Results and Discussion
Objective of the algorithm developed is to check distribution of pixel on the bottle edge.A total collection of 500 images of plastic bottle constitutes the database to generate the input images.All these images are divided into two groups, slim and broad.In this work, the extracted partial-morphological based feature vectors are the maximum of 9HbSPV which were derived from the generated sum-pixel value after the erosion process.All the maximum value occurred on 90 o since all the bottle images is in the same position.Initial result shows that maximum value for broad bottle is smaller than maximum value of the slim bottle.The reason for this, broad bottle have consistent shape between 90 o and 180 o compared to slim bottle.Details are showed in Figure 1 below.
As can be seen, all the extracted feature vectors are the maximum of 9HbSPV which were derived from the generated sum-pixel value after the erosion process.These feature vectors will compared based on length of structuring element and effect of partial and regular erosion.

a) Length of structuring element
A few tests were done to check the optimum length of structuring element for the bottle images.The length to be equal to 5 and 10 were compared.

b) Effect of partial and regular erosion
Regular erosion is the erosion effect using matlab function, imerode.Imerode function, will erode whatever pixel which is suitable to the structuring element.Effect of the tolerant erosion can be set whether equal to 50% or 100%.No erosion effect will be displayed on an image if the effect is less than 50%.More than 100% will worsen the image and all edges will be deleted.
Based on training and testing of the features set using MLP neural network, the following results were obtained and showed in Table 2 below.
From the result, the best feature set to be adopted for plastic bottle shape using partial morphological-based approach is partial erosion with a line equal to 10 and a percent equal to 50% can be concluded.The line equal to 10 is the optimum length suitable to define the shape of the plastic bottle.Partial erosion equal to 50% is the optimal effect that can be applied to define shape of the plastic bottle.

Conclusion
This paper has presented a novel feature extraction (FE) of image processing method to represent images of plastic bottles for classification according to their plastic bottle shape.This work compares regular erosion using matlab function imerode and improved version of erosion which is called partial erosion.Partial erosion algorithm is more robust by giving a choice in setting the erosion effect to the image.


RGB to Binary image conversion  getting image's silhouette  compute sum-pixel value of the image's silhouette: A  getting image's edge  Defining structuring element  SE = strel('line',LEN,DEG) -flat and linear structuring element. Test on a few type of LEN = 3 or 5 or 10  Apply morphological operation -erosion process on image's edge  Apply partial erosion effect at 50% or 100%  Apply regular erosion -using imerode function from MATLAB  compute sum-pixel value after erosion for every 0 o to 180 o  change to 9 histogram bin -every (0 o to 36 o ):B  normalization: divide B/A  find maximum number of 9 histogram bin sum pixel value. save data /*repeat loop for all image*/ -end -generate 9 feature vectors for every image STOP 3.1 Pre-Processing

Table 2 .
Classification result