Object Segmentation from Background of 2D Image

One of the difficult tasks in the image processing field and still not solved is segmentation of object from background of 2D image accurately. Therefore, a new method has been proposed for the purpose of segmenting the object from its background for the purpose of enhancing the images and obtains characteristics of the object without the rest of the region of the image. This process is important to provide optimal classification in the process of pattern recognition. Therefore, this paper proposed the method that includes several tasks, after loading the six files of images; this work applies the segmentation algorithm depending on the border and the color of the object. Finally, 2D median filtering algorithm was employed to remove noisy objects of various shapes and sizes. The algorithm was tested on variety images, and the results are high precision. In the other words, the proposed method is able to segment the objects from the background with promising results.


-Introduction
Before the application of any recognition technique, it requires some manipulation to the images. This process prepares the image and improves its quality in order to eliminate irrelevant information and to enhance the selection of the important features for recog-nition, this is known as pre-processing. Image segmentation is considered the most im-portant field in image processing, which is used in many scientific fields such as pattern recognition, robotic systems, medical imaging for diagnosis, and different applications in engineering and technology [1] [2]. Therefore, one of the great challenges of computer vision is image segmentation [3], which is performed to improve the robustness of features to be extracted that assisting in the classification process. It is the process that divides the digital image into regions, which are share according to the color of object, intensity or texture [3].
Several methods have been proposed in order to recognize the objects in the image [4]. Some of authors depended on multiple threshold to seg-ment objects such as [5]. The other used the color for object segmen-tation, where the object has been classified by using artificial neural networks (ANN) [6]. Coins segmentation depended on local entropy and gray value ranges is proposed by [7]. Furthermore, image segmenta-tion is used in the medical field to divide the image into various regions to determine the tumors [2] [8] for example [2] they focused on two categories that are deformable models-and classification approaches. This approach is based on the RGB color and the border for segmenting object, as important factors for dividing the object from its background.
Therefore, this paper is structured as follows: Materials and methods are drawn in section 2. Section 3 discusses the experimental setup; analysis and evaluation the method are presented in section 4, and the conclusions are given in section 5.

-Materials and Methods
The framework of this methodology consists of three phases as follows: the first phase was dedicated to the image acquisition, while the second phase was applying the proposed algorithm for object segmentation, and the third phase focused on the noise removal that resulting from the previous phase; and Figure 1 shows that methodology. To fulfill the implementation of the proposed method, MATLAB application was adopted in the prepa-ration of programs.

-Image Acquisition
This procedure is responsible for loading six images files into the memory; each one has the dimensions 300 × 210 pixels and .JPG format

-Segmentation Algorithm
For enhancement purpose, the selection of the most important features of an object seg-mentation algorithm is applied [9]; also it is facilitating the classifying process. After uploading the image, the segmentation algorithm should run to extract the object from its background. In this paper, color of an object has been exploited to locate it, because the color is an important element to recognize the objects. So, the following algorithm represents the segmentation procedure and Figure 2 represents the diagram of proposed method: The proposed algorithm for extracting 2D object from colored images. Step1: Read colored image.
Step3: Using the strel command to obtain a flat morphological structuring element.
Step5: Subtracting the second matrix from the first matrix Step6: Convert the result of step 4 to gray image.
Step7: To get a binary image, apply edge function.
Step8: Binary image is eroded and dilated to remove the noisy pixels at the edges.
Step9: Using bwtraceboundary function, boundary of the image is extracted. (2D boundary is perfectly extracted at this point). Let's call the binary image boundary which contains 2D boundary only.
Step10: Fill inside the edges of the image and let's call this matrix t. Step11: Create three matrices of the same size with the original image.
Step12: Compare the matrix in step10 Step12.1: If the value of pixel = 1, the pixel of three matrices in step 11 have the same values of (R, G, B) in Step2.
Step13: Collect all matrices and convert matrix from (double image) to (uint8 image).

-Noise Removal Algorithm
As a result of the application of the segmentation algorithm, sometimes some noisy ob-jects of various shapes and sizes are appearing, so in the current work, in order to remove the noisy objects, 2D median filtering algorithm [10] has been used. This is done through the use of windows for testing the noisy objects in the im-age, which are within the window border. After testing the existence of these objects and checking whether they are isolated from the object or not, if they are isolated, it will be removed, as the following algorithm:

-Experimental Setup
When the system is running, the user interface window is opened directly for the purpose of loading six images files to read and store in the memory. As shown in Figure  3, the user can select the images from the menu pop-up.
In order to obtain the objects without background, it has been applied the proposed algorithm that is object segmentation for each image, which has been loaded. This algorithm will begin work by dragging the slider and it can move between the images, as depicted in Figure 4.
As shown in Figure 4 there are two objects: the vase and the background, supposed to segment the vase from the background. After looking at the image, it is clear that the easiest way to segment the vase depending on the color information. Therefore, all the pixels those belonging to the desired object are needed interest. As shown in the image there is a horizontal gradient in the background from light of mauve to dark and there is a similarity in the colors between the vase and the background, so consider this task difficult. This task includes several steps, the first step has converted the image from RGB color to the flat morphological structuring element, and this step will be using both grayscale and binary images that are important for creating a flat structuring element [11], as shown in Figure 5.
The next step converts the result of the image to the gray image, as shown in Figure 6 the structure of the object has been clear, but the edges of the object should be identified. Therefore, the edge function of MATLAB has been applied to extract the edges of the vase, which produces some noises remaining around the object as illustrate in Figure  7 (a). Thus should apply the 2D Median Filtering Algorithm to remove the pixels not belong to the main object, the result as shown in Figure 7 (b).
Consequently, in order to develop this step, it must fill the inside of the vase body as shown in Figure 8. Finally, compare the pixels for the last image has been done, if the pixel has one must recover the original value of (Red, Green, and Blue), zero otherwise. See the result in Figure 9. Moreover, there is another results shown in Figure 10 (a, b, c, d, e) that represent remain five images.

-Analysis and Evaluation the Method
This part focuses on the evaluation, analysis and compares the performance of all the pro-posed method based on individual experiments. Therefore, to evaluate the performance of the proposed algorithm, several tests were conducted on the image dataset that consists of six classes as depicted in Table 1. As illustrated in Table 1 the dataset consists of 20 images, which are consider suitable to test the suggested method. In order to evaluate the performance of the proposed method,several experiments were conducted using the dataset that obtained in Table 1. A series of experiments was run upon the dataset that obtained, and its results demonstrate in Table 2.
As shown in the Table 2 that evaluates the proposed method for accuracy, the proposed method has been testing it by using 20 variant images. Thus, it achieved a success of 90%, because it was able to segment 18 images out of 20 and fail into 2 images which include one for children class and the other from flowers class. Therefore, the proposed method has demonstrated its efficiency to segment the objects.

-Conclusions
Object segmentation is important task to obtain the significant features of the object, which in turn achieves the best classification. This work proposes an approach to segment an object based on color information and the boundaries of the object to separate it from the background. The proposed method achieved a success rate of 90% for all classes and the rate of fail is10%, so we conclude that the segmentation technique is effective and achieves promising results. In the future, more details about the features such as the intensity or texture of the surfaces of the object that will gives better results.