Wear analysis in cutting tools by the technique of image processing with the application of two-dimensional matrices

The useful life of the tools is a very important economic factor in the metal industry, so any improvement of the tool or material that can extend the useful life of the tools is productive. Tool deterioration can cause damage, cracking and vibration to the tool, and even damage to the machine. Effective tool wear control is most important. Effective tool wear control is most important. At present, there are some tools that can obtain the necessary conditions through digital image processing, and study their lifespan according to their work cycle, as well as the types of possible relationships between the pixels of the image and the different modes of operation, allowing the extraction or isolation of the objects considered. This work analyzes the wear of the tool with the application of two-dimensional matrices with the toolbox of the MATLAB software, which allows to monitor the status of the inserts with the comparison of images in gray scales, in addition, a method of analysis based on interfaces is also being studied; through it, users can access the database that has been implemented, as well as a set of images used to verify the functions developed, determining the wear on the cutting tool.


Introduction
Cutting tools have played a key role in the evolution of manufacturing systems, various industries such as metallurgy, aerospace, naval and mining have been a high-impact point that required a variety of studies that made production systems more flexible and were key to bringing the quality of machining to another level [1,2]. However, despite the advantages this offers, there are problematic aspects in the processes associated with the lifespan of the cutting tools, one of the variables involved is the physical and chemical composition of the inserts that directly affect the transformation of a part with mechanical effort associated with a computerized numerical control (CNC) type machine and other semi-automatic and manual mechanisms [3][4][5].
In this sense, factors such as friction between rigid elements at different speeds and coefficients of elasticity, corrosion or fatigue can affect the wear of the cutting tool, which results in low durability and uncertainty of the internal condition of the tool in its microstructure throughout its work cycles [6,7]. Indeed, several authors have contributed to the calculation of the state of wear of these cutting tools with high precision under operating conditions, using experimental and analytical methodologies supported by software such as MATLAB [8] with its image processing in the specific areas of affectation [9]. Others have also contributed to this field by using image data processing using neural networks for the prediction of tool wear [10][11][12]. Also, with innovative studies such as [7,13]; the feasibility of using a method of automatic detection of the tool wear value was verified with the development of a coupled charging device image sensor (DIS) deep learning algorithms, and a convolutional neural network (CNN) model to automatically identify the types of wear of high temperature alloy tools in the milling process, having an absolute error of 4.76% compared to a manual detection system.
Given the situation, this research is aimed at the use of a direct method of image processing supported by MATLAB software [8], which is based on the application of two-dimensional matrices, using comparison of images on grayscales, when doing the color analysis after using the tool; in this way to monitor the condition of wear of the inserts in a machining center, in addition an analytical methodology was studied at microscopic level on worn surfaces, which will have a positive impact in optimizing machining processes and inspecting tool life more accurately.

Materials and methods
This type of research is descriptive and employed an analytical methodology to study the measurement of cutting tools, such as imaging techniques to monitor the condition of tool deterioration in a milling machine. This article takes as reference the standard (ISO 8688-1 [14]) to evaluate the area affected by wear.
A vertical machining center (LEADWELL 32i) was used. A milling cutter (Walter), with a diameter of 80 mm, with 7 inserts (each with 8 edges) was used to carry out the machining, considering the parameters stipulated in the standard. Hard metal inserts with a coating (SNMX1205ANN-F57 WKP35S Tiger-tec Sil) were used to carry out the experiments in this work. An AISI SAE 1045 steel ingot with a rectangular cross-section with a width of 0.6 times the diameter of the cutter, minimum length of 3 times the diameter of the cutter and height at your convenience was chosen as the grinding material. A stereoscope (OPTIKA) with a camera (SONY UHCCD) was used for imaging. The "image processing toolbox" of MATLAB® software [8] for data processing and Mastercam was used as a machine programming system. This work was carried out following the proposed methodology, presented in the flowchart, Figure 1.
The flow diagram represents the process that was carried out for the development of the investigation, which costs an initial phase called "inspection area" where high resolution images were taken in the machining process, were then introduced to the system "digital image input" where the reading and classification of samples by passes is performed. Then, in the image processing phase, the software details the area of interest with the integrated functions of MATLAB® [8], to finally analyze the "data output" that the software provides and conclude the results obtained. The digital treatment of images studies the set of processes and techniques that allow to manipulate the image in such a way that the result allows to highlight certain information contained in it [15,16]. In this section some basic concepts will be introduced, where some techniques of digital image processing were studied, fundamental to understand the application implemented in this project.
One of the most important requirements in capturing images is lighting. The effects produced by lighting depend on the type of surface to be treated, the distribution of light and its reflectance properties. All this influences the quality of the captured image and its subsequent segmentation. The image acquisition was structured according to the necessary steps to be carried out for the acquisition and treatment of the images prior to the analysis of the data obtained. In this sense, two aspects can be distinguished. On the one hand, the corresponding to the physical system or hardware and on the other hand the computer field. The acquisition was made through a graphical interface considering previously that one of the most important factors in this phase is lighting, as it is a variable dependent on the type of surface, the distribution of light on it and its reflectance properties.
The image processing seeks to isolate the wear mark produced on the tool in the cutting process, so that some geometric properties can be quantified that allow comparison with the roughness of the machined part [17]. In this way, with the initial image taken through the stereoscope at a resolution of 5.1 megapixel the mark of wear is observed in the machining process, the execution of the stage was continued focusing the area with the interest of isolating the study body. For this, the area of the tip was cut with the selection of the specific coordinates and applying the "imcrop" function to eliminate areas that could interfere with the segmentation process as seen in Figure 2. This research required that the image processing be done automatically using the "toolbox" of digital image processing [18]. The process starts with the conversion of the image to greyscale by reducing the color information which allows to increase the ease of processing used the "rgb2gray" function. In MATLAB [8] a grayscale image is represented by a two-dimensional matrix of m n elements, where each element in the matrix of the image has a value from 0 (black) to 255 (white), shown by Equation (1) [19,20]. Let's express a digital image as f (x,y), where x and y are the spatial coordinates and the value of f at each point (x,y) is proportional to the light intensity (gray level) of that point [19].
f(x, y) = ( where, n represents the number of pixels in width, m the number of pixels in length, element V11 corresponds to the element in the upper left corner (see Figure 3) [19].  Thus, in its programming interface, the software uses the techniques of global thresholding, they are generally applied to divide the image into background and foreground areas with a bimodal histogram [21,22]. Therefore, the first task is to divide the image into foreground and background pixels. This step is done to identify the region of interest (ROI). Any general threshold algorithm converts an image into a binary image according to the following Equation (2) [21,22]; where, T is the threshold value selected to segment the image.
The process starts with the conversion of the image to greyscale by reducing the color information which allows to increase the ease of processing used the function "rgb2gray". The image is segmented according to the brightness levels of each pixel by the conditions of the image, the process was performed by looking for three brightness ranges with the command "multithresh", to show the results each level was colored (label2rgb) to distinguish it from the others, the number of levels was obtained after multiple tests, the result can be seen in Figure 4(a).
The next step was to isolate the pixels containing the wear mark information, in this case the selected level shown in Figure 4(a), in yellow is extracted, and stored in a black and white file Figure 4(b), with which the process is continued. It can be seen that in addition to the wear mark there are other areas that have the selected brightness level but that must be removed since they do not correspond to the area of interest, to achieve part of that target was used a morphological processing with "bwmorph", which allows to remove gaps, points and stains from the image [23][24][25], the result can be seen in Figure 4(c), although the process can improve the image to the point where the wear mark is clearly distinguished, it can contain large areas that must be removed.
Finally, some properties of the image region were used and separated, leaving the wear mark that interests us in a single image, Figure 4(d). In relation to the above, some properties of the image regions were used and separated, leaving the wear mark of interest on a single image, shown in Figure 4(d). From the final image the geometric characteristics of the brand were extracted, in this case the size of the major axis, the size of the minor axis and the footprint area with "regionprops" were selected. The values shown in Table 1 are in pixels, the camera information, stereoscope, as well as the geometric characteristics of the insert were used to scale the length values, so that they can be used in the comparison process [26].

Results
The data released by MATLAB software [8] showed the wear behavior of the cutting tool in the machining process with the application of two-dimensional matrix physical methods. The analysis was based on the length of the minor axis due to the wear behavior and comparing with the values   [14]; the length behavior is shown in Figure 5, observing that starts with a minimum value 0.024 mm and increases as each process is performed. Having a significant increase between test number 45 and 46, indicating the expiration of the useful life of the cutting tool, as seen in Figure 5.

Conclusions
This project was developed with the application of two-dimensional matrix physical methods in Matlab software, allowing the comparison of grayscale in overlapping images that shed as the insert deteriorates as it was used in the machining process of parts, The good capture of the images makes this tool allow the artificial vision system to perform a proper process of segmentation and selection of the mark left by the wear on the tool as important information in the creation of the database wear.
The design and construction of the assembly to measure the wear of the inserts is important for the development of the research, since it must be achieved that the inserts before and after each machining process, remain exactly in the same position for the image capture. Thanks to this, aspects such as light intensity, shutter speed, aperture value to obtain a good image were controlled.
In the creation of the database related to the vision system the most useful descriptors are simple geometrics, since they offer a data matrix whose information shows relevant aspects of the status of the tool such as the length of the minor axis, major axis length and area.
The system of artificial vision allowed to identify the moment in which the wear is raised significantly, previewing the change of the tool, and thus prolonging the use of it; for this work a significant increase is seen between tests 45 and 46, indicating the expiry of the useful life of the cutting tool and indicating the change of the cutting tool for subsequent processes.