3
A Fast Variable Precision Template Matching Algorithm Based On Hybrid Genetic Algorithm Ye Mao-yi Beijing Institute of Graphic Communication Beijing, China [email protected] You Fu-cheng Beijing Institute of Graphic Communication Beijing, China [email protected] Abstract—Conventional algorithms for image matching are slow and inefficient, and standard genetic algorithm (SGA) in image matching is not high in accuracy. In order to solve these problems, a fast and variable precision template matching algorithm based on hybrid genetic algorithm is proposed in this article. The algorithm combines GA and hill-climbing algorithm in an efficient way and performs fast both in global search and local search. The speed and accuracy of the Algorithm is proved by the experiment. Keywords-component; hybrid genetic algorithm; template matching; hill-climbing algorithm; variable precision I. INTRODUCTION Image matching is an important area in image processing. Image matching is the foundation of computer vision applications, such as camera calibration, three-dimensional reconstruction, intelligent monitoring and motion analysis. There are mainly two kind of image matching method, one is feature-based and the other is grayscale-based. The feature- based method uses the physical feature for image matching, such as edges, skeleton lines and corners. The computational complexity of this method is low, but it is only suitable for simple images with significant geometric features. [1] The grayscale-based method performs high in accuracy, but the computational complexity of this method is high. The grayscale-based method usually uses the template matching method, and the conventional template matching method such as Absolute Balance Search (ABS) is inefficient and time- consuming, the sequential similarity detection algorithm (SSDA) is more efficient, but still not meet the requirements of real-time. II. GENETIC ALGORITHM IN IMAGE MATCHING A. Template matching method The basic ideal of template matching method is to determine the target position by calculating the similarity between the template image and reference image. The template matching method performance depends on similarity measurement method and search strategy. The reference image is described as F(x,y), and its size is M the template image is described as G(x,y), and its size is P Q, there are (M-P+1) (N-Q+1) potential match position. There are mainly three similarity measurement methods, they are Absolute Balance Search (ABS), normalized correlation algorithm (NC) and sequential similarity detection algorithm (SSDA). The similarity measurement formula of ABS method is: + + = = = 1 0 1 0 2 )] , ( ) , ( [ ) , ( P j Q ik k j t k y j x f y x R (1) The ABS method needs (M-P+1) × (N-Q+1) × P × Q basic arithmetic operations, so it is inefficient. When either the template image or the reference image performs linear transformation, the method will lose its function. The similarity measurement formula of NC algorithm is: + + = = = = = = + + = 1 0 1 0 2 1 0 1 0 2 1 0 1 0 )] , ( [ )] , ( [ ) , ( ) , ( ) , ( P j Q k P j Q k P j Q k k j t k y j x f k j t k y j x f y x R (2) The NC algorithm is linear transformation immune. But the computational complexity of NC algorithm is equal to the ABS method in the asymptotic sense. The similarity measurement formula of SSDA algorithm is: = = + + = 1 0 1 0 ) , ( ) , ( * 1 ) , ( P j Q k k j t k y j x f Q P y x R (3) SSDA algorithm is faster than the previous two. The SSDA algorithm randomly selects the pixel on the template image, and calculate the value of R(x,y), it stop calculating when the value of R(x,y) is more than the threshold. [2] B. Standard Genetic Algorithm Genetic algorithm is a population-based evolutionary algorithm for global optimization search with the implicit parallelism. GA is based on schema theorem and building block hypothesis. GA provides a general model to solve the complex optimization problems. First the solution space is mapped to coding space by some encoding mode, and the every single code is called chromosome which corresponds to a solution of the problem, then the algorithm randomly initialize a group of individuals which called population. In the 978-1-4244-7874-3/10/$26.00 ©2010 IEEE

[IEEE 2010 International Conference on Multimedia Technology (ICMT) - Ningbo, China (2010.10.29-2010.10.31)] 2010 International Conference on Multimedia Technology - A Fast Variable

Embed Size (px)

Citation preview

Page 1: [IEEE 2010 International Conference on Multimedia Technology (ICMT) - Ningbo, China (2010.10.29-2010.10.31)] 2010 International Conference on Multimedia Technology - A Fast Variable

A Fast Variable Precision Template Matching Algorithm Based On Hybrid Genetic Algorithm

Ye Mao-yi Beijing Institute of Graphic Communication

Beijing, China [email protected]

You Fu-cheng Beijing Institute of Graphic Communication

Beijing, China [email protected]

Abstract—Conventional algorithms for image matching are slow and inefficient, and standard genetic algorithm (SGA) in image matching is not high in accuracy. In order to solve these problems, a fast and variable precision template matching algorithm based on hybrid genetic algorithm is proposed in this article. The algorithm combines GA and hill-climbing algorithm in an efficient way and performs fast both in global search and local search. The speed and accuracy of the Algorithm is proved by the experiment.

Keywords-component; hybrid genetic algorithm; template matching; hill-climbing algorithm; variable precision

I. INTRODUCTION

Image matching is an important area in image processing. Image matching is the foundation of computer vision applications, such as camera calibration, three-dimensional reconstruction, intelligent monitoring and motion analysis. There are mainly two kind of image matching method, one is feature-based and the other is grayscale-based. The feature-based method uses the physical feature for image matching, such as edges, skeleton lines and corners. The computational complexity of this method is low, but it is only suitable for simple images with significant geometric features. [1] The grayscale-based method performs high in accuracy, but the computational complexity of this method is high. The grayscale-based method usually uses the template matching method, and the conventional template matching method such as Absolute Balance Search (ABS) is inefficient and time-consuming, the sequential similarity detection algorithm (SSDA) is more efficient, but still not meet the requirements of real-time.

II. GENETIC ALGORITHM IN IMAGE MATCHING

A. Template matching method The basic ideal of template matching method is to

determine the target position by calculating the similarity between the template image and reference image. The template matching method performance depends on similarity measurement method and search strategy. The reference image is described as F(x,y), and its size is M the template image is described as G(x,y), and its size is P Q, there are (M-P+1)

(N-Q+1) potential match position. There are mainly three similarity measurement methods, they are Absolute Balance

Search (ABS), normalized correlation algorithm (NC) and sequential similarity detection algorithm (SSDA).

The similarity measurement formula of ABS method is:

−++−

=

=

=1

0

1

0

2)],(),([),(P

j

Q

ikkjtkyjxfyxR (1)

The ABS method needs (M-P+1)× (N-Q+1)× P× Q basic arithmetic operations, so it is inefficient. When either the template image or the reference image performs linear transformation, the method will lose its function.

The similarity measurement formula of NC algorithm is:

++−

=

=

=

=

=

=

++=

1

0

1

0

21

0

1

0

2

1

0

1

0

)],([)],([

),(),(),(

P

j

Q

k

P

j

Q

k

P

j

Q

k

kjtkyjxf

kjtkyjxfyxR (2)

The NC algorithm is linear transformation immune. But the computational complexity of NC algorithm is equal to the ABS method in the asymptotic sense.

The similarity measurement formula of SSDA algorithm is: −

=

=

−++=1

0

1

0

),(),(*1),(

P

j

Q

kkjtkyjxf

QPyxR (3)

SSDA algorithm is faster than the previous two. The SSDA algorithm randomly selects the pixel on the template image, and calculate the value of R(x,y), it stop calculating when the value of R(x,y) is more than the threshold. [2]

B. Standard Genetic Algorithm Genetic algorithm is a population-based evolutionary

algorithm for global optimization search with the implicit parallelism. GA is based on schema theorem and building block hypothesis. GA provides a general model to solve the complex optimization problems. First the solution space is mapped to coding space by some encoding mode, and the every single code is called chromosome which corresponds to a solution of the problem, then the algorithm randomly initialize a group of individuals which called population. In the

978-1-4244-7874-3/10/$26.00 ©2010 IEEE

Page 2: [IEEE 2010 International Conference on Multimedia Technology (ICMT) - Ningbo, China (2010.10.29-2010.10.31)] 2010 International Conference on Multimedia Technology - A Fast Variable

subsequent iteration according to the principles of survival of the fittest, selects the individuals according to the value of fitness, and the selected individuals produce new individuals which is more adaptable by crossover and mutation operations until it satisfy the optimization criterion. The best individual in the last population is decoded as the solution of the problem. The value of crossover probability and mutation probability in GA are variable, so they can be changed to achieve the best result for different problems.

C. Standard Genetic Algorithm in image matching The speed of image matching is enhanced because of the

global search ability and the implicit parallelism of GA. The global search ability of GA determines the fast speed of the search process from the random value to the sub-optimal value, and its weak local search ability leads to inefficient from the sub-optimal value to optimal value, and the accuracy of GA is not high because of its randomness. Although some improved GA was used in image matching, like the adaptive genetic algorithm (AGA) [3], family genetic algorithm (FGA) [4] and multi-mutation genetic algorithm (MGA) [5], these algorithms did not improve the local search ability of GA.

III. HYBRID GENETIC ALGORITHM

The hybrid genetic algorithm (HGA) combines GA and hill-climbing algorithm in an efficient way, it uses GA in global search and uses hill-climbing in local search. The HGA also uses a combination of rough matching and precise matching. In the rough matching process, the algorithm selects the pixel by space K (K>1) in the template image, then calculate the difference between the selected pixel in the template image and the correspond pixel in the reference image. In the precise matching process, the value of K is 1, thus the algorithm select all pixels in the template image. Fig.1 shows an example of rough matching process when the value of K is 2. If the size of reference is M×N, the size of template image is P×Q, the coordinate of the start matching point in the reference image is (x,y), C(x,y) is the fitness of this point, the formula of C(x,y) is:

QP

jifyxC

KP

i

KQ

jK

*

),(),( 0 0

2

= == 4

20),(),(

20)|,(),(|

1

0{),(<−++

>=−++=

jimjyixMIF

jimjyixMIFjif 5

m(i,j) is the gray value of pixel which coordinate is (i,j) in the template image, M(x+i,y+j) is the gray value of the corresponding pixel in the reference image. The value of K is variable, in the rough process, K=K1=min{P,Q}/10, in the precise matching process, K=K2=1; The speed of rough matching process is K1 × K1 times faster than the precise process, but the accuracy of rough matching process is 1/(K1 × K1) of the precise matching process. The similarity measurement is counted by the numbers of matched pixel

rather than the value of the difference of gray value between the template image and the reference image. The pixel is counted when the value of difference of gray value between the template image and the reference image is less than 20.

Figure 1. Select point for match in rough match

The HGA contains a route table to restore the point the hill-climbing process has went through. Thus it prevents the algorithm to reenter the precise matching process through these points.

Figure 2. The flow chart of HGAUnits

IV. EXPERIMENTAL RESULTS

The algorithm is programmed with VC++ 6.0, and tested in PC with Pentium 1.86GHz basic frequency and 1G memory. The size of reference image is 768 × 512 and the size of template image is 174×149.

Page 3: [IEEE 2010 International Conference on Multimedia Technology (ICMT) - Ningbo, China (2010.10.29-2010.10.31)] 2010 International Conference on Multimedia Technology - A Fast Variable

Figure 3. The reference image

Figure 4. The template image

The result of experiment in the noise-free environment is showed by table :

TABLE I. THE COMPARISON OF IMAGE MATCHING ALGORITHM IN NOSE-FREE ENVIRONMENT

Experimental times

Average time/ms

Correct times

Accuracy /%

ABS 100 90250 100 100 SSDA 100 16526 100 100 SGA 100 6468 86 86 HGA

(T2=1) 100 126 100 100

The result shows that the ABS algorithm requires the longest time, and the HGA requires the shortest time. The SGA algorithm is faster than the ABS and SSDA algorithm, but the accuracy is lower. The HGA algorithm performs both well in time and accuracy.

The result of experiment with 0.05 intensity salt and pepper noise is showed by table :

TABLE II. THE COMPARISON OF IMAGE MATCHING ALGORITHM WITH SALT AND PEPPER NOISE

Experimental times

Average times/ms

Correct times

Accuracy/%

SGA 100 7523 80 80 HGA

(T2=0.9) 100 131 100 100

The result of experiment with mixed noise is showed by table :

TABLE III. THE COMPARISON OF IMAGE MATCHING ALGORITHM WITH MIXED NOISE

Experimental times

Average times/ms

Correct times

Accuracy/%

SGA 100 9512 32 32 HGA

(T2=0.9) 100 372 85 85

In Table the intensity of the salt and pepper noise is 0.05, the result of table 2 shows that the salt and pepper noise has little effect on the HGA algorithm. In Table the mixed noise is composed by the salt and pepper and Gaussian white noise. The mixed noise decreases the accuracy of SGA significantly, and also has some effect on the HGA algorithm.

ACKNOWLEDGMENT

This paper is support by Funding Project for Academic Human Resources Development in Institutions of Higher Learning under the Jurisdiction of Beijing Municipality.

REFERENCES

[1] Zhang Hong-yuan, Chen Zi-li, Research on Classical Image Matching Algorithm and Its Improved Method. Exploitation and Application of Software, vol 27, 2008

[2] Hu You-wei, Research on Target Recognition Based on Genetic Algorithm. Wuhan University of Technology Master's degree paper, April 2006

[3] Shi Ming-xia, Tao Lin-bo, Shen Jian-jing, Improvement and Application of a Self - Adaptive Genetic Algorithm. Microcomputer Applications, vol 27, July 2006

[4] Yu Qing-an, Li Jian-hua, Wang Sun-an, Fast Image Matching Based on Optimum Family Genetic Algorithm. Computer Applications, vol 24, December 2004

[5] Sun Guo-xi, Yin Jun-xun, A Multi2Mutation Genetic Algorithm for the Image2Matching Question. Journal of Jiangxi Normal University, vol 30, May 2006.