4
Application of Improved KMP Algorithm in Tire Disfigurement Recognition Fengying cui Baoming Shan College of Automation and Electronic Engineering Qingdao University of Science and Technology Qingdao, 266042, China [email protected] Abstract—Image matching is usually used in tire disfigurement recognition. Traditional template matching methods such as the NC and the SSDA have high matching precision, but the calculating is hard and time consuming. The fast template matching algorithm based on the projection and the KMP algorithm has been proposed. Firstly, the feature string is gotten by projecting the image followed by matching it to get the approximate matching results. Secondly, the NC method is used to validate the approximate matching results. The algorithm has been used in the tire disfigurement recognition based on image matching and proven to be efficient. Keywords- tire disfigurement recognition; template matching; projection; feature string; KMP algorithm I. INTRODUCTION With the rapid development of tire industry, tire performance inspection and automatic disfigurement recognition become an important research. Among disfigurement recognition the key issue is that the images have obvious characteristics of uneven luminance in level direction because the system is disturbed by the hardware himself, the tire structures, and so on. What’s more, it is difficult to estimate these factors and difficult to eliminate them by modeling. It can be only decreased by noise processing. Then by statistic, it can take 25 seconds acquiring a full tire image from the tire being placed on the bracket to the X machine. So the system must have speedy recognition to judge the tire quality from nature and fix quantity. So it is another nodus to seek a quick and efficient algorithm. At present the tire disfigurements recognition is usually based on image matching. In this paper from former works an improved image matching method is put forward to realize the approximate matching and gain the result rapidly and exactly with other matching methods. II. ALGORITHM DESIGN A. Algorithm Idea At present there are about four kinds of image matching, such as based on gray correlation, characters, modeling and transform domain [1]. Matching method based on gray correlation is defined that the pixels being searched with gray array of certain size window are searched to match by one or several similarity metrics in order. The traditional template matching algorithms are included of absolute balance search algorithm, normalized correlation algorithm (NC) and sequential similarity detection algorithm (SSDA). The absolute balance search algorithm uses the pixel’s gray difference to represent the correlation from the search windows between template image and image to be matched. This algorithm is easy to realize, but it is limited. It is difficult to solve such cases that the gray images to be matched or the template images are transformed linearly. Various images and templates have different ground gray and different searching windows, so the threshold values are various and difficult to be selected beforehand, then the mismatching rate is high. The NC gray matching with high precision and adaptability is an efficient algorithm. It has immunity to the linear transform for image gray value, that is to say, the NC value is independent of the transform for gray, but is time consuming [2]. Otherwise SSDA is a fast matching algorithm. It selects pairs of pixels (m, n) randomly and sums them without calculating all the pixels. It shows the local position is not the matching location if the sum exceeds the set threshold, stop this calculating. Otherwise, test the next position until the matching point is found. SSDA algorithm is much more efficient than NC algorithm, but it is difficult to implement [3]. In a word, the current image matching based on gray correlation is difficult to satisfy the real-time request because of its hard calculating and slow matching speed. In this paper firstly the image matching based on gray is converted to matching strings, that is KMP algorithm, and a new express template matching algorithm based on the projection and the KMP algorithm is proposed. The idea of this algorithm is to get one-dimension gray projection signals by reducing dimensions of the template images and target images to achieve the feature strings by calculating difference of one-dimensional signals. The KMP algorithm is used to match feature strings to finish the approximate matching, so it can reduce the matching time [4]. The other matching algorithms are applied to match precisely and to achieve the fast matching. B. KMP Algorithm Firstly the image matching based on gray is converted to match feature strings, that is to say, the KMP algorithm is applied. Its basic idea is introduced as follows [5]. 2009 Second International Workshop on Computer Science and Engineering 978-0-7695-3881-5/09 $26.00 © 2009 IEEE DOI 10.1109/WCSE.2009.140 649 2009 Second International Workshop on Computer Science and Engineering 978-0-7695-3881-5/09 $26.00 © 2009 IEEE DOI 10.1109/WCSE.2009.140 35 2009 Second International Workshop on Computer Science and Engineering 978-0-7695-3881-5/09 $26.00 © 2009 IEEE DOI 10.1109/WCSE.2009.761 35

[IEEE 2009 Second International Workshop on Computer Science and Engineering - Qingdao, China (2009.10.28-2009.10.30)] 2009 Second International Workshop on Computer Science and Engineering

  • Upload
    baoming

  • View
    215

  • Download
    3

Embed Size (px)

Citation preview

Page 1: [IEEE 2009 Second International Workshop on Computer Science and Engineering - Qingdao, China (2009.10.28-2009.10.30)] 2009 Second International Workshop on Computer Science and Engineering

Application of Improved KMP Algorithm in Tire Disfigurement Recognition

Fengying cui ,Baoming Shan College of Automation and Electronic Engineering

Qingdao University of Science and Technology Qingdao, 266042, China

[email protected]

Abstract—Image matching is usually used in tire disfigurement recognition. Traditional template matching methods such as the NC and the SSDA have high matching precision, but the calculating is hard and time consuming. The fast template matching algorithm based on the projection and the KMP algorithm has been proposed. Firstly, the feature string is gotten by projecting the image followed by matching it to get the approximate matching results. Secondly, the NC method is used to validate the approximate matching results. The algorithm has been used in the tire disfigurement recognition based on image matching and proven to be efficient.

Keywords- tire disfigurement recognition; template matching; projection; feature string; KMP algorithm

I. INTRODUCTION With the rapid development of tire industry, tire

performance inspection and automatic disfigurement recognition become an important research. Among disfigurement recognition the key issue is that the images have obvious characteristics of uneven luminance in level direction because the system is disturbed by the hardware himself, the tire structures, and so on. What’s more, it is difficult to estimate these factors and difficult to eliminate them by modeling. It can be only decreased by noise processing. Then by statistic, it can take 25 seconds acquiring a full tire image from the tire being placed on the bracket to the X machine. So the system must have speedy recognition to judge the tire quality from nature and fix quantity. So it is another nodus to seek a quick and efficient algorithm. At present the tire disfigurements recognition is usually based on image matching. In this paper from former works an improved image matching method is put forward to realize the approximate matching and gain the result rapidly and exactly with other matching methods.

II. ALGORITHM DESIGN

A. Algorithm Idea At present there are about four kinds of image matching,

such as based on gray correlation, characters, modeling and transform domain [1]. Matching method based on gray correlation is defined that the pixels being searched with gray array of certain size window are searched to match by one or several similarity metrics in order.

The traditional template matching algorithms are included of absolute balance search algorithm, normalized correlation algorithm (NC) and sequential similarity detection algorithm (SSDA). The absolute balance search algorithm uses the pixel’s gray difference to represent the correlation from the search windows between template image and image to be matched. This algorithm is easy to realize, but it is limited. It is difficult to solve such cases that the gray images to be matched or the template images are transformed linearly. Various images and templates have different ground gray and different searching windows, so the threshold values are various and difficult to be selected beforehand, then the mismatching rate is high.

The NC gray matching with high precision and adaptability is an efficient algorithm. It has immunity to the linear transform for image gray value, that is to say, the NC value is independent of the transform for gray, but is time consuming [2]. Otherwise SSDA is a fast matching algorithm. It selects pairs of pixels (m, n) randomly and sums them without calculating all the pixels. It shows the local position is not the matching location if the sum exceeds the set threshold, stop this calculating. Otherwise, test the next position until the matching point is found.

SSDA algorithm is much more efficient than NC algorithm, but it is difficult to implement [3]. In a word, the current image matching based on gray correlation is difficult to satisfy the real-time request because of its hard calculating and slow matching speed. In this paper firstly the image matching based on gray is converted to matching strings, that is KMP algorithm, and a new express template matching algorithm based on the projection and the KMP algorithm is proposed. The idea of this algorithm is to get one-dimension gray projection signals by reducing dimensions of the template images and target images to achieve the feature strings by calculating difference of one-dimensional signals. The KMP algorithm is used to match feature strings to finish the approximate matching, so it can reduce the matching time [4]. The other matching algorithms are applied to match precisely and to achieve the fast matching.

B. KMP Algorithm Firstly the image matching based on gray is converted to

match feature strings, that is to say, the KMP algorithm is applied. Its basic idea is introduced as follows [5].

2009 Second International Workshop on Computer Science and Engineering

978-0-7695-3881-5/09 $26.00 © 2009 IEEE

DOI 10.1109/WCSE.2009.140

649

2009 Second International Workshop on Computer Science and Engineering

978-0-7695-3881-5/09 $26.00 © 2009 IEEE

DOI 10.1109/WCSE.2009.140

35

2009 Second International Workshop on Computer Science and Engineering

978-0-7695-3881-5/09 $26.00 © 2009 IEEE

DOI 10.1109/WCSE.2009.761

35

Page 2: [IEEE 2009 Second International Workshop on Computer Science and Engineering - Qingdao, China (2009.10.28-2009.10.30)] 2009 Second International Workshop on Computer Science and Engineering

The target string U and the pattern string V (StringV is non-null) are matched, first x and y are all 1, it means matching begin the first string from stringU andV . If they are equal, then 1 is added to x and y , it means the next string will be compared continuously, at the same time, the x th string is still compared to the 1st string of pattern string to judge whether it is the first equal (If the first equal, marked by the state variable). If the equal is the first time, k is used to remember the position in target string and is marked as the first equal. When the next string is compared to the first string in stringV , k is not updated because it is not the first equal. If the x th string in string U isn’t equal to the y th string in string V and k is not equal to 0, that is to say, k is used to mark certain useful position in string U which is equal to the first string in string V , then only y is updated to 2, x is updated to 1k + . The 2nd string in stringV is compared with the 1k + th string in stringU , because in this comparison k is the position of string which is the first equal between the strings after beginning comparison in string U and the first string in stringV .

Usually the time complexity of the KMP reduced algorithm is approximate to ( )O m n+ , where n is the length of target string and m is the length of pattern string, especially it is better than the basic pattern matching in general case. In KMP algorithm it is difficult to understand the calculating of next[ ]y , but now only one time comparison is added between the current string in stringU and the first string in string V when the first equal is true. If they are equal, the current position is marked as a variable. What’s more, the first equal state is set false, meaning in subsequent comparison the extra comparison is not needed, the next string comparison in string U and V is continued. At the same time, the algorithm generates backtrack in comparison. It has no feature of non-backtrack when the KMP processes the huge files from peripherals.

C. One- dimension gray projection of image Suppose the template imageT with the size of M N× is

matched to the target image with the size of P Q× [6].

Take the top left corner of template image as origin point and accumulate the projection to the x axis, then calculate the average (the column vectors’ average). The average is denoted as follows:

1

1( ) ( , )M

mn T m n

== ∑

(1)

Where, ( )nν is one-dimension signal named as one-dimension average vector in horizontal direction,

1, 2,3,...,n N= .

D. Calculate the feature string by differential quantization For the template T and the search image S, the relative size

relations between neighboring pixel grayscale are determined by the template being determined. The relative size relations are consistent to the template if the search window is matched to the template; vice versa, it is thought they are not matched to template and should be eliminated. Considering above factors, the one-dimension signals ( )nν should be difference processing as follows after projection; in neighboring two data, the former one is subtracted by the latter and encode the difference by the data in table 1. Then the one-dimension signal with the length of N is changed into a feature string with the length of N-1.

TABLE I. GAUGE OF FEATURE STRING

difference Feature string

[-255,-3d) A [-3d,-2d) B [-2d,-d) C [-d,0) D [0,d] E

(d,2d] F (2d,3d] G

(3d,255] H

It is noted that d can be selected different value in different image situations in table 1.

E. The realization of matching algorithm The steps of this matching algorithm are as follows:

Step 1: Calculate the one-dimension average of template which is projected to x axis by the formula (1) to get one-dimension signals ( )nν .

Step 2: According to the method in B, acquire its feature stringV with the length of N-1 by table 1.

Step 3: Based on the method in B and C, take the neighboring M rows of pixels successively in target image to get a feature string U with the length of 1Q − .There will be

1P M+ − feature strings with the length of 1Q − .

Step 4: Through KMP algorithm, match the feature stringV to the feature stringU .The corresponding region in search image may be the proper position of search window matched to template.

Step 5: Follow the above four steps, project the search window that may be matched with template to y axis and match the feature string. If they are mismatched, turn to the step 7; if matched, turn to the next step.

Step 6: Take the search region which is got from the above steps to match using normalized correlation algorithm (NC). Compare the obtained value ( , )R i j with the previous

6503636

Page 3: [IEEE 2009 Second International Workshop on Computer Science and Engineering - Qingdao, China (2009.10.28-2009.10.30)] 2009 Second International Workshop on Computer Science and Engineering

threshold, if ( , )R i j is bigger than threshold, the search region is thought to match the template successfully and the position of reference point is preserved in chain-list result; vice visa, the matching is thought to be failed, then turn to the step 3 to continue.

Step 7: End

III. RESULT ANALYSIS AND IMPLEMENTATION The express algorithm proposed in this paper based on one-

dimension projection and KMP is first simulated and tested in Matlab. Select the search image of 256×256, its grayscale is 256 and the size of template is 22×30.The matching time is variable with the value d. When d=255, the matching time is 18.8s.Otherwise it is 258.5s using the traditional algorithm of NC. The results show that the algorithm can improve greatly the matching speed.

The algorithm proposed in this paper is applied to approximate match in tire disfigurement recognition. First take the same type and qualified tires as template; then match them by the above steps and get the results; last judge the tire quality according the results.

For example, when judging a specific window image, the process steps are as follows:

a) Select template. Usually select ten templates which are from the same type qualified tire images acquired in different time.

b) Acquire template feature strings. Respectively project in the vertical and horizontal directions and calculate their feature strings.

c) Acquire target feature strings. In a target image, get the vertical and horizontal feature strings using the same method as acquiring target feature strings.

d) Match the feature strings in vertical direction. In target strings take the same length as template and start from the first bit of target string to match.

e) Match the feature strings in horizontal direction. Match the target and template strings in their corresponding regions by the same method as matching the vertical feature string .

f) Take the template image sliding on the target, repeat step (3) and (5), until to the end of the target image.

Then according to the record and mismatching position, the matching results are analyzed to judge the tire defect types.

A kind of tire is studied to recognize the disfigurement in this research. To recognition better, the tire image is divided into 5 parts, such as left tire bead, left tire sidewall, crown, right tire sidewall, right tire bead. Where, the size of two tire beads is all 194×180, the size of two tire sidewall is 336×180, the crown is 476×180. Then the collected images are preprocessed by using dyadic wavelets transform to eliminate noise and enhancing image contrast, and so on [7] [8].

In all the tire images, the pixel grayscale is in the range of [70,210], so the parameter d can be selected dynamically to

describe the features effectively when calculating the feature vector. The parameter d is shown in table 2.

TABLE II. GAUGE OF FEATURE STRING

One-dimension Projection average

Feature string

One-dimension Projection average

Feature string

[0,35] A [126,130] N [36,70] B [131,135] O [71,75] C [136,140] P [76,80] D [141,145] Q [81,85] E [146,150] R [86,90] F [151,155] S [91,95] G [156,160] T [96,100] H [161,165] U [101,105] I [166,170] V [106,110] J [171,175] W [111,115] K [176,190] X [116,120] L [191,210] Y [121,125] M [211,255] Z

In the experiment a lot of actual images have been applied

to verify the algorithm, but due to the limited space, only some representative images and test results are given. Some disfigurements such as the left tire bead edge slots and the right tire sidewall missing cord are showed in figure 1 and figure 2. In these images the mismatching regions are displayed by reverse color to observe clearly.

Figure 1. Left tire bead edge slot

Figure 2. Right tire sidewall missing cord

6513737

Page 4: [IEEE 2009 Second International Workshop on Computer Science and Engineering - Qingdao, China (2009.10.28-2009.10.30)] 2009 Second International Workshop on Computer Science and Engineering

IV. CONCLUSIONS On the basis of research on traditional image matching

algorithms, the gray matching is instead of string matching named KMP algorithm and an express matching method based on one-dimension projection and KMP is proposed in this paper. The method is proven to be rapid and is applied to match the tire disfigurement recognition approximately. It can detect some defects and give accurate results with other methods.

REFERENCES [1] Hongmei Zhang, Ke Zhang, Yanjun Li, Research Progress on Image

Matching [J], Computer Engineering and Applications, Vol.19, 2004,42-44, 77

[2] Ju Cao, Jie Ma, Yihua Tan, etc, the Express Cross Correlation Image Matching Based on Sample Pixels [J], Astronautics Journals, 2004(3), 173-178

[3] Yuan Sun, Ganghui Zhou, Lichu Zhao, etc, the Express Matching Algorithm of Gray Image [J], Shanghai jiao tong University Journals, 2005(1), 702-704

[4] Zhanlun Cao, Xiaohong Wu, Yongjun Jiang, etc, Application of Improved Match Algorithm in LED Die Bonder Image Recognition [J], Semiconductor Technology, 2008, 33(3), 200-203

[5] Baohua Li, Yingchun Zhang, Huayi Li, etc, Star Image Recognition Method with Star-sensor Using KMP Algorithm, Opto-Electronic Engineering, 2004,31(1):9-1l

[6] Jing Li, String Pattern Matching Algorithm—Discussion of KMP Algorithm[J], Journal of Qingdao Institute of Chemical Technology, 2002(6),78-80

[7] Rafael C. Gonzalez, Richard E. Woods. Digital Image Processing (the 2nd edition) [M], Peking: Electronic Industry Press, 2005, 540-543

[8] Huttenlocher D P, Rucklidge W J. Comparing Images Using the Hausdorff Distance under Translating[C]. IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 1992

6523838