## 3 Image-Servo Control and Pattern Recognition of the Positioning Mark
### Image Processing and Pattern Recognition  
Before the alignment using the XXY stage is performed, the image processing and recognition are obtained according to the following steps: (1) teaching the pattern of positioning mark; (2) capturing the images by dual GIGA-E CCDs; (3) spatial and frequency filtering; (4) binarization; (5) erosion and dilation; (6) recognizing the positioning mark from the region of interest (ROI) by the pattern matching method, (7) edge detecting the fiducial marks and obtaining the centers of the positioning marks; and (8) transforming the image coordinates to actual Cartesian coordinates. Object detection plays an important role in determining the localization of the alignment mark in this image processing problem. To achieve the image alignment, the most important point is the mark recognition at first. If the mark recognition method is robust and stable, the accuracy of mark recognition can be guaranteed. Generally, the pattern image should be complete and clear enough for the precision alignment. The pattern of the target image should be obtained by image processing and it is usually called pattern teaching in the AOI software. First, the pattern image is acquired from the ROI as the target image and the captured image is processed by the binarization to become a binary image. After that, the binarized image is processed by morphologically processing to become a cleaner binary image and stored in the PC memory. Second, the binarized image is applied to perform pattern matching to find the located regions of the actual image which are similar to the target pattern image. Figure 8 is used to describe the relationship between the testing image and the pattern where the gray value of the testing image to be searched at image pixel (\(x\), \(y\)) is denoted by _f(x, y)_ and that of the pattern image is denoted by \(w(x,y)\). In addition, the size of the testing image is denoted as \(M\times N\) and the size of the pattern image is \(J\times K\). Therefore, the matched score \(R(x,y)\) between the pattern image and the testing image can be defined as follows. \[R(x,y)=\sum_{x}\sum_{y}\left[f(s,t)-w(x+s,y+t)\right]^{2} \tag{5}\]  
Based on the above equation, the perfect match is when the value of \(R\) is zero. Otherwise, the larger \(R\) means that the matching case is worse. The above method is called the square difference matching method [11]. Different from the above method, there is another popular method which uses the normalized correlation coefficient (NCC) between the pattern image and the searched image to determine the matching score; this method is called the NCC matching method [17]. The definition of the NCC is described as follows. Figure 7: (**a**) Upper alignment mark; (**b**) Lower alignment mark. (6)  
where \(s=0\), \(1\), \(2\), \(\ldots\), \(M-1\), \(t=0\), \(1\), \(2\), \(\ldots\), \(N-1\), \(\overline{w}\) is the average gray-level value of the pattern, \(w(x\), \(y)\), and \(\overline{f}\) is the average gray-level value of the testing image \(f(x\), \(y)\). The NCC value has two characteristic properties: (1) the correlation coefficient \(r(s,t)\) is normalized in the range between \(-1\) and \(+1\); (2) the larger \(r(s,t)\) implies the larger pattern matching. In this study, the NCC method is applied to find the fiducial mark. Figure 9 illustrates a pattern matching case by the NCC method; Figure 9a is the actual testing image and Figure 9b is the pattern image which is binarized. Figure 9c shows that the captured image is binarized and the pattern matching result using the NCC method is shown in Figure 9d (the red circle is used to mark the matched image). It is easy for the pattern recognition if there is only one fiducial mark that must be identified. However, to increase the speed of the image-servo mask alignment, the proposed method must capture the upper mark and the lower mark in the one shot.