Materials Science Forum Vol. 526 (2006) pp. 61-66 online at http://www.scientific.

net © (2006) Trans Tech Publications, Switzerland

Design of a Computer Vision System to Estimate Tool Wearing E. Alegre 1,a, J. Barreiro 1,b, H. Cáceres 2,c, L. K. Hernández 2,d, R. A. Fernández 1,e, M. Castejón 1,f

Escuela de Ingeniería Industrial e Informática. Universidad de León. 24071. León. España. Telf.: (0034) 987291792

Dpto. de Ingeniería Mecánica, Industrial y Mecatrónica. Universidad de Pamplona, Km. 1 carretera Bucaramanga. Pamplona. Colombia. Telf.: (0057) 75685303 Ext. 163
a,,,, e f,

Keywords: monitoring, tool wear, artificial vision, statistical descriptors.

Abstract. Wear level of tool inserts in automated processes is tried using techniques of artificial vision. An application has been developed in Matlab that allows the acquisition of images with different resolutions and later on to process them. It is explained how the vision system used has been designed and implemented. The method for acquiring tool insert images and their treatment in the pre-processing, segmentation and post-processing is commented. First results are also presented using diverse texture descriptors. These first results must be corroborated carrying out new experiments with a bigger number of images. Introduction One of the most interesting relationships to monitoring in machining is tool life time. It is important to control the cutting time and therefore, the wear level, changing it when it has arrived effectively at the end of its useful life. Digital image world is suffering a very high development, with continuous improvements and quick reduction in the price of cameras. Although this fact has allowed improvement in wear measuring, they are still deficiencies that make difficult to apply these equipments in industry satisfactorily: lack of enough development in algorithms and applications of image analysis and extraction of results [1-3]. The processing and analysis of these images usually consist of the following stages: (1) acquisition, (2) pre-processing, (3) segmentation, (4) description and (5) recognition. Set-up of the first stages is showed in this paper and also how following ones will be carry out [4,5,6]. Use of diverse types of texture descriptors allows to obtaining information to identify and differentiate changes of intensity associated with wear. Experiments are being carried out with different statistical descriptors and different classifiers to evaluate their performance. Subsequent studies will be determined considering the results and contribution of the different descriptors used. Materials and Stages. Before starting the capture of information, the equipment should be calibrated with the purpose of maintaining constant the conditions of acquisition: lighting, focus distances and magnification. A lathe has been prepared with appropriate tools and a coolant with 10% of concentration, which allows the machining of medium hardness steels with average speeds in the range 100-200 m/min, keeping a high lubrication level and dissipating the heat appropriately. The machine program used contains cylinder operations, making stops in each pass to capture the image of the insert wear. This allows to observing the evolution of wear in each pass. Inserts with different wear level have been chosen, and a special fix has been made that allows to seeing the location of crater and flank always at the same coordinates. Keeping constant the height
All rights reserved. No part of contents of this paper may be reproduced or transmitted in any form or by any means without the written permission of the publisher: Trans Tech Publications Ltd, Switzerland, (ID:,13:22:56)


Advances in Materials Processing Technologies

of both faces, the optic is calibrated and the most appropriate lighting for image capture is set-up. Final adjust was determined combining both parameters in diverse ways, so that a good capture of the image with a low level of shines is achieved. Tool inserts were worn by means of cylinder operations in AISI 1045 normalized and 4140 tempered steels. Parts of 90 and 250 mm of diameter and length, respectively, were used. Image Acquisition. Selection of the lighting system is a decisive stage in the design of any vision system. It affects to the quality of the captured image, understanding this quality as the achievement of a correct and uniform illumination, without shines, so that the region of interest is fully illuminated and, at the same time, getting the biggest possible contrast with the back. Adjusting the lighting correctly enables to obtain the information which is looked for in the area of interest and, at the same time, segmentation will be easier. The lighting system is composed of a regulated light source DCR®III of FOSTEC that provides an intense cold light. A system of diffuse illumination SCDI of NER SCDI-25-F0 is used to avoid shines. The system provides diffuse illumination in the same axis of the camera and it has been specially designed for applications with irregular mirrored surfaces that require uniform light. The positioning of the lighting is carried out by means of a dual bundle of Fostec. Diverse tests were done changing the intensity of the light, obtaining the best results for a level of 70. The image is obtained using a Pulnix PE2015 B/W camera with 1/3" CCD. A Matrox Meteor II frame grabber card is used to digitize the images. The optic assembly is composed of an industrial zoom 70XL of OPTEM, with an extension tube of 1X and 0.5X/0,75X/1.5X/2.0X lens, also of OPTEM. The zoom selected for the capture is of 1:1,25. Fig. 1 shows the camera and the lighting system.

Fig. 1. The camera and the lighting system Matlab software has been used to create a graphic application that helps to the acquisition and storage of images (Fig. 2). The program code can be divided in three functional blocks: 1. Camera initialization. When the program starts up, all the available information about the installed device of image capture is obtained automatically. Next, the system is adjusted so that it captures RGB images with the maximum possible resolution. Finally, a user's graphic interface is presented for the capture with a real time video window. In any moment, the user will be able to modify the resolution of the captured images, as well as to hide and show the video window. 2. Configuration of the sequence. At the beginning of an experiment, a location should be chosen to store the sequence of images. Images are stored in jpg format with names that include information

Materials Science Forum Vol. 526


about date and order. In order to allowing that one experiment can be carried out in different work sessions, if the location contains images, then the date is conserved and the existent sequence continues. 3. Image acquisition. Once the sequence is configured, the images are sequentially acquired as the user presses the ‘Capture Picture' button (Fig. 3).
% Camera setup with max. resolution: % 1. Obtaining information of the installed device handles.datosPC=imaqhwinfo; % 2. Visualization of the installed devices length(handles.datosPC.InstalledAdaptors); disp('List of installed adaptors:'); for (k=1:length(handles.datosPC.InstalledAdaptors)) disp(handles.datosPC.InstalledAdaptors{1,k}); end % 3. Selection of the first device from the list and visualization of information handles.adaptador=handles.datosPC.InstalledAdaptors{1,1}; info = imaqhwinfo(handles.adaptador); numero = info.DeviceIDs{1,1}(1); disp(info); handles.dev_info = imaqhwinfo(handles.adaptador,numero); disp('Device information:') disp(handles.dev_info.SupportedFormats); % 4. Setup to the max. available RGB resolution h=handles.dev_info.SupportedFormats; [u,d]=strtok(h,'x');[t,c]=strtok(d,'x'); [w,s]=strtok(u,'_');[w,s]=strtok(s,'_');strcat(t,'x',w); a=zeros(length(t),1);b=zeros(length(t),1); for(k=1:length(t));a(k)=str2num(t{k});b(k)=str2num(w{k});end tamanyo=a.*b; for(k=1:length(tamanyo)) pos=strfind(h{k},'RGB') if isempty(pos) tamanyo(k)=-1; end end tamanyo maximo=find(tamanyo==max(tamanyo(:))); resolucionInicial=handles.dev_info.SupportedFormats{maximo} %5. Object creation for the video input a=imaqfind; delete(a); % Delete previous objects if it is the case = videoinput(handles.adaptador,1,resolucionInicial); set(handles.Resoluciones,'Value',maximo); preview(

Fig. 2. Matlab code for the set-up of the camera Pre-processing. As a previous stage to segmentation, several operations are carried out to set up and improve the aspect and conditions of the image. A low pass filter is applied to soften the back and to facilitate segmentation. The captured image is cut so that the lower half of the insert is eliminated, since wear only takes place in the higher half. Later on, a stretching of the histogram is done to improve contrast. Fig. 4 shows the image corresponding to the flank of an insert with low wear, before and after carrying out a stretching of the histogram.


Advances in Materials Processing Technologies

Fig. 3. Image obtained with Matlab

Fig. 4. Flank, pre-processed image with its histograms Segmentation. Image was segmented to detect the wear region using growth of regions [7-8] for pixel aggregation. Generator pixels were selected as the middle elements of the white regions obtained after making binary the image, and getting the threshold by means of the Otsu method. Once the diverse regions are obtained, a new binary process is carried out, obtaining as result an image with the wear region in white and all the rest in black. Before the calculation of descriptors, diverse post-processing operations were carried out to improve the shape of the obtained region. The first one is a median filtering which produces an image softening, since small size noise is eliminated. Next, the wear region is marked up. In some images, this region is not closed appearing linked to the back area. This situation has been solved carrying out a closing of the wear area. Description and Recognition. A small number of experiments have been carried out using different statistical moments. We have used descriptors with 22 simple moments, with 9 central moments, with 9 normalized central

Materials Science Forum Vol. 526


moments, with the 7 moments of Hu, with the moments of Zernike until the order 4, with 9 moments of Legendre, with 8 moments of Taubin, and with the 6 moments of Flusser. Firstly, a supervised classification has been carried out attending to the wear level in each insert. A label has been assigned to each image which indicates its inclusion in one of the three classes settled down by an expert: class 1, inserts with low wear; class 3, inserts with very high wear; and class 2, inserts with medium wear level. A pattern has been generated for each of the three classes in which inserts have been grouped. With the previously mentioned descriptors a classification has been carried out using a minimum distance classifier. The pattern of each class has been obtained calculating the media of all the characteristic vectors belonging to the class. Later on a k nearest neighbours classifier was used, with k=10. Error rate: three classes with Euclidean distance.
Simple Class 0.258 1 0.583 2 0.200 3 Cent. 0.193 0.583 0.600 Norm. 0.548 0.583 0.200 Hu 0.903 0.500 0 Taub. 0.935 1 0 Fluss. 0.968 0.830 1 Zern 0.129 0.250 0.400 Leg. 0.097 0.500 0.400

Table 1. Table 1 shows that, with the Euclidean distance, the best results have been obtained using the moments of Zernike, with an error near to 13%, and with the moments of Legendre, whose error rate is of almost 10%. The other descriptors produce higher errors, in some case near to 60%, for example the central moments. These high error rates can be originated by the fact that patterns have been obtained with a small number of images, only 12 in each one of the classes. Therefore, we consider necessary to carry out more experiments using a bigger number of images. Later on new experiments were carried out grouping the inserts in only two classes. In the first class were included inserts with low wear level whereas in the second class were included inserts with a high wear level. Tables 2 and 3 shows the errors obtained in the classification using a k nearest neighbours classifier. Error rate: Simple, Centrals, Normalized, and Hu with 10 nearest neighbour’s classifier
Simple Class 1 2 0.198±0.081 0.418±0.100 Centrals 0.150±0.058 0.420±0.100 Normalized 0.254±0.106 0.428±0.104 Hu 0.244±0.088 0.518±0.087

Table 2. Error rate: Flusser, Zernike, Legendre and Taubín with 10 nearest neighbour’s classifier
Flusser Class 1 2 Zernike Legendre 0.074±0.055 0.397±0.116 Taubín 0.172±0.084 0.242±0.091

0.226±0.100 0.042±0.056 0.650±0.123 0.368±0.109

Table 3. Results in tables 2 and 3 show that the smallest errors are obtained using the moments of Zernike, Taubín and Legendre, with small deviations among them. It is observed, therefore, that the moments of Zernike and Legendre are those that obtain better results in both experiments, while those of Taubín are very sensitive to the used classifier. With the Euclidean distance many classification errors take place. The use of the 10 nearest neighbours provides good results as descriptor.


Advances in Materials Processing Technologies

Summary The vision system, camera, optics, frame grabber card and lighting selected allow to obtaining satisfactory images. Diverse texture descriptors have been applied over the images obtained with the insert flank wear, which allow carrying out general classifications of the wearing level. Diverse images have also been obtained that form stereoscopic pairs and that will be used to carry out crater wear measuring. Both types of images will be evaluated in future works by means of statistical descriptors obtained from the captured images. First results indicate that descriptors of Zernike and Legendre are those that generate lower error rates. We observe that the use of more robust classifiers can offer an interesting improvement because with some descriptors the errors when using 10 nearest neighbors are significantly smaller that those that appear with the Euclidean distance. For that fact, we think the use of a neuronal network can provide interesting improvements. We believe that these initial results must be enlarged carrying out new experiments in which the training group has a bigger number of images. References [1] A. Weckenmann, K. Nalbantic: Precision measurement of cutting tools with two matched optical 3D-sensors. Annals of the CIRP, vol. 52, nº 1 (2003), p. 443-446. [2] T. Pfeifer and L. Wiegers: Reliable tool wear monitoring by optimized image and illumination control in machine vision, Measurement, vol. 28, nº 3 (2000), p. 209-218. [3] S. Kurada, C. Bradley: A review of machine vision sensor for tool condition monitoring. Computers in industry, 34 (1997), p. 55-72 [4] J. Zhang, T. Tan: Brief review of invariant texture analysis methods. Pattern Recognition, Vol 35 (2002), p. 735-747 [5] C. Jin, D. Wen: Review recent developments in the applications of image processing techniques for food quality evaluation, Trends in food science & technology, Vol.15, (2004), p. 230-249. [6] M.H. Bharati, J.J. Liu, J.F. MacGregor, Image texture analysis: methods and comparisons. Chemometrics and Intelligent Laboratory Systems. Vol. 72 (2004), p. 57-71. [7] E. Alegre, J. Barreiro, R. A. Fernández, T. Alonso: Evaluation of cutting insert wear surface using digital image. XXIV Automatic Forum, (León, Spain, 2003). [8] E. Alegre, J. Barreiro, T. Alonso: Software for the automatic measurement of cutting insert wear using digital image. XVI Mechanical Engineering National Congress Vol. 3 (León, Spain, 2004).