A method, system and device for precisely measuring the size of tiny watch parts

By combining the dimensional measurement of tiny clock parts with light artifact characteristic values ​​and structural regularity, the real edge is screened and a three-dimensional model is constructed, the problem of low measurement accuracy in the prior art is solved, and high-precision measurement of the size of tiny clock parts is achieved.

CN119559179BActive Publication Date: 2025-05-02SHENZHEN GAOJIN IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510128031.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-05
Publication Date
2025-05-02
Estimated Expiration
2045-02-05

AI Technical Summary

Technical Problem

Existing machine vision-based methods have problems with low measurement accuracy when measuring the size of tiny clock parts, especially projection errors and interference edges caused by lighting, which affect the accuracy of dimensional measurement.

Method used

By obtaining the edge lines in the surface image of tiny clock parts at different perspectives, combining the grayscale distribution of pixel points on the edge lines, the grayscale distribution of pixel points in the neighborhood, and the light source direction, the lighting artifact feature values ​​are determined, and the real edges of the part are screened according to the structural regularity of the edge lines, and finally a three-dimensional model is constructed through a matching algorithm to determine the size data of the part.

Benefits of technology

It effectively distinguishes the real edges and false edges of parts, avoids light artifacts and shadow interference, and improves the accuracy and accuracy of measurement of tiny clock parts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119559179B_ABST
    Figure CN119559179B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of dimension measurement technology, and in particular to a method, system and device for precise dimension measurement of tiny watch parts. The method comprises: obtaining edge lines in the surface images of tiny watch parts at different viewing angles; combining the grayscale distribution of the pixels on each edge line and the pixels in the neighborhood to obtain the illumination artifact characteristic value of each edge line; obtaining the structural regularity of each edge line according to the difference in gradient amplitude between the pixels on each edge line and the pixels in the neighborhood, the relative position between the pixels on each edge line and its adjacent pixels, and the illumination artifact characteristic value; combining the difference and relative position of the structural regularity between each edge line and the adjacent pixels in other edge lines to screen the real edge of the part, convert the surface images of tiny watch parts at different viewing angles into three-dimensional models, and then determine the dimensions of the tiny watch parts. The present invention improves the accuracy of the dimension measurement results of tiny watch parts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of dimension measurement, and in particular to a method, system and device for precisely measuring the dimensions of tiny clock parts. Background Art

[0002] The modern mechanical watchmaking industry has high demands for accuracy and efficiency, so it is necessary to achieve precise measurement of the size of tiny watch parts. With the continuous development of watchmaking technology, the size of parts has become increasingly refined, especially for tiny parts such as gears and bearings, which have extremely small dimensional errors. Traditional mechanical contact measurement methods can no longer meet high-precision requirements. Based on machine vision and non-contact measurement technology, the shape and size of parts can be accurately measured by performing high-resolution image processing, edge detection, and geometric fitting algorithms on the parts. Combined with three-dimensional reconstruction and high-precision geometric analysis, the accuracy and efficiency of measurement are further improved to meet the needs of tiny watch parts with complex shapes and high precision requirements.

[0003] In the prior art, when the dimensions of tiny watch parts in an image are precisely measured, since the parts have a three-dimensional structure and depth information, the three-dimensional structure is projected to form edges in the captured two-dimensional image. If a part of the part is tilted or has a certain thickness, multiple edges may be projected in the image, and one side of the part may form an edge in the image, but this edge is not the actual boundary, but a projection error caused by the slope or thickness of the object, resulting in the confusion between the actual part edge and the surface reflection or shadow edge, affecting the measurement accuracy of the size. Summary of the invention

[0004] In order to solve the problem of low measurement accuracy when measuring the size of tiny watch parts based on existing machine vision methods, the purpose of the present invention is to provide a method, system and device for precise size measurement of tiny watch parts. The technical solutions adopted are as follows:

[0005] In a first aspect, the present invention provides a method for precisely measuring the size of tiny watch parts, the method comprising the following steps:

[0006] Obtain edge lines in surface images of tiny watch parts at different viewing angles;

[0007] Determine the light source direction based on the grayscale distribution of pixels in the neighborhood of each edge line; obtain the illumination artifact characteristic value of each edge line by combining the grayscale distribution of pixels on each edge line, the grayscale distribution of pixels in the neighborhood, and the light source direction; obtain the structural regularity of each edge line according to the difference between the gradient amplitude of the pixel on each edge line and the pixel in the neighborhood, the relative position between the pixel on each edge line and its adjacent pixel, and the illumination artifact characteristic value;

[0008] Combining the difference in structural regularity and relative position between each edge line and adjacent pixel points in other edge lines, the part edge feature value of each edge line is obtained; the real edge of the part is screened based on the part edge feature value;

[0009] The surface images of tiny watch parts at different viewing angles are converted into three-dimensional models through a matching algorithm, and the size data of the tiny watch parts are determined based on the position of the real edges of the parts in the three-dimensional model.

[0010] Preferably, determining the light source direction based on the grayscale distribution of pixels in the neighborhood of each edge line includes:

[0011] Clustering all pixels in the neighborhood of the candidate edge line based on the grayscale values ​​of the pixels in the neighborhood of the candidate edge line, and determining the direction from the center point of the cluster with the largest average grayscale value to the center point of the cluster with the smallest average grayscale value as the light source direction;

[0012] The candidate edge line is any edge line in the surface image of the tiny watch part at any viewing angle.

[0013] Preferably, the step of combining the grayscale distribution of pixels on each edge line, the grayscale distribution of pixels in a neighborhood, and the light source direction to obtain the illumination artifact feature value of each edge line includes:

[0014] The center point of the cluster with the largest average gray value and the center point of the cluster with the smallest average gray value are connected by a straight line to obtain a first straight line, and the first straight line intersects the candidate edge line at the first edge pixel point;

[0015] A second straight line is drawn perpendicular to the light source direction through the center point of the cluster with the largest average gray value, and the second straight line intersects the candidate edge line at the second edge pixel point;

[0016] Determine a pixel point between the first edge pixel point and the second edge pixel point on the candidate edge line as a light source feature point on the candidate edge line;

[0017] The illumination artifact feature value of the candidate edge line is obtained according to the grayscale difference between adjacent light source feature points on the candidate edge line and the difference between the average grayscale values ​​of the pixels in the neighborhood on both sides of the candidate edge line.

[0018] Preferably, obtaining the illumination artifact feature value of the candidate edge line according to the grayscale difference between adjacent light source feature points on the candidate edge line and the difference between the average grayscale values ​​of the pixels in the neighborhood on both sides of the candidate edge line includes:

[0019] Calculate a first average value of grayscale differences between all adjacent light source feature points on the candidate edge line;

[0020] Calculate the negative correlation mapping result of the difference between the average grayscale values ​​of the pixels in the neighborhood on both sides of the candidate edge line;

[0021] The product of the first average value and the negative correlation mapping result is determined as the illumination artifact feature value of the candidate edge line.

[0022] Preferably, the obtaining of the structural regularity of each edge line according to the difference between the gradient amplitude of the pixel point on each edge line and the pixel points in the neighborhood, the relative position between the pixel point on each edge line and its adjacent pixel points, and the illumination artifact feature value comprises:

[0023] Calculate the first difference in gradient magnitude between each pixel point on the candidate edge line and each pixel point in its neighborhood; calculate the cumulative sum of the first differences between all pixels on the candidate edge line and pixels in their neighborhood;

[0024] For any pixel point on the candidate edge line: obtain two directions from the any pixel point to its adjacent pixel point, and determine the angle between the two directions as the characteristic angle of the any pixel point;

[0025] Calculate the second difference between the feature angles of two adjacent pixel points on the candidate edge line;

[0026] The structural regularity of the candidate edge line is obtained based on the cumulative sum, the average value of the second differences corresponding to all two adjacent pixel points on the candidate edge line, and the illumination artifact characteristic value of the candidate edge line. The cumulative sum is positively correlated with the part cutting performance, and the average value of the second difference and the illumination artifact characteristic value of the candidate edge line are both negatively correlated with the structural regularity.

[0027] Preferably, the step of combining the difference in structural regularity and relative positions between adjacent pixels in each edge line and other edge lines to obtain the part edge feature value of each edge line includes:

[0028] Calculate the DTW distance between the feature angle sequence corresponding to the candidate edge line and the feature angle sequence corresponding to any other edge line; where the feature angle sequence is composed of the feature angles of all pixels on the corresponding edge line;

[0029] According to the difference between the structural regularity of the candidate edge line and any other edge line and the DTW distance, a part coplanarity factor of the candidate edge line and any other edge line is obtained, wherein the difference between the structural regularity and the DTW distance are both negatively correlated with the part coplanarity factor;

[0030] The part edge feature value of the candidate edge line is determined by using the part coplanarity factor between the candidate edge line and all other edge lines and the structural regularity of the candidate edge line.

[0031] Preferably, the determining the part edge feature value of the candidate edge line by using the part coplanarity factor of the candidate edge line and all other edge lines and the structural regularity of the candidate edge line comprises:

[0032] Obtaining the maximum value of the coplanarity factor of the part between the candidate edge line and all other edge lines;

[0033] The sum of the constant 1 and the maximum value is calculated; and the product of the sum and the structural regularity of the candidate edge line is determined as the part edge feature value of the candidate edge line.

[0034] Preferably, screening the real edge of the part based on the edge feature value of the part includes:

[0035] Based on the part edge eigenvalues ​​of all edge lines, the K-means clustering algorithm is used to cluster all edge lines to obtain clusters, and the average value of the part edge eigenvalues ​​of all edge lines in the cluster with the largest average value of the part edge eigenvalues ​​is used as the demarcation threshold;

[0036] Among all edge lines, the edge lines whose part edge feature values ​​are greater than the demarcation threshold are determined as the true edges of the parts.

[0037] In a second aspect, the invention provides a device for precisely measuring the dimensions of tiny watch parts, comprising a memory and a processor, wherein the processor executes a computer program stored in the memory to implement a method for precisely measuring the dimensions of tiny watch parts.

[0038] In a third aspect, the present invention further provides a system for accurately measuring the size of tiny watch parts, the system comprising:

[0039] An edge acquisition module is used to acquire edge lines in surface images of tiny watch parts at different viewing angles;

[0040] A structural regularity determination module is used to determine the light source direction based on the grayscale distribution of pixels in the neighborhood of each edge line; obtain the illumination artifact characteristic value of each edge line by combining the grayscale distribution of pixels on each edge line, the grayscale distribution of pixels in the neighborhood, and the light source direction; obtain the structural regularity of each edge line according to the difference between the gradient amplitude of the pixel on each edge line and the pixel in the neighborhood, the relative position between the pixel on each edge line and its adjacent pixel, and the illumination artifact characteristic value;

[0041] The real edge screening module is used to combine the difference in structural regularity and relative position between each edge line and the adjacent pixel points in other edge lines to obtain the part edge feature value of each edge line; and screen the real edge of the part based on the part edge feature value;

[0042] The size determination module is used to convert the surface images of tiny watch parts under different viewing angles into three-dimensional models through a matching algorithm, and determine the size data of the tiny watch parts based on the position of the real edge of the parts in the three-dimensional model.

[0043] The present invention has at least the following beneficial effects:

[0044] The present invention takes into account that when measuring the size of tiny watch parts, due to the influence of illumination, the three-dimensional parts present a projection effect in the two-dimensional image, and there are interference edges. Therefore, the present invention first performs edge detection on the surface images of tiny watch parts at different viewing angles, and then evaluates the illumination artifact characteristics in combination with the grayscale distribution of the pixels on the edge line, the grayscale distribution of the pixels in the neighborhood, and the direction of the light source. The regularity of the edge line is evaluated based on the difference between the gradient amplitude of the pixels on the edge line and the pixels in the neighborhood, the relative position between the pixels on the edge line and its adjacent pixels, and the illumination artifact characteristic value, and then screens out multiple real edges of parts from all edge lines. The present invention analyzes the regular structure and texture repeatability of the part edge in the image, effectively distinguishes the real edge of the part from other false edges, distinguishes the interference edges caused by metal surface reflection or three-dimensional structure, avoids the measurement errors caused by image noise or reflection interference, ensures the accurate edge data of the part, and finally constructs a three-dimensional model of the tiny watch part. The accurate size data of the tiny watch part is determined based on the position of the real edge of the part in the three-dimensional model. The method can accurately eliminate the influence of the interference edges caused by shadows and the materials of the tiny watch parts on the error of the measured size, realizes the precise measurement of the size of the tiny watch parts, and improves the accuracy of the measurement results of the size of the tiny watch parts. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. 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 creative work.

[0046] Figure 1 A flow chart of a method for precisely measuring the size of a tiny watch part provided by an embodiment of the present invention;

[0047] Figure 2 A binary image of a tiny watch part provided by an embodiment of the present invention;

[0048] Figure 3 An edge profile diagram of a tiny watch part provided by an embodiment of the present invention;

[0049] Figure 4 This is a graph showing the edge detection results of a tiny watch part provided by an embodiment of the present invention;

[0050] Figure 5 A schematic diagram of pixel points within the neighborhood of an edge line provided by an embodiment of the present invention;

[0051] Figure 6 This is a structural block diagram of a system for precisely measuring the dimensions of tiny watch parts provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0052] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the following is a detailed description of a method, system and device for precise size measurement of tiny watch parts proposed in accordance with the present invention in combination with the accompanying drawings and preferred embodiments.

[0053] 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.

[0054] The specific scheme of the method, system and device for accurately measuring the size of tiny watch parts provided by the present invention is described in detail below with reference to the accompanying drawings.

[0055] An embodiment of a method for precisely measuring the size of tiny watch parts:

[0056] The specific scenario targeted by this embodiment is: in the process of determining the size of tiny watch parts by collecting surface images of tiny watch parts, it is necessary to collect surface images of tiny watch parts at different viewing angles, filter the real edges of the parts in the images based on image features, match the real edges of the parts at different viewing angles, construct a three-dimensional model of the tiny watch parts, and then determine the size data of the tiny watch parts according to the position of the real edges of the parts in the three-dimensional model.

[0057] This embodiment provides a method for accurately measuring the size of tiny watch parts. Figure 1 As shown, a method for precisely measuring the size of a tiny watch part in this embodiment includes the following steps:

[0058] Step S1, obtaining edge lines in surface images of tiny watch parts at different viewing angles.

[0059] First, place the tiny watch parts on the inspection platform, and use a high-resolution industrial camera, which is fixed directly above the tiny watch parts on the inspection platform through a pan-tilt. The pan-tilt can adjust the angle and position of the camera through electric control, allowing the camera to capture the surface images of the tiny watch parts from multiple angles to ensure that all faces and edges of the parts can be fully captured. At the same time, a light source is fixed directly above the inspection platform to provide uniform lighting. The type of light source is selected by the implementer according to the specific situation. When the tiny watch parts are located on the inspection platform, the pan-tilt controls the camera to capture the surface images of the tiny watch parts from different angles to ensure that all geometric features of the tiny watch parts can be fully captured. After the part image is collected, it is transmitted to a computer or remote server in real time through a wireless network, and each collected image is preprocessed, and the preprocessed image is recorded as the surface image of the tiny watch parts at different viewing angles. Image preprocessing is a prior art and will not be described in detail here.

[0060] Then, each surface image is processed by Otsu threshold segmentation and Sobel bidirectional edge detection to obtain the binary image and edge contour map of each surface image. Figure 2 As shown, the edge contour is Figure 3 As shown, the binary image of the part and the edge are XOR-fused to obtain a closed part area. Otsu threshold segmentation and Sobel bidirectional edge detection are both existing technologies and will not be described in detail here. It should be noted that the surface images mentioned later are all images of the pre-processed part area, that is, the area that does not contain non-micro watch parts.

[0061] Since watch parts are three-dimensional structures, they can only be expressed through projection in two-dimensional images. According to the reflective characteristics of the watch parts material, the part close to the light source is prone to produce highlights, and the part structure far away from the light source may also produce shadows, forming multiple interfering edges. Therefore, it is necessary to analyze the edge characteristics formed by the three-dimensional structure of watch parts under the influence of light.

[0062] Due to the small complexity of the structure of watch parts, the edges formed are relatively subtle. The Canny edge detection algorithm can accurately locate these edges, making the edges clearer and ensuring that the important geometric edges of the parts are not lost. Therefore, the Canny edge detection algorithm is used to extract edge lines from the part area, such as Figure 4 As shown in FIG. 1 , the figure is an edge detection result figure. The Canny edge detection algorithm is a prior art and will not be described in detail here.

[0063] So far, this embodiment has acquired a plurality of edge lines in the surface image of the tiny watch part at each viewing angle.

[0064] Step S2, determining the direction of the light source based on the grayscale distribution of the pixels in the neighborhood of each edge line; obtaining the illumination artifact characteristic value of each edge line by combining the grayscale distribution of the pixels on each edge line, the grayscale distribution of the pixels in the neighborhood, and the light source direction; obtaining the structural regularity of each edge line based on the difference between the gradient amplitudes of the pixels on each edge line and the pixels in the neighborhood, the relative position between the pixels on each edge line and its adjacent pixels, and the illumination artifact characteristic value.

[0065] This embodiment uses the existing edge detection algorithm to detect the edge of the surface image, but the detected edge lines are not all the real edge lines of the parts. There may be interference edges caused by the three-dimensional structure of the watch parts being projected in the two-dimensional image due to the influence of light. The metal material of the watch parts may cause highlight areas at the near light source and shadows at the far light source. The highlight and shadow areas may produce pseudo edges during edge detection, interfering with the measurement of the part size. However, the changes in these interference areas are directional, and the edges weaken and become blurred along the direction of light. Therefore, the change characteristics of the edge pixels are analyzed according to the grayscale change direction of the pixels in the edge neighborhood.

[0066] Due to the distance between the watch parts and the light source, highlights or shadows will be generated. At the same time, the edge of the interference area will produce a grayscale blurred gradient effect along the direction of the light source. Therefore, the changes of each edge are observed in the direction from near to far of the light source, and the changes in edge grayscale are analyzed through the brightest to darkest direction in the neighborhood area of ​​each edge.

[0067] There is a contrast difference between the edges formed by the interference area caused by the three-dimensional structure of watch parts and the real edges of the parts. The edges of the highlight area of ​​the near light source are usually a gradual transition of grayscale, with blurred edges and a lack of clear contrast. At the same time, the grayscale value of the shadow edge of the far light source is low, close to the grayscale of the surrounding background, and the boundary is blurred. Therefore, the interference edges have the characteristic of weak contrast.

[0068] Next, this embodiment is described by taking an edge line as an example, and other edge lines can be processed by the method provided in this embodiment.

[0069] Specifically, any edge line in the surface image of a tiny watch part at any viewing angle is recorded as a candidate edge line, and all pixels in the neighborhood of the candidate edge line are clustered based on the grayscale values ​​of the pixels in the neighborhood of the candidate edge line, and the direction from the center point of the cluster with the largest average grayscale value to the center point of the cluster with the smallest average grayscale value is determined as the light source direction. The process of obtaining the pixel points in the neighborhood of the candidate edge line is as follows: taking each pixel point on the candidate edge line as the center, extending a preset number of pixels to both sides of the candidate edge line, and taking the extended pixel points as the pixel points in the neighborhood of the edge line, such as Figure 5 As shown, 1 in the figure is an edge line, and 2 in the figure is a pixel point in the neighborhood of the edge line. In this embodiment, the preset number is 3. In specific applications, the implementer can set it according to specific circumstances.

[0070] Based on the grayscale values ​​of the pixels in the neighborhood of the candidate edge line, the K-means clustering algorithm is used to cluster all the pixels in the neighborhood of the candidate edge line to obtain each cluster. In this embodiment, the value of k is set to 2 when the K-means clustering algorithm is used for clustering; the K-means clustering algorithm is a prior art and will not be described in detail here. According to the grayscale values ​​of all the pixels in each cluster, the average grayscale value of all the pixels in each cluster is calculated, and the direction from the center point of the cluster with the largest average grayscale value to the center point of the cluster with the smallest average grayscale value is determined as the direction of the light source.

[0071] The center point of the cluster with the largest average gray value and the center point of the cluster with the smallest average gray value are connected by a straight line to obtain a first straight line, and the first straight line intersects with the candidate edge line at the first edge pixel point; a second straight line perpendicular to the light source direction is drawn through the center point of the cluster with the largest average gray value, and the second straight line intersects with the candidate edge line at the second edge pixel point; it should be noted that: the first edge pixel point and the second edge pixel point are both the first pixel points intersecting with the candidate edge line. The pixel points between the first edge pixel point and the second edge pixel point on the candidate edge line are determined as light source feature points on the candidate edge line; it should be noted that: in this embodiment, the light source feature points include the first edge pixel point and the second edge pixel point. According to the grayscale difference between every two adjacent light source feature points on the candidate edge line, the average value of the grayscale difference between all adjacent light source feature points on the candidate edge line is calculated, and the average value is recorded as the first average value; in this embodiment, the grayscale difference between two pixels is obtained by calculating the absolute value of the difference between the grayscale values ​​of the two pixels, and taking the absolute value as the grayscale difference between the two pixels. Then, according to the grayscale values ​​of all pixels in the neighborhood on each side of the candidate edge line, the average grayscale value of all pixels in the neighborhood on each side of the candidate edge line is calculated, and then the negative correlation mapping result of the difference between the average grayscale values ​​of the pixels in the neighborhood on both sides of the candidate edge line is calculated; the product of the first average value and the negative correlation mapping result is determined as the illumination artifact feature value of the candidate edge line.

[0072] In this embodiment, a specific calculation formula for the illumination artifact characteristic value is given, and the illumination artifact characteristic value of the i-th edge line can be expressed as:

[0073]

[0074] in, represents the illumination artifact feature value of the i-th edge line, Represents the average gray value of all pixels in the neighborhood on one side of the i-th edge line. represents the average gray value of all pixels in the neighborhood on the other side of the i-th edge line. represents the number of light source feature points on the i-th edge line, Represents the grayscale value of the x-th light source feature point on the ith edge line, represents the gray value of the x+1th light source feature point on the ith edge line, exp( ) represents an exponential function with a natural constant as the base, Indicates the absolute value sign.

[0075] It is used to represent the difference between the average grayscale values ​​of the pixels in the neighborhood on both sides of the i-th edge line. The larger the value, the greater the grayscale difference of the pixels in the neighborhood on both sides of the i-th edge line, which means that the grayscale transition on both sides of the edge is smoother and the transition width of the edge is larger. Represents the first average value, which is used to reflect the grayscale change of the pixel points of the ith edge line in the direction of the light source. The larger its value is, the more obvious the grayscale gradient feature of the ith edge line in the direction of the light source is, and the greater the light and shadow directionality along the light source is. In order to more accurately extract the edges of watch parts, it is necessary to determine the distinguishing characteristics of the interference edges. Analyze the performance characteristics of the interference edges that are different from the edges of watch parts in the image, and obtain the illumination artifact characteristic value of each edge. When the difference between the average grayscale values ​​of the pixels in the neighborhood on both sides of the ith edge line is smaller and the grayscale change of the pixels of the ith edge line in the direction of the light source is greater, the illumination artifact characteristic value of the ith edge line is greater.

[0076] Due to the thickness of the three-dimensional structure of watch parts, different planes are projected into two-dimensional images to form multiple edges. However, the edges of different planes caused by the thickness may be confused with the edges of shadows. Therefore, it is necessary to further analyze the unique performance characteristics of the edges of parts in the image. The sharp edges of tiny watch parts are formed by precision cutting, and the junctions of different planes or curved surfaces on the surface of the parts form obvious grayscale changes. Under normal lighting conditions, the edges appear as sharp transitions.

[0077] Based on the above characteristics, the structural regularity of the edge line is evaluated according to the difference between the gradient amplitudes of the pixels on the edge line and the pixels in the neighborhood, the relative positions of the pixels on the edge line and its adjacent pixels, and the illumination artifact feature values.

[0078] Next, the candidate edge line is still taken as an example for explanation. Specifically, the absolute value of the difference in gradient amplitude between each pixel point on the candidate edge line and each pixel point in its neighborhood is calculated respectively. The absolute value represents the difference in gradient amplitude between the two pixel points. The difference is recorded as the first difference, that is, the absolute value is recorded as the first difference; the cumulative sum of the first differences between all pixel points on the candidate edge line and the pixel points in its neighborhood is calculated.

[0079] The edge of the part appears in a relatively regular shape in the image, which is consistent with the actual geometric structure of the part, such as a straight line, an arc, etc. When the edge is a regularly changing shape, it may be the edge of the part. Therefore, the edge regularity is evaluated in combination with the changing angle of each pixel point on the edge.

[0080] For any pixel point on the candidate edge line: obtain two directions from the any pixel point to its adjacent pixel point, and determine the angle between the two directions as the characteristic angle of the any pixel point, wherein the adjacent pixel points are all pixel points on the candidate edge line; by using this method, the characteristic angle of each pixel point on the candidate edge line can be obtained. The difference between the characteristic angles of each two adjacent pixel points on the candidate edge line is calculated respectively, and the difference is recorded as the second difference; it should be noted that: in this embodiment, the calculation method of the difference between the characteristic angles of two adjacent pixel points is: calculate the absolute value of the difference between the characteristic angles of two adjacent pixel points, and use the absolute value as the characteristic angle of the two pixel points. According to the cumulative sum, the average value of the second difference corresponding to all two adjacent pixel points on the candidate edge line, and the illumination artifact characteristic value of the candidate edge line, the structural regularity of the candidate edge line is obtained, the cumulative sum is positively correlated with the part cutting performance, and the average value of the second difference and the illumination artifact characteristic value of the candidate edge line are both negatively correlated with the structural regularity.

[0081] Among them, the negative correlation relationship indicates that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases. It can be a subtraction relationship, a division relationship, etc., which is determined by actual application; the positive correlation relationship indicates that the dependent variable will increase as the independent variable increases, and the dependent variable will decrease as the independent variable decreases. It can be an addition relationship, a multiplication relationship, etc., which is determined by actual application.

[0082] In this embodiment, a specific calculation formula for the structural regularity is given, and the structural regularity of the i-th edge line can be expressed as:

[0083]

[0084] in, represents the structural regularity of the ith edge line, N represents the number of pixels on the ith edge line, represents the characteristic angle of the nth pixel on the i-th edge line, represents the characteristic angle of the n+1th pixel on the i-th edge line, represents the illumination artifact feature value of the i-th edge line, represents the gradient amplitude of the nth pixel on the ith edge line, represents the gradient amplitude of the rth pixel in the neighborhood of the nth pixel on the ith edge line, and exp( ) represents an exponential function with a natural constant as the base.

[0085] represents the first difference in the gradient magnitude between the nth pixel on the i-th edge line and the rth pixel in its neighborhood, represents the cumulative sum of the first differences between all pixels on the i-th edge line and the pixels in its neighborhood, Characterizes the mean of the first differences. It represents the second difference between the nth pixel and the n+1th pixel on the ith edge line, and is used to reflect the difference between the characteristic angles of the nth pixel and the n+1th pixel. The larger the value, the larger the gradient value of the pixel on the edge compared to the neighborhood, the more obvious the edge feature, and the greater the part cutting performance. Indicates the degree of consistency of the angle change of all pixels on the ith edge line. The smaller the value, the more consistent the change of the pixels along the edge and the higher the regularity. When the illumination artifact feature value of the ith edge line is smaller, the difference in feature angles between adjacent pixels on the ith edge line is smaller, and the difference in gradient amplitude between all pixels on the ith edge line and the pixels in its neighborhood is larger, it means that the change characteristics of the pixels along the ith edge line are more consistent, that is, the structural regularity of the ith edge line is greater.

[0086] By adopting the above method, the structural regularity of each edge line can be obtained.

[0087] Step S3, combining the difference in structural regularity and relative position between each edge line and adjacent pixel points in other edge lines, to obtain the part edge feature value of each edge line; and screening the real edge of the part based on the part edge feature value.

[0088] Watch parts are mostly parts with repetitive structures such as gears, usually with periodic or repetitive geometric shapes. Most of them have many similar edges, and with different positioning of the parts, the arrangement of the edges will appear multiple times in the image, which is easy to generate repeated edge information during extraction. Their edge features are highly consistent, while interference edges are generally random and irregular. Therefore, based on the similarity between edge lines, it is determined whether each edge line is the edge of a repetitive structure. The edge of a repetitive structure is more likely to be the true edge of a part.

[0089] The surface image of a watch part contains edge information of different planes or curved surfaces of the part. When an edge is in the same plane as the edge with the greatest shape similarity, it is more likely to be the real edge of the watch part. The geometric shapes of various parts of the watch part in space maintain a certain regularity. Similar edges are usually located on the same physical plane, ensuring consistency during design. If an edge is closer to the structural regularity of other edges, it is more likely to belong to the same plane, and this edge is more likely to be the real edge of the part.

[0090] Next, the candidate edge line is still taken as an example for explanation. The part edge feature value of the candidate edge line is obtained through the similarity between the candidate edge line and other edge lines.

[0091] For an edge line, the characteristic angle sequence corresponding to the edge line is obtained by sorting the characteristic angles of all the pixels on the edge line according to the arrangement sequence of the pixels on the edge line. By adopting this method, the characteristic angle sequence corresponding to each edge line can be obtained. The dynamic time warping (DTW) distance between the characteristic angle sequence corresponding to the candidate edge line and the characteristic angle sequence corresponding to any other edge line is calculated. The calculation method of the DTW distance is a prior art and will not be described in detail here. According to the difference between the structural regularity between the candidate edge line and any other edge line and the DTW distance, the part coplanarity factor between the candidate edge line and any other edge line is obtained. The difference between the structural regularity and the DTW distance are both negatively correlated with the part coplanarity factor.

[0092] Among them, the negative correlation relationship means that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases. It can be a subtraction relationship, a division relationship, etc., which is determined by practical applications.

[0093] In this embodiment, a specific calculation formula for the part coplanarity factor is given, and the part coplanarity factor between the ith edge line and the oth edge line other than the ith edge line can be expressed as:

[0094]

[0095] in, represents the part coplanarity factor between the ith edge line and the oth edge line except the ith edge line, represents the characteristic angle sequence corresponding to the i-th edge line, represents the characteristic angle sequence corresponding to the oth edge line except the i-th edge line, Indicates the DTW distance. represents the DTW distance between the feature angle sequence corresponding to the ith edge line and the feature angle sequence corresponding to the oth edge line except the ith edge line, represents the structural regularity of the i-th edge line, Indicates the structural regularity of the oth edge line except the i-th edge line.

[0096] Characterizes the difference in structural regularity between the ith edge line and the oth edge line except the ith edge line. The larger the value, the greater the difference in structural regularity between the two edge lines. The more consistent the structural regularity of two edge lines located in the same plane, the smaller the value, which means that the two edge lines are more likely to be located in the same plane.

[0097] When the difference in structural regularity between the i-th edge line and the o-th edge line excluding the i-th edge line is greater, and the DTW distance between the feature angle sequence corresponding to the i-th edge line and the feature angle sequence corresponding to the o-th edge line excluding the i-th edge line is also greater, the part coplanarity factor between the i-th edge line and the o-th edge line excluding the i-th edge line is smaller.

[0098] By using the above method, the part edge feature values ​​of the candidate edge line and each other edge line can be obtained. In order to distinguish the interfering edges and strengthen the performance characteristics of the part edges at the same time, according to the regular repetitive characteristics of the part edges in the image, the edges with similar structural rules should be in the same physical plane of the part, and the possibility of being the real part edges is high. The part edge features of the edge lines are evaluated to obtain the part edge feature values.

[0099] Specifically, the maximum value of the part coplanarity factor of the candidate edge line and all other edge lines is obtained; the sum of the constant 1 and the maximum value is calculated; and the product of the sum and the structural regularity of the candidate edge line is determined as the part edge feature value of the candidate edge line.

[0100] In this embodiment, a specific calculation formula for the part edge characteristic value is given, and the specific calculation formula for the part edge characteristic value of the i-th edge line is:

[0101]

[0102] in, represents the part edge feature value of the i-th edge line, represents the structural regularity of the i-th edge line, Indicates the maximum value of the part coplanarity factor between the i-th edge line and all other edge lines.

[0103] The larger the maximum value of the part coplanarity factor between the ith edge line and all other edge lines, the more likely it is that the ith edge line is a repeated structure on the same plane, and the more likely it is that it is a part edge. The greater the structural regularity of the ith edge line, if it is an edge that appears repeatedly on the same plane, it represents a repeated structural edge of a part, and the more likely it is that the edge line is the edge of a part, and the larger its part edge eigenvalue is.

[0104] By adopting the above method, this embodiment can obtain the part edge feature value of each edge line.

[0105] In the process of precise dimensional measurement of tiny watch parts, the key is to extract the edge. If the edge of the watch part is determined, the distance between the edge points can represent the dimensional data of the watch part. Next, a range will be determined based on the part edge feature value of each edge line in the image obtained above to ensure that the edge belongs to the actual edge of the part.

[0106] Specifically, based on the part edge feature values ​​of all edge lines, the K-means clustering algorithm is used to cluster all edge lines to obtain clusters. In this embodiment, when the K-means clustering algorithm is used for clustering processing, the value of k is 2. According to the part edge feature values ​​of all edge lines in each cluster, the average value of the part edge feature values ​​of all edge lines in each cluster is calculated, and the average value of the part edge feature values ​​of all edge lines in the cluster with the largest average value of the part edge feature value is used as the demarcation threshold.

[0107] Among all edge lines, the edge lines whose part edge feature values ​​are greater than the demarcation threshold are determined as the true edges of the parts.

[0108] Thus, the method provided in this embodiment can be used to screen out multiple real edges of parts in the surface image of tiny watch parts at each viewing angle.

[0109] Step S4, converting the surface images of the tiny watch parts at different viewing angles into a three-dimensional model through a matching algorithm, and determining the size data of the tiny watch parts based on the position of the real edge of the parts in the three-dimensional model.

[0110] In step S3, this embodiment screens multiple real edges of parts in the surface image of the tiny watch parts at each viewing angle, and the pixels on each real edge of the parts are the actual edge pixels. The surface images of the tiny watch parts at multiple viewing angles are converted into the three-dimensional model of the watch parts through the stereo matching algorithm. The three-dimensional coordinates of the actual edge pixels are obtained by calculating the position offset of the actual edge points of the parts in the surface images of the tiny watch parts at different viewing angles. The actual edge pixels are converted into points in three-dimensional space to generate the three-dimensional model of the watch parts. The conversion method of the three-dimensional model is a prior art and will not be described in detail here.

[0111] By measuring the distance between two points in the three-dimensional model of watch parts, the length, width and height of the parts are calculated; for the curved parts of the parts, the angle dimensions are obtained by calculating the angle between the normal vectors of the edge points; for the curved parts, the curvature on the curved surface is calculated to measure the degree of curvature, thereby obtaining high-precision dimensional data of tiny watch parts.

[0112] So far, the method provided in this embodiment has been used to accurately measure the dimensional data of tiny watch parts.

[0113] This embodiment takes into account that when measuring the size of tiny watch parts, due to the influence of lighting, the three-dimensional parts present a projection effect in the two-dimensional image, and there are interference edges. Therefore, this embodiment first performs edge detection on the surface images of tiny watch parts at different viewing angles, and then evaluates the lighting artifact characteristics in combination with the grayscale distribution of pixels on the edge line, the grayscale distribution of pixels in the neighborhood, and the direction of the light source. The regularity of the edge line is evaluated based on the difference between the gradient amplitude of the pixel points on the edge line and the pixel points in the neighborhood, the relative position between the pixel points on the edge line and its adjacent pixels, and the lighting artifact characteristic value, and then multiple real edges of parts are screened out from all edge lines. This embodiment analyzes the regular structure and texture repeatability of the part edge in the image, effectively distinguishes the real edge of the part from other false edges, and distinguishes the interference edges caused by metal surface reflection or three-dimensional structure to avoid measurement errors caused by image noise or reflection interference, thereby ensuring the acquisition of accurate edge data of the part. Finally, a three-dimensional model of the tiny watch part is constructed, and the accurate size data of the tiny watch part is determined based on the position of the real edge of the part in the three-dimensional model. This method can accurately eliminate the influence of interference edges caused by shadows and tiny watch part materials on the error caused by the measured size, thereby achieving precise measurement of the size of tiny watch parts and improving the accuracy of the measurement results of the size of tiny watch parts.

[0114] An embodiment of a device for precisely measuring the size of tiny watch parts:

[0115] A device for precisely measuring the dimensions of tiny watch parts in this embodiment includes a memory and a processor. The processor executes a computer program stored in the memory to implement the method for precisely measuring the dimensions of tiny watch parts described above.

[0116] An embodiment of a system for precisely measuring the size of tiny watch parts:

[0117] like Figure 6 As shown, the figure shows a structural block diagram of a system for precisely measuring the size of tiny watch parts, the system comprising an edge acquisition module, a structural regularity determination module, a true edge screening module and a size determination module;

[0118] The edge acquisition module is used to acquire edge lines in the surface images of tiny watch parts at different viewing angles;

[0119] A structural regularity determination module is used to determine the light source direction based on the grayscale distribution of pixels in the neighborhood of each edge line; obtain the illumination artifact characteristic value of each edge line by combining the grayscale distribution of pixels on each edge line, the grayscale distribution of pixels in the neighborhood, and the light source direction; obtain the structural regularity of each edge line according to the difference between the gradient amplitude of the pixel on each edge line and the pixel in the neighborhood, the relative position between the pixel on each edge line and its adjacent pixel, and the illumination artifact characteristic value;

[0120] The real edge screening module is used to combine the difference in structural regularity and relative position between each edge line and the adjacent pixel points in other edge lines to obtain the part edge feature value of each edge line; and screen the real edge of the part based on the part edge feature value;

[0121] The size determination module is used to convert the surface images of tiny watch parts under different viewing angles into three-dimensional models through a matching algorithm, and determine the size data of the tiny watch parts based on the position of the real edge of the parts in the three-dimensional model.

[0122] It should be understood that Figure 6 The structural block diagram of a system for precisely measuring the size of tiny watch parts and its modules shown can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. Those skilled in the art can understand that the above-mentioned method and system can be implemented using computer executable instructions and / or included in a processor control code, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The system and its modules of this specification can not only be implemented by hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., but can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software (for example, firmware).

[0123] For more details about the above modules, please refer to other places in this manual and will not be repeated here.

[0124] In other embodiments, a medium is also provided, wherein the medium stores at least one program executable by a computer, and when the at least one program is executed by a computer, the computer executes the steps in the method for precise measurement of the dimensions of tiny watch parts in the above-mentioned embodiment, and the medium may be a computer-readable storage medium.

[0125] Among them, the provided devices, systems, and media 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.

[0126] It should be noted that 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 in the protection scope of the present invention.

Claims

1. A method for precisely measuring the size of tiny watch parts, characterized in that: The method comprises the following steps: Obtain edge lines in surface images of tiny watch parts at different viewing angles; Determine the light source direction based on the grayscale distribution of pixels in the neighborhood of each edge line; obtain the illumination artifact characteristic value of each edge line by combining the grayscale distribution of pixels on each edge line, the grayscale distribution of pixels in the neighborhood, and the light source direction; obtain the structural regularity of each edge line according to the difference between the gradient amplitude of the pixel on each edge line and the pixel in the neighborhood, the relative position between the pixel on each edge line and its adjacent pixel, and the illumination artifact characteristic value; Combining the difference in structural regularity and relative position between each edge line and adjacent pixel points in other edge lines, the part edge feature value of each edge line is obtained; the real edge of the part is screened based on the part edge feature value; The surface images of tiny watch parts at different viewing angles are converted into three-dimensional models through a matching algorithm, and the size data of the tiny watch parts are determined based on the positions of the real edges of the parts in the three-dimensional model; The determining of the light source direction based on the grayscale distribution of the pixels in the neighborhood of each edge line includes: Clustering all pixels in the neighborhood of the candidate edge line based on the grayscale values ​​of the pixels in the neighborhood of the candidate edge line, and determining the direction from the center point of the cluster with the largest average grayscale value to the center point of the cluster with the smallest average grayscale value as the light source direction; The candidate edge line is any edge line in the surface image of the tiny watch part at any viewing angle; The acquisition of the structural regularity of each edge line includes: Calculate the first difference in gradient magnitude between each pixel point on the candidate edge line and each pixel point in its neighborhood; calculate the cumulative sum of the first differences between all pixels on the candidate edge line and pixels in their neighborhood; For any pixel point on the candidate edge line: obtain two directions from the any pixel point to its adjacent pixel point, and determine the angle between the two directions as the characteristic angle of the any pixel point; Calculate the second difference between the feature angles of two adjacent pixel points on the candidate edge line; Obtaining a structural regularity of the candidate edge line according to the cumulative sum, an average value of the second differences corresponding to all two adjacent pixel points on the candidate edge line, and a characteristic value of illumination artifacts of the candidate edge line, wherein the cumulative sum is positively correlated with the structural regularity, and the average value of the second differences and the characteristic value of illumination artifacts of the candidate edge line are both negatively correlated with the structural regularity; The acquisition of part edge feature values ​​for each edge line includes: Calculate the DTW distance between the feature angle sequence corresponding to the candidate edge line and the feature angle sequence corresponding to any other edge line; where the feature angle sequence is composed of the feature angles of all pixels on the corresponding edge line; According to the difference between the structural regularity of the candidate edge line and any other edge line and the DTW distance, a part coplanarity factor of the candidate edge line and any other edge line is obtained, wherein the difference between the structural regularity and the DTW distance are both negatively correlated with the part coplanarity factor; The part edge feature value of the candidate edge line is determined by using the part coplanarity factor between the candidate edge line and all other edge lines and the structural regularity of the candidate edge line.

2. The method for precise measurement of the size of tiny watch parts according to claim 1, characterized in that: The step of combining the grayscale distribution of pixels on each edge line, the grayscale distribution of pixels in the neighborhood, and the light source direction to obtain the illumination artifact feature value of each edge line includes: The center point of the cluster with the largest average gray value and the center point of the cluster with the smallest average gray value are connected by a straight line to obtain a first straight line, and the first straight line intersects the candidate edge line at the first edge pixel point; A second straight line is drawn perpendicular to the light source direction through the center point of the cluster with the largest average gray value, and the second straight line intersects the candidate edge line at the second edge pixel point; Determine a pixel point between the first edge pixel point and the second edge pixel point on the candidate edge line as a light source feature point on the candidate edge line; The illumination artifact feature value of the candidate edge line is obtained according to the grayscale difference between adjacent light source feature points on the candidate edge line and the difference between the average grayscale values ​​of the pixels in the neighborhood on both sides of the candidate edge line.

3. The method for precise measurement of the size of tiny watch parts according to claim 2, characterized in that: The step of obtaining the illumination artifact feature value of the candidate edge line according to the grayscale difference between adjacent light source feature points on the candidate edge line and the difference between the average grayscale values ​​of the pixels in the neighborhood on both sides of the candidate edge line comprises: Calculate a first average value of grayscale differences between all adjacent light source feature points on the candidate edge line; Calculate the negative correlation mapping result of the difference between the average grayscale values ​​of the pixels in the neighborhood on both sides of the candidate edge line; The product of the first average value and the negative correlation mapping result is determined as the illumination artifact feature value of the candidate edge line.

4. The method for precise measurement of the size of tiny watch parts according to claim 1, characterized in that: Determining the part edge feature value of the candidate edge line by using the part coplanarity factor of the candidate edge line and all other edge lines and the structural regularity of the candidate edge line includes: Obtaining the maximum value of the coplanarity factor of the part between the candidate edge line and all other edge lines; The sum of the constant 1 and the maximum value is calculated; and the product of the sum and the structural regularity of the candidate edge line is determined as the part edge feature value of the candidate edge line.

5. The method for precise measurement of the size of tiny watch parts according to claim 1, characterized in that: The screening of the real edge of the part based on the edge feature value of the part includes: Based on the part edge eigenvalues ​​of all edge lines, the K-means clustering algorithm is used to cluster all edge lines to obtain clusters, and the average value of the part edge eigenvalues ​​of all edge lines in the cluster with the largest average value of the part edge eigenvalues ​​is used as the demarcation threshold; Among all edge lines, the edge lines whose part edge feature values ​​are greater than the demarcation threshold are determined as the true edges of the parts.

6. A device for precisely measuring the size of tiny watch parts, comprising a memory and a processor, characterized in that: The processor executes the computer program stored in the memory to implement the method for precisely measuring the size of tiny watch parts according to any one of claims 1 to 5.

7. A system for precisely measuring the dimensions of tiny watch parts, the system being used to implement the method for precisely measuring the dimensions of tiny watch parts as claimed in any one of claims 1 to 5, characterized in that: The system comprises: An edge acquisition module is used to acquire edge lines in surface images of tiny watch parts at different viewing angles; A structural regularity determination module is used to determine the light source direction based on the grayscale distribution of pixels in the neighborhood of each edge line; obtain the illumination artifact characteristic value of each edge line by combining the grayscale distribution of pixels on each edge line, the grayscale distribution of pixels in the neighborhood, and the light source direction; obtain the structural regularity of each edge line according to the difference between the gradient amplitude of the pixel on each edge line and the pixel in the neighborhood, the relative position between the pixel on each edge line and its adjacent pixel, and the illumination artifact characteristic value; The real edge screening module is used to combine the difference in structural regularity and relative position between each edge line and the adjacent pixel points in other edge lines to obtain the part edge feature value of each edge line; and screen the real edge of the part based on the part edge feature value; The size determination module is used to convert the surface images of tiny watch parts under different viewing angles into three-dimensional models through a matching algorithm, and determine the size data of the tiny watch parts based on the position of the real edge of the parts in the three-dimensional model.

Citation Information

Patent Citations

  • Visual identification method for valve surface defects

    CN116030034A

  • Environment-friendly and energy-saving aluminum silicate plate quality detection method

    CN116168039A