HOME  ABOUT  JOURNAL ARTICLES  FOR AUTHORS AND REVIEWERS 
Advanced Search >> 
Sorry.
You are not permitted to access the full text of articles.
If you have any questions about permissions,
please contact the Society.
μ£μ‘ν©λλ€.
νμλμ λ Όλ¬Έ μ΄μ© κΆνμ΄ μμ΅λλ€.
κΆν κ΄λ ¨ λ¬Έμλ ννλ‘ λΆν λλ¦½λλ€.
[ Article ]  
Journal of Korea Technical Association of the Pulp and Paper Industry  Vol. 52, No. 4, pp.2837  
Abbreviation: J. Korea TAPPI  
ISSN: 02533200 (Print)  
Print publication date 30 Aug 2020  
Received 26 Jun 2020 Revised 12 Aug 2020 Accepted 14 Aug 2020  
DOI: https://doi.org/10.7584/JKTAPPI.2020.08.52.4.28  
An Algorithm for OnLine Image Segmentation of Multiple Paper Defects Based on Fast TwoDimensional Threshold Method  
Yunhui Qu^{1}^{, 2}^{, †} ; Wei Tang^{1} ; Bo Feng^{3}
 
1Department of Electric and Control Engineering, Shaanxi University of Science & Technology, Xi’an, Shaanxi, 710021, Professor, People’s Republic of China  
2Computer Teaching and Research Section, Xi’an Medical University, Xi’an, Shaanxi, 710021, Professor, People’s Republic of China  
3Department of Electric and Control Engineering, Shaanxi University of Science & Technology, Xi’an, Shaanxi, 710021, Lecturer, People’s Republic of China  
Correspondence to : † Email: nannan_1951@163.com (Address: Department of Electric and Control Engineering, Shaanxi University of Science & Technology, Xi’an, Shaanxi, 710021, People’s Republic of China)  
Funding Information ▼ 
The twodimensional threshold segmentation algorithm is timeconsuming and cannot detect multiple paper defects. Considering these problems, a fast twodimensional threshold method for online segmentation of multiple paper defects was proposed. The image subtraction operation was used first to segment the image with multiple paper defects. Then dividing twodimensional threshold into two onedimensional thresholds was used to accelerate the segmentation. At the same time, according to the gray distribution characteristics of the paper defect image after subtraction, the search range of the threshold was narrowed, and the selection of the optimal threshold was further accelerated. Experimental results showed that the algorithm proposed in this paper can accurately and quickly detect multiple paper defects, and could be effectively used for realtime detection of the paper production process.
Keywords: Background subtraction, multiple paper defects, twodimensional threshold 
With the development of pulp and paper industry, the appearance quality of paper is more and more concerned by modern enterprises.^{1)} In the paper industry, the flaws that do not meet the technical requirements of paper quality are called paper defects. With the rapid development of papermaking production automation, the speed of modern paper machine can reach 1,500 m/min and the width can exceed 10 m.^{2,3)} With the increase of the speed and the width of the web, the probability of paper defects in the process of making is also increasing, which brings great challenges to the detection technology of paper defects.
At present, the paper defect detection system used in the production lines generally use lineararray CCD cameras to collect the paper image sequence, and then use industrial computer to detect and classify the defects. The hardware diagram of the paper defect detection system is shown in Fig. 1.^{4,5)}
The paper defect detection system based on machine vision can detect the paper defects continuously and accurately, which plays an important role in improving the production efficiency and product quality of the paper machine and improving the competitiveness of enterprises.
At present, the commonly used methods for detecting paper defects include thresholdbased, regionbased, edge detection based and specific theorybased segmentation method. Among these methods, the thresholdbased segmentation method is favored by many scholars because of its simple calculation, high efficiency and fast speed.^{6,7)}
The traditional threshold segmentation is mostly based on onedimensional histogram, which cannot use the spatial information of the image. When the target occupies a very small area and the contrast of paper object is low, the phenomenon of false segmentation is serious. Many researchers proposed the threshold segmentation methods based on twodimensional histogram.^{810)} The twodimensional histogram threshold segmentation methods use the gray value of the pixel itself and the correlation of its neighborhood, which reduce the impact of noise on the segmentation, and have a good segmentation effect. However, after expanding from onedimensional to twodimensional, the time complexity is bound to increase, which is not suitable for realtime detection of paper defects in paper production line. Moreover, when there are multiple paper defects with different gray levels in the same paper image, the traditional threshold detection methods are also difficult to select the threshold.
In order to solve the problems that the twodimensional threshold segmentation algorithm is timeconsuming and the traditional threshold algorithm cannot detect multiple paper defects, an improved algorithm was proposed in this paper. Firstly, the paper image was subtracted by subtraction method. Secondly, the twodimensional threshold was decomposed into two onedimensional thresholds for optimal solution. And then, the two onedimensional optimal thresholds were combined into twodimensional optimal thresholds. Which not only improves the speed and accuracy of threshold selection, the accuracy of segmentation, but also effectively solves the problem of multipaper defects segmentation. In the experiment, programs were compiled by Visual Studio 2010+Open CV for simulation, and the results showed that the algorithm can accurately and quickly detect multiple paper defects and can be effectively used in the paper production process.
In view of the realtime consideration, the threshold method is most commonly used in paper defect detection. The threshold method based on onedimensional histogram does not use the spatial information of the image. When the paper defects occupy the very small area of the image, the phenomenon of false segmentation is serious. Especially when the contrasts of paper defects are low, the results of segmentation have a large deviation. The threshold method based on twodimensional histogram can use part of the spatial position information to get better segmentation results than onedimensional threshold method, which lays a good foundation for the extraction of paper disease areas and paper disease classification in the later stage.^{11)}
Let I(x,y) is the image with gray level of L, f(x,y)=i is the gray value of (x,y) point, g(x,y)=j is the average gray value of (x,y) point neighborhood, and a binary (i,j) is formed. The threshold vector (t,s) can divide the twodimensional histogram of the image into four regions, as shown in Fig. 2.:
Among them, areas I and III are target and background areas respectively, areas II and IV are noise and edge points.
Otsu algorithm is also known as the maximum inter class difference method, which basic idea is to select the best threshold to segment the image into multiple parts, so that the maximum inter class variance of each part of the image after segmentation. Twodimensional Otsu segmentation algorithm is described as follows^{12,13)}:
1) The total number of pixels of the image is as follows:
[1] 
Where, the probability of occurrence of pixels with gray value i is as follows:
[2] 
2) Let f(x,y)=i，g(x,y)=j，a binary (i,j) is formed.
3) Let the occurrence number of binary (i,j) is f_{ij}; The probability density of the binary is P_{ij}, P_{ij}=f_{ij}/N, i=1,2,…,L；Where, N is the total pixel number of the image.
4) The probability corresponding to the target and background is P_{o} and P_{b}. When the threshold is (s,t), P_{o} and P_{b} can be calculated by Eqs. 34.
[3] 
[4] 
Let C_{o} and C_{b} are mean vectors of target and background areas，which can be calculated by Eqs. 3, 5 and 6.
[5] 
[6] 
The total gray value C_{T} of the image is shown in Eq. 7:
[7] 
The dispersion matrix is defined as Eq. 8:
[8] 
The trace of the dispersion matrix is defined as Eq. 9:
[9] 
The maximum (t,s) is the best segmentation threshold.
In the traditional twodimensional threshold method, the selection method of the best combination threshold is the exhaustive method, which needs to search in the whole gray level range to find the best threshold that meets the maximum of Eq. 9. Although this method can ensure the accuracy of segmentation, the time complexity is O(L^{4}), which is timeconsuming and not conducive to the use of industrial online detection.^{14)} In addition, when there are multiple paper defects with different gray levels in the same paper image, it is difficult to segment multiple paper defects directly using threshold method. In view of the above problems, a fast twodimensional threshold segmentation method of multiple paper defects is proposed. The flow is shown in Fig. 3.
Before threshold segmentation, subtraction is performed first. That is using the difference between the paper defects image and the image template without defect to obtain the subtracted paper image.^{15)} The contrast image before and after the subtraction is shown in Fig. 4. For some images with gray value less than normal gray value, such as dirty points (as shown in Fig. 4(d)), the gray value of the paper defect part will be negative after the subtraction. In order to solve the problem that the gray value is negative after subtraction, the absolute value of the difference is taken as the output. In this way, the gray value of all the paper defect areas after subtraction operation will be greater than the background area (as shown in Fig. 4(g)). In the process of threshold segmentation, only a suitable threshold value needs to be selected to segment multiple paper defect areas.
The traditional twodimensional threshold segmentation uses the exhaustive method to select the threshold, which needs double cycle. When the gray level of the image is L, the time complexity is O(L^{4}). The calculation and time complexity are too high, which is not conducive to the online paper defects detection. Therefore, this paper proposes a decomposition idea to reduce the time complexity, and according to the gray distribution range of the paper defect area after subtraction, reduce the gray search range, improve the speed and accuracy of threshold selection, and meet the requirements of online detection of paper defect image. The specific methods are as follows:
1) Decomposition of the two dimensional threshold
The twodimensional threshold method is decomposed into two onedimensional optimal thresholds for solution，and then combined into twodimensional thresholds. According to the definition of twodimensional threshold, the threshold t is obtained from the original image f(x,y), and the threshold s is obtained from the neighborhood mean image g(x,y). The two onedimensional thresholds t and s are solved respectively by the following methods:
Set threshold t to divide the image into two categories: objective and background. The mean value is u_{o} and u_{b} respectively, and the probability of occurrence is p_{o} and p_{b} respectively. Then the variance between the two categories is shown in Eq. 10.
[10] 
Where, u is the mean value of the paper defects image after subtraction.
Set p_{i} is the probability of occurrence of grayscale i, the intra class variance of objective and background is shown in Eq. 11 and Eq. 12 respectively. And the total intra class variance is shown in Eq. 13.
[11] 
[12] 
[13] 
The best segmentation should make the variance between the object and background class s_{p} maximum, and the variance within intra class s_{in} minimum. Let S=s_{p}/s_{in}. Then the segmentation threshold t at S maximum should be the optimal threshold of f(x,y).
Similarly, the same operation is performed on g(x,y) to obtain the best segmentation threshold s.
Two onedimensional thresholds, t and s, are calculated by the above method instead of the twodimensional Otsu algorithm. This method can not only reduce the time complexity of the twodimensional threshold algorithm, but also reduce the space complexity, which is conducive to the realtime detection of the production line.
2) Limitation of threshold range
After subtraction, the gray value of the paper defect area must be greater than the mean value of the background, and in the paper defect image, the paper defect area must be far less than the background area. Therefore, when selecting the threshold value, the lower limit of the threshold value is set as the mean value of the subtraction image. In addition, because the gray value of the paper defect area must not be greater than the maximum gray value of the image, the upper limit of the threshold value is set as the maximum gray value of the paper defect image. This will greatly reduce the range of threshold selection, reduce the number of cycles, and speed up the twodimensional threshold selection.
In productive processing of paper, the common paper defects include dirty spots, holes, and cracks. Among them, the dirty spots and holes belong to relatively high contrast paper defects, cracks belong to low contrast paper defects. The gray values of dirty spots are lower than that of paper background, and the holes and cracks are higher than background. The three kinds of paper defects and several different kinds of paper defects in the same image were used as the test objects in the paper. Programs were compiled by Visual Studio 2010+Open CV to compare the proposed method with 1D OSTU and 2D OSTU algorithms. The environment used in the experiment was: Windows 10 Home Edition, Intel^{®} core™ I77500u CPU, 8G DDR4 2400.
The segmentation algorithm and optimal segmentation threshold of the algorithm proposed in this paper were shown in Table 1:
Paper defects  Image after subtraction  Image after segmentation  Segmentation threshold 

(49,46)  
(64,62)  
(54,55)  
(37,44) 
In this paper, three algorithms were respectively used to segment the paper defect image with holes and the multi paper defects image, and the segmentation effect was shown in Table 2. (Because there are crack and dirty spot in the image of multiple paper defects, the segmentation results of two kinds of paper defects were not shown in the experimental results).
Image after subtraction  1D Otsu  2D Otsu  Proposed 

It can be seen from the contrast effect in Table 2 that when the paper defect area was large and the contrast was obvious, the segmentation effect of the three algorithms was ideal. And for the segmentation of paper defects with low contrast and small area, the segmentation effect of onedimensional Otsu algorithm was poor in the lower part of contrast, while the segmentation effect of proposed in this paper was close to that of twodimensional Otsu algorithm, which was obviously better than that of onedimensional Otsu algorithm.
In order to further verify the performance of the algorithm proposed in this paper, peak signaltonoise ratio (PSNR) was used to quantitatively compare the segmented images of the three algorithms. The definition of PSNR is as follows:
[14] 
Where, MSE is the mean square error. The smaller MSE value is, the smaller the difference between the segmented image and the contrast image is, and the more accurate the segmentation is. The MSE calculation formula is as follows:
[15] 
The PSNR comparison values of the three algorithms are shown in Table 3:
Image  OSTU  2D OSTU  Proposed 

Multi defects  18.1538  21.7923  21.3267 
From the results in Table 3, it can be seen that the PSNR of the algorithm proposed in this paper was higher than that of onedimensional Otsu algorithm and close to that of twodimensional Otsu algorithm, which was consistent with the comparison and evaluation results of visual effects.
The time complexity of three threshold segmentation algorithms was shown in Table 4:
Image  OTSU  2D OTSU  Proposed 

Crack+Dirty spot  0.04657  0.6563  0.04735 
From the results in Table 4, it can be seen that the time complexity of the algorithm proposed in this paper was far lower than that of the twodimensional Otsu threshold segmentation algorithm, which was close to the onedimensional Otsu segmentation algorithm, so as to achieve the purpose of acceleration. When there were multiple paper defects in the image, the segmentation time was basically the same as that of a single paper defect, and the time complexity did not increase significantly. The algorithm proposed in this paper can basically meet the needs of the web defects detection.
In this paper, a fast twodimensional threshold method for online segmentation of multiple paper defects was proposed. Firstly, the image subtraction operation was used to segment the multi paper defect image. After subtraction, the twodimensional threshold was divided into two onedimensional thresholds to accelerate. At the same time, according to the gray distribution characteristics of the paper defect image after subtraction, the search range of the threshold was narrowed, and the selection of the optimal threshold was further accelerated. This method not only improved the speed and accuracy of threshold selection, the accuracy of segmentation, but also effectively solved the problem of multi paper image segmentation. The experimental results show that the algorithm can accurately and quickly detect multiple paper defects of the production line, and can be effectively used for realtime detection of the paper production line.
This work was partially supported by Scientific Research Project of Shaanxi Provincial Education Department (17JK0645). We sincerely thank for the funding of the project.
1.  Wei, A. J., Li, Q., and Tang, W., An improved paper defects denoising method based on gray associated with neighborhood characteristics, China Pulp & Paper 28(1):4447 (2013). 
2.  Qu, Y. H., Tang, W., and Wen, H., Paper defects denoising algorithm based on homomorphic filtering and discrete cosine transform, China Pulp & Paper 37(5):4549 (2018). 
3.  Shan, W. J. and Tang, W., Multivariable dimensionreduction and synergic control strategy for crossdirectional basis weight of papermaking process, Journal of Korea TAPPI 51(2):7687 (2019). 
4.  Wu, G. A. and Wu, D., Application of industrial camera on paper making, Paper and Paper Making 35(07):816 (2016). 
5.  Wang, B., Tang, W., Dong, J. X., and Wang, F., Study on the drive parameters of a high precision basis weight control valve, Journal of Korea TAPPI 49(3):4156 (2017). 
6.  Zhou, Q., Chen, Y., and Shen, T. Y., Review of paper defect detection system based on machine vision technology, China Pulp & Paper 35(5):7279 (2016). 
7.  Feng, B., Tang, W., and Qu, Y. H., Dynamic threshold setting scheme of paper disease detection based on fuzzy logic, Packaging Engineering 41(03):218223 (2020). 
8.  Wu, Y. Q., Zhu, L., and Wu, S. H., Fast iterative algorithm for image threshold segmentation based on twodimensional Arimoto gray entropy, Journal of South China University of Technology (Natural Science Edition) 44(05):4857 (2016). 
9.  Zhao, H., An, W. S., and Yang, T., Hyperbolic two dimensional Otsu threshold segmentation algorithm, Computer & Digital Engineering 47(08):20332038 (2019). 
10.  Hamed, A., Luiz, E. V. S., and Silva, A. C. M. O., Twodimensional dispersion entropy: An informationtheoretic method for irregularity analysis of images, Signal Processing: Image Communication 75:178187 (2019). 
11.  Xu, C., Huang, F. H., and Mao, Y. Z., An improved twodimensional Otsu thresholding segmentation method, Application of Electronic Technique 42(12):108111 (2016). 
12.  Gao, H. J., Wang, L., and Gong, W. Y., Twodimensional Otsu fast image segmentation based on modified CS algorithm, Communications Technology 50(12):26982703 (2017). 
13.  Qu, Y. H., Tang, W., and Feng, B., Web inspection algorithm for low contrast paper defects based on artificial bee colony optimization, Journal of Korea TAPPI 52(2): 4351 (2020). 
14.  Liu, J. and Jin, W. D., Fast method for 2D threshold segmentation algorithm based on interclass and intraclass variances, Journal of Southwest Jiaotong University 49(05):913919 (2014). 
15.  Qu, Y. H., Tang, W., and Feng, B., Online detection and classification method based on background subtraction and SVM, Packaging Engineering 39(23):176180 (2018). 
