Journal of Robotics, Networking and Artificial Life, Vol. 4, No. 4 (March 2018) 308-311___________________________________________________________________________________________________________An Automated Optical Inspection system for a tube inner circumference state identification
Chung-Wen Hung*, Jhen-Gu Jiang, Hsien-Huang P. Wu, Wei-Lung Mao

Department of Electrical Engineering, National Yunlin University of Science & Technology , 123 University Road,
Section 3,Douliou Yunlin 64002, Taiwan, R.O.C

E-mail: wenhung@yuntech.edu.tw
www.yuntech.edu.tw

Abstract
An automated optical inspection, AOI, system for a chopstick tube inner circumference state identification is
proposed. This AOI system is installed after the material feed equipment to screen for cost reduction. The tube status
identification is based on the proposed machine vision software, and implemented with EmguCV library. The
algorithms of image processing are used to sort the material into five groups. In this paper, the algorithm will bedetailed, and the experimental results will show the proposed AOI system is workable.
Keywords: Machine Vision, AOI, EmguCV, Tube inner circumference.
telecentric lens are used to enhance the accuracy of the machine
vision system. In order to prevent the influence from theenvironment light, a stable light source is needed [1], and acircular light source is used to ensure uniform illumination ofeach tube. The proposed system is based on the machine vision
software library, EmguCV[2], to quickly confirm a tube wasimaged clearly and in compliance with the imaging
requirements of the defect inspection.

1. Introduction
As AOI technology advances, it is adopted in more and moreproduction lines, but due to cost, not for traditional industry
factories, such as chopstick factories. An expensive process forchopsticks is the chopstick defect detecting, and laborers checkthe good quality only in the final phase.. However, most of thedefective products are caused by the original flawed material.
Only rely on the naked eye to determine the defects, it is too
difficult and waste time. In the other hand, the optical detection
methods will not damage the surface of the tube. An AOI
system for chopstick material is proposed in this paper.
Machine vision technology is used to screen out the tube forflaws before they are processed. In order to have the recoveryof defective materials, the defects are sorted into four types:"Large", "Small", "Deformed" and "Empty".
In machine vision, the quality of object imaging can be a criticalpart. The complexity and accuracy of the algorithm are related
to it. Therefore, the Charge-coupled Device, CCD, and

2. Related researching
2.1. Region of Interest, ROI
The purpose of ROI is to separate the images captured by theCCD in a particular area by filters, binarization, image cuts, etc.
Moreover, it is used to reduce the computational resources
required in image processing [3], and it can also reduce the error
in the operation of subsequent algorithms with the priorthreshold design.

Copyright © 2018, the Authors. Published by Atlantis Press.
This is an open access article under the CC BY-NC license (http://creativecommons.org/licenses/by-nc/4.0/).
308

Journal of Robotics, Networking and Artificial Life, Vol. 4, No. 4 (March 2018) 308-311___________________________________________________________________________________________________________Table 1. Specification of the CCD and lens

2.2. Edge detection
After the image filtering, grayscale, binarization, the black-andwhite boundary point in the ROI will been detected and marked,
and the marked line segment is the outline which is theperipheral line of the tube. In many algorithms, Cannydetector[4] is more effective in the edge extraction, so in thispaper, Canny detector is used to extract the edge of the tube.

OSCPU
Development tools

ComputerWindows 7
I7-5500 x64
Visual Studio 2017

Interface
Sensor type
Shutter
Resolution

2.3. Component Labeling
When edges or binarization of an image is detected, labeling isused to cluster the pixels connected to the same area into thesame object. Its purpose is to isolate the noise in some images[5]or the non-interesting content that can not be completelyremoved in the previous step. These noise and non-interesting
content can be ruled out by simple threshold judgment, and thenthe most complete image information for subsequent feature
extraction is got.

3.

Magnification
Working distance

CameraUSB 3.0
CMOS
Rolling shutter
3840 x 2748 Pixel
Lens
0.184
132.9mm

5. Algorithm and flow chart

The development library: EmguCV

There are many software packages developed for AOI, and they
are also popular. Such as Halcon, an image processing softwarefrom Germany, claims the most effective computer vision
software in Europe and Japan. However, due to cost issue, thispaper developed the system based on open source libraries.
EmguCV is an open source image processing development kit
that includes the many relevant libraries required for many
applications such as image processing, machine learning andcomputer vision. Users can choose according to their own needs
different programming languages such as C #, VB, C++.and soon. EmguCV solved the lack of OpenCV Graphical User
Interface, GUI, and is suitable for more application
development.

4. Hardware specifications and configuration
Table 1 shows the specifications of the CCD and lens used in
the system proposed this paper. The CCD with a telecentric lenscan effectively reduce the image deformation which caused by
the normal lens [1]. In order to average the light on each tube
and minimize the shadow [6, 7], the light source used in thissystem is a circular parallel ring light. Figure 1 is theconfiguration for camera, lens, light and tubes used in this paper.
The relative distance between the lens and the tube depends on
the working distance of the lens itself.

Figure.2 A flowchart of the system
The system flow chart is shown in Figure 2. The main purposeof the system is the inner circumference measurement of the of
the chopstick tube. There is no any image filter adopted in thepreprocessing stage in this proposed system. Because themaintenance of the image original information is mostimportant, and filters may remove some critical information.
The AOI system sorts the defect materials into five modes: one
empty situation, and four defect types. The inspection
algorithms are detailed in following:

5.1. Empty
By connecting the size of the region, the system could
determine whether the tube on the fixture. If the connected
region is bigger than the setting threshold, the system will
indicate no tube on the fixture, otherwise. The threshold setting
is based on analysis of the inner area of pre-shot photographs.
Figure.1 Schematic diagram of the AOI309

Journal of Robotics, Networking and Artificial Life, Vol. 4, No. 4 (March 2018) 308-311___________________________________________________________________________________________________________n

5.2. Deformation tube

6.1. Experimental hardware system

The ellipse fitting algorithm is used to fit an under testing tube
to the most suitable ellipse [8]. The difference between the tworadii of the fitting ellipse is used to determine whether the tube
has a deformation situation. When the difference is bigger than
the setting threshold (about 8 pixels), the tube will be denoted
as “deformation”.

The block diagram and photo of the proposed system are shownin Figure 1 and 5. The results of the pre-processing are present
in Figure 3 and Figure 4, what are Edge detection andconnectivity region functions.

6.2. Circumference Threshold
The circumference threshold is a key parameter to sort the tube
into “Normal”, “Large” and “Small” types when not empty anddeformation. As Figure 6, the tubes of three types provided by
the factory are measured, then threshold could be decided.

5.3. Iron filing elimination algorithm
Except empty and deformation, iron filing effect has to beeliminated. The iron filings effect is caused in the process orfactory environment, and these iron filings have significant
influences on the accuracy in the precise identification. The ironfiling elimination algorithm is proposed to eliminate this effect.
The Inscribed and circumcircled circles are estimated [8]. Whenthe circumference difference of the two circles is big, the circle
fitting is used to estimate the tube inner circumference.
Contrary in small difference, what means minor iron filing
effect, the circumference is integrated from pixels directly.

6. Experimental results

Figure.6 Single state comparison graph6.3. Mix state test results

123456789101112

Figure.3 Edge detection

Figure.4 Connectivity region

Figure.7 Serial Numbering

Figure.5 Photo of the AOI system
Figure.8 Mixed test 1310

Journal of Robotics, Networking and Artificial Life, Vol. 4, No. 4 (March 2018) 308-311___________________________________________________________________________________________________________

can effectively identify a variety of different types of the tube
by comparing various parameters and threshold design. The
experimental result indicates the 91.67% of the recognition
rate, and the system can be used in automated production lines
and effectively reduce the production loss.

Acknowledgment
This work is partially supported by the Ministry of Science andTechnology, ROC, under contract No. MOST 106-2221-E-224025, and 106-2218-E150-001.

References
Figure.9 Mixed test 2Table 2. Test Results 1

1. H. Liao, Z. Chen and X. Zhang, “Calibration of Camerawith Small FOV and DOF Telecentric Lens”, Precedingof 2013 IEEE International Conference on Robotics andBiomimetics, Shenzhen, China, 2013.
2. EmguCV.org Available at www.emgu.com/wiki fourth
November 2017
3. W. C. Tham, S.I. Woolley, S. Cribbs and D. Anderson,“Diagnostically lossless compression of pipeline
inspection data”, Proceedings of Data Compression
Conference 2002, Snowbird, UT, USA, 2002
4. J. Canny, “A computational approach to edge detection”,
IEEE Transactions on Pattern Analysis and MachineIntelligence. Vol. PAMI-8, Iss. 6, Nov. 1986
5. J. Song, Z. Zhao, Q. Zeng and Y. Wei, “An algorithm foreliminating the isolated regions based on connected area
in image classification” Preceding of IGARSS 2004. 2004
IEEE International Geoscience and Remote Sensing
Symposium, Anchorage, AK, USA, 2004
6. K. W. Khawaja, A. A. Maciejewski, D. Tretter, and C. A.
Bouman, “Camera and Light Placement for Automated
Assembly Inspection” Preceding of Robotics andAutomation, 1996. Proceedings of IEEE International
Conference on Robotics and Automation, Minneapolis,
MN, USA, USA, 1996
7. Mónica Valenzuela-Delgado Wendy Flores-Fuentes,
Miguel E. Bravo-Zanoguera, Alejandro S. Ortiz-Pérez,Daniel Hernandez-Balbuena, Moises Rivas-López, Oleg
Sergiyenko, “Felix F. Gonzalez-Navarro, Machine visionsystem to measuring the velocity field in a fluid by Particle
Image
Velocimetry:SpecialCaseofMagnetohydrodynamics” 2017 IEEE 26th International
Symposium on Industrial Electronics (ISIE), Edinburgh,
UK, 2017
8. Truc Le and Ye Duan, “CIRCLE DETECTION ON
IMAGES BY LINE SEGMENT AND CIRCLECOMPLETENESS”,
2016
IEEEInternational
Conference on Image Processing, Phoenix, AZ, USA,2016

Serial Number Real situation Identify results
1NormalNormal
2Deformed
Deformed
3SmallSmall
4SmallSmall
5
NormalNormal6
NormalNormal7LargeLarge
8Deformed
Deformed
9Deformed
Deformed
10Large
Large
11
Small
Normal
12
Large
Large
Table 3. Test Results 2
Serial Number Real situation Identify results
1
Large
Large
2
Deformed
Deformed3
NormalNormal4
Small
Normal
5
Large
Large
6
Deformed
Deformed
7
Empty
Empty
8
NormalNormal9
Deformed
Deformed10
NormalNormal11
Deformed
Deformed
12
Small
Small
Figure 7 shows the serial number of tubes. The Figure 8 and 9
are the sampling photo, and the Tables 2 and 3 are theinspection results. There is only one error in every test, and therecognition rate of the algorithm reaches 91.67%.

7. Conclusion
An AOI system for a chopstick tube inner circumference
state identification is proposed, in this paper. The system

311