Sequential Similarity Detection Algorithm Based On Image Edge Feature
Sequential Similarity Detection Algorithm Based On Image Edge Feature
MA Guo-hong∗ (), WANG Cong ( ), LIU Pei ( ), ZHU Shu-lin ()
(School of Mechanical & Electrial Engineering, Nanchang University, Nanchang 330031, China)
Abstract: This paper proposes a new sequential similarity detection algorithm (SSDA), which can overcome
matching error caused by grayscale distortion; meanwhile, time consumption is much less than that of regular
algorithms based on image feature. The algorithm adopts Sobel operator to deal with subgraph and template
image, and regards the region which has maximum relevance as final result. In order to solve time-consuming
problem existing in original algorithm, a coarse-to-fine matching method is put forward. Besides, the location
correlation keeps updating and remains the minimum value in the whole scanning process, which can significantly
decrease time consumption. Experiments show that the algorithm proposed in this article can not only overcome
gray distortion, but also ensure accuracy. Time consumption is at least one time orders of magnitude shorter than
that of primal algorithm.
Key words: welding image, feature matching, sequential similarity detection algorithm (SSDA), self-adaption
value
CLC number: TG 409 Document code: A
the coordinate of S which is the lower-left corner point ing form is difficult to be confirmed; for VMCA, the
of S (i,j) and also can be called reference point. The threshold is hard to choose in actual application; in-
meaning of these parameters is shown in Fig. 1. variant moments algorithm is tough to achieve real-time
although it has good stability.
M At present, research on improved SSDA mainly
S(i, j) chooses MAD similarity measure[9,15-16] . Its principle
is simple; meanwhile, it is fast. But result of these
improved algorithms which based on MAD will pro-
duce serious error for gray distortion image. Aiming at
this problem, this paper proposes another new SSDA,
which is based on image feature. It can avoid large time
N
In these approaches discussed above, metric has the Idea of the algorithm is shown as follows. Firstly
smallest value while T is just covering S (i,j) which is the edge detector is applied in subgrph and template image,
target area, but the result has an error while processing and its essence is to extract edges between target and
grayscale distortion image. Therefore, ABS algorithm background in image. Edge is an important feature of
only can be used in the practical field in which high image. Gray distortion or some other noise has little
speed and low calculation precision are required. In influence on it.
order to improve the ability of resisting grayscale dis- This paper adopts Sobel operator, which belongs to
tortion, Nprod and NNprod have been proposed. Al- the first order differential operators. Sobel operator can
though they can overcome the problem created by dis- not only well respond edge, but also repress noise. All
tortion, it is time-consuming[7] . In order to improve of these characteristics have a strong adaptability to
the image matching speed, sequential similarity detec- welding image in practical application. Calculation of
tion algorithm (SSDA) is put forward[8], it can discover Sobel gradient is based on 3 pixel×3 pixel area. Sobel
and abandon non-matching areas in advance. Besides, operator comprises two convolution kernels. Each pixel
the algorithm is simple. But its threshold value is fixed. point in image has to use kernels to get itself respond.
Meanwhile, plenty of time will be spent if a high thresh- Value in kernel equals to corresponding location value
old value is set, and a low value produces low preci- in masking T , as shown in Fig. 2. One kernel is used
sion. Some researchers have proposed improved algo- to detect horizontal gradient, and its result is largely
rithm to solve it[9] , and the time consumption is largely affected by vertical edge; the other is to detect vertical
decreased based on a self-adaptive threshold value fi- gradient, and horizontal edge has a significant impact
nally. on its response. Two convolution kernels are shown in
(2) The other is the algorithms based on feature. Fig. 2.
It utilizes spatial location relative invariant feature in
matching process. These features can be edge, curve,
−1 −2 −1 −1 0 1
corner point, intersection and centroid etc. Researchers
proposed a new SSDA based on image edge feature[10] .
Canny operator is adopted to extract characteristic 0 0 0 −2 0 2
points from subgraph, and to calculate those points re-
sponding pixel-value difference between subgraph and 1 2 1 −1 0 1
template image. The smallest value corresponding re-
gion is regarded as the target area. (a) x-direction (b) y-direction
In addition to those algorithm discussed above,
Fig. 2 Sobel convolution kernels
speed algorithms also contain wavelet pyramid[11] , ge-
netic algorithm[12], various mask correlation algorithm
(VMCA)[13] and invariant moments algorithm[14] , etc. After the gradient is gotten, a preset constant T is
Detail information of image being searched and tem- used to divide pixel points into two parts: one part will
plate image will be lost during the decomposing of be regarded as edge if its response G is greater than T ,
wavelet. It is difficult to guarantee matching precision; and the other will be considered as background if its
genetic algorithm always causes the problem which cod- response G is less than or equals to T . Relevance can
J. Shanghai Jiaotong Univ. (Sci.), 2014, 19(1): 79-83 81
(a) Original image (b) Processing (threshold value 75) (c) Processing (threshold value 90)
Fig. 3 Threshold processing on seam image
While threshold value is 75, there are 25 555 feature ture point. The relationship can be shown in
points; meanwhile, big threshold will make the target
area covered by background. Consequently, an appro- A = A1 + A2 + A3 , (3)
priate value is important; a suitable value can not only
filter many useless points, but also remain the target where, A is the sum of feature point location non-
area. When the threshold is set to 90, the number of overlapping between subgraph and template; A1 is the
feature points decreases to 16 119. number of occurrences (when one point of subgraph is
This algorithm is aimed at initial seam location 1, corresponding spot in template is 0); A2 is number of
recognition before welding operation. Initial seam lo- another occurrences (one point of subgraph is 0 while
cation graphic contains seam, contour and surface of corresponding spot in template is 1); A3 is the last case
the workpiece, and padding (or fixture) located below (when one point of subgraph is 0, corresponding spot
workpiece, etc. All of this information can ensure that in template is 0).
the image which is also regarded as template has ob- The whole scan process adopts coarse-to-fine scan-
vious edge feature. Therefore, the chance that target ning method. In coarse matching part, an initial value
region appears in background area is impossible. A0 which indicates the feature point location relevance
between template and lower-left corner subgraph of ref-
If we directly make a location correlation detecting erence graph should be acquired firstly. Then scan the
between subgraph feature points and template feature rest subgraph, and compare each Ai (i = 1, 2, 3) pro-
points, a region which has a maximum location cor- duced by subgraph and template graph. When Ai is
relation will be considered as the target area. That greater than A0 , scanning process of a subgraph is not
approach can get an accurate result, but programs will finished yet, then scanning should stop immediately,
take a long time to complete. Because programs need and directly scan next subgraph. If Ai is less than A0
to scan (N − n + 1) × (M − m + 1) points (N , M are till the end, then Ai replace A0 before the next scanning
the size of S; n, m are the size of T ; the process is begins. Coarse matching result, denoted as point (X,
shown in Fig. 1), the algorithm calculates gradient of Y ), can be acquired after the whole reference graph.
every point in each subgraph S (i,j) in S, and counts Every subgraph of reference graph can be processed
location correlation between subgraph S (i,j) and tem- according to
plate T . Therefore, the means should be improved.
A0 , Ai > A0
3 Algorithm Optimization and Proce- A= . (4)
Ai , Ai A0
dures
In fine matching process, the scanning area is a 2m ×
We select feature point location non-overlapping 2n rectangle area which center point is (X, Y ) and its
frequency as correlation measure. An image can be scan procedure is the same as coarse scanning.
equivalent to an empty two-dimensional array. Every Scanning strategy is shown as follows.
pixel is corresponding to array element one by one. An (1) One strategy is coarse matching. It is to make
element is set to 1 when its corresponding pixel is fea- the feature point location relevance between lower-left
82 J. Shanghai Jiaotong Univ. (Sci.), 2014, 19(1): 79-83