A precision measurement method, measurement system and measurement device for aluminum part size

By analyzing the images of the aluminum part at each moving perspective, combining the local and overall template matching degrees and attention weights, and calculating the rationality of template matching, the problem of inaccurate matching of local key areas in the aluminum part size measurement is solved, achieving higher measurement accuracy and efficiency.

CN120451143BActive Publication Date: 2025-09-16ZHEJIANG DESHI ELECTRICAL APPLIANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510926426.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-07
Publication Date
2025-09-16
Estimated Expiration
2045-07-07

AI Technical Summary

Technical Problem

The existing image measurement method based on template matching fails to accurately reflect the alignment status of local key areas in the aluminum part size measurement, resulting in inaccurate aluminum part size measurement.

Method used

By acquiring images of the aluminum part to be measured at various viewing angles each time it moves, the template matching degree of the local area and the overall template matching degree are analyzed. The reasonableness of the template matching is calculated by combining the attention weight and contour similarity, thereby accurately measuring the size of the aluminum part.

Benefits of technology

It improves the accuracy and efficiency of aluminum part size measurement, ensures the matching effect of local key areas, and enhances the reliability of measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451143B_ABST
    Figure CN120451143B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of aluminum part template matching, and specifically to a method, system, and device for precisely measuring the size of aluminum parts. The method obtains an image of an aluminum part to be measured each time it moves; based on the shape similarity between the aluminum part image and the template aluminum part image in the local area, obtains the local template matching degree and the overall template matching degree of the local area of ​​the aluminum part image, and then obtains the attention weight and the final local template matching degree of the local area; based on the contour similarity between the aluminum part to be measured and the template aluminum part, obtains the contour template matching degree; based on the difference between the contour template matching degree and the final local template matching degree and the attention weight, obtains the reasonable degree of template matching of the aluminum part to be measured, and then measures the size of the aluminum part to be measured. The present invention accurately reflects the matching situation between the aluminum part to be measured and the template aluminum part by accurately obtaining the reasonable degree of template matching, which is beneficial to improving the accuracy of dimensional measurement of the aluminum part to be measured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of aluminum part template matching, and in particular to a precise measurement method, a measurement system and a measurement device for the size of an aluminum part. Background Art

[0002] Aluminum parts are widely used in aerospace, automotive, precision instruments and other fields due to their lightweight and high strength. As industrial precision requirements continue to increase, precise measurement of aluminum part dimensions has become a key step in ensuring product quality.

[0003] In the existing methods, the image measurement method based on template matching is used to measure the size of aluminum parts. However, in reality, since aluminum parts are mostly assembled from separate structures such as piston components and hammer components, the dimensional accuracy of their joints (such as bolt holes and assembly interfaces) is crucial to the overall performance. The image measurement method based on template matching only focuses on global matching and ignores the alignment status of local key areas (such as joint surfaces and hole positions). At the same time, there is a lack of quantitative analysis of the correlation between "local matching-global matching", resulting in inaccurate matching results analysis between the aluminum part to be measured and the template aluminum part, affecting the precise measurement of the size of the aluminum part to be measured. Summary of the Invention

[0004] In order to solve the technical problem that the matching analysis results of the aluminum part to be measured and the template aluminum part are inaccurate, which affects the accurate measurement of the size of the aluminum part to be measured, the purpose of the present invention is to provide a precise measurement method, measurement system and measurement device for the size of the aluminum part. The technical solutions adopted are as follows:

[0005] In a first aspect, an embodiment of the present invention provides a method for precisely measuring the size of an aluminum part, the method comprising the following steps:

[0006] Acquire images of the aluminum part under test at various viewing angles each time the aluminum part moves;

[0007] Based on the shape similarity between each aluminum part image and the template aluminum part image at the same viewing angle in each local area, the local template matching degree of each local area of ​​each aluminum part image and the overall template matching degree of each aluminum part image are obtained; based on the correlation between the overall template matching degree of each aluminum part image at each viewing angle and the local template matching degree of each local area, the attention weight of each local area is obtained; wherein the position of the local area is fixed;

[0008] The final local template matching degree of each local area is determined based on the overall template matching degree; the contour template matching degree of the aluminum part to be tested at each viewing angle is obtained based on the similarity between the contours of the aluminum part to be tested and the template aluminum part at each viewing angle; the reasonableness of the template matching of the aluminum part to be tested is obtained based on the difference between the contour template matching degree of the aluminum part to be tested at each viewing angle and the final local template matching degree of each local area at each viewing angle, as well as the attention weight of each local area;

[0009] The size of the aluminum part to be measured is measured based on the reasonable degree of template matching and the final local template matching degree.

[0010] Furthermore, the method for obtaining the local template matching degree is:

[0011] For any aluminum part image at any viewing angle and any local area at the viewing angle, obtaining an area difference between the aluminum part image and the template aluminum part image at the viewing angle in the local area as a first difference;

[0012] Acquire a difference in perimeter between the aluminum component image and the template aluminum component image at the viewing angle in the local area as a second difference;

[0013] The first difference and the second difference are added, negatively correlated, and normalized to obtain a result, which is used as the local template matching degree of the local area of ​​the aluminum component image.

[0014] Furthermore, the method for obtaining the overall template matching degree is:

[0015] For any aluminum part image, the sum of the local template matching degrees of all local areas of the aluminum part image is used as the overall template matching degree of the aluminum part image.

[0016] Furthermore, the method for obtaining the attention weight is:

[0017] For any viewing angle and any local area under the viewing angle, the overall template matching degree of each aluminum part image under the viewing angle is arranged according to the order of the corresponding movement of the aluminum part images to obtain the overall template matching degree sequence;

[0018] Arranging the local template matching degrees of the local area according to the order of the corresponding movement of the corresponding aluminum part image to obtain a local template matching degree sequence of the local area;

[0019] The result of normalizing the Pearson correlation coefficient between the overall template matching degree sequence and the local template matching degree sequence is used as the attention weight of the local area.

[0020] Furthermore, the method for obtaining the final local template matching degree is:

[0021] Obtain the sum of the overall template matching degree of the aluminum part under test at each movement and each viewing angle as the template target matching degree of each movement;

[0022] The local template matching degree corresponding to each local area under the maximum template target matching degree is used as the final local template matching degree of each local area.

[0023] Furthermore, the method for obtaining the matching degree of the contour template is:

[0024] The aluminum part images at each viewing angle corresponding to the maximum template target matching degree are all used as target images;

[0025] For any viewing angle, obtain a set of inflection points on the contour line of the target image at the viewing angle as a first set;

[0026] Obtain a set of inflection points on the contour line of the template aluminum part image at the viewing angle as the second set;

[0027] The target image at the viewing angle and the template aluminum part image at the viewing angle are mapped into the same image, and the distance between each point in the first set and each point in the second set is obtained, and both are used as the reference distance for each point in the first set;

[0028] The mean of the minimum reference distances of each point in the first set is taken as the distance analysis value of the first set;

[0029] Obtain the distance between each point in the second set and each point in the first set, and use them as the reference distance for each point in the second set;

[0030] The mean of the minimum reference distances of each point in the second set is used as the distance analysis value of the second set;

[0031] The result of negatively correlating and normalizing the sum of the distance analysis values ​​of the first set and the distance analysis values ​​of the second set is used as the matching degree of the contour template of the aluminum part to be measured at the viewing angle.

[0032] Furthermore, the method for obtaining the reasonable degree of template matching is:

[0033] For any viewing angle and any local area under the viewing angle, the difference between the contour template matching degree of the aluminum part to be tested under the viewing angle and the final local template matching degree of the local area is negatively correlated and normalized, and the result is used as the consistent analysis value of the local area;

[0034] The product of the attention weight of the local area and the consistent analysis value is used as the final consistent analysis value of the local area;

[0035] The final consistent analysis values ​​of all local areas under the viewing angle are added together and normalized, and the result is used as the matching reasonable analysis value of the aluminum part to be tested under the viewing angle;

[0036] The average of the reasonable matching analysis values ​​of the aluminum part to be tested under all viewing angles is taken as the reasonable degree of template matching of the aluminum part to be tested.

[0037] Furthermore, the method for measuring the size of the aluminum part to be measured based on the reasonable degree of template matching and the final local template matching degree is:

[0038] When the final local template matching degree is less than the preset local template matching degree threshold, the corresponding local area is regarded as an abnormal local area;

[0039] When the template matching rationality is greater than or equal to the preset template matching rationality threshold, and the number of abnormal local areas is less than or equal to the preset number threshold, the size of the aluminum part to be measured is measured by the unit size of the pixel points in the template aluminum part image;

[0040] When the template matching rationality is less than a preset template matching rationality threshold or the number of abnormal local areas is greater than a preset number threshold, the size of the aluminum part to be measured is measured manually.

[0041] In a second aspect, another embodiment of the present invention provides a precision measurement system for aluminum part dimensions, the system comprising:

[0042] An image acquisition module is used to acquire images of the aluminum part under test at various viewing angles each time the aluminum part moves;

[0043] An attention weight acquisition module is used to obtain the local template matching degree of each local area of ​​each aluminum part image and the overall template matching degree of each aluminum part image based on the shape similarity between each aluminum part image and the template aluminum part image at the same viewing angle in each local area; and obtain the attention weight of each local area based on the correlation between the overall template matching degree of each aluminum part image at each viewing angle and the local template matching degree of each local area; wherein the position of the local area is fixed;

[0044] The template matching rationality acquisition module is used to determine the final local template matching degree of each local area based on the overall template matching degree; obtain the contour template matching degree of the aluminum part to be tested at each viewing angle based on the similarity between the contours of the aluminum part to be tested and the template aluminum part at each viewing angle; obtain the template matching rationality degree of the aluminum part to be tested based on the difference between the contour template matching degree of the aluminum part to be tested at each viewing angle and the final local template matching degree of each local area at each viewing angle, as well as the attention weight of each local area;

[0045] The data processing module is used to measure the size of the aluminum part to be measured based on the reasonable degree of template matching and the final local template matching degree.

[0046] In a third aspect, another embodiment of the present invention provides a precision measuring device for the size of aluminum parts, the device comprising: a memory, a processor, and a computer program stored in the memory and running on the processor, and when the processor executes the computer program, the steps of any one of the above methods are implemented.

[0047] The present invention has the following beneficial effects:

[0048] The present invention first obtains the local template matching degree of each local area of ​​each aluminum part image and the overall template matching degree of each aluminum part image according to the shape similarity between each aluminum part image and the template aluminum part image at the same viewing angle in each local area, accurately reflecting the template matching situation of each aluminum part image in each local area and the overall template matching situation, which is conducive to the subsequent determination of the optimal measurement position of the aluminum part to be tested and the optimal template matching situation of each local area; in order to determine the importance of each local area and to accurately analyze the correlation between the local template matching situation of the aluminum part to be tested and the global template matching situation in the subsequent movement, the attention weight of each local area is obtained according to the correlation between the overall template matching level of each aluminum part image at each viewing angle and the local template matching level of each local area, accurately reflecting the importance of each local area; further based on the overall template matching level, the aluminum part to be tested is determined The optimal measurement position of the aluminum part is determined, and then the final local template matching degree of each local area, that is, the optimal template matching situation, is determined; in order to obtain the global template matching situation of the aluminum part to be measured, the contour template matching degree of the aluminum part to be measured at each viewing angle is obtained according to the contour similarity between the aluminum part to be measured and the template aluminum part at each viewing angle, accurately reflecting the global template matching situation of the aluminum part to be measured at each viewing angle; and then according to the difference between the contour template matching degree of the aluminum part to be measured at each viewing angle and the final local template matching degree of each local area at each viewing angle, as well as the attention weight of each local area, the reasonable degree of template matching of the aluminum part to be measured is obtained, accurately reflecting the reasonable situation of template matching of the aluminum part to be measured; and then based on the reasonable degree of template matching and the final local template matching degree, the reliability of dimensional measurement of the aluminum part to be measured by the template aluminum part is accurately analyzed, which is conducive to improving the accuracy of dimensional measurement of the aluminum part to be measured. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0050] Figure 1 A schematic flow chart of a method for precisely measuring the dimensions of an aluminum part provided by one embodiment of the present invention;

[0051] Figure 2 A structural diagram of a precision measurement system for aluminum parts provided by one embodiment of the present invention;

[0052] Figure 3 A schematic diagram of a computer device provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0053] To further illustrate the technical means and effectiveness of the present invention in achieving its intended objectives, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail a method, system, and device for precisely measuring the dimensions of aluminum parts, including their specific implementation, structure, features, and effectiveness. In the following description, references to "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.

[0054] Unless defined otherwise, 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 belongs.

[0055] The specific scheme of the precise measurement method, measurement system and measurement device of the aluminum part size provided by the present invention is described in detail below with reference to the accompanying drawings.

[0056] Example 1:

[0057] This invention proposes a method for precise measurement of aluminum parts size. Figure 1 , which shows a schematic flow chart of a method for precisely measuring the size of an aluminum part provided by one embodiment of the present invention, the method comprising the following steps:

[0058] Step S1: Acquire images of the aluminum part under test at various viewing angles each time the aluminum part moves.

[0059] Specifically, this embodiment takes an aluminum part to be tested as an example for analysis, and all aluminum parts to be tested that appear subsequently are referred to as the aluminum part to be tested. After the aluminum part to be tested is transported to the designated measurement position, there may be a deviation between the position of the aluminum part to be tested and the set template aluminum part, or there may be a deviation between the shape of the aluminum part to be tested and the shape of the template aluminum part itself. In order to better match the aluminum part to be tested with the template aluminum part, it is necessary to use a robotic arm to slightly move the aluminum part to be tested multiple times, and at the same time obtain the image of the aluminum part at each viewing angle each time the aluminum part to be tested moves. Subsequently, the image of the aluminum part at each viewing angle each time the aluminum part moves is compared with the image of the template aluminum part at the corresponding viewing angle to determine the optimal measurement position of the aluminum part to be tested, that is, the optimal template matching position, so that the size of the aluminum part to be tested can be accurately measured subsequently. The viewing angles in this embodiment include main viewing angle, side viewing angle, and top viewing angle. The implementer can set the direction of the viewing angle according to actual conditions, which is not limited here. Among them, the movement of the aluminum part to be tested is manually controlled so that the position of the aluminum part to be tested is closer to the position of the template aluminum part. In order to ensure the local details between the aluminum part to be tested and the template aluminum part match, this embodiment sets the number of slight movements to 50 times. The implementer can set the number of movements according to actual conditions, which is not limited here. At the same time, the implementer can set the degree of each movement of the aluminum part to be tested according to actual conditions, which is not limited here.

[0060] Step S2: Based on the shape similarity between each aluminum part image and the template aluminum part image at the same viewing angle in each local area, obtain the local template matching degree of each local area of ​​each aluminum part image and the overall template matching degree of each aluminum part image; based on the correlation between the overall template matching degree of each aluminum part image at each viewing angle and the local template matching degree of each local area, obtain the attention weight of each local area; wherein the position of the local area is fixed.

[0061] Specifically, in order to more accurately analyze the matching between each aluminum part image and the template aluminum part image at the corresponding viewing angle, this embodiment sets a uniform local area at each viewing angle. This embodiment limits the existence of at least 4 local areas at each viewing angle. The implementer can set the local area at each viewing angle according to actual conditions, which is not limited here. Among them, the position of the local area at each viewing angle is fixed. When the shape and size of a certain aluminum part image and the template aluminum part image at the same viewing angle in each local area are more similar, it means that the template matching effect of the aluminum part image is better. Then, this embodiment obtains the local template matching degree of each local area of ​​each aluminum part image and the overall template matching degree of each aluminum part image based on the shape similarity of each aluminum part image and the template aluminum part image at the same viewing angle in each local area, which is conducive to the subsequent determination of the best matching position of the aluminum part to be tested.

[0062] Taking into account that in actual situations the template matching situation of each local area has different effects on the overall template matching situation under its perspective, in the process of moving the aluminum part to be tested, when the local template matching degree of a local area is more consistent with the changing trend of the overall template matching degree under the corresponding perspective, it means that the local area has more reference significance in the overall template matching process under the corresponding perspective. Furthermore, this embodiment obtains the attention weight of each local area according to the correlation between the overall template matching degree of each aluminum part image under each perspective each movement and the local template matching degree of each local area. The greater the attention degree, the more reference significance the corresponding local area has in the template matching process of the aluminum part to be tested.

[0063] Preferably, in one implementation of this embodiment, the method for obtaining the degree of local template matching is as follows: for any aluminum part image at any viewing angle and any local area at that viewing angle, the absolute value of the difference between the area of ​​the aluminum part image and the template aluminum part image at that viewing angle in the local area is obtained as a first difference; and the absolute value of the difference between the perimeter of the aluminum part image and the template aluminum part image at that viewing angle in the local area is obtained as a second difference. It should be noted that both the area and perimeter are obtained by the number of pixels, wherein, for an image that fills the local area, the perimeter is assumed to be the perimeter of the local area. The smaller the first and second differences are, the better the template matching effect of the aluminum part image in that local area is. Therefore, this embodiment adds the first and second differences, performs negative correlation, and normalizes the result as the degree of local template matching for that local area of ​​the aluminum part image. This embodiment raises the sum of the first and second differences to the power of an exponential function with a natural constant as the base, and the output of the exponential function is a negatively correlated and normalized result.

[0064] At this point, the local template matching degree of each local area of ​​each aluminum part image is obtained.

[0065] Preferably, in one achievable method of this embodiment, the method for obtaining the overall template matching degree is: for any aluminum part image, the sum of the local template matching degrees of all local areas of the aluminum part image is used as the overall template matching degree of the aluminum part image.

[0066] At this point, the overall template matching degree of each aluminum part image is obtained.

[0067] Preferably, in one possible implementation of this embodiment, the method for obtaining the attention weight is:

[0068] For any viewing angle and any local area under the viewing angle, the overall template matching degree of each aluminum image under the viewing angle is arranged according to the order in which the aluminum image corresponds to the movement of the aluminum to be tested, and the overall template matching degree sequence is obtained; the local template matching degree of the local area is arranged according to the order in which the corresponding aluminum image corresponds to the movement of the aluminum to be tested, and the local template matching degree sequence of the local area is obtained; when the data change trend in the local template matching degree sequence is more consistent with that in the overall template matching degree sequence, it means that the local area has a greater impact on the overall template matching situation under the viewing angle, and the degree of attention to the local area should be greater. Then, in this embodiment, the result of normalizing the Pearson correlation coefficient of the overall template matching degree sequence and the local template matching degree sequence is used as the attention weight of the local area. In this embodiment, the Pearson correlation coefficient of the overall template matching degree sequence and the local template matching degree sequence is normalized by the norm normalization function. Among them, the method for obtaining the Pearson correlation coefficient is a well-known technology and will not be repeated here.

[0069] At this point, the attention weight of each local area is obtained.

[0070] Step S3: Determine the final local template matching degree of each local area based on the overall template matching degree; obtain the contour template matching degree of the aluminum part to be tested at each viewing angle according to the contour similarity between the aluminum part to be tested and the template aluminum part at each viewing angle; obtain the reasonableness of the template matching of the aluminum part to be tested according to the difference between the contour template matching degree of the aluminum part to be tested at each viewing angle and the final local template matching degree of each local area at each viewing angle, as well as the attention weight of each local area.

[0071] Specifically, when the aluminum part to be tested is in the optimal matching position, the overall template matching degree at each viewing angle should be the greatest. Therefore, this embodiment determines the final local template matching degree for each local area based on the overall template matching degree, and determines the template matching status of each local area of ​​the aluminum part to be tested. In existing methods, the global template matching status of the aluminum part to be tested is analyzed based on the similarity of the contours of the aluminum part to be tested and the template aluminum part. Furthermore, this embodiment obtains the contour template matching degree of the aluminum part to be tested at each viewing angle based on the similarity of the contours of the aluminum part to be tested and the template aluminum part at each viewing angle, accurately reflecting the global template matching status of the aluminum part to be tested at each viewing angle. The closer the local template matching and global template matching of the aluminum part under test are at the same viewing angle, the more reasonable the template matching of the aluminum part under test is indirectly. Considering the different levels of attention in different local areas, that is, the different levels of reference for the corresponding local parts of the aluminum part under test, in order to more accurately describe the reasonableness of the template matching of the aluminum part under test, the reasonableness of the template matching of the aluminum part under test is obtained based on the difference between the contour template matching degree of the aluminum part under test at each viewing angle and the final local template matching degree of each local area under each viewing angle, as well as the attention weight of each local area. The greater the reasonableness of the template matching, the more reasonable the match between the aluminum part under test and the template aluminum part.

[0072] Preferably, in one possible implementation of this embodiment, the final local template matching degree is obtained by summing the overall template matching degrees at each viewing angle for each movement of the aluminum part to be tested, using this sum as the template target matching degree for each movement; the greater the template target matching degree, the more consistent the position of the aluminum part to be tested and the template aluminum part after the corresponding movement. Thus, this embodiment uses the local template matching degree corresponding to each local area at the maximum template target matching degree as the final local template matching degree for each local area. It should be noted that if there are at least two maximum template target matching degrees, the template target matching degree with the smallest variance in the overall template matching degree is selected.

[0073] Preferably, in one possible implementation of this embodiment, the method for obtaining the degree of matching of the contour template is as follows: the aluminum part images at each viewing angle corresponding to the maximum template target matching degree are all used as target images, that is, images of the aluminum part to be tested at each viewing angle at the best matching position; for any viewing angle, the contour lines in the target image at that viewing angle and the contour lines in the template aluminum part image at that viewing angle are obtained by using the Canny edge detection algorithm, and in order to analyze the global matching between the target image at that viewing angle and the template aluminum part image at that viewing angle, a set of inflection points on the contour lines in the target image at that viewing angle is obtained as a first set; a set of inflection points on the contour lines in the template aluminum part image at that viewing angle is obtained as a second set; wherein the Canny edge detection algorithm and the method for obtaining the inflection points are both well-known technologies and will not be described in detail;

[0074] Then, the target image at the viewing angle and the template aluminum part image at the viewing angle are mapped to the same image, and the Euclidean distance between each point in the first set and each point in the second set is obtained, and both are used as the reference distance of each point in the first set; the mean of the minimum reference distance of each point in the first set is used as the distance analysis value of the first set, which accurately reflects the distance between the inflection point on the contour of the aluminum part to be measured at the viewing angle and the contour of the template aluminum part at the viewing angle; further, the Euclidean distance between each point in the second set and each point in the first set is obtained, and both are used as the reference distance of each point in the second set; the mean of the minimum reference distance of each point in the second set is used as the distance analysis value of the second set, which accurately reflects the distance between the inflection point on the contour of the template aluminum part at the viewing angle and the contour of the aluminum part to be measured at the viewing angle; wherein, the method for obtaining the Euclidean distance is a well-known technology and will not be described in detail;

[0075] When both the distance analysis values ​​of the first set and the distance analysis values ​​of the second set are smaller, it indicates that the global template matching effect of the aluminum part to be tested at that viewing angle is better. Therefore, this embodiment negatively correlates and normalizes the sum of the distance analysis values ​​of the first set and the distance analysis values ​​of the second set as the degree of contour template matching of the aluminum part to be tested at that viewing angle. The greater the degree of contour template matching, the better the global template matching effect of the aluminum part to be tested at that viewing angle. This embodiment uses the sum of the distance analysis values ​​of the first set and the distance analysis values ​​of the second set as the power of an exponential function with a natural constant as the base, and the output of this exponential function is a negatively correlated and normalized result.

[0076] At this point, the matching degree of the contour template of the aluminum part to be tested at each viewing angle is obtained.

[0077] Preferably, in a manner that can be implemented in this embodiment, the method for obtaining the reasonable degree of template matching is: for any viewing angle and any local area under the viewing angle, the absolute value of the difference between the contour template matching degree of the aluminum part to be tested at the viewing angle and the final local template matching degree of the local area is negatively correlated and normalized as the consistent analysis value of the local area; in this embodiment, the absolute value of the above difference is used as the power of an exponential function with a natural constant as the base, and the output result of the exponential function is a negatively correlated and normalized result; the larger the consistent analysis value, the more consistent the global template matching of the local area with the aluminum part to be tested at the viewing angle. Taking into account the template matching reference of the local area, the product of the attention weight of the local area and the consistent analysis value is used as the final consistent analysis value of the local area. In order to comprehensively represent the reasonableness of the template matching of the aluminum part to be tested at this viewing angle, the final consistent analysis values ​​of all local areas at this viewing angle are added and normalized, and the result is used as the reasonable matching analysis value of the aluminum part to be tested at this viewing angle. This embodiment uses the norm normalization function to normalize the sum of the final consistent analysis values ​​of all local areas at this viewing angle. Finally, the average of the reasonable matching analysis values ​​of the aluminum part to be tested at all viewing angles is used as the reasonable degree of template matching of the aluminum part to be tested.

[0078] Step S4: measuring the size of the aluminum part to be measured based on the reasonableness of the template matching and the final local template matching degree.

[0079] Specifically, in the process of measuring the size of aluminum parts using the image measurement method based on template matching, the rationality of template matching can accurately reflect the reliability of measuring the size of the aluminum parts to be measured based on the template aluminum parts. Therefore, the greater the rationality of template matching, the more accurate the image measurement method based on template matching. At the same time, it is also necessary to ensure that the matching effect between the aluminum parts to be measured and the template aluminum parts meets the standards. Therefore, this embodiment measures the size of the aluminum parts to be measured based on the rationality of template matching and the final local template matching degree.

[0080] Preferably, in one possible implementation of this embodiment, the method for measuring the size of the aluminum part to be tested based on the reasonable degree of template matching and the final local template matching degree is as follows: it is known that the greater the final local template matching degree, the better the matching effect between the aluminum part to be tested and the template aluminum part, which indirectly indicates that the shape and size of the aluminum part to be tested and the template aluminum part are more consistent. Therefore, this embodiment sets the preset local template matching degree threshold to 0.7. The implementer can set the value of the preset local template matching degree threshold according to actual conditions, and it is not limited here. When the final local template matching degree is less than the preset local template matching degree threshold, the corresponding local area is regarded as an abnormal local area;

[0081] When the template matching rationality is greater and the number of abnormal local areas is smaller, it means that the image measurement method based on template matching is more accurate. When the template matching rationality is greater than or equal to the preset template matching rationality threshold and the number of abnormal local areas is less than or equal to the preset number threshold, the size of the aluminum part to be measured is measured by the unit size of the pixel points in the template aluminum part image.

[0082] Specifically, the unit size of the pixels in the template aluminum part image is obtained by dividing the size of the template aluminum part by the number of corresponding pixels in the template aluminum part. The unit size of the pixels in the image of the aluminum part to be measured is then set as the unit size of the pixels in the template aluminum part image. The number of pixels corresponding to each position to be measured in the image of the aluminum part to be measured is then obtained, and the product of the above number of pixels and the unit size of the pixels in the image of the aluminum part to be measured is used as the size of the corresponding position.

[0083] If the template matching rationality is less than the preset template matching rationality threshold or the number of abnormal local areas is greater than the preset number threshold, it indicates that the match between the aluminum part to be tested and the template aluminum part is inaccurate or the match between the aluminum part to be tested and the template aluminum part is poor. In this case, the dimensions of the aluminum part to be tested are directly measured manually. In this embodiment, the preset template matching rationality threshold is set to 0.85 and the preset number threshold is set to 1. The implementer can set the preset template matching rationality threshold and the preset number threshold according to actual circumstances, and the values ​​are not limited here.

[0084] This embodiment can effectively improve the accuracy and efficiency of measuring the size of the aluminum part to be measured, while ensuring the accuracy of the measurement.

[0085] In summary, this embodiment obtains an image of the aluminum part to be tested each time it moves; based on the shape similarity between the aluminum part image and the template aluminum part image in the local area, obtains the local template matching degree and the overall template matching degree of the local area of ​​the aluminum part image, and then obtains the attention weight of the local area and the final local template matching degree; based on the contour similarity between the aluminum part to be tested and the template aluminum part, obtains the contour template matching degree; based on the difference between the contour template matching degree and the final local template matching degree and the attention weight, obtains the reasonable degree of template matching of the aluminum part to be tested and then measures the size of the aluminum part to be tested. The present invention accurately reflects the matching situation of the aluminum part to be tested and the template aluminum part by accurately obtaining the reasonable degree of template matching, which is conducive to improving the accuracy of dimensional measurement of the aluminum part to be tested.

[0086] Example 2:

[0087] The present invention also proposes a precise measurement system for the size of aluminum parts. Figure 2, which shows a structural diagram of a precision measurement system for aluminum part dimensions provided by an embodiment of the present invention. The system includes: an image acquisition module 10, an attention weight acquisition module 20, a template matching rationality acquisition module 30 and a data processing module 40.

[0088] The image acquisition module 10 is used to acquire the image of the aluminum part under test at each viewing angle each time the aluminum part moves.

[0089] The attention weight acquisition module 20 is used to obtain the local template matching degree of each local area of ​​each aluminum part image and the overall template matching degree of each aluminum part image based on the shape similarity between each aluminum part image and the template aluminum part image at the same viewing angle in each local area; and obtain the attention weight of each local area based on the correlation between the overall template matching degree of each aluminum part image at each viewing angle and the local template matching degree of each local area thereof; wherein the position of the local area is fixed.

[0090] The template matching rationality acquisition module 30 is used to determine the final local template matching degree of each local area based on the overall template matching degree; obtain the contour template matching degree of the aluminum part to be tested at each viewing angle according to the contour similarity between the aluminum part to be tested and the template aluminum part at each viewing angle; obtain the template matching rationality of the aluminum part to be tested according to the difference between the contour template matching degree of the aluminum part to be tested at each viewing angle and the final local template matching degree of each local area at each viewing angle, as well as the attention weight of each local area.

[0091] The data processing module 40 is used to measure the size of the aluminum part to be measured based on the reasonableness of the template matching and the final local template matching degree.

[0092] It should be noted that the system provided in the above embodiment is merely an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the above embodiment provides a system for the precise measurement of aluminum part dimensions and an embodiment of a method for the precise measurement of aluminum part dimensions, which are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0093] Example 3:

[0094] The present invention also provides a device for precisely measuring the dimensions of aluminum parts. The device includes a memory and a processor. The memory stores executable program code, and the processor is configured to call and execute the executable program code to implement a method for precisely measuring the dimensions of aluminum parts provided in an embodiment of the present application. The device can be a chip, component, or module. The chip may include a processor and memory connected to each other. The memory is configured to store instructions. When the processor calls and executes the instructions, the chip executes the method for precisely measuring the dimensions of aluminum parts provided in the above embodiment.

[0095] In addition, the present invention also protects a computer device, see Figure 3 The computer device includes a memory 401, a processor 402, and a computer program 403 stored in the memory 401 and running on the processor 402, wherein when the processor 402 executes the computer program 403, the computer device can execute any one of the above-mentioned methods for precisely measuring the size of aluminum parts.

[0096] Example 4:

[0097] The present invention also provides a computer-readable storage medium, which stores computer program code. When the computer program code is run on a computer, the computer executes the above-mentioned related method steps to implement a precise measurement method for the size of aluminum parts provided in the above embodiment.

[0098] Example 5:

[0099] The present invention also provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement a method for precisely measuring the size of an aluminum part provided in the above-mentioned embodiment.

[0100] Among them, the device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0101] It should be noted that the order in which the embodiments of the present invention are described above is for illustrative purposes only and does not necessarily represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0102] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.

Claims

1. A method for precise measurement of aluminum parts size, characterized in that: The method comprises the following steps: Acquire images of the aluminum part under test at various viewing angles each time the aluminum part moves; Based on the shape similarity between each aluminum part image and the template aluminum part image at the same viewing angle in each local area, the local template matching degree of each local area of ​​each aluminum part image and the overall template matching degree of each aluminum part image are obtained; based on the correlation between the overall template matching degree of each aluminum part image at each viewing angle and the local template matching degree of each local area, the attention weight of each local area is obtained; wherein the position of the local area is fixed; The final local template matching degree of each local area is determined based on the overall template matching degree; the contour template matching degree of the aluminum part to be tested at each viewing angle is obtained based on the similarity between the contours of the aluminum part to be tested and the template aluminum part at each viewing angle; the reasonableness of the template matching of the aluminum part to be tested is obtained based on the difference between the contour template matching degree of the aluminum part to be tested at each viewing angle and the final local template matching degree of each local area at each viewing angle, as well as the attention weight of each local area; The size of the aluminum part to be measured is measured based on the reasonable degree of template matching and the final local template matching degree; The method for obtaining the reasonable degree of template matching is: For any viewing angle and any local area under the viewing angle, the difference between the contour template matching degree of the aluminum part to be tested under the viewing angle and the final local template matching degree of the local area is negatively correlated and normalized, and the result is taken as the consistent analysis value of the local area; The product of the attention weight of the local area and the consistent analysis value is used as the final consistent analysis value of the local area; The final consistent analysis values ​​of all local areas under the viewing angle are added together and normalized, and the result is used as the matching reasonable analysis value of the aluminum part to be tested under the viewing angle; The average of the reasonable matching analysis values ​​of the aluminum part to be tested under all viewing angles is used as the reasonable degree of template matching of the aluminum part to be tested; The method for measuring the size of the aluminum part to be measured based on the reasonable degree of template matching and the final local template matching degree is: When the final local template matching degree is less than the preset local template matching degree threshold, the corresponding local area is regarded as an abnormal local area; When the template matching rationality is greater than or equal to the preset template matching rationality threshold, and the number of abnormal local areas is less than or equal to the preset number threshold, the size of the aluminum part to be measured is measured by the unit size of the pixel points in the template aluminum part image; When the template matching rationality is less than a preset template matching rationality threshold or the number of abnormal local areas is greater than a preset number threshold, the size of the aluminum part to be measured is measured manually.

2. A method for accurately measuring the size of an aluminum part according to claim 1, characterized in that: The method for obtaining the local template matching degree is: For any aluminum part image at any viewing angle and any local area at the viewing angle, obtaining an area difference between the aluminum part image and the template aluminum part image at the viewing angle in the local area as a first difference; Acquire a difference in perimeter between the aluminum component image and the template aluminum component image at the viewing angle in the local area as a second difference; The first difference and the second difference are added, negatively correlated, and normalized to obtain a result, which is used as the local template matching degree of the local area of ​​the aluminum component image.

3. The method for accurately measuring the size of an aluminum part according to claim 1, wherein: The method for obtaining the overall template matching degree is: For any aluminum part image, the sum of the local template matching degrees of all local areas of the aluminum part image is used as the overall template matching degree of the aluminum part image.

4. A method for accurately measuring the size of an aluminum part according to claim 1, characterized in that: The method for obtaining the attention weight is: For any viewing angle and any local area under the viewing angle, the overall template matching degree of each aluminum part image under the viewing angle is arranged according to the order of the corresponding movement of the aluminum part images to obtain the overall template matching degree sequence; Arranging the local template matching degrees of the local area according to the order of the corresponding movement of the corresponding aluminum part image to obtain a local template matching degree sequence of the local area; The result of normalizing the Pearson correlation coefficient between the overall template matching degree sequence and the local template matching degree sequence is used as the attention weight of the local area.

5. The method for accurately measuring the size of an aluminum part according to claim 1, wherein: The method for obtaining the final local template matching degree is: Obtain the sum of the overall template matching degree of the aluminum part under test at each movement and each viewing angle as the template target matching degree of each movement; The local template matching degree corresponding to each local area under the maximum template target matching degree is used as the final local template matching degree of each local area.

6. A method for accurately measuring the size of an aluminum part according to claim 5, characterized in that: The method for obtaining the matching degree of the contour template is: The aluminum part images at each viewing angle corresponding to the maximum template target matching degree are all used as target images; For any viewing angle, obtain a set of inflection points on the contour line of the target image at the viewing angle as a first set; Obtain a set of inflection points on the contour line of the template aluminum part image at the viewing angle as the second set; The target image at the viewing angle and the template aluminum part image at the viewing angle are mapped into the same image, and the distance between each point in the first set and each point in the second set is obtained, and both are used as the reference distance for each point in the first set; The mean of the minimum reference distances of each point in the first set is taken as the distance analysis value of the first set; Obtain the distance between each point in the second set and each point in the first set, and use them as the reference distance for each point in the second set; The mean of the minimum reference distances of each point in the second set is used as the distance analysis value of the second set; The result of negatively correlating and normalizing the sum of the distance analysis values ​​of the first set and the distance analysis values ​​of the second set is used as the matching degree of the contour template of the aluminum part to be measured at the viewing angle.

7. A precision measurement system for aluminum parts, characterized in that: The system comprises: An image acquisition module is used to acquire images of the aluminum part under test at various viewing angles each time the aluminum part moves; An attention weight acquisition module is used to obtain the local template matching degree of each local area of ​​each aluminum part image and the overall template matching degree of each aluminum part image based on the shape similarity between each aluminum part image and the template aluminum part image at the same viewing angle in each local area; and obtain the attention weight of each local area based on the correlation between the overall template matching degree of each aluminum part image at each viewing angle and the local template matching degree of each local area; wherein the position of the local area is fixed; The template matching rationality acquisition module is used to determine the final local template matching degree of each local area based on the overall template matching degree; obtain the contour template matching degree of the aluminum part to be tested at each viewing angle based on the similarity between the contours of the aluminum part to be tested and the template aluminum part at each viewing angle; obtain the template matching rationality degree of the aluminum part to be tested based on the difference between the contour template matching degree of the aluminum part to be tested at each viewing angle and the final local template matching degree of each local area at each viewing angle, as well as the attention weight of each local area; A data processing module is used to measure the size of the aluminum part to be measured based on the reasonable degree of template matching and the final local template matching degree; The method for obtaining the reasonable degree of template matching is: For any viewing angle and any local area under the viewing angle, the difference between the contour template matching degree of the aluminum part to be tested under the viewing angle and the final local template matching degree of the local area is negatively correlated and normalized, and the result is taken as the consistent analysis value of the local area; The product of the attention weight of the local area and the consistent analysis value is used as the final consistent analysis value of the local area; The final consistent analysis values ​​of all local areas under the viewing angle are added together and normalized, and the result is used as the matching reasonable analysis value of the aluminum part to be tested under the viewing angle; The average of the reasonable matching analysis values ​​of the aluminum part to be tested under all viewing angles is used as the reasonable degree of template matching of the aluminum part to be tested; The method for measuring the size of the aluminum part to be measured based on the reasonable degree of template matching and the final local template matching degree is: When the final local template matching degree is less than the preset local template matching degree threshold, the corresponding local area is regarded as an abnormal local area; When the template matching rationality is greater than or equal to the preset template matching rationality threshold, and the number of abnormal local areas is less than or equal to the preset number threshold, the size of the aluminum part to be measured is measured by the unit size of the pixel points in the template aluminum part image; When the template matching rationality is less than a preset template matching rationality threshold or the number of abnormal local areas is greater than a preset number threshold, the size of the aluminum part to be measured is measured manually.

8. A precision measuring device for aluminum part dimensions, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When executing the computer program, the processor implements the steps of the method for precisely measuring the size of an aluminum part as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Building aluminum template identification structure and method based on local features

    CN113701821A

  • Quantum, biological, computer vision, and neural network systems for industrial internet of things

    US20230176550A1