Computer Engineering and Intelligent Systems ISSN 2222-1719 (Paper) ISSN 2222-2863 (Online) Vol.4, No.3, 2013

www.iiste.org

Noise Removal in Binarized Handwritten Document Using Mamdani-type Fuzzy Inference Systems Olaniyi Kayode A.* Computer Engineering Department, CEAT, P.M.B 5026 Ifo, Olabisi Onabanjo University Ago-Iwoye, Nigeria *E-mail of the corresponding Author: kayode_olaniyi@yahoo.com Abstract. In this paper we present the processes of designing a Mamdani-type Fuzzy Inference Systems (FIS) for the detection and subsequent removal of small statistical and structural noise from a binarized handwritten document images. Features are extracted from the connected component followed by defining fuzzy sets on each shape feature. The number of fuzzy sets that are defined are dependent on the context knowledge and the rules that would be defined. The first step in the Mamdaniâ€™s Inference System which is referred to as fuzzification would then be to compute the degree of membership of each input variable xi to all fuzzy sets that are defined on it. Then we construct the FIS systems so that they compute the degree of truth of a connected component being a dot, small noise, dash etc. based on the values of the features. The last step in the system is defuzzification; using Center of Gravity (COG) method of defuzzication for transforming a fuzzy set into a single crisp value. The research demonstrated the effectiveness of the rule-based noise removal system and how these rules can further be refined or expanded using more features. Keywords: Fuzzy Inference System (FIS), Noise, Features, Image, Fuzzy Set

1. Introduction The use of digital images of handwritten historical documents has become more popular in recent years. Handwritten text images of old documents are sometimes difficult to read or noisy due to the preservation of the document and quality of the image. Image noise is the random variation of brightness or color information in images produced by the sensor and circuitry of a scanner or digital camera. Image noise is generally regarded as an undesirable by-product of image capture usually quantified by the percentage of pixels which are corrupted [1]. In literature several (fuzzy and non-fuzzy) filters have been studied [2] [3] [5] [6] for impulse noise reduction. These techniques are often complementary to existing techniques and can contribute to the development of better and robust methods. There are usually two categories of noise that are encountered when working with handwritten documents: statistical and structural. Low-level noise is a statistical artifact that is introduced in the transmission medium due to a noisy channel, errors during the measurement process, during quantization of the data for digital storage and by the involved equipment, for example during the scanning process[2, 4, 6]. Structural noise is not an artifact but rather a part of the data that may be undesirable, for example when we

40

Computer Engineering and Intelligent Systems ISSN 2222-1719 (Paper) ISSN 2222-2863 (Online) Vol.4, No.3, 2013

www.iiste.org

want to recognize a handwritten word in a text line, the comma that separates the word from the following word is considered as structural noise. There are a lot of different approaches to reducing (or removing) low-level statistical noise from images. However, structural noise removal depends on the specific application, and obviously the inherent constraints and settings of each problem may call for different treatments. Defining structural noise and the need to be removed is usually defined by some linguistic rules and qualitative terms which are imprecise in nature. For example, if we want to remove the separator dots (‘.’) from a text line but keep the dots that belong to the characters (‘i’ and ‘j’), we decide based on a rule that uses a piece of knowledge that a separator dot should appear near the baseline. Fuzzy logic is a form of logic derived from fuzzy set theory to deal with variables and reasoning that are approximate. Fuzzy inference systems (FISs) which are rule-based systems based on fuzzy variables have been successfully applied to many fields such as expert systems, data classification, decision making, computer vision and automatic control. One main advantage of fuzzy variables and fuzzy rules is that they facilitate the expression of rules and facts that are easily understandable for humans. Furthermore, it is easy to modify a fuzzy inference system by inserting and deleting rules, meaning that there is no need to create a new system from scratch. In order to train a fuzzy inference system, it is possible to start with a few rules that are designed by human expert and then fine-tune the parameters of the FIS over a set of training (validation) data. This paper is expected to present the process of designing a FIS for removal of statistical and structural noise from images distinguishing small noises from character dots and then showing how to extend the system for other types of structural noise such as background line noise versus dashes etc.

1.2 Objective The objective of the paper is to give a new better, faster and efficient solution for removing the noise from the corrupted images. 2.0 Review of Fuzzy Logic Fuzzy logic is an extension of classical (binary) logic that uses a continuous range of truth degrees in the real interval [0, 1], rather than the strict values of 0 and 1. To introduce fuzzy logic, we must first present the definition of fuzzy sets. 2.1 Fuzzy Sets A fuzzy set is a set whose elements have degrees of membership in the real interval [0, 1]. The membership of an element x in a set A, in classical logic, is defined by an indicator function also known as characteristic function). The value of the indicator function is 1 when

and 0 when

. In fuzzy logic, the

degree of membership of an element in a set is indicated by a value in the real interval [0, 1]. This extension allows the gradual assessment of the membership of elements in a set. The function that defines the degree

41

Computer Engineering and Intelligent Systems ISSN 2222-1719 (Paper) ISSN 2222-2863 (Online) Vol.4, No.3, 2013

www.iiste.org

of membership of an element x in a set A is mA(x), and therefore we denote the fuzzy set by the pair (A, mA (x)), or A(x) for short [4, 12]. 2.2 Fuzzy Operators The basic operations defined on crisp sets, namely intersection (AND), union (OR) and complement (NOT), can be generalized to fuzzy sets. The generalization to fuzzy sets can be achieved in more than one possible way. The most widely used fuzzy set operations that will be adopted in this work are called standard operations. They are; standard fuzzy intersection, standard fuzzy union, and standard fuzzy complement [3][6][7]. Let A(x) and B(x) denote two fuzzy sets, that is the degree to which x belongs to A is mA(x), and the degree to which x belongs to B is mB(x). The standard fuzzy complement for set A(x) denoted by cA(x) is defined as 1 – mA(x). The standard fuzzy intersection for two set A(x) and B(x) denoted by (A ∩ B)(x) is defined as min[ mA(x), mB(x) ]. The standard fuzzy union for two set A(x) and B(x) denoted by (A ∪ B)(x) is defined as max[ mA(x), mB(x) ]. 2.3 Fuzzy Rules A fuzzy rule has the form If x is A then y is B in which A and B are fuzzy sets, defined on universes X and Y, respectively. In fuzzy logic, logic rules are represented by a collection of IF-THEN statements. Interpreting an if–then rule is a three part process: (a) Resolve all fuzzy statements in the antecedent to a degree of membership between 0 and 1; (b) if there are multiple parts to the antecedent, apply fuzzy logic operators and resolve the antecedent to a single number between 0 and 1, is the result being the degree of support for the rule; and (c) apply the implication method, using the degree of support for the entire rule to shape the output fuzzy set. If the rule has more than one antecedent, the fuzzy operator is applied to obtain one number that represents the result of applying that rule [8,4]. Examples of such rules in everyday conversation are •

If you are hungry then eat.

•

If the room is cold, then increase the heat

A single assignment statement has the general form of “x is Ai” and a compound assignment statement is constructed from single assignments and set operations for example “orientation is HORIZONTAL AND height is HIGH”. Fuzzy rules facilitate the representation of linguistic rules. In order to make the representation of such rules even easier, we use fuzzy hedges, which are equivalent of the adverbs in natural languages. The most common types of fuzzy hedges are “very” and “somewhat” which are defined as follows. Let (A, mA(x)) denote a fuzzy set defined on the universe of discourse x, then: Very A(x) ≡ (very A, mvery A(x))

where mvery A(x) = [mA (x)]2

42

www.iiste.org

Somewhat A(x) ≡ (somewhat A, msomewhat A (x))

where msomewhat A (x) = [mA (x)]½

2.4 Fuzzy Inference System Fuzzy rule-based systems utilize linguistic variables and changing numerical data of an image into its linguistic form can be very challenging [5, 6]. The process of definition of the mapping from a given set of inputs to a set of outputs using fuzzy logic is called Fuzzy Inference. The relation between the set of inputs and outputs is defined by fuzzy IF-THEN rules. The set of fuzzy rules combined with a method of fuzzy inference is called Fuzzy Inference System (FIS). There are two major types of FIS systems: Mamdani-type and Sugeno-type. The Mamdani-type is the most commonly used and it is adopted for the purpose of this research work. The Mamdani type is characterized by the following fuzzy rule schema: IF x is A then y is B.

Figure 2.1 illustrate the Scheme of a Fuzzy Inference System

FIS is based on “MIN-MAX” operations, therefore sometimes Mamdani’s inference method is referred to as MIN-MAX inference. The first step in Mamdani’s inference is fuzzification which is to compute the degree of membership of each input variable xi to all fuzzy sets that are defined on it. The next step would be to compute the truth degree or the value of antecedent of each rule in the rule base. When P is a single assignment (i.e. orientation is HORIZONTAL), the value of antecedent is simply the value of the corresponding membership function. When P is a compound assignment statement (i.e. orientation is HORIZONTAL AND height is SHORT), the value of antecedent is obtained by applying the MIN (for AND) and MAX (for OR) operators to the truth degrees of each part of P. For example, if the truth degree (i.e. membership value) of “orientation is HORIZONTAL” is 0.6, and the truth degree of “height is SHORT” is 0.7, then the antecedent value of the rule “IF orientation is HORIZONTAL AND height is SHORT THEN …” is min(0.6, 0.7) = 0.6 After obtaining the value of antecedent, the consequent membership function for each rule is computed. The process which is referred to as fuzzy implication. In Mamdani’s inference, the implication operator is MIN. The MIN operator limits the membership function of the consequent to the value of antecedent. Formally, let P be the antecedent, vP(x) be the value of antecedent, and Q(x) ≡ (Q,mQ (x)) be the consequent. Then, the membership function of the consequent Q is defined to be min(vP(x), mQ(x)). The next step is to aggregate the conclusions, that are the membership functions of the consequents of all rules in the rule base. In Mamdani’s inference, the aggregation operator is MAX, which is the standard fuzzy union operator. When there are more than one rule defining the relation between the input variables and an output variable, in fuzzy logic, all rules are represented with different degrees of strength and hence they collaborate to define the value of the output. As the rules are independent, and they are all equally important, the combination of them is defined as the union which can be obtained by the MAX operator. The last step in Mamdani’s inference is defuzzification. A defuzzification unit converts the inferred fuzzy control action into the required crisp control value. In function approximation or decision problems, the

43

www.iiste.org

output typically has to be expressed by a single value[6]. For example, in the proposed fuzzy-based denoising algorithm, we want to eventually be able to decide whether or not a connected component in image is a small noise that needs to be removed. There are many different methods of defuzzification including Center of Area (COA), Center of Gravity (COG), Middle of Maximum (MOM) etc. In this work, we use the COG which is one of the most popular defuzzification methods. Formally, let (A, mA(x)) be a fuzzy set defined on the universe of discourse x, then the defuzzified value of the set A, using the COG method, is defined to be

[∫ xmA (x)]/[∫mA (x)], which is the x-coordinate of the center of gravity of the

membership function. 3.0 Feature Extraction The process of feature extraction of a character consists of the distinguishing typical elements (vertices) and branches or segments [4]. Feature extraction or codification is necessary in order to cluster strokes within our effort to build a base of character primitives and classify stroke sequences that correspond to complete characters. Then features should be discriminant, geometrically significant and consistent for each character class [5].

In this work we construct the FIS systems so that they compute the degree of truth of a

connected component being a dot, small noise, dash etc. based on the values of the features. For the purpose of the research a total of 7 distinct features are extracted. To facilitate the definition of the fuzzy sets, the values of the selected features are expected to be independent of the size and coordinate system of the image. This is achieved by normalizing the height, width and y-coordinate of the center of gravity by the height of the image. The following features were extracted from a connected component in order to decide whether it is a dot or small noise are: 1.

Height,

2.

Width,

3.

Aspect ratio (defined as the ratio of height to width)

4.

y-coordinate of the center of gravity (which can measure how close the connected component is to the upper baseline).

5.

Orientation,

6.

Eccentricity, (defined as an indication of elongation) and

7.

Compactness (compactness is an indication of solidness and convexity)

The extraction of features is followed by defining fuzzy sets on each shape feature. The number of fuzzy sets that are defined are dependent on the context knowledge and how we are going to define the rules. This number is usually between 1 and 4. i.e. in order to determine whether a small dot belongs to a character, a human expert uses a linguistic rule such as: “if the dot is near the top of the image then it most likely belongs to a character”. Typically only one or two fuzzy sets will be enough in this case: TOP ≡ near the

44

www.iiste.org

top of the image, and BOTTOM â‰Ą near the bottom of the image. Table 1 shows the fuzzy sets that have been defined on each shape feature. Fig. 3.1(a) shows the fuzzy sets TOP and BOTTOM that are defined on the feature y-coordinate of the center of gravity (YCOG). On the feature Aspect Ratio (AR), only one fuzzy set is defined: AROUND_1, which defines how close the aspect ratio is to unity. The membership function mAROUND_1(x) is shown in Fig. 3.1(b). It is a triangular with the value of 1 at x = 1 which linearly goes to 0 at x = 0.5 and x = 2, which implies that the aspect ratio is not around 1 when the height is two times larger than the width, or the width is two times larger than the height.

For a decision to be reached to decide whether a small connected

component is noise or part of the text, an estimate value for Average Stroke Width (ASW) would have to be calculated. For a binary image C, we take the median of run-lengths of black (text) pixels in all rows and all columns of the input image as an estimate for ASW: ASWC = median (length(RH) âˆŞ length(RV) ). where RH = {black runs in all rows of C} and RV = {black runs in all columns of C}. Figure 3.1 Fuzzy sets defined on variables Normalized Y-COG and Aspect Ratio. The size (height and width) of a dot that is part of the text is expected to be close to the stroke width. Therefore, we define three fuzzy sets on the normalized height and normalized width of a connected component to specify how small, equal or large these features are compared to the Normalized ASW (NASW). These fuzzy sets as shown in Fig.3.2 are called; SMALL COMPARED TO NASW, EQUAL TO NASW and LARGE COMPARED TO NASW . Aside from these three fuzzy sets, we also define the three fuzzy sets of SMALL, MEDIUM and LARGE as shown in Fig. 3.3(a). In fuzzy applications, these are the most typical fuzzy sets that are defined on a real variable in the interval [0, 1]. Also for input variables eccentricity and compactness the same fuzzy set are defined. Finally, we define the four fuzzy sets of HORIZONTAL, VERTICAL, DIAGONAL LEFT and DIAGONAL RIGHT on orientation as shown in Fig. 3.3(b). The rule base for the detection of each separator consists of a set of intuitively-designed linguistic rules. 3.3 Rule Base for Detection of Dots and Small Noises The rule base for the detection of dots and small noises is defined to be composed of rules of the following form: Rule 1: = IF (Normalized Height is SMALL_COMPARED_TO_NASW) AND (Normalized Width is SMALL_COMPARED_TO_NASW) THEN (Dot is LOW) AND (Small Noise is HIGH);

45

Rule

2:

=

IF

(Normalized

Height

www.iiste.org

is

EQUAL_TO_NASW)

AND

(Normalized

Width

is

EQUAL_COMPARED_TO_NASW) THEN (Dot is HIGH) AND (Small Noise is LOW); IF (Normalized Height is ...) AND (Normalized Width is ...) AND (Normalized YCOG is ...) AND (Aspect Ratio is ...) AND (Eccentricity is ...) AND (Compactness is ...) AND (Orientation is ...) THEN (Dot is ...) AND (Small Noise is ...); These rules can be expanded by adding more knowledge about the location of the connected component. We know that if a small connected component appears near the bottom of the image for instance, it is less likely to be a character dot, compared to when it appears near the top of the image [9 13]. Therefore, based on the location of the connected component, we can decompose Rule 1 into two rules and modify Rule 2 as follows: Rule 1-1 := IF (Normalized Height is SMALL_COMPARED_TO_NASW) AND (Normalized Width is SMALL_COMPARED_TO_NASW) AND (Normalized YCOG is BOTTOM) THEN (Dot is very LOW) AND (Small Noise is very HIGH); Rule 1-2 := IF (Normalized Height is SMALL_COMPARED_TO_NASW) AND (Normalized Width is SMALL_COMPARED_TO_NASW) AND (Normalized YCOG is not BOTTOM) THEN (Dot is somewhat LOW) AND (Small Noise is somewhat HIGH); Rule

2:=

IF

(Normalized

Height

is

EQUAL_TO_NASW)

AND

(Normalized

Width

is

EQUAL_COMPARED_TO_NASW) AND (Normalized YCOG is not BOTTOM) THEN (Dot is very HIGH) AND (Small Noise is very LOW); The fuzzy hedges “very”/“somewhat” have been used to increase/decrease the emphasis on their corresponding fuzzy sets. These rules can further be refined or expanded using more features such as aspect ratio and compactness. 4.0 experimental Results We have demonstrated the procedures of applying the FIS-based noise removal filter to some images of handwritten words For an input document image, first we estimate the average stroke width (ASW) of the binarized handwritten image locally, and extract the feature set for each connected component.

We apply the FIS

for detection of dots and small noises to each connected component C and we defuzzify the output to obtain the degree of truth of the connected component being a dot (Tdot) and a small noise (Tnoise). The connected component is removed if it satisfies the two conditions: 1) it is noise and 2) it is more noise than dot. In order to decide if a connected component is noise, we look at the degree of truth Tnoise, which is a value between 0 and 1. Therefore, in the absence of any further information, if Tnoise is higher than 0.5, we should take the connected component as noise.

46

www.iiste.org

Using the FIS-based noise removal filter, we are able to keep the dot that belongs to the word and remove all other noises. This filter is intended for small noises and dots and therefore cannot be used to remove other types of structural noise such as background lines. However the rules can be further expanded to accomplish such tasks as removal of background lines dashes etc. 5.0 Conclusion The algorithm of fuzzy rule-based inference consists of three basic steps and an additional original step. These steps are: (i) Fuzzy matching: Calculate the degree to which the input data match the condition of the fuzzy rules. (ii) Inference: Calculate the rules conclusion based on its matching degree. (iii) Combination: combine the conclusion inferred by all fuzzy rules into a final conclusion. (iv)Defuzzification: for outputs that need a crisp output and additional step is to convert a fuzzy conclusion into a crisp one. The success of the fuzzy rule-based system that is used in denoising would be quite heavily depended on the accuracy of the features extracted and the way the rules are structured. In order to decide if a connected component is noise, we look at the degree of truth Tnoise, which is a value between 0 and 1. Therefore, in the absence of any further information, if Tnoise is higher than 0.5, we should take the connected component as noise. This filter is only designed for small noises and dots, however in future, modification and expansion of fuzzy rules can yield better result.

6.0 REFERENCE [1] Harish Kundra , Monika Verma & Aashima “Filter for Removal of Impulse Noise by Using Fuzzy Logic”

International Journal of Image Processing (IJIP) Volume(3), Issue(5).

[2] Chen, J., Paris, S., Durand F. “Real-time Edge-Aware Image Processing with the Bilateral Grid”. In Transactions on Graphics, ACM ,Vol. 26, No. 3. (2007). [3] Hadi Sadoghi Yazdi, Faranak Homayouni “Impulsive Noise Suppression of Images Using Adaptive Median Filter” International JSPIP Vol. 3, No. 3, September, 2010. [4] J. Gilewski Phil Phillips, “Handwriting Recognition- Neural Networks-Fuzzy Logic” Proceedings of the IAPR International Conference on Pattern Recognition and Information Processing – PRIP’97, vol. 1, pp.39-47, 1997. [5] E. Gómez Sánchez, Y.A. Dimitriadis, M. Sánchez-Reyes Más, “On-Line Character Analysis and Recognition with Fuzzy Neural Networks” Intelligent Automation and Soft Computing, Vol. 7, No. 3, pp. 161-162, 1998 [6] Legault R. & Suen, C.Y. (1997). “Optimal Local Weighted Averaging Methods in Contour Smoothing”, IEEE Trans. Pattern Anal. Machine Intell., July vol. 18, pp. 690-706. [7] Mamdani, E. H., and Assilian, S. “An experiment in linguistic synthesis with a fuzzy logic controller”. Int. Journal of Man-Machine Studies 7, pp. 1–13. (1975). [8] Kosko, B. Fuzzy systems as universal approximators. Proceedings of the IEEE International Conference on Fuzzy Systems. San Diego, CA, pp. 1151–1162. (1992)

47

www.iiste.org

[9] Liang-Kai Huang, Mao-Jiun J. Wang. “Image Thresholding by Minimizing The measures of Fuzziness”. Pattern Recognition, Vol. 28, No. 1, pp. 41 51, (1995) [10] Carl Steven Rapp, “Image Processing and Image Enhancement”, Texas, (1996). [11] Tizhoosh, “Fuzzy Image Processing”, Springer, (1997). [12] R. Vorobel, "Contrast Enhancement of Remotely-Sensed Images," in 6th Int. Conf. Math. Methods in Electromagnetic Theory, Lviv, Ukraine, , pp. 472-475.

(1996)

[13] Harish Kundra , Monika Verma & Aashima International Journal of Image Processing (IJIP) Volume(3), Issue(5) 202 First Author - Olaniyi Kayode A received the B.Sc in Physics, in 1998 from the UNAAB, Nigeria and the M.Sc degree in Electrical & Electronics in 2004, from the UI in Nigeria. He Lectures at the Olabisi Onabanjo University Ago-Iwoye Nigeria. He is currently working on his Ph.D. degree. His research interests include Pattern Recognition, Automated Inspection and Information Technology. .

Features Normalized Y-coordinate Gravity Aspect Ratio Normalized Height

Fuzzy sets of

Center

of TOP, BOTTOM AROUND_1 SMALL_COMPARED_TO_NASW, EQUAL_TO_NASW, LARGE_COMPARED_TO_NASW, SMALL, MEDIUM, HIGH

Normalized Width

SMALL_COMPARED_TO_NASW, EQUAL_TO_NASW, LARGE_COMPARED_TO_NASW, SMALL, MEDIUM, HIGH

Orientation

HORIZONTAL,VERTICAL,DIAGONAL_RIGHT, DIAGONAL_LEFT,

Eccentricity Compactness

SMALL, MEDIUM, HIGH SMALL, MEDIUM, HIGH

Table 1.0 Fuzzy sets defined on shape features.

48

www.iiste.org

Figure 2.1: Scheme of a Fuzzy Inference System

(a) Fuzzy sets defined on Normalized Y-COG

(b) Fuzzy set defined on Aspect Ratio

Figure 3.2 Fuzzy sets defined on variables normalized height and normalized width.

49

www.iiste.org

(a) Fuzzy set defined on Compactness

(b) Fuzzy set defined on Orientation

Figure 3.3 Fuzzy sets defined on variables compactness and orientation.

50

This academic article was published by The International Institute for Science, Technology and Education (IISTE). The IISTE is a pioneer in the Open Access Publishing service based in the U.S. and Europe. The aim of the institute is Accelerating Global Knowledge Sharing. More information about the publisher can be found in the IISTEâ€™s homepage: http://www.iiste.org CALL FOR PAPERS The IISTE is currently hosting more than 30 peer-reviewed academic journals and collaborating with academic institutions around the world. Thereâ€™s no deadline for submission. Prospective authors of IISTE journals can find the submission instruction on the following page: http://www.iiste.org/Journals/ The IISTE editorial team promises to the review and publish all the qualified submissions in a fast manner. All the journals articles are available online to the readers all over the world without financial, legal, or technical barriers other than those inseparable from gaining access to the internet itself. Printed version of the journals is also available upon request of readers and authors. IISTE Knowledge Sharing Partners EBSCO, Index Copernicus, Ulrich's Periodicals Directory, JournalTOCS, PKP Open Archives Harvester, Bielefeld Academic Search Engine, Elektronische Zeitschriftenbibliothek EZB, Open J-Gate, OCLC WorldCat, Universe Digtial Library , NewJour, Google Scholar