Advances in Systems Science and Applications (2012) Vol.12 No.2 113-121 Sup-Pixel Edge Detection Technology and its Application in Non-contact Measurement of Precise Parts Bo Lei, Hong Lu and Chenghuo Shang School of Mechanical and Electronic Engineering, Wuhan University of Technology, Wuhan, China Abstract The precision of traditional methods of edge detection of precise parts with linear CCD is determined by the size of CCD cells. The precision can only reach µm at high cost. A sup-pixel edge detection method of CCD based on least square method and derivative operator method is proposed to improve the measurement precision. The Image Gradient obtained using derivative operator method. Point A with the max Gradient is then regarded as the point of the edge, and then the pixels nearby edge are interpolated linearly. For example, a high-speed data acquisition system is designed using high accuracy linear CCD TCD1501D and high speed A/D converter TLC5510. FIFO memory CY7C460A is used to store the converted data. Using the sample pulse of CCD as the system control clock, a high speed data acquisition and storing system with simple circuit is designed in this paper. Experimental results show that the resolution µ of the system design is 0.036 pixels and the measurement precision is improved by one order of magnitude over traditional methods of edge detection. It reaches sub-pixel accuracy. Keywords edge detection, sub-pixel, linear CCD 1 Introduction With the growth of heavy industries and the demand for high quality production, many industries require some form of technology for controlling their production quality. One common quality control (QC) technique employs linear CCD cam- eras for precise parts measurement. The edge detection and its localization in the image are, in particular, used for dimensional inspection and for localizing objects in industrial applications[1]. The precision is determined by the size of CCD cells used for measurement by linear CCD. People try to improve the precision of the measurement system in this way, for example, improving the manufacturing pro- cess to decrease the size of CCD cells, and improving the precision of system by amplifying measured parts with optical system. But the precision can only reach µm at high cost. In order to obtain accurate edge measurements, it is necessary to determine the location of an edge to a greater resolution than the spacing between the pixels of the image sensor, that is to say, at sub-pixel resolution[2]. Ohtani[3] summarizes the common sub-pixel edge detection techniques and di- vide them into first derivative algorithm, second derivative algorithm, template 114 Bo Lei:Sup-Pixel Edge Detection Technology and its Application in Non-contact... matching, edge fitting, and statistical approaches. Linearity interpolation, which is a mature theory, is widely used in many fields, such as Image and Signal Pro- cessing. But the interpolation result is too smooth, and it would loose some edge of images information[4]. Therefore, a sub-pixel measurement method of CCD is proposed to so that the edge of static images is detected using derivative op- erator method in digital image processing, and the pixels nearby edge are then interpolated linearly. 2 Design of Measurement System 2.1 Design of Optical System The optical system is as shown (See Fig.1). After the amplified by the optical system, the shade of part is imaged on the photosensitive cells of CCD. Fig.1 Optical system 1-Laser 2-Test part 3-Objective lens 4-Imaging objective lens 5-Linear CCD 2.2 System Composition The system is composed of Illumination Unit, Test Part, Optical Imaging Unit, Linear CCD, Signal Acquisition Unit, FIFO Memory and PC computer (See Fig.2). We choose laser as Illumination Unit. And Linear CCD is a TOSHIBA CCD linear image sensor (TCD1501D). The parallel beam irradiates the edge of the test part, it passes through the optical amplification unit and images on the Advances in Systems Science and Applications (2012) Vol.12 No.2 115 photosensitive surface of CCD. After being sampled and A/D conversion by the Signal Acquisition Unit, the output signals of CCD are stored at FIFO memory (CY7C460A). Then the digital signals are transmitted to PC computer. 2.3 Composition of Hardware 2.3.1 Linear CCD TCD1501D The TCD1501D which includes sample-and-hold circuits is a high sensitive and low dark current 5000 elements CCD image sensor. The sensor is designed for facsimile, image scanner and OCR. The device is operated by 5V (pulse), and 12V power supply[5]. The features of TCD1501D are shown as Table 1 below. Table 1 The features of TCD1501D Image Sensor Elements Size 7µm by 7µm on 7µm centers Photo Sensor Region high sensitive and low voltage dark signal pn photodiode Clock 2 Phase (5V) Internal Circuit S/H Circuit Package 22pin 2.3.2 Analog-To-Digital Converters TLC5510 The TLC5510 is CMOS, 8-bit, 20MSPS analog-to-digital converters (ADCs) that utilize a semiflash architecture. The TLC5510 operates with a single 5-V supply and typically consume only 130 mW of power. Included is an internal sample-and-hold circuit, parallel outputs with high- impedance mode, and internal reference resistors. The semiflash architecture reduces power consumption and die size compared to flash converters. By im- plementing the conversion in a 2-step process, the number of comparators is significantly reduced. The latency of the data output valid is 2.5 clocks. The TLC5510 uses the three internal reference resistors to create a standard, 2V, full-scale conversion range using VDDA[6]. So its peripheral circuit is simplified. 2.3.3 FIFO Memory CY7C460A The CY7C460A is 8K words by 9-bit wide first-in first-out (FIFO) memory. Each FIFO memory is organized such that the data is read in the same sequential order that it was written. Full and Empty flags are provided to prevent overrun and underrun. Three additional pins are also provided to facilitate unlimited expansion in width, depth, or both. The depth expansion technique steers the control signals from one device to another by passing tokens. The read and write operations may be asynchronous; each can occur at a rate of up to 50 MHz. The write operation occurs when the Write (W) signal is 116 Bo Lei:Sup-Pixel Edge Detection Technology and its Application in Non-contact... Fig.2 System composition LOW. Read occurs when Read (R) goes LOW. The nine data outputs go to the high-impedance state when R is HIGH[7]. 2.3.4 Single-Chip Computer AT89S52 The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two- level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry[8]. 2.4 Design of Hardware System After being sampled and A/D conversion the output video signals of CCD are transmitted to PC computer. And it is transformed into digital images by PC computer. The key parts of the Signal Acquisition Unit are high-speed analog-to- digital converter (TLC5510), FIFO memory (CY7C460A) and simple chip com- puter (AT89S52). Its principle is shown (see Fig.3). Advances in Systems Science and Applications (2012) Vol.12 No.2 117 Fig.3 Block diagram of hardware system Through differential amplifier and low-pass filter, the output signals of CCD (Opt) are sent into A/D converts TLC5510. Under the control of the A/D convert controlling clock (CLK) that generated by the sample pulse of CCD (SP), the simulated output signal of CCD (Opt) are converted into 8-bit digital signals that is corresponding to its simulated amplitude. If enabling port (OE) captures the low level signal, the converted signals are sent to the 8-bit input data ports (A0A0) of FIFO memory (CY7C460A). And under the control of write clock (W), which is generated by the sample pulse of CCD (SP), the converted signals are stored in FIFO in turn. Relative address methods are used in FIFO memory, and the address coding generator can be omitted, so the circuits are simplified. Upon power-up, the FIFO must be reset with a master reset (MR) cycle. This causes the FIFO to enter the empty condition signified by the Empty flag (EF) being LOW, and both the Half Full (HF), and Full flags (FF) being HIGH. So while enabling port (OE) of TLC5510 captures the low level signal, the reset 118 Bo Lei:Sup-Pixel Edge Detection Technology and its Application in Non-contact... port (MR) of FIFO memory should capture low level to reset the FIFO .The shift pulse (SH) of the CCD is sent to the trunk line (INTO) of the simple chip computer (AT89S52). We can get the beginning time and end time of the output signals of CCD by (INTO). So the signals of 5000 elements of CCD are stored into FIFO memory in turn. Then the AT89S52 reads data which stored into the FIFO with bus mode and sends them to PC computer one by the serial ports. The 74LS373 is used for improving the stability of reading data. 3 Analysis of The Measurement Signal of CCD When the test part is imaged on the photosensitive cells of CCD, the CCD con- verts the optical signals of the test part into discrete Voltage signals. The value of each discrete voltage signal corresponds to the light intensity of the photosen- sitive cells, and the order of output signal is corresponding to the position of the cell. After preprocessing the discrete output voltage signal of CCD, such as high pass filter, differential amplifier and low-pass filter. The edge of one-dimensional image signal of CCD is corresponding to the physical boundary of the test part. The low voltage signals of the CCD output correspond to the shadow of the test part and the high voltage signals is corresponding to the bright area where the test part cant shade the light. The ideal edge signal is a step signal (see Fig.4(a)). But the edge signal actually is a gradually-changed signal which de- creases gradually(see Fig.4(b)), and the actual edge point is located at this area. Fig.4 Edge signal of one dimension image 4 Sub-Pixel Edge Detection Algorithm We define that the resolution equals the numbers of cells X when the CCD sensor gets valid signal, and the signal of CCD is valid if the signal to noise ratio (SNR) S>1. The image SNR is signal square to noise square ratio. And if we take S=1, the valid signal F(x) is the least local variance of all pixel H(x). F (x) = H(x) (1) Advances in Systems Science and Applications (2012) Vol.12 No.2 119 We can get the Image Gradient by derivative operator method. Then the point A with the max Gradient is regarded as the point of the edge. And we get several points nearby point A. The number of points is m. We can get the polynomial curve equation (2) and the max residue by polynomial curve fitting. According to error theory and data processing method [9], and take confidence probability P= 95.44%, can get (3): G(x) = k ∗ x+ c (2) and H(x) = 2δ (3) We take ∆G(x) = 2δ, therefore obtain from (2) and (3): ∆X = 2δ/|k| (4) which leads to: µ = 2δ/|k| (5) The magnification of optical system is β, and it leads to µ = 2δ/(|k| ∗ β) (6) But the output of CCD is discrete signals, so the actual edge point P is between the point P and the point P’. The point P’ is nearest point of the point P. We take H(XA) = ξ ·H(XP ) + (1− ξ) ·H(XP ) (7) and the linear factor ξ ∈ [0, 1],Then obtain the position of actual edge point XA is: XA = (H(XA)− c)/k (8) 5 Application Fig.5 one of the pictures of the experiment data According to the algorithm mentioned above, we measured the location a specific edge with the system. The number of measure times is 5. The magnification of optical system β=20, and the polynomial curve equation under the condition of 120 Bo Lei:Sup-Pixel Edge Detection Technology and its Application in Non-contact... the number of points m=7. One of data of the experiment is shown (see Fig.5), we get the results of its polynomial curve fitting (see Fig.6).The experimental results show that the performance of this algorithm is better than the traditional method in precision of measurement. Fig.6 Results of polynomial curve fitting Table 2 The features of TCD1501D ORDER ξ=0.3(pixel) ξ=0.5(pixel) ξ=0.7(pixel) µ(pixel) 1 1048.6 1048.3 1048.1 0.021 2 1048.7 1048.3 1048.0 0.034 3 1049.2 1048.9 1048.6 0.031 4 1049.2 1048.7 1048.2 0.047 5 1049.1 1048.7 1048.2 0.048 Statistical Results average 1049.0 1048.6 1048.2 0.036 Standard deviation 0.288 0.268 0.228 0.011 Then we get the results under the condition of linear factor ξ=0.3, ξ=0.5 and ξ=0.7 . The results are shown as Table 2 blow. The data of the table means the location of the pixel. There are no abnormal data in this table. With the comparison analysis on actual location of the specific edge, the result is best under the condition of ξ=0.7. The repetitive error (2δ) is 0.45, which is lest than a pixel, and the resolution µ of the system is 0.036pixel in theory. Thus it reaches sub-pixel accuracy. Advances in Systems Science and Applications (2012) Vol.12 No.2 121 6 Conclusions In this paper, a sub-pixel measurement method of CCD was presented, which detect edge of static images with derivative operator method in digital image processing, and then the pixels nearby edge are interpolated linearly. The tech- nique is to improve the precision of measurement at low cost. At the same time the resolution of the measurement system is calculated in theory. Finally the results of experiment verify that the system can extract the accurate sub-pixel edge position. Acknowledgements This work was supported by Hubei Province Science Foundation (NO.2008CDB274) and Wuhan High-Tech Development Project Foundation (NO.200812121559). References [1] O. Faugeras. (1993), Three Dimensional Computer Vision, Cambridge, The MIT Press:Cambridge. [2] A.J. Tabatai and O.R. Mitchell. (1984), “Edge location to subpixel values in digital imagery”, IEEE Trans. Pattern Analysis Machine Intell, pp.188-201. [3] K. Ohtani, M. Baba. (2001), “A fast edge location measurement with sub- pixel accuracy”, IEEE Proceedings Instrumentation and Measurement Tech- nology, pp.2087-2092. [4] Zhang Xiong, Bi Duyan, Yang Baoqiang. (2007), “An edge preserved im- age interpolation method”, Journal of Air Force Engineer University, Vol.8, No.3, pp.78-80. [5] Toshiba. (1996), The TOSHIBA CCD Linear Image Sensor - TCD1501D. [6] Li Cai, Wang An. (2003), “Application of 8 bit high speed A/D converter TLC5510”, Foreign Electronic Devices and Components, pp.59-61. [7] CYPRESS. (2002), Datasheet of CY7C460A. [8] ATMEL company. (2002), Datasheet of AT89S52. [9] Fei Yetai. (2000), Error Theory and Data Processing, China Machine Press. Beijing, pp.72-82.