Gray-scale Transformation Thresholding Theory of Shape Based Matching Application

24 As can be seen the higher the pixels quantity e.g. 800x600 or 5 Mega Pixels the better the image quality and also the more accurate the digital image representations of the actual images.

2.1.1.1 Gray-scale Transformation

Gray scale images store values for levels of brightness as opposed to colour information. A typical gray scale image is 256 shades of gray ranging from 0 black at the weakest intensity to 255 white at the strongest intensity. This method are given to transform the image from colour RGB transformation to gray scale black and white for simplifies the amount of information in the image. Although gray scale image contains less information than a colour image, the majority of important, feature related information is maintained, such as edges, blobs, regions, noise and so on. As shown in Figure 2.6, shows the process of gray scaling from original image to distinguish the RGB channel into gray scale. Figure 2.6: Process of Gray Scale Transformation 25 The importance of gray-scale transformation is to reduce image information and characteristic to be extracted in the system. Colour image have plenty of information regarding on RGB transformation leads to the complex process in the system. In gray- scale, colour information being ignored and the system will focus on the object characteristic for easier processes.

2.1.1.2 Thresholding

Thresholding is an indispensable step in extracting pertinent information in image source. A gray-scale image often contains only two level of significant information: the foreground level constituting objects of interest and the background level against which the foreground is discriminated. A complete segmentation of an image, R is a finite set of regions R 1 , R 2 ,..., R m , ⋃ 2.1 If R b is a background in the image, then ⋃ is considered the object and ⋃ where is the set complement. While there are two principal peaks of the foreground and the background intensities in the image histogram, there are many others gray intensities present. Binarization can be accomplished by the choice of intensity, between the two histogram peaks, that is the threshold between all background intensities below and all foreground intensities above. The input image I 1 is being transformed to an input binary segmented image I 2 , in the following way: { 2.2 26 Where T is the threshold, for the object elements and stated for the background elements Gonzalez, 2002. Successful threshold segmentation depends on the threshold selection. By referring to Figure 2.2, its histogram is calculated in Table 2.1 and drawn as shown in Figure 2.7. From Figure 2.7, the x-axis represents the gray values range from 0 to 255 and the y-axis represents the numbers of pixels of the same gray value. Table 2.1: Histogram Table of Example Images Gray Value Pixels Quantity 71 60 8 150 9 210 8 Figure 2.7: Histogram of Example Images 27 From the histogram, the information can be used to extract the object from the background by selecting a threshold value, T that is suitable to separate the two different modes by using Equation 2.2. For instance, assuming that all three shapes were to be extracted from Figure 2.2, therefore the threshold value of 50 is selected. All pixels with gray value greater than 50 will then be converted into 1 and others will be converted into 0, the resultant result can be seen in Figure 2.8. Similarly if threshold value were to be changed to 200, only pixels with gray value greater than 200 will be converted into 1 while all other pixels converted into 0. The result is shown in Figure 2.9. Figure 2.8: Threshold Results for Example Images using Threshold Value of 50 28 A number of conditions like poor image contrast or spatial nonuniformities in background intensity can make difficult to resolve foreground and background. These cases require user interaction for specifying the desired object and its distinguishing intensity features.

2.1.1.3 Region of Interest ROI