A quick tool setting method and system for machining of a numerical control machine tool casting
By acquiring grayscale images and 3D models of the workpiece and cutting tool, and using the SIFT algorithm to identify reflective areas and adjust the light source, the problem of reflections from metal products affecting the accuracy of tool setting is solved, achieving efficient and accurate tool setting operations.
Patent Information
- Application Number
- CN202511403830.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-29
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-09-29
AI Technical Summary
Since both the workpiece and the cutting tool are metal products, there may be reflection issues, which may affect the computer's recognition of the outer contour of the workpiece and the cutting tool or the machining points of the workpiece, resulting in errors in the tool setting results.
By acquiring grayscale images and 3D models of the workpiece and cutting tool, the SIFT algorithm is used to match key points, identify reflective areas, and determine reflective areas based on differences in texture contrast and uniformity. The position of the light source is then adjusted to eliminate the influence of reflections and improve the accuracy of tool setting.
By identifying and processing reflective areas, the accuracy and efficiency of tool setting operations are improved, ensuring the correct identification and positioning of the workpiece and the tool.
Smart Images

Figure CN120894430B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and more specifically to a method and system for rapid tool setting in CNC machine tool casting machining. Background Technology
[0002] With the development of science and technology and the machining industry, the production of mechanical products is becoming increasingly precise, diversified, and complex. When processing different products, machine tools and process equipment undergo significant changes and adjustments. To adapt to the diversity of modern products, open CNC systems enable a single machine to process multiple products, saving production space and greatly promoting the development of the manufacturing industry. Preparation time mainly includes fixture loading and unloading time and tool setting and adjustment time. To shorten preparation time and improve production efficiency, automatic tool setting technology is introduced to gradually eliminate manual tool setting in production, thereby improving the automation level of machine tool production and the processing quality of products. To achieve automatic tool setting, computer vision can be combined with coordinate transformation to determine the position of the workpiece in the machine tool coordinate system. However, in the process of acquiring images of the workpiece and tool through industrial cameras to determine their relative positions, since both the workpiece and tool are metal products, reflection problems may occur, affecting the computer's recognition of the outer contours of the workpiece and tool or the workpiece machining points, ultimately leading to incorrect tool setting results. Summary of the Invention
[0003] This invention provides a method and system for rapid tool setting in CNC machine tool casting machining, to solve the problem that since both the workpiece and the tool are metal products, there may be reflection issues, which may affect the computer's recognition of the outer contour of the workpiece and the tool or the workpiece machining points, ultimately leading to incorrect tool setting results.
[0004] The present invention provides a method and system for rapid tool setting in CNC machine tool casting machining, which adopts the following technical solution:
[0005] One embodiment of the present invention provides a method for rapid tool setting in CNC machine tool casting machining, the method comprising the following steps:
[0006] Obtain grayscale images of the workpiece and tool, as well as planar views of each tool and workpiece from different angles, representing the 3D model of each workpiece and the 3D model of each tool.
[0007] Obtain all key points in each tool planar image and the grayscale images of the workpiece and tool. Match the key points to obtain the probability that the grayscale images of the workpiece and tool correspond to the 3D model of each tool planar image. Based on the probability that the grayscale images of the workpiece and tool correspond to the 3D model of each tool planar image and the key points, obtain the corrected probability that the grayscale images of the workpiece and tool correspond to the 3D model of each tool planar image. Based on the corrected probability that the grayscale images of the workpiece and tool correspond to the 3D model of each tool planar image, obtain the target tool planar image, the tool region in the grayscale images of the workpiece and tool, and the workpiece region.
[0008] In the grayscale images of the workpiece and the tool, several connected components are obtained; based on the distance between each connected component and the centroid of the tool region and the workpiece region, the probability that each connected component is a reflective region is obtained; the texture contrast and uniformity within each connected component are obtained; based on the difference in texture contrast and uniformity of each connected component and the probability that it is a reflective region, a reflective region composed of several connected components is obtained.
[0009] The influence of each connected component on image quality is obtained by considering the shortest distance from each connected component of the reflective region to the workpiece region and the tool region. The influence of each connected component on image quality is obtained by considering the influence of each connected component of the reflective region on image quality, the probability that the grayscale images of the workpiece and tool are the 3D models corresponding to the planar images of the target tool, and the correction probability.
[0010] Based on the degree of influence of each connected component on image quality correction, tool setting operations are performed on the workpiece and tool in the grayscale images of the workpiece and tool.
[0011] Preferably, the specific steps for obtaining all key points in each tool planar image and the grayscale images of the workpiece and tool, matching the key points, and obtaining the probability that the grayscale images of the workpiece and tool are the 3D models corresponding to each tool planar image are as follows:
[0012] The SIFT algorithm is used to obtain several pairs of key points in each tool planar image and the grayscale images of the workpiece and tool, as well as the similarity between key points in each pair;
[0013] The grayscale images of the workpiece and the cutting tool are the first... The specific formula for calculating the probability of the 3D model corresponding to the planar view of the cutting tool is as follows:
[0014]
[0015] In the formula, The grayscale image of the workpiece and tool is represented as the first... The probability of the 3D model corresponding to the planar diagram of the cutting tool; The grayscale images of the workpiece and tool are represented in the first... The number of pairs in the plan view of the cutting tools; The grayscale images of the workpiece and tool are represented in the first... Zhang's cutting tool plan view, number Similarity between key points in each pair; It is a linear normalization function.
[0016] Preferably, the specific steps for obtaining the corrected probability of the workpiece and tool grayscale images corresponding to the 3D model of each tool planar view based on the probability of the workpiece and tool grayscale images being the 3D model corresponding to each tool planar view and the key points are as follows:
[0017] In the In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In the pairing, the coordinate system transformation rule is used to transform the first pairing. The distance between the key points corresponding to the tool planar image and the corresponding pixels in the workpiece and tool grayscale images is denoted as the distance between the key points in the tool planar image and the corresponding pixels in the workpiece and tool grayscale images. The key points corresponding to the workpiece and tool grayscale images are then mapped to the first... The pixel in the planar diagram of the cutting tool is... The distance between the key points corresponding to the tool plan view is denoted as the distance between the key points of the workpiece and tool grayscale images in the tool plan view.
[0018]
[0019] In the formula, The grayscale image of the workpiece and tool is represented as the first... The correction probability of the 3D model corresponding to the plan view of the cutting tool; Indicates the first In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In each pairing, the distance between key points in the grayscale images of the workpiece and the tool in the tool planar image; Indicates the first In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In each pairing, the distance between key points in the grayscale images of the workpiece and the tool in the tool planar image; It is an absolute value function.
[0020] Preferably, the specific steps for obtaining the target tool plan view, the tool region in the workpiece and tool grayscale images, and the workpiece region based on the correction probability of the 3D model corresponding to each tool plan view according to the grayscale images of the workpiece and the tool are as follows:
[0021] In all tool planar images, the tool planar image corresponding to the maximum value of the correction probability of the 3D model corresponding to each tool planar image is denoted as the target tool planar image.
[0022] Using the SIFT algorithm, the matching region of the target tool plane image in the grayscale images of the workpiece and the tool is obtained, and is denoted as the tool region;
[0023] Using all workpiece plan views, the workpiece area is obtained based on the method of obtaining the tool area in the grayscale images of the workpiece and the tool.
[0024] Preferably, the specific formula for determining the probability that each connected region is a reflective region based on the distance between each connected region and the centroid of both the tool region and the workpiece region is as follows:
[0025]
[0026] In the formula, Indicates the first The probability that a connected component is a reflective region; Indicates the first The distance between the centroid of each connected region and the centroid of the tool region; Indicates the first The distance between the centroid of each connected region and the centroid of the workpiece region; Indicates the first The number of pixels belonging to the workpiece region and the tool region among the edge pixels of a connected domain; Indicates the first The average gray value of all pixels within a connected component; It is a linear normalization function; It is a minimum value function.
[0027] Preferably, the specific steps for obtaining a reflective region composed of several connected regions based on the differences in texture contrast and uniformity of each connected region and the probability of it being a reflective region are as follows:
[0028] In the Among all the adjacent connected components around a connected component, any two connected components can be combined into a connected component pair.
[0029] Based on the differences in texture contrast and uniformity of each connected component and each connected component pair, the specific calculation formula corresponding to the difference between each connected component and its surrounding texture is as follows:
[0030]
[0031] In the formula, Indicates the first The difference between each connected component and the surrounding texture; Indicates the first Texture contrast within each connected domain; Indicates the relationship with the first The first connected component is adjacent to the first... Texture contrast of each connected domain; Indicates the first Texture uniformity within a connected region; Indicates the relationship with the first The first connected component is adjacent to the first... Texture uniformity of connected domains; Indicates the first The number of adjacent connected components around a connected component; Indicates the relationship with the first The first connected component corresponds to the th The absolute value of the difference in texture contrast between connected components in a pair of connected components; Indicates the relationship with the first The first connected component corresponds to the th The absolute value of the difference in texture uniformity between connected components; Indicates the relationship with the first The number of all adjacent connected component pairs around a connected component; This is the normalization function; It is an absolute value function;
[0032] The first The probability that the first connected component is a reflective region and the probability that the second connected component is a reflective region The normalized result of the product of the differences between each connected component and the surrounding texture is denoted as the i-th. The corrected probability of each connected component being a reflective region;
[0033] In all connected components, the probability of correcting for reflective areas will be greater than a preset threshold. The region consisting of all connected domains is denoted as the reflective region.
[0034] Preferably, the specific steps for determining the influence of each connected region on image quality based on the shortest distance from each connected region of the reflective area to the workpiece area and the tool area are as follows:
[0035] Calculate the first reflective area The shortest distance from each connected component to the workpiece region and the first... The reciprocal of the minimum value among the shortest distances from each connected component to the tool region and the th The product of the areas of the nth connected components, after normalization, is denoted as the nth reflective region. The degree of influence of each connected component on image quality.
[0036] Preferably, the step of obtaining the degree of influence of each connected component on image quality based on the influence of each connected component of the reflective region on image quality, the probability that the grayscale images of the workpiece and the tool are the three-dimensional models corresponding to the planar images of the target tool, and the correction probability, includes the following specific formulas:
[0037]
[0038] In the formula, The first part representing the reflective area The degree of influence of each connected component on image quality correction; The first part representing the reflective area The degree of influence of each connected component on image quality; This represents the probability that the grayscale image of the workpiece and the tool is a 3D model corresponding to the planar image of the target tool; This represents the correction probability of the grayscale images of the workpiece and the tool being the 3D model corresponding to the planar image of the target tool; It is a function for maximizing the value; This is the default value; This is the normalization function; It is an absolute value function.
[0039] Preferably, the specific steps for performing tool setting operations on the workpiece and tool in the grayscale images of the workpiece and tool based on the degree of influence of each connected component on image quality correction are as follows:
[0040] The average value of the degree of influence of all connected components of the reflective region on the image quality is denoted as the degree of influence of the reflective region on the image quality.
[0041] When the impact of reflective areas on image quality is less than or equal to a preset threshold... At that time, the tool setting operation is performed directly on the workpiece and tool in the grayscale image of the workpiece and tool;
[0042] When the impact of reflective areas on image quality exceeds a preset threshold... Then, adjust the position of the light source until the impact of the reflective area on the image quality in the newly acquired grayscale image of the workpiece or tool is less than or equal to the preset judgment threshold. Then, a tool setting operation is performed on the workpiece and tool in the grayscale images of the workpiece and tool.
[0043] The present invention also proposes a rapid tool setting system for CNC machine tool casting machining, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the computer program stored in the memory to implement the steps of the aforementioned rapid tool setting method for CNC machine tool casting machining.
[0044] The beneficial effects of the technical solution of this invention are as follows: Based on the distance between each connected region and the centroid of the tool region and the workpiece region, the probability that each connected region is a reflective region is obtained; based on the differences in texture contrast and uniformity of each connected region, a reflective region composed of several connected regions is obtained; by determining the reflective region, the accuracy of subsequent judgments on whether the light source needs adjustment is improved, thereby improving the efficiency and accuracy of tool setting. Based on the shortest distance from each connected region of the reflective region to the workpiece region and the tool region, the degree of influence of each connected region on image quality is obtained; based on the degree of influence of each connected region of the reflective region on image quality, the probability that the grayscale images of the workpiece and tool are the three-dimensional models corresponding to the planar images of the target tool, and the correction probability, the degree of correction influence of each connected region on image quality is obtained. By identifying and processing the reflective regions through their grayscale values and shape and position features, the reflection in the processed image has a small impact on image quality or the reflection problem is eliminated, improving the accuracy of tool setting operations. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a flowchart illustrating the steps of a rapid tool setting method for machining castings on a CNC machine tool according to the present invention.
[0047] Figure 2 This is a schematic diagram of a camera installation provided in this embodiment. Detailed Implementation
[0048] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a rapid tool setting method and system for machining CNC machine tool castings according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0050] The following description, in conjunction with the accompanying drawings, details the specific solution of a rapid tool setting method and system for machining castings on a CNC machine tool provided by this invention.
[0051] Please see Figure 1 The diagram illustrates a flowchart of a rapid tool setting method for machining castings on a CNC machine tool, according to an embodiment of the present invention. The method includes the following steps:
[0052] Step S001: Obtain grayscale images of the workpiece and the cutting tool, as well as planar views of the cutting tool and the workpiece at different angles for each workpiece 3D model and the cutting tool 3D model.
[0053] Industrial cameras are installed above and to the side of the CNC machine tool where rapid tool setting is required. The position of the camera installed above the CNC machine tool is shown in the following reference: Figure 2 As shown;
[0054] It should be noted that the installed industrial camera must be able to acquire images of the workpiece and cutting tool during the adjustment process, so that the acquired images can be used as the basis for automatic tool setting. When the camera is mounted on the side, it should also be possible to acquire images of the workpiece and cutting tool.
[0055] The movement of an industrial camera should be recorded during its movement to ensure that the correspondence between the camera coordinate system and the world coordinate system can always be confirmed.
[0056] It should be noted that the acquired images are preprocessed to improve their quality and facilitate subsequent processing.
[0057] The acquired workpiece and tool images are converted to grayscale to obtain grayscale images of the workpiece and tool.
[0058] Based on the production plan, a database containing three-dimensional models of all workpieces and cutting tools that may be machined by the target machine tool is created using computer-aided design software.
[0059] Generate planar views of each workpiece 3D model and tool 3D model from various angles in the 3D model database, and obtain several tool planar views and workpiece planar views;
[0060] Obtain grayscale images of the workpiece and cutting tool, as well as planar views of each cutting tool and workpiece from different angles, representing the 3D model of each workpiece and the 3D model of each cutting tool.
[0061] Step S002: Obtain all key points in each tool planar image and the grayscale images of the workpiece and tool. Match the key points to obtain the probability that the grayscale images of the workpiece and tool are the corresponding 3D models of each tool planar image. Based on the probability that the grayscale images of the workpiece and tool are the corresponding 3D models of each tool planar image and the key points, obtain the corrected probability that the grayscale images of the workpiece and tool are the corresponding 3D models of each tool planar image. Based on the corrected probability that the grayscale images of the workpiece and tool are the corresponding 3D models of each tool planar image, obtain the target tool planar image, the tool region in the grayscale images of the workpiece and tool, and the workpiece region.
[0062] It should be noted that the area of the tool or workpiece is represented by comparing the acquired image with the image in the database and by recognizing the characteristics of the tool and the workpiece themselves.
[0063] It should be noted that, in order to extract the workpiece area from an image containing a large amount of information, it is necessary to find the feature points in the preprocessed image and compare them with the planar view of the workpiece to successfully identify the workpiece area. To achieve this, it is first necessary to construct a database containing 3D models of all workpieces that may be processed by the target machine tool and available cutting tools, based on the factory's actual production plan. This database should also contain the dimensional information of each model. Using computer-aided design software, planar views of the corresponding models from various angles are generated based on the 3D models. Feature matching is then used to find the workpiece and cutting tool areas in the obtained images.
[0064] The SIFT algorithm is used to obtain the key points of each planar image and the key points of the grayscale images of the workpiece and tool; each detected key point generates a SIFT descriptor;
[0065] It should be noted that the descriptor captures local image features around the key points; the descriptors are compared, the key points are paired according to the descriptor comparison results, and the similarity between the paired key points is obtained; based on the similarity relationship, the possible specifications of the workpiece and the tool in the acquired image are confirmed, and their corresponding regions are identified.
[0066] It should be noted that, based on the grayscale images of the workpiece and the tool, the key points of the grayscale images of the workpiece and the tool are paired with the key points of the planar image according to the descriptor comparison results, resulting in several pairs; the similarity between the key points in each pair is obtained using Euclidean distance.
[0067] Therefore, the SIFT algorithm is used to obtain several pairs of key points in each tool plan view and grayscale images of the workpiece and tool, as well as the similarity between key points in each pair;
[0068] Among them, pairing and similarity acquisition are operations in the SIFT algorithm. The SIFT algorithm is a well-known technique, and the specific method will not be introduced here.
[0069] The grayscale images of the workpiece and the cutting tool are the first... The probability of the 3D model corresponding to the planar view of the cutting tool is calculated as follows:
[0070]
[0071] In the formula, The grayscale image of the workpiece and tool is represented as the first... The probability of the 3D model corresponding to the planar diagram of the cutting tool; The grayscale images of the workpiece and tool are represented in the first... The number of pairs in the plan view of the cutting tools; The grayscale images of the workpiece and tool are represented in the first... Zhang's cutting tool plan view, number Similarity between key points in each pair; It is a linear normalization function.
[0072] It should be noted that, at the same time, the existence of workpieces and cutting tools with the same shape but different sizes should also be considered. The distances of key points in the acquired image should be converted into actual key point distances according to the coordinate system transformation rules. The smaller the difference between the distance between any two key points and the distance between the corresponding key point pairs in the planar image, the more certain it is that the workpiece and cutting tool captured in the image are the first... The 3D model corresponding to the plan view of the cutting tool.
[0073] It should be noted that the distance between key points in the grayscale images of the workpiece and the tool is transformed according to the coordinate system transformation rules to obtain the actual distance between the key points;
[0074] By using coordinate system transformation rules, the actual distance between key points can be obtained;
[0075] In the In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In the pairing, the coordinate system transformation rule is used to transform the first pairing. The distance between the key points corresponding to the tool plan view and the pixels in the grayscale images of the workpiece and the tool, and the corresponding key points in the grayscale images of the tool, is denoted as the distance between the key points of the tool plan view and the key points in the grayscale images of the workpiece and the tool.
[0076] In the In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In each pairing, coordinate system transformation rules are used to map the key points corresponding to the grayscale images of the workpiece and the tool to the first pair. The pixel in the planar diagram of the cutting tool is... The distance between the key points corresponding to the tool plan view is denoted as the distance between the key points of the workpiece and tool grayscale images in the tool plan view.
[0077] The coordinate system transformation rules are well-known techniques, and the specific methods will not be introduced here.
[0078] The grayscale images of the workpiece and the cutting tool are the first... The method for calculating the correction probability of the 3D model corresponding to the planar view of the cutting tool is as follows:
[0079]
[0080] In the formula, The grayscale image of the workpiece and tool is represented as the first... The correction probability of the 3D model corresponding to the plan view of the cutting tool; The grayscale image of the workpiece and tool is represented as the first... The probability of the 3D model corresponding to the planar diagram of the cutting tool; Indicates the first In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In each pairing, the distance between key points in the grayscale images of the workpiece and the tool in the tool planar image; Indicates the first In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In each pairing, the distance between key points in the grayscale images of the workpiece and the tool in the tool planar image; The grayscale images of the workpiece and tool are represented in the first... The number of pairs in the plan view of the cutting tools; This is the normalization function; It is an absolute value function.
[0081] It should be noted that when the denominator in the formula is 0, let the denominator be 1. This will be used as an example to ensure that the formula is true.
[0082] In all tool planar images, the tool planar image corresponding to the maximum value of the correction probability of the workpiece and tool grayscale image as the 3D model corresponding to each tool planar image is denoted as the target tool planar image.
[0083] Using the SIFT algorithm, the matching region of the target tool plane image in the grayscale images of the workpiece and the tool is obtained, which is denoted as the tool region.
[0084] Using all workpiece plan views, the workpiece area is obtained based on the method of obtaining the tool area in the grayscale images of the workpiece and the tool.
[0085] At this point, the tool area and the workpiece area are obtained.
[0086] Step S003: Obtain several connected regions in the grayscale images of the workpiece and the tool; based on the distance between each connected region and the centroid of the tool region and the workpiece region, obtain the probability that each connected region is a reflective region; obtain the texture contrast and uniformity within each connected region; based on the difference in texture contrast and uniformity of each connected region and the probability that it is a reflective region, obtain a reflective region composed of several connected regions.
[0087] It should be noted that the degree of influence of the reflective area is determined based on the characteristics of the reflective area and its relative position to the workpiece or tool area.
[0088] It should be noted that region growing of a grayscale image results in the extraction of multiple connected components. According to the analysis, the connected components representing reflective areas should have higher grayscale values in the grayscale image, and they are often adjacent to the workpiece area or are themselves inside the workpiece area. Based on the above characteristics, the connected components representing reflective areas are identified.
[0089] A region growing algorithm is used on the grayscale images of the workpiece and the tool to obtain several connected components;
[0090] The centroids of the connected domain and the tool region are obtained from the centroid calculation formula.
[0091] The region growing algorithm and the centroid calculation formula are well-known techniques, and the specific methods will not be introduced here.
[0092] No. The probability that a connected region is a reflective region is calculated as follows:
[0093]
[0094] In the formula, Indicates the first The probability that a connected component is a reflective region; Indicates the first The distance between the centroid of each connected region and the centroid of the tool region; Indicates the first The distance between the centroid of each connected region and the centroid of the workpiece region; Indicates the first The number of pixels belonging to the workpiece region and the tool region among the edge pixels of a connected domain; Indicates the first The average gray value of all pixels within a connected component; It is a linear normalization function; It is a minimum value function.
[0095] It should be noted that, in order to further determine the reflective area, it is necessary to combine the texture information on the workpiece or tool to correct the probability that a certain area is a reflective area. If a texture abrupt change or texture interruption is detected in some areas, and the overlap between the edge of the area and the suspected reflective area is higher, then it is more likely that the suspected area is a reflective area. The gray-level co-occurrence matrix of the acquired image is calculated, and the contrast and uniformity of the texture are analyzed through the obtained gray-level co-occurrence matrix. The difference in image texture on both sides of the edge of the connected domain of the suspected reflective area is compared. The greater the difference, the more likely the area is to be a reflective area.
[0096] It should be noted that the calculation involves determining the difference in texture contrast and uniformity between the regions surrounding each connected domain and other regions representing the workpiece, as well as the difference between these regions.
[0097] The texture contrast and uniformity within each connected component were statistically determined using the gray-level co-occurrence matrix.
[0098] Among them, the gray-level co-occurrence matrix is a well-known technique, and the specific method will not be introduced here;
[0099] In the Among all adjacent connected components around a given connected component, any two connected components can be combined to form a connected component pair.
[0100] No. The method for calculating the difference between a connected component and its surrounding texture is as follows:
[0101]
[0102] In the formula, Indicates the first The difference between each connected component and the surrounding texture; Indicates the first Texture contrast within each connected domain; Indicates the relationship with the first The first connected component is adjacent to the first... Texture contrast of each connected domain; Indicates the first Texture uniformity within a connected region; Indicates the relationship with the first The first connected component is adjacent to the first... Texture uniformity of connected domains; Indicates the first The number of adjacent connected components around a connected component; Indicates the relationship with the first The first connected component corresponds to the th The absolute value of the difference in texture contrast between connected components in a pair of connected components; Indicates the relationship with the first The first connected component corresponds to the th The absolute value of the difference in texture uniformity between connected components; Indicates the relationship with the first The number of all adjacent connected component pairs around a connected component; This is the normalization function; It is an absolute value function.
[0103] It should be noted that when the denominator in the formula is 0, let the denominator be 1. This will be used as an example to ensure that the formula is true.
[0104] No. The method for calculating the correction probability of a connected region being a reflective area is as follows:
[0105]
[0106] In the formula, Indicates the first The corrected probability of each connected component being a reflective region; Indicates the first The probability that a connected component is a reflective region; Indicates the first The difference between each connected component and the surrounding texture; This is the normalization function.
[0107] Preset threshold With a value of 0.8, the probability of correcting for reflective areas is greater than the preset threshold across all connected components. The region consisting of all connected domains is denoted as the reflective region.
[0108] At this point, the reflective area has been obtained.
[0109] Step S004: Based on the shortest distance from each connected component of the reflective area to the workpiece area and the tool area, obtain the degree of influence of each connected component on the image quality; based on the degree of influence of each connected component of the reflective area on the image quality, the probability that the grayscale images of the workpiece and the tool are the three-dimensional models corresponding to the planar images of the target tool, and the correction probability, obtain the degree of correction influence of each connected component on the image quality.
[0110] It should be noted that to determine the impact of reflection on an image, the larger the area of reflection and the closer the reflected area is to the edge of the workpiece, the greater the impact of the reflection on image quality. The number of pixels represents the area of the connected region.
[0111] Calculate the first reflective area The shortest distance from each connected component to the workpiece region and the first... The reciprocal of the minimum value among the shortest distances from each connected component to the tool region and the th The product of the areas of the nth connected components, after normalization, is denoted as the nth reflective region. The degree of influence of each connected component on image quality;
[0112] The first reflective area The method for calculating the impact of each connected component on image quality is as follows:
[0113]
[0114] In the formula, The first part representing the reflective area The degree of influence of each connected component on image quality; The first part representing the reflective area The area of each connected region; The first part representing the reflective area The shortest distance from each connected domain to the workpiece region; The first part representing the reflective area The shortest distance from each connected domain to the tool region; It is a minimum value function; This is the normalization function.
[0115] It should be noted that, to assist in determining whether the reflective area affects the identifiability of the workpiece and tool, and further to determine the degree of influence, the connected components representing the reflection can be merged with the workpiece and tool using image processing techniques. This transforms the reflective area into the workpiece and tool, and the merged image is then re-identified to represent the workpiece and tool regions. The resulting grayscale image of the workpiece and tool is the first... The correction probability of the 3D model corresponding to the planar image of the tool is determined by the fact that the reflective area affects the recognizability of the workpiece and the tool. When the grayscale image of the workpiece and the tool is the 3D model corresponding to the planar image of the target tool, the correction probability increases compared to the probability of the 3D model corresponding to the planar image of the target tool. The greater the increase, the greater the influence of the reflective area on the image quality. Based on this, the influence of the reflective area on the image quality is corrected.
[0116] Default value =0;
[0117] The first reflective area The method for calculating the degree of influence of each connected component on image quality correction is as follows:
[0118]
[0119] In the formula, The first part representing the reflective area The degree of influence of each connected component on image quality correction; The first part representing the reflective area The degree of influence of each connected component on image quality; This represents the probability that the grayscale image of the workpiece and the tool is a 3D model corresponding to the planar image of the target tool; This represents the correction probability of the grayscale images of the workpiece and the tool being the 3D model corresponding to the planar image of the target tool; It is a function for maximizing the value; This is the default value; This is the normalization function; It is an absolute value function.
[0120] Thus, we have obtained the degree of influence of each connected region of the reflective area on the correction of image quality.
[0121] Step S005: Based on the degree of influence of each connected component on the image quality correction, perform tool setting operation on the workpiece and tool in the grayscale images of the workpiece and tool.
[0122] It should be noted that, based on the degree of impact of the above-mentioned corrected reflective area on the image quality of the workpiece or tool, it is determined whether the light source needs to be adjusted to reduce or eliminate reflection.
[0123] The average value of the degree of influence of all connected components of the reflective region on the image quality is denoted as the degree of influence of the reflective region on the image quality.
[0124] Preset judgment threshold The threshold value is 0.8, meaning the impact of reflective areas on image quality is less than or equal to a preset threshold. At the same time, there is no need to adjust the position of the light source; the tool setting operation can be performed directly on the workpiece and tool in the grayscale image of the workpiece and tool.
[0125] When the impact of reflective areas on image quality exceeds a preset threshold... Then, adjust the position of the light source until the impact of the reflective area on the image quality in the re-acquired grayscale image of the workpiece or tool is less than or equal to the preset judgment threshold. Then, a tool setting operation is performed on the workpiece and tool in the grayscale images of the workpiece and tool.
[0126] If the light source position needs to be adjusted, the light source position is adjusted, and the industrial camera is used to recapture images of the workpiece and tool. The newly acquired images are used to identify reflective areas and assess their impact. Based on the position information of the workpiece and tool, and combined with coordinate system transformation rules, tool setting data is calculated; then tool setting is performed.
[0127] It should be noted that if adjustments are necessary, the optimal adjustment method should be determined based on the actual reflection situation. This may include changing the angle or intensity of the light source, or using different types of light sources (such as changing the color temperature of the light source or using polarized light). According to the determined adjustment mode, the light source should be adjusted in practice. After the light source is adjusted, the industrial camera should be used to recapture images of the workpiece and tool. The newly acquired images should be used to identify the reflective areas and assess their impact to ensure that the adjustment is effective. The adjusted images should then be used to calculate the tool setting data based on the position information of the workpiece and tool, combined with coordinate system transformation rules.
[0128] It should be noted that a high-precision sample is selected or made, and the sample is machined using a CNC machine tool according to the tool setting data calculated above. The machining results on the sample are measured and compared with the expected results to evaluate the tool setting accuracy. The inspection results and measurement data are then sent back to the system. The system analyzes the returned data, identifies any deviations or errors in the tool setting process, and automatically adjusts the algorithm or parameters based on this information to improve the accuracy of future tool setting.
[0129] This invention also provides a rapid tool setting system for CNC machine tool casting machining, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the above steps S001 to S005.
[0130] This concludes the embodiment.
[0131] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for rapid tool setting in CNC machine tool casting machining, characterized in that, The method includes the following steps: Obtain grayscale images of the workpiece and tool, as well as planar views of each tool and workpiece from different angles, representing the 3D model of each workpiece and the 3D model of each tool. Obtain all key points in each tool planar image and the grayscale images of the workpiece and tool. Match the key points to obtain the probability that the grayscale images of the workpiece and tool correspond to the 3D model of each tool planar image. Based on the probability that the grayscale images of the workpiece and tool correspond to the 3D model of each tool planar image and the key points, obtain the corrected probability that the grayscale images of the workpiece and tool correspond to the 3D model of each tool planar image. Based on the corrected probability that the grayscale images of the workpiece and tool correspond to the 3D model of each tool planar image, obtain the target tool planar image, the tool region in the grayscale images of the workpiece and tool, and the workpiece region. In the grayscale images of the workpiece and the tool, several connected components are obtained; based on the distance between each connected component and the centroid of the tool region and the workpiece region, the probability that each connected component is a reflective region is obtained; the texture contrast and uniformity within each connected component are obtained; based on the difference in texture contrast and uniformity of each connected component and the probability that it is a reflective region, a reflective region composed of several connected components is obtained. The influence of each connected component on image quality is obtained by considering the shortest distance from each connected component of the reflective region to the workpiece region and the tool region. The influence of each connected component on image quality is obtained by considering the influence of each connected component of the reflective region on image quality, the probability that the grayscale images of the workpiece and tool are the 3D models corresponding to the planar images of the target tool, and the correction probability. Based on the degree of influence of each connected component on image quality correction, tool setting operations are performed on the workpiece and tool in the grayscale images of the workpiece and tool. The method for obtaining the reflective area is as follows: In the Among all the adjacent connected components around a connected component, any two connected components can be combined into a connected component pair. Based on the differences in texture contrast and uniformity of each connected component and each connected component pair, the specific calculation formula corresponding to the difference between each connected component and its surrounding texture is as follows: In the formula, Indicates the first The difference between each connected component and the surrounding texture; Indicates the first Texture contrast within each connected domain; Indicates the relationship with the first The first connected component is adjacent to the first... Texture contrast of each connected domain; Indicates the first Texture uniformity within a connected region; Indicates the relationship with the first The first connected component is adjacent to the first... Texture uniformity of connected domains; Indicates the first The number of adjacent connected components around a connected component; Indicates the relationship with the first The first connected component corresponds to the th The absolute value of the difference in texture contrast between connected components in a pair of connected components; Indicates the relationship with the first The first connected component corresponds to the th The absolute value of the difference in texture uniformity between connected components; Indicates the relationship with the first The number of all adjacent connected component pairs around a connected component; This is the normalization function; It is an absolute value function; The first The probability that the first connected component is a reflective region and the probability that the second connected component is a reflective region The normalized result of the product of the differences between each connected component and the surrounding texture is denoted as the i-th. The corrected probability of each connected component being a reflective region; In all connected components, the probability of correcting for reflective areas will be greater than a preset threshold. The region consisting of all connected domains is denoted as the reflective region. The method for obtaining the degree of influence of the correction is as follows: In the formula, The first part representing the reflective area The degree of influence of each connected component on image quality correction; The first part representing the reflective area The degree of influence of each connected component on image quality; This represents the probability that the grayscale image of the workpiece and the tool is a 3D model corresponding to the planar image of the target tool; This represents the correction probability of the grayscale images of the workpiece and the tool being the 3D model corresponding to the planar image of the target tool; It is a function for maximizing the value; This is the default value; This is the normalization function; It is an absolute value function.
2. The method for rapid tool setting in CNC machine tool casting machining according to claim 1, characterized in that, The specific steps involved in obtaining all key points in each tool planar image and the grayscale images of the workpiece and tool, matching the key points, and obtaining the probability that the grayscale images of the workpiece and tool are the corresponding 3D models of each tool planar image are as follows: The SIFT algorithm is used to obtain several pairs of key points in each tool planar image and the grayscale images of the workpiece and tool, as well as the similarity between key points in each pair; The grayscale images of the workpiece and the cutting tool are the first... The specific formula for calculating the probability of the 3D model corresponding to the planar view of the cutting tool is as follows: In the formula, The grayscale image of the workpiece and tool is represented as the first... The probability of the 3D model corresponding to the planar diagram of the cutting tool; The grayscale images of the workpiece and tool are represented in the first... The number of pairs in the plan view of the cutting tools; The grayscale images of the workpiece and tool are represented in the first... Zhang's cutting tool plan view, number Similarity between key points in each pair; It is a linear normalization function.
3. The method for rapid tool setting in CNC machine tool casting machining according to claim 2, characterized in that, The specific steps involved in obtaining the corrected probability of the 3D model corresponding to each tool planar view based on the probability of the grayscale images of the workpiece and tool being the 3D model corresponding to each tool planar view, and the key points, are as follows: In the In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In the pairing, the coordinate system transformation rule is used to transform the first pairing. The distance between the key points corresponding to the tool planar image and the corresponding pixels in the workpiece and tool grayscale images is denoted as the distance between the key points in the tool planar image and the corresponding pixels in the workpiece and tool grayscale images. The key points corresponding to the workpiece and tool grayscale images are then mapped to the first... The pixel in the planar diagram of the cutting tool is... The distance between the key points corresponding to the tool plan view is denoted as the distance between the key points of the workpiece and tool grayscale images in the tool plan view. In the formula, The grayscale image of the workpiece and tool is represented as the first... The correction probability of the 3D model corresponding to the plan view of the cutting tool; Indicates the first In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In each pairing, the distance between key points in the grayscale images of the workpiece and the tool in the tool planar image; Indicates the first In the plan view of the cutting tool and the grayscale images of the workpiece and the cutting tool, the first... In each pairing, the distance between key points in the grayscale images of the workpiece and the tool in the tool planar image; It is an absolute value function.
4. The method for rapid tool setting in CNC machine tool casting machining according to claim 1, characterized in that, The specific steps for obtaining the target tool plan view, the tool region in the workpiece and tool grayscale images, and the workpiece region by adjusting the 3D model corresponding to each tool plan view based on the workpiece and tool grayscale images are as follows: In all tool planar images, the tool planar image corresponding to the maximum value of the correction probability of the 3D model corresponding to each tool planar image is denoted as the target tool planar image. Using the SIFT algorithm, the matching region of the target tool plane image in the grayscale images of the workpiece and the tool is obtained, and is denoted as the tool region; Using all workpiece plan views, the workpiece area is obtained based on the method of obtaining the tool area in the grayscale images of the workpiece and the tool.
5. The method for rapid tool setting in CNC machine tool casting machining according to claim 1, characterized in that, The probability of each connected region being a reflective region is obtained based on the distance between each connected region and the centroid of both the tool region and the workpiece region. The specific formulas include the following: In the formula, Indicates the first The probability that a connected component is a reflective region; Indicates the first The distance between the centroid of each connected region and the centroid of the tool region; Indicates the first The distance between the centroid of each connected region and the centroid of the workpiece region; Indicates the first The number of pixels belonging to the workpiece region and the tool region among the edge pixels of a connected domain; Indicates the first The average gray value of all pixels within a connected component; It is a linear normalization function; It is a minimum value function.
6. The method for rapid tool setting in CNC machine tool casting machining according to claim 1, characterized in that, The specific steps for determining the influence of each connected region on image quality based on the shortest distance from each connected region of the reflective area to the workpiece area and the tool area are as follows: Calculate the first reflective area The shortest distance from each connected component to the workpiece region and the first... The reciprocal of the minimum value among the shortest distances from each connected component to the tool region and the th The product of the areas of the nth connected components, after normalization, is denoted as the nth reflective region. The degree of influence of each connected component on image quality.
7. The method for rapid tool setting in CNC machine tool casting machining according to claim 1, characterized in that, The specific steps for performing tool setting operations on the workpiece and tool in the grayscale images of the workpiece and tool, based on the degree of influence of each connected component on image quality correction, are as follows: The average value of the degree of influence of all connected components of the reflective region on the image quality is denoted as the degree of influence of the reflective region on the image quality. When the impact of reflective areas on image quality is less than or equal to a preset threshold... At that time, the tool setting operation is performed directly on the workpiece and tool in the grayscale image of the workpiece and tool; When the impact of reflective areas on image quality exceeds a preset threshold... Then, adjust the position of the light source until the impact of the reflective area on the image quality in the newly acquired grayscale image of the workpiece or tool is less than or equal to the preset judgment threshold. Then, a tool setting operation is performed on the workpiece and tool in the grayscale images of the workpiece and tool.
8. A rapid tool setting system for machining castings on a CNC machine tool, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed by the processor, it implements the steps of the rapid tool setting method for machining castings on a CNC machine tool as described in any one of claims 1-7.
Citation Information
Patent Citations
Intelligent image denoising method for titanium alloy machining cutter model construction
CN118154456A
Cutter tip rapid identification method and system for machine tool cutter
CN118314312A