## Jinlong Zhu* , Fanhua Yu* , Mingyu Sun* , Dong Zhao* and Qingtian Geng*## |

Min | Max | CP | R | LAP | Norm | μ | σ_{i} | |

1 | 87 | 97 | 0.8 | 4 | 0.1 | -1.28155 | 2.97025 | 0.433271 |

2 | 85 | 95 | 0.85 | 4.2 | 0.075 | -1.43953 | 1.19025 | 0.412706 |

3 | 83 | 96 | 0.8 | 4.1 | 0.1 | -1.28155 | 1.98025 | 0.433271 |

4 | 89 | 97 | 0.9 | 4.2 | 0.05 | -1.64485 | 2.97025 | 0.392641 |

5 | 90 | 96 | 0.85 | 4 | 0.075 | -1.43953 | 1.98025 | 0.412706 |

6 | 82 | 96 | 0.85 | 4.1 | 0.075 | -1.43953 | 1.98025 | 0.412706 |

7 | 81 | 95 | 0.85 | 4.2 | 0.075 | -1.43953 | 1.19025 | 0.412706 |

8 | 80 | 96 | 0.8 | 4.1 | 0.1 | -1.28155 | 1.98025 | 0.433271 |

9 | 86 | 95 | 0.85 | 4.1 | 0.075 | -1.43953 | 1.19025 | 0.412706 |

10 | 87 | 95 | 0.9 | 4 | 0.05 | -1.64485 | 1.19025 | 0.392641 |

Y | 9.9225 | 0.058463809 | ||||||

σ | 3.15 | 0.241792905 | ||||||

cv | 3.44% | 8.39% |

First, the square transform method converts the low frequency image into a gray-scale image. In addition, we choose exponential transformation, piecewise linear transformation, square root transformation and logarithmic transformation as comparison algorithms. Fig. 5(a) is an exponentially transformed image, with the result that too many black pixels cause a lot of trouble for future processing and application. Fig. 5(c) is a piecewise linear transformation, which results in the algorithm detecting more pseudo foreign object regions. In Fig. 5(d) and (e) are square root transformation and logarithmic transform, respectively. Their results indicate that too large a white background makes it difficult to detect foreign objects. Fig. 5(b) is a square transform with a large proportion of black pixels and a uniform distribution.

The maximum entropy method which is a low frequency passed image based on wavelet multiresolution filters is proposed for binarization, and the result is satisfactory. Otsu method leads to excessive impurity to influence the recognition of foreign body in Fig. 6(a). The minimum error method mixes the background and foreign matter, making it difficult to identify the foreign matter in Fig. 6(b). The maximum entropy method (Fig. 6(c)), the minimum bias-normal distribution method (Fig. 6(d)) and the moment preserving method (Fig. 6(e)) can generate a sharp contour image as compared with the above method. But the maximum entropy method is better than the other two methods. The binary image obtained by the maximum entropy method is the basic framework of image analysis. Finally, the detection algorithm uses the basic frame to identify foreign objects based on the low-frequency image and highfrequency image edge detection.

Fig. 7 is a comparison of our proposed method (Fig. 7(h)) with other edge detection methods. Fig. 7(d) and (e) is difficult to identify the edge of foreign bodies. The results of Fig. 7(b), (c), and (f) are too much interference, making it difficult to identify foreign objects effectively. Fig. 7(g) is a vertical edge detection that contains too many discrete points that do not form an effective boundary. Fig. 7(a) and (i) detect more pronounced boundaries than other methods. Compared with these two methods, we propose a wavelet method with smaller interference boundary and higher recognition accuracy.

Firstly, the distribution of histogram was used to classify images into five categories (C1, C2, C3, C4 and C5) in Fig. 8.

Our algorithm can effectively identify the location of foreign bodies for the five categories as shown in Fig. 9. The red region is the final result of algorithm analysis.

Table 2.

Precision (%) | Error probability | Proportion of missing | |

C1 | 100 | 0 | 0 |

C2 | 99.0789 | 0.844 | 0 |

C3 | 99.2 | 0.8 | 0 |

C4 | 98.6 | 0.14 | 0.005 |

C5 | 100 | 0 | 0 |

In the five types of input images, we prove that our proposed algorithm can identify foreign objects as shown in Table 2. Each type of image is prepared with 500 test cases to test the performance of the algorithm. The precision indicates the ratio of detected foreign body area (foreign body) and the recognition of the detected foreign body area. The error probability indicates detected foreign object (false foreign object) accounted for the proportion of detected foreign object. The missed rate indicates the proportion of unidentified foreign bodies occupying foreign bodies. The accuracy rate of C1 and C5 is 100%. The recognition accuracy of C2 and C3 is up to 99.0789% and 99.2%, respectively. The C4 recognition accuracy rate is 98.6%, but the reason is the lack of illumination with 4% omission of foreign object detection. The proposed algorithm is more accurate than the traditional wavelet transform algorithm, as shown in Tables 3 and 4. The difference between the two is that the traditional wavelet algorithm will determine the background area (similar to the foreign body) as the foreign object area which leads to decreased the accuracy of recognition. Therefore, with the enhancement of image contrast and the uniform distribution of pixels, the proposed algorithm is more accurate. We propose a foreign detecting algorithm based on wavelet transform to achieve the purpose of practical application.

Table 4 shows that our proposed algorithm improves the accuracy of foreign object recognition. The experimental results are more reasonable than other methods.

An improved wavelet transform algorithm with image analysis mechanism has been proposed to detect the foreign bodies on the inner wall of a threaded pipe image. We combine the Monte Carlo method to analyze the probability of foreign body. The algorithm chooses typical characteristics (location and size of suspicious regions) as evaluation parameters. The image analysis mechanism can generate a background with the suspected foreign object region to initialize the contours. This mechanism uses the connected domain to separate the background, the clutter, the foreign objects. The wavelet transform is used to detect the edge of foreign object in low frequency and high frequency image, and the foreign object is determined by the background analysis. Experimental results show that the algorithm has a promising recognition effect. Compared with the traditional wavelet transform method, this method can obtain the boundary region closer to the foreign object. However, the intensity of the light affects the accuracy of the algorithm so that our research is continuing in future work.

This paper is funded by National Natural Science Foundation of China (Grant No. 61604019), science and technology development project of Jinlin Province (No. 20160520098JH and 20180201086SF), Education Department of Jilin Province (No. JJKH20181181KJ and JJKH20181165KJ), Jilin Provincial Development and Reform Commission (No. 2017C031-2).

He was born in 1984. He received the B.E. and M.S. degrees in computer science and technology from Jilin University, China, in 2003 and 2007, respectively. He is a lecturer, School of Computer Science and Technology, Changchun Normal University, Jilin, China. His research interests include computer algorithms and simulation, evacuation planning, image processing and 3D modelling.

He received M.S. degree in computer science and technology, Changchun University of Science and Technology in 2008. He is an associate professor, School of Computer Science and Technology, Changchun Normal University, Jilin, China. His research interests include intelligent information system and embedded technology.

He is currently an associate professor in School of Computer Science and Technology, Changchun Normal University, Jilin, China. He received his B.S. and M.S. degrees in computer science and technology from Jilin University of Technology and Jilin University in 1996 and 2005, respectively. He received his Ph.D. degree in computer science and technology from Jilin University in 2016. His current research fields include image processing and pattern recognition.

- 1 Y. Qin, B. Wang, "Study of on-line inspection technique for foreign substance in Ampoule," in
*Proceedings of International Conference on Artificial Intelligence*, Management Science and Electronic Commerce, Dengleng, China, 2011;pp. 4342-4345. doi:[[[10.1109/AIMSEC.2011.6009975]]] - 2 Y. Qin, B. X. Wang, W. Li, C. Y. Y ang, "Inspection of small moving foreign substances in ampoule based on cascade classifiers,"
*Optics and Precision Engineering*, vol. 20, no. 1, pp. 190-196, 2012.doi:[[[10.3788/ope.20122001.0190]]] - 3 H. T. Chou, C. Y. Chen, T. Y amamoto, N. Hoshi, K. Kawamura, "Foreign substance inspection apparatus,"
*U.S. Patent 6977721 Dec. 20*, 2005.custom:[[[https://patents.google.com/patent/US4468120A/en]]] - 4 L. Zhang, A. Xiang, "An improved region growing algorithm and its application of foreign substances inspection,"
*Nondestructive T esting*, vol. 32, no. 7, pp. 490-492, 2010.custom:[[[http://en.cnki.com.cn/Article_en/CJFDTOTAL-WSJC201007008.htm]]] - 5 F. Mao, S. Y. Zhang, C. L. Huang, "Inspection of foreign substances in mould using image scattergrams and multi-resolution analysis,"
*Journal of Zhejiang University (Engineering Science)*, vol. 43, no. 10, pp. 1749-1756, 2009.doi:[[[10.3785/j.issn.1008-973X.2009.10.001]]] - 6 V. Skorpil, J. Stastny, "Wavelet transform for image analysis," in
*Proceedings of IEEE/Siberian Conference on Control and Communications*, Tomsk, Russia, 2003;pp. 50-55. custom:[[[-]]] - 7 F. Jing, S. Ning, "A novel wavelet transform algorithm for feature extraction of hyperspectral remote sensing image," in
*Proceedings of 2009 International Conference on Computational Intelligence and Natural Computing*, Wuhan, China, 2009;pp. 147-150. doi:[[[10.1109/CINC.2009.142]]] - 8 A. V. Katsuk, "Application of wavelet in image analysis," in
*Proceedings of the 8th Russian-Korean International Symposium on Science and Technology*, Tomsk, Russia, 2004;pp. 140-142. doi:[[[10.1109/KORUS.2004.1555570]]] - 9 J. Liu, "Shannon wavelet spectrum analysis on truncated vibration signals for machine incipient fault detection,"
*Measurement Science and Technology*, vol. 23, no. 5, 2012.doi:[[[10.1088/0957-0233/23/5/055604]]] - 10 A. N. Akansu, W. A. Serdijn, I. W. Selesnick, "Emerging applications of wavelets: a review,"
*Physical Communication*, vol. 3, no. 1, pp. 1-18, 2010.doi:[[[10.1016/j.phycom.2009.07.001]]] - 11 S. Li, J. Wen, "A model-based fault detection and diagnostic methodology based on PCA method and wavelet transform,"
*Energy and Buildings*, vol. 68, pp. 63-71, 2014.doi:[[[10.1016/j.enbuild.2013.08.044]]] - 12 S. M. Hossain, M. Y. Razib, I. Karim, Image Compression Using Wavelet Transform. Saarbruucken, Gemany: VDM Verlag Dr. Muller, 2010.custom:[[[https://www.morebooks.de/store/gb/book/image-compression-using-wavelet-transform/isbn/978-3-639-27994-8]]]
- 13 R. Singh, A. Khare, "Fusion of multimodal medical images using Daubechies complex wavelet transform: a multiresolution approach,"
*Information Fusion*, vol. 19, pp. 49-60, 2014.doi:[[[10.1016/j.inffus.2012.09.005]]] - 14 S. Banerjee, M. Mitra, "Application of cross wavelet transform for ECG pattern analysis and classification,"
*IEEE Transactions on Instrumentation and Measurement*, vol. 63, no. 2, pp. 326-333, 2014.doi:[[[10.1109/TIM.2013.2279001]]] - 15 S. Agarwal, A. K. Verma, N. Dixit, "Content based image retrieval using color edge detection and discrete wavelet transform," in
*Proceedings of 2014 International Conference on Issues and Challenges Intelligent Computing Techniques*, Ghaziabad, India, 2014;pp. 368-372. doi:[[[10.1109/ICICICT.2014.6781310]]] - 16 C. Yardim, P. Gerstoft, W. S. Hodgkiss, "Statistical maritime radar duct estimation using hybrid genetic algorithm–Markov chain Monte Carlo method,"
*Radio Science*, vol. 42, no. 3, 2007.custom:[[[https://scholar.google.co.kr/scholar?hl=ko&as_sdt=0%2C5&q=Statistical+maritime+radar+duct+estimation+using+hybrid+genetic+algorithm%E2%80%93Markov+chain+Monte+Carlo+method&btnG=]]] - 17 S. B. Ahmad, A. Sarfehnia, M. R. Paudel, A. Kim, S. Hissoiny, A. Sahgal, B. Keller, "Evaluation of a commercial MRI Linac based Monte Carlo dose calculation algorithm with geant 4,"
*Medical Physics*, vol. 43, no. 2, pp. 894-907, 2016.doi:[[[10.1118/1.4939808]]] - 18 B. J. Minsley, "A trans-dimensional Bayesian Markov chain Monte Carlo algorithm for model assessment using frequency-domain electromagnetic data,"
*Geophysical Journal International*, vol. 187, no. 1, pp. 252-272, 2011.doi:[[[10.1111/j.1365-246x.2011.05165.x]]] - 19
*J. Zhang and W. Li, 2014 (Online). Available:*, https://arxiv.org/abs/1407.3336 - 20 D. Y. Jia, T. H. Ding, "Detection of foreign materials in cotton using a multi-wavelength imaging method,"
*Measurement Science & Technology*, vol. 16, no. 6, pp. 1355-1365, 2005.doi:[[[10.1088/0957-0233/16/6/018]]] - 21 Y. P. Guan, "Automatic extraction of lips based on multi-scale wavelet edge detection,"
*IET Computer Vision*, vol. 2, no. 1, pp. 23-33, 2008.doi:[[[10.1049/iet-cvi:20070061]]] - 22 F. Chen, W. Wang, "Target recognition in clutter scene based on wavelet transform,"
*Optics Communications*, vol. 282, no. 4, pp. 523-526, 2009.doi:[[[10.1016/j.optcom.2008.10.061]]]