*Article* **Automatic Feature Region Searching Algorithm for Image Registration in Printing Defect Inspection Systems**

#### **Yajun Chen 1,2, Peng He 1, Min Gao <sup>1</sup> and Erhu Zhang 1,2,\***


Received: 20 October 2019; Accepted: 7 November 2019; Published: 12 November 2019

**Abstract:** Image registration is a key step in printing defect inspection systems based on machine vision, and its accuracy depends on the selected feature regions to a great extent. Aimed at the current problems of low efficiency and crucial errors of human vision and manual selection, this study proposes a new automatic feature region searching algorithm for printed image registration. First, all obvious shapes are extracted in the preliminary shape extraction process. Second, shape searching algorithms based on contour point distribution information and edge gradient direction, respectively, are proposed. The two algorithms are combined to put forward a relatively effective and discriminative feature region searching algorithm that can automatically detect shapes such as quasi-rectangular, oval, and so on, as feature regions. The entire image and the subregional experimental results show that the proposed method can be used to extract ideal shape regions, which can be used as characteristic shape regions for image registration in printing defect detection systems.

**Keywords:** machine vision; defect inspection; image registration; feature region; contour point distribution; edge gradient direction

#### **1. Introduction**

Product surface defect detection is an important application field of machine vision, and it has been widely used in various industries, including the steel industry [1], textile industry [2], semiconductor manufacturing industry [3,4], and printing industry [5,6]. For surface defect detection systems based on machine vision, one key technology is image registration. Image registration is an image processing technique that aligns two images spatially. Machine vision inspection systems ensure that each detected image captured by the camera is aligned with the standard template image in a spatial position [7]. Selecting the appropriate registration features for different detection contents is a critical in improving registration accuracy.

At present, image registration algorithms can be roughly divided into three types: pixel grayscale-, image feature-, and transform domain-based image registration algorithms [8]. The pixel grayscale-based image registration algorithm usually finds the optimal match through a grayscale similarity measure, such as the normalized cross-correlation registration algorithm [9] and the sequential similarity detection algorithm [10]. This type of algorithm is stable and usually uses full grayscale information to measure the similarity of two images. However, pixel grayscale-based registration methods are often computationally intensive and thus achieve poor real-time performance. The image feature-based registration algorithm mainly uses image features such as corner, edge, texture, and shape. This method extracts the features of two images and uses a similarity measure to determine the spatial transformation relationship [11]. The extracted feature types determine the accuracy of image registration. The existing feature extraction operators mainly include the Harris operator [12], Forstner operator [13], SIFT operator [14], SURF operator [15], FAST operator [16], PCA-SIFT [17], SAR-SIFT [18], AB-SIFT [19], and other operators. This type of algorithm entails a minimal amount of computation and achieves strong robustness. However, for images with inconspicuous features, this type of algorithm seems to be ineffective [17]. The transform domain-based registration algorithm transforms images from the spatial domain to the frequency domain and then analyzes the image in the frequency domain to determine the registration parameters. The commonly used frequency domain transform-based image registration algorithms mainly include wavelet transform registration technology [20,21], Fourier transform registration technology [22–24] and composite registration algorithm combined with the space and frequency domain [25,26]. This type of image registration method has a strong anti-noise ability, but the calculation amount is relatively large.

Pixel grayscale-based and shape feature-based image registration algorithms are widely used in the field of printing defect detection systems based on machine vision. However, as mentioned previously, the pixel grayscale-based image registration algorithm entails a large amount of calculation, achieves low real-time performance, and is greatly influenced by illumination. In addition, the registration feature regions based on pixel grayscale are difficult to establish and are not robust because the image contents of different prints vary widely. Therefore, the current study adopts the shape feature-based image registration algorithm to align captured printed images with a standard reference template image. In existing printing defect detection systems, feature regions are selected manually. However, manual selection results in inconsistent selected regions and low efficiency. These drawbacks affect the precision of registration and cause systems to fail to meet the requirements of the highly automated visual inspection of printed matter. Hence, this study proposes an automatic feature region searching algorithm for image registration without manual marking to improve the real-time results and accuracy of the registration process. In addition, an automatic method for identifying registration subregions is proposed on the basis of the region partition of printed images and a subregional-associated searching method. The proposed method can cope with the misregistration of partial areas caused by paper deformation or slight rotation. Moreover, we propose a method of how to represent a good shape and give an effective feature region searching method. To the best of our knowledge, no previous research has explored this topic.

The main contributions of this work are fourfold. The details are as follows.


have stable registration feature regions. The proposed feature region searching method associated with neighborhood subregions can address this problem.

The paper is organized as follows. Section 2 presents the methodology, including the problem description, shape feature analysis, proposed shape searching method based on contour point distribution information, shape searching method based on edge gradient direction, and the improved algorithm based on the combination of contour point distribution information and edge gradient direction information. Section 3 discusses the experimental results of the automatic searching of entire image registration feature regions and subregions. Section 4 provides the conclusions.

#### **2. Methodology**

#### *2.1. Description of the Problem*

The schematic diagram of a web printing machine is shown in Figure 1. This machine usually consists of four color units, namely, cyan, magenta, yellow, and black. The printing cylinder is continuously rotating, and the printed image of one plate is repeating [5]. Figure 2 shows a schematic diagram of the entire printed image of one plate. The registration marks on the two sides of the image are used to register the cyan, magenta, yellow, and black color units. Printing defect detection generally uses the entire printed image of a cylinder plate as the basic detection unit. The images captured by the line camera are compared with the standard reference template image, which requires image registration.

**Figure 1.** Schematic diagram of web printing machine [5].

**Figure 2.** Entire printed image of one plate and the color registration mark.

Previous printing defect inspection systems utilize the cross-line registration marks on both sides of a printed image as the registration feature. They also inspect the entire printed image of the plate as a whole. However, with the increase in printing speed, the stretching, deformation, and vibration of printing materials cause inconsistencies in the physical size of printed images. Moreover, registration with a whole plate image may cause false detection. Therefore, an increasing number of printing defect inspection systems require partition detection of entire printed images, that is, a printed image is divided into several subregions for sub-area detection. At present, the printed images of each region are not necessarily the same, and the traditional manual method of selecting a registration area is inefficient. Meanwhile, the selection of the feature regions of every sub-area by human vision is unstable and prone to errors. Therefore, an intelligent and automatic registration feature region searching method is urgently needed to achieve an effective selection of the registration feature regions of subdetection area.

Figure 3 presents the flowchart of the online printing defect detection system. We use printing defect visual inspection machine to capture the standard reference template images and other printed images in real time. During printed image defect detection, the image to be detected and the standard reference template image need to be registered initially. We propose an automatic feature region searching algorithm for image registration.

**Figure 3.** Flowchart of online printing defect inspection.

In this work, a region with discriminative shapes is used as the registration feature region for aligning the printed image collected online with the standard template image. A good shape region requires significant contour features and can be highly differentiated from other regions, such as geometric shapes, text, and characters, in printed images.

#### *2.2. Shape Feature Analysis and Flow of Feature Shape Region Searching Algorithm*

#### 2.2.1. Shape Feature Analysis

As shown in Figure 4, several shapes are extracted from a printed image after the preliminary shape extraction process (Section 2.2.2). The shape in Figure 4a is mainly composed of several horizontal lines. These shapes are often included in the edges of graphics or in the complicated strokes of the characters in graphics-rich printed matter. Hence, this type of registration region shape is likely to cause a mismatch. The shape in Figure 4b belongs to a segment of a barcode. The shape feature is not obvious, and it is surrounded by many similar shapes, which could cause a mismatch. The shape in Figure 4c consists of the numeral 2 and a horizontal line. The contour of the numeral 2 is relatively regular and highly recognizable and may thus be an ideal shape feature. By contrast, the horizontal line

contains little characteristic information and is almost meaningless for shape matching. In addition, it increases time consumption and is consequently undesirable. Other shapes are formed by the boundaries of the two patterns. The shape shown in Figure 4d is common in texture-rich printed matter; it is irregular and can easily cause a mismatch. On the contrary, the shape region shown in Figure 4e is a Chinese character "period" with obvious features, regular contours, and high degree of recognition feature. Thus, it is a good shape region for image registration during printed image defect detection.

**Figure 4.** Several shape types from printed packaging. (**a**) Shape 1; (**b**) Shape 2; (**c**) Shape 3; (**d**) Shape 4; (**e**) Shape 5.

No research or strict definition describes the ideal shape for registration in printing defect inspection. Considering the requirements of the automatic searching of registration feature regions in online printing defect inspection, we innovatively propose a description of an ideal shape. It preferably contains the following three elements:


The analysis shows that the feature region for printed image registration requires a completely closed contour shape, a rich contour edge gradient direction, horizontal and vertical lines, and so on. Therefore, we conclude that regions containing any one shape, such as quasi-rectangle, ellipse-like shapes, or a shape with numerous changes in edge direction, can be used as a feature region for image registration. This feature region should be easy to identify and exhibit strong robustness. This study proposes an automatic shape feature region detection algorithm that can detect quasi-rectangle, ellipse-like shapes, etc. The results should address the inaccurate and time-consuming problems of the manual selection of registration feature regions.

2.2.2. Flow of Proposed Feature Shape Region Searching Algorithm for Image Registration

The proposed feature shape region searching algorithm is shown in Figure 5. Here, "Capture printed images online" means that the printed matter for defect detection is captured on an actual printing press in real time. The proposed algorithm mainly includes four main steps.

**Figure 5.** Flow chart of the proposed feature region searching algorithm.


gradient directions is retained. The shape contours that do not satisfy the judgment condition are eliminated.

(4) The contour point distribution information and the edge gradient histogram information are combined to propose an improved automatic feature region searching algorithm for image registration in printing defect inspection systems. The detailed description is provided in Section 2.5.

#### *2.3. Shape searching Algorithm Based on Contour Point Distribution Information*

#### 2.3.1. Algorithm Description

The outline of a shape is composed of points, and the positional relationship of the points constitutes different shapes. The positional relationship of the shape contour points can be used to describe a shape [27]. The specific steps of the proposed algorithm are as follows.

First, the centroid position of the shape is calculated and taken as the pole to establish a polar coordinate system.

Second, the azimuth direction is divided into 12 intervals, and the number of contour points falling into each direction bin is counted, as shown in Figure 6. In this figure, point *O is* the centroid position, and point P is a point on the shape contour falling within the first direction bin.

**Figure 6.** Shape and its contour point distribution information.

Third, we count the number of contour points in each direction bin with the assumption that the number of contour points in each direction bin is stored in a variable named *Direct*, where *Direct* = (*d*1, *d*2, *d*3, ... , *d*12). The contour points of a regular shape are usually evenly distributed over all directions. Therefore, we propose the following judgement conditions as Formula (1) to determine whether or not a shape is regular:

$$\begin{cases} N\_{\rm d} > N\\ d\_{\rm min} < S\_{\rm d} = \text{Deviation}(\textit{Direct}) < d\_{\rm max} \end{cases} \tag{1}$$

where *N*<sup>d</sup> is the number of direction bins covered by all shape contour points. The operator Deviation(·) is used to calculate the normalized standard deviation of the number of contour points in each direction bin. Take Figure 3 as an example. The number of direction bins covered by the contour points of the shape is 8, *N* is a threshold value that defines the minimum number of direction bins covered by the contour points, and *S*<sup>d</sup> is the normalized standard deviation of the number of contour points in each direction bin. The normalized standard deviation is calculated with the standard deviation of the number of contour points in each direction bin divided by the largest standard deviation of all direction bins to adapt to the contour shapes of different sizes. *d*min and *d*max, respectively, denote the low threshold and high threshold. The thresholds define the allowable range of the normalized standard deviation of the number of contour points in each direction bin; the more uniform the

distribution direction is, the lower the standard deviation will be, resulting in a high upper-limit threshold. Note that the standard deviation of the circle contour is considerably low, that is, it is close to 0. As the circular registration region cannot determine the rotation angle of the image, the circle shape is not suitable as an image registration region. Therefore, we must define the minimum value of the standard deviation. In the actual test, the values of the above parameters are *N* = 8, *d*min = 0.01, *d*max = 0.07. The maximum value of *n* can be 11.

#### 2.3.2. Experimental Results and Analysis

As shown in Figure 7a,b, the red shape region is the result of the shape search algorithm based on the contour point distribution information, as proposed in Section 2.2.1. Figure 7 shows that the algorithm selects the regular shape region and eliminates the similar shapes in Figure 4c,d. However, the effect of the elimination is poor, as shown in Figure 4a,b.

**Figure 7.** Experimental results of shape searching algorithm based on contour point distribution information. (**a**) Shape 1; (**b**) Shape 2.

The analysis reveals that the method takes the shape centroid as the reference point and describes the shape according to the distribution of the other points around the centroid. Although the method can judge the regularity of the shape as a whole, it cannot reflect the shape feature well. The shape shown in Figure 2a,b presents a regular contour, but the characteristics are not obvious. Therefore, the proposed method is not suitable for such cases.

#### *2.4. Shape Searching Algorithm Based on Edge Gradient Direction*

The shape of the image is outlined by the edge, and the edge is the location of gray level changes. The edge also corresponds to the boundary between the foreground and the background. Therefore, the edge gradient direction information can also reflect the shape of the image to some extent [28,29]. In general, the regular contour and obvious shape have a regular histogram of the edge gradient direction. Otherwise, the histogram of the edge gradient direction appears random. Therefore, the shape can be described on the basis of the histogram of the edge gradient direction, which is a suitable shape description method. The calculation steps of the histogram of the edge gradient direction are as follows.

First, the edge gradient of the shape is calculated using the Sobel gradient operator shown in Formulas (2) and (3), where *w*<sup>1</sup> is the horizontal gradient operator and *w*<sup>2</sup> is the vertical gradient operator:

$$w\_1 = \begin{bmatrix} -1 & 0 & 1 \\ -2 & 0 & 2 \\ -1 & 0 & 1 \end{bmatrix} \tag{2}$$

$$w\_2 = \begin{bmatrix} -1 & -2 & -1 \\ 0 & 0 & 0 \\ 1 & 2 & 1 \end{bmatrix} \tag{3}$$

Second, with the assumption that the image corresponding to the shape region is *I*(*i*, *j*), the gradient along the x direction is its horizontal gradient denoted by *Gx*(*i*, *j*), which is given in Formula (4). Here, *i*, *j*, respectively, denote the horizontal and vertical position of the convolution calculation center at the time of Sobel extraction. The calculation is performed on the image corresponding to the minimum circumscribed rectangle of each shape region.

$$G\_{\mathbf{x}}(i,j) = \begin{cases} l(i-1,j+1) + 2 \ast l(i,j+1) + l(i+1,j+1) - l(i-1,j-1) - 2 \ast l(i,j-1) \\ -l(i+1,j-1) \rfloor, \ 0 < i < m, \ 0 < j < n \end{cases} \tag{4}$$

Third, the gradient along the y direction, i.e., the vertical gradient is denoted by *Gy*(*i*, *j*), which is given in Formula (5):

$$\begin{array}{lcl} \mathbf{G}\_{\mathbf{y}}(i,j) = & \{l(i+1,j-1) + 2 \ast I(i+1,j) + I(i+1,j+1) - I(i-1,j-1) - 2 \ast I(i-1,j) \\ & - I(i+1,j+1) \} \ , \ 0 < i < m, \ 0 < j < n \end{array} \tag{5}$$

Therefore, the gradient direction is given in Formula (6):

$$\theta = \arctan(\frac{G\_y(i, j)}{G\_x(i, j)}) \ 0 \le \theta < 2\pi \tag{6}$$

where angle θ is quantized every 5◦ as a direction. Thus, the interval between 0 and 2π is divided into 72 direction bins. The histogram of the edge gradient direction can be obtained by counting the number of edge points in each direction. Figure 8 illustrates the histogram of the edge gradient direction, in which every 5◦ is a column.

**Figure 8.** Histogram of edge gradient direction for the shape region. (**a**) Schematic diagram of gradient direction. (**b**) Histogram of gradient direction of one shape region

Variables *L* and *Hg* represent the edge perimeter of a shape and the histogram of the edge gradient direction for storing the number of edge points in each direction. These two variables are given in Formula (7). Parameter *h*<sup>i</sup> represents the number of edge points in the i-th gradient direction of each shape region.

$$\begin{cases} \mathbf{H\_{g}} = (h\_{1}, h\_{2}, \dots, h\_{72}) \\ \frac{72}{\sum} h\_{i} = L \end{cases} \tag{7}$$

As shown in Figure 9, several differently shaped regions (marked as green portions) and the corresponding histograms of their edge gradient directions are given. The shape shown in Figure 9a is particularly close to a rectangle. Figure 9b shows that the edge gradient direction of the shape is mainly concentrated in the horizontal and vertical directions, that is, π/2, π, 3π/2, and 2π. The four directions respectively correspond to 18, 36, 54, and 72 gradient direction bins. The histogram of the edge gradient direction distribution resembles a cross shape and a quasi-cross shape.

**Figure 9.** Experiment results of the method based on the histogram of the edge gradient direction. (**a**) Approximate rectangular shape; (**b**) shape's histogram of edge gradient direction; (**c**) elliptical shape; (**d**) shape's histogram of edge gradient direction; (**e**) good shape; (**f**) shape's histogram of edge gradient direction histogram.

Figure 9c shows an elliptical shape. The number of edge points in the vicinity of the two gradient directions (π/2, 3π/2) is large, that is, the numbers of edge points in the 18th and 54th direction or nearby sections are large. The numbers of edge points in the 36th and 72nd directions or nearby sections are also large, and the numbers of edge points in the other gradient directions are relatively close. In general, the histogram distribution of the edge gradient direction is relatively uniform, as

shown in Figure 9d, and is similar to the histogram distribution of the edge gradient direction of the quasi-elliptical shape. The values of the *Y* axis in Figure 9b,d,f are of a gradient magnitude, that is, the number of contour point falling into the direction bin.

In addition, many shapes exhibit the characteristics of the two types of regions described previously. Figure 9e shows a good shape, which has several edge points in 18, 36, 54, and 72 gradient direction bins. In addition, the numbers of edge points in the other gradient direction bins are relatively close. In general, the histogram distribution of the edge gradient direction is relatively uniform, as shown in Figure 9f.

Figure 9 shows that the aforementioned shapes have obvious features and regular contours and are thus suitable as registration feature regions. Hence, we propose to use the histogram of the edge gradient direction to detect the shape regions with rectangle, cross shape, quasi-rectangle, and quasi-cross shape types as the image registration feature regions. The detection method is defined by Formula (8):

$$h\_i > T\_{m\_t} \text{ : } i = 18, \text{ 36, 54, 72} \tag{8}$$

where *Tm* is a threshold value used to define the number of edge points in the four gradient direction bins.

Alternatively, we can select the shape region in which the overall distribution of the edge points in the gradient direction bins is relatively uniform as a feature region for image registration. The judgment conditions are as follows:

$$\begin{cases} N\_{\text{\%}} > T\_{\text{\%}}\\ S\_{\text{\%}} = \text{Deviation}(H\_{\text{\%}}) < T\_{\text{\%}} \end{cases} \tag{9}$$

where *Ng* is the number of directions covered by the contour points; *Tn* is the threshold of the number of directions, which limits the total number of directions in the lowest gradient and ensures that the shape has obvious features; *Sg* is the normalized standard deviation of the number of edge points in each gradient direction bin and reflects the uniformity of the distribution of edge points in each gradient direction. The size of each shape is different from the inconsistent number of edge points. Therefore, the standard deviation of the number of edge points distributed in each gradient direction bin must be normalized to ensure its versatility for differently shaped regions. *Tg* is a threshold that limits the maximum standard deviation of the edge points distributed over each gradient direction bin. If the condition is satisfied, then the overall distribution of the edge points of the shape in the gradient direction bin is considered to be uniform.

In the actual test, the values of the above threshold parameters are follows: *Tm* = 32, *Tn* = 25, *Tg* = 0.035. The proposed method can extract shapes with rich features and regular contours. For example, the poor shapes of types (a) to (b) in Figure 4 show a good exclusion effect. The reason is that the edge gradient direction of the shape (a) in Figure 4 is mainly concentrated in the horizontal direction, whereas the edge gradient direction of the shape in Figure 4b is mainly concentrated in the vertical direction, and it has a single gradient direction. However, this method is also capable of extracting the shape regions of types (c) to (d) shown in Figure 4. The reason is that the edge gradients of the types (c) to (d) regions are rich and the shape is irregular. Although the basic principle of this method is based on changes in the edge gradient, it does not consider the shape as a whole. Consequently, the method cannot exclude the types (c) to (d) regions shown in Figure 4. In view of the above reasons, we propose a new feature region search method that combines the contour point distribution information and edge gradient direction.

#### *2.5. Shape Search Algorithm Based on Combination of Contour Point Distribution and Edge Gradient Direction*

The previous analysis reveals that the histogram of the edge gradient direction can effectively represent the shape feature of a region, which belongs to the global feature. The contour point distribution information can reflect the uniformity of the contour point distribution with respect to the centroid, that is, the regularity of the shape contour. The contour point distribution information

belongs to local features. Therefore, a new shape searching algorithm based on the combination of the two criteria is proposed.

For a shape region with a rectangular shape, a cross shape, a quasi-rectangular shape, and a quasi-cross shape, the condition shown in Formula (10) should be satisfied, with consideration for the regularity of the shape contour. Then, the shape region can be used as the feature region for printing image registration.

$$\begin{cases} \text{ } h\_i > T\_{\text{m},i} = 18, \text{ } 36, 54, 72\\ \text{ } d\_{\text{min}} < \text{S}\_{\text{d}} = \text{Deviation}(\text{Direct}) < d\_{\text{max}} \end{cases} \tag{10}$$

For the shape region in which the overall distribution is relatively uniform, the determination condition shown by Formula (11) is employed:

$$\begin{cases} N\_{\text{\%}} > T\_{\text{\%}}\\ S\_{\text{\%}} = \text{Deviation}(H\_{\text{\%}}) < T\_{\text{\%}}\\ d\_{\text{min}} < S\_{\text{\%}} = \text{Deviation}(\dot{D} \text{rect}) < d\_{\text{max}} \end{cases} \tag{11}$$

where the definition of each parameter is the same as the above equations.

#### **3. Experimental Results and Analysis**

#### *3.1. Results of Automatic Feature Region Searching for Image Registration*

The experimental results show that the proposed shape searching algorithm based on the combination of contour point distribution information and edge gradient direction can select the good shape in the image stably and quickly. Figure 10 provides an example of the result of a printed image. Figure 10a shows all shapes extracted after edge detection and the connected component analysis. Figure 10b shows the good shapes searched. Figure 10c presents a partially enlarged view.

**Figure 10.** First set of searching results for good shapes. (**a**) All shapes detected; (**b**) good shapes searched; (**c**) partially enlarged image of Figure (**b**).

In addition to the results in Figure 10, the results of the test on the automatic registration feature region searching algorithm for other printed packaging images are given. The red contours in Figures 11a and 12a present all the shapes detected by the preliminary shape extraction method, and the red contours in Figures 11b and 12b represent good shapes searched. Figures 11c and 12c represent, respectively, the partially enlarged image of Figures 11b and 12b.

**Figure 11.** Second set of searching results for good shapes. (**a**) All shapes detected; (**b**) good shapes searched; (**c**) partially enlarged image of Figure (**b**).

(**c**)

**Figure 12.** Third set of searching results for good shapes. (**a**) All shapes detected; (**b**) good shapes searched; (**c**) partially enlarged image of Figure (**b**).

#### *3.2. Results of Automatic Feature Region Searching for Subregion Image Registration*

A printed image is usually divided into many detection areas to overcome the influence of paper deformation during printing defect inspection. Moreover, a registration feature region is determined for each detection area. If more than one feature region is searched in a detection area, then the feature region near the center of the detection area is generally taken as the feature region for the registration of the area, and the others are discarded. If no feature region is searched in one detection area, then the neighboring feature region is taken as the registration feature region to align with the detection area. This approach is called the subregion-associated feature region searching method.

The steps of the detection zone partition and extraction of registration feature region are as follows.


**Figure 13.** Results of subregion searching of shape feature region for image registration.


Figure 13 shows the subregion processing result of Figure 10. The printed image size is 1604 × 888, which is divided into six detection areas. As shown in Figure 13, each detection area is automatically searched for a suitable feature region, i.e., the green region in Figure 13.

#### *3.3. Shape Search Parameter*

After many experiments, the required parameters in the search strategy are determined. The value of each parameter is suitable when searching for shapes (Table 1). Therefore, in the actual search strategy, the parameter in Table 1 is taken as the initial value of the parameter if the condition is not found under this condition. The appropriate parameter limits of the shape can be further relaxed.

*T***<sup>n</sup>** *T***<sup>g</sup>** *d***min** *d***max** *T***<sup>m</sup>** 25 0.035 0.01 0.07 32

**Table 1.** Selected parameter values for shape search.

In the experiment, the time required to search for the best shape region in the printed image with size of 1604 × 888 pixel is 4 s. In an actual printing defect detection system, searching the feature region in the detected reference template image is set offline. Therefore, this speed of 4 s can meet the needs of the printing defect detection industry.

#### **4. Conclusions**

Automatic methods for searching feature regions in printed image registration are studied in this work, and the existing problems of the manual marker feature regions are addressed. The automatic feature region searching method for image registration without manual marking is proposed. First, the characteristics of different shapes are analyzed. The characteristics of feature region shapes for image registration are proposed. Second, the contour point distribution information and the edge gradient direction are combined. The decision conditions of the corresponding shape searching algorithm are given. The experimental results show that the proposed method can extract the ideal shape, such as a quasi-rectangle region and a quasi-ellipse region, and use it as the image registration feature region in a printing defect detection system.

The contributions of the proposed automatic feature region searching algorithms are as follows. First, despite the real-time requirements of printing defect inspection systems, the proposed algorithm for the automatic searching of registration feature regions is not particularly complicated and solves the problem in printing defect online detection systems. It also solves the problem of automatically, efficiently, and accurately establishing the registration feature regions in printing defect detection systems. The method can establish a detection standard reference template image automatically and quickly during online printing defect detection. The problem of low efficiency and unreliability of registration regions in manual searching is overcome by the proposed method, which provides an effective solution for image registration feature region searching in printing defect detection systems. Second, the description of a good shape region for image registration for printing defect inspection is proposed. Lastly, the proposed feature region extraction method for subregion registration and the subregion-associated feature region searching method solve the problem of local registration errors for the registration of entire printed images caused by the deformation and rotation of printed images. The proposed method is successfully applied to an actual online printing defect detection system for a certain enterprise.

**Author Contributions:** Y.C. guided the experiments and wrote the manuscript. P.H. carried out the measurements and analyzed the experimental data. M.G. designed the automatic feature region searching algorithms and wrote the program code. E.Z. conceived this study and proposed some valuable suggestions.

**Funding:** This work is supported by the National Key R&D Program of China under Grant No. 2018YFD0700400- 2018YFD0700403, the National Natural Science Foundation of China under Grant No. 61671374, the Key Research and Development Program of Shaanxi under Grant No. 2019GY-080, the Key Program of Natural Science Foundation of Shaanxi Province of China under Grant No. 2017JZ020, the Project of Xi'an University of Technology of China under Grant No. 108-451418006, and the PhD Stand-up Fund of Xi'an University of Technology of China under Grant No. 108-256081702.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
