A method and system for detecting etching quality of watch parts
By identifying and analyzing the change directions of the etched line segments and feature line segments in the surface images of the clock parts, combining the differences between reference lines and comparison lines, the direction change deviation factor is calculated to screen the suspected defect areas, which solves the problem of low detection accuracy in the prior art and improves the accuracy of etching quality detection.
Patent Information
- Application Number
- CN202510142697.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-10
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2045-02-10
AI Technical Summary
When the existing methods detect the etching quality of clock parts, the accuracy of the detection results is low, making it difficult to distinguish the etched parts and the slight irregularities in the image.
By acquiring the surface image of the clock parts, obtaining the etched line segments based on the gradient distribution of pixel points, filtering the etched line segment pairs, determining the etched connection domain, and obtaining the characteristic line segments according to the grayscale value distribution. Combining the variation direction vector, position distribution and the difference between the reference line comparison lines of the characteristic line segment, the direction change deviation factor is calculated to screen the etched area of suspected defects.
The accuracy of the etching quality detection results of watch parts and watch parts is improved, and the accuracy and consistency of etching quality is ensured.
Smart Images

Figure CN119600024B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of etching quality detection, and in particular to a method and system for detecting the etching quality of watch parts. Background Art
[0002] In watch manufacturing, etching technology is often used on the surface of some parts and components to achieve fine patterns, text or logos; the etching quality of watch parts and components is directly related to the appearance and durability of the watch. When the etching solution is deposited or the temperature distribution of the etching solution is uneven, it may cause uneven etching depth and affect the etching effect; therefore, a series of quality inspections are required during the manufacturing process to ensure the accuracy and effect of the etching process.
[0003] In order to ensure uniform etching of watch parts and guarantee etching quality, machine vision anomaly detection is performed by collecting surface images of watch parts after etching. However, due to the complex surface etching patterns of watch parts, it is difficult to distinguish the etched parts, and when there are slight unevenness in the etching quality, it will not be obvious in the image, which will affect the accuracy of the etching quality detection results. Summary of the invention
[0004] In order to solve the problem of low accuracy of detection results when detecting the etching quality of watch parts after etching in the existing method, the purpose of the present invention is to provide a method and system for detecting the etching quality of watch parts, and the technical scheme adopted is as follows:
[0005] In a first aspect, the present invention provides a method for detecting etching quality of watch parts, the method comprising the following steps:
[0006] Acquire a surface image of a watch etching part to be inspected;
[0007] Obtain each etched line segment based on the gradient distribution of the pixel points around each pixel point in the surface image; select each etched line segment pair according to the relative position distribution between different etched line segments; determine the etched connected domain based on the position distribution of each etched line segment pair and the gradient distribution of adjacent pixel points; obtain each characteristic line segment according to the gray value distribution of the pixel points around each pixel point in the etched connected domain;
[0008] According to the grayscale values of the pixels on each feature line segment and its adjacent pixels, the change direction vector of each feature line segment is determined; in combination with the change direction vector of each feature line segment, the position distribution of each feature line segment and the position distribution of the etched connected domain where each feature line segment is located, the reference line and the comparison line of each feature line segment are obtained, and the change direction vector of the reference line and the change direction vector of the comparison line are calculated; according to the difference in the change direction vector between the reference line and the comparison line of each feature line segment, the difference in the change direction vector between each feature line segment and its reference line segment and the difference in the change direction vector between each feature line segment and its comparison line, the direction change deviation factor of each feature line segment is obtained;
[0009] The etched regions suspected of being defects are screened based on the direction change deviation factor.
[0010] Preferably, the step of obtaining each etching line segment based on the gradient distribution of pixel points around each pixel point in the surface image includes:
[0011] For any pixel point in the neighborhood of the candidate pixel point: if the gradient value of any pixel point in the neighborhood is the maximum gradient value of all pixels in the neighborhood, and the difference between the gradient value of the candidate pixel point and any pixel point in the neighborhood of the candidate pixel point is the smallest, then any pixel point in the neighborhood is determined as a third pixel point; the candidate pixel point is any pixel point in the surface image;
[0012] All adjacent third pixel points in the surface image are connected to obtain etching line segments.
[0013] Preferably, the screening of each etching line segment pair according to the relative position distribution between different etching line segments includes:
[0014] For any etched line segment:
[0015] Obtaining the DTW distance between any etched line segment and the etched line segment closest to it; obtaining the first distance between each pixel point on any etched line segment and the etched line segment closest to it, and calculating the information entropy of the first distance corresponding to all pixels on any etched line segment;
[0016] According to the DTW distance and the information entropy, a correlation between any etching line segment and its closest etching line segment is obtained, wherein both the DTW distance and the information entropy are negatively correlated with the correlation;
[0017] If the correlation is greater than a preset correlation threshold, any one of the etching line segments and the etching line segment closest to it constitute an etching line segment pair.
[0018] Preferably, the step of determining the etched connected domain by combining the position distribution of each etched line segment pair and the gradient distribution of adjacent pixel points includes:
[0019] For any etched line pair:
[0020] Respectively obtain the etching line pairs where the etching lines closest to each etching line in any etching line pair are located, and record them as the first etching line pairs;
[0021] Taking the endpoint of each etching line in any etching line pair as a starting point, taking the endpoint of each etching line in the first etching line pair as an ending point, and using a region growing algorithm to perform region growing on pixel points to obtain an etching connected domain;
[0022] The rule of regional growing is as follows: obtain a line between a seed point and a point to be grown, draw a vertical line perpendicular to the line through the point to be grown, record two pixel points on the vertical line adjacent to the point to be grown as a first pixel point and a second pixel point respectively, and if the difference in gradient values between the first pixel point and the second pixel point is less than a preset gradient difference threshold, perform regional growing on the point to be grown.
[0023] Preferably, the step of obtaining each characteristic line segment according to the gray value distribution of pixel points around each pixel point in the etched connected domain includes:
[0024] The pixel point with the smallest gray value difference between the pixel point to be analyzed and the pixel point to be analyzed in the preset neighborhood is recorded as the fourth pixel point;
[0025] Connecting the pixel to be analyzed and its fourth pixel to obtain characteristic line segments;
[0026] The pixel point to be analyzed is any pixel point in the etched connected domain.
[0027] Preferably, determining the change direction vector of each characteristic line segment according to the grayscale values of the pixel points on each characteristic line segment and the pixel points adjacent to the pixel points includes:
[0028] For any pixel point on the first feature line segment: draw a straight line perpendicular to the first feature line segment through the pixel point, record the two pixel points adjacent to the pixel point on the straight line as reference pixel points, point the reference pixel point with the largest grayscale value among the two reference pixel points corresponding to the pixel point in the direction of the reference pixel point with the smallest grayscale value as the direction of the feature vector of the pixel point, and the size of the feature vector is 1; calculate the average value of the difference in grayscale value between the pixel point and its reference pixel points, and record it as the first feature value of the pixel point;
[0029] Combining the feature vectors of all pixels on the first feature line segment and the first feature value to obtain a change direction vector of the first feature line segment;
[0030] The first characteristic line segment is any characteristic line segment.
[0031] Preferably, the step of combining the change direction vector of each characteristic line segment, the position distribution of each characteristic line segment, and the position distribution of the etched connected domain where each characteristic line segment is located to obtain the reference line and the comparison line of each characteristic line segment includes:
[0032] A straight line perpendicular to the direction of the change direction vector of the first characteristic line segment is drawn through the center of the first characteristic line segment as a collinear straight line; the center of the first characteristic line segment is taken as the initial position, the first characteristic line segment is translated on the collinear straight line until it is translated to the edge line of the etched connected domain where the first characteristic line segment is located and the translation distance is the smallest, and the translated first characteristic line segment is determined as the comparison line of the first characteristic line segment;
[0033] The points in the etched connected domain where the first characteristic line segment is located that are closest to the two end points of the comparison line are connected by straight lines to obtain a reference line of the first characteristic line segment.
[0034] Preferably, the step of obtaining the direction change deviation factor of each characteristic line segment according to the difference in change direction vector between the reference line and the comparison line of each characteristic line segment, the difference in change direction vector between each characteristic line segment and its reference line segment, and the difference in change direction vector between each characteristic line segment and its comparison line comprises:
[0035] The angle between the direction corresponding to the change direction vector of the reference line of the first characteristic line segment and the direction corresponding to the change direction vector of the comparison line of the first characteristic line segment is recorded as the first angle; the angle between the direction corresponding to the change direction vector of the first characteristic line segment and the direction corresponding to the change direction vector of the reference line of the first characteristic line segment is recorded as the second angle;
[0036] Calculating a difference vector between a change direction vector of a first characteristic line segment and a change direction vector of a reference line of the first characteristic line segment;
[0037] A direction change deviation factor of the first characteristic line segment is obtained according to the first angle, the second angle and the difference vector.
[0038] Preferably, the screening of the etching area of suspected defects based on the direction change deviation factor includes:
[0039] For any etching area: calculating the second average value of the direction change deviation factors of all characteristic line segments in the etching area;
[0040] Based on the second average values corresponding to all etching regions, the Otsu threshold segmentation algorithm is used to screen the etching regions suspected of defects.
[0041] In a second aspect, the present invention provides a system for detecting etching quality of watch parts, the system comprising:
[0042] An image acquisition module, used to acquire a surface image of a watch etching part to be inspected;
[0043] The feature line segment determination module is used to obtain each etching line segment based on the gradient distribution of the pixel points around each pixel point in the surface image; select each etching line segment pair according to the relative position distribution between different etching line segments; determine the etching connected domain based on the position distribution of each etching line segment pair and the gradient distribution of adjacent pixel points; obtain each feature line segment according to the gray value distribution of the pixel points around each pixel point in the etching connected domain;
[0044] A calculation module is used to determine the change direction vector of each characteristic line segment according to the grayscale values of the pixel points on each characteristic line segment and the pixel points adjacent to it; obtain the reference line and the comparison line of each characteristic line segment in combination with the change direction vector of each characteristic line segment, the position distribution of each characteristic line segment and the position distribution of the etched connected domain where each characteristic line segment is located, and calculate the change direction vector of the reference line and the change direction vector of the comparison line; obtain the direction change deviation factor of each characteristic line segment according to the difference in the change direction vector between the reference line and the comparison line of each characteristic line segment, the difference in the change direction vector between each characteristic line segment and its reference line segment and the difference in the change direction vector between each characteristic line segment and its comparison line;
[0045] The suspected defect area determination module is used to screen the suspected defect etching area based on the direction change deviation factor.
[0046] The present invention has at least the following beneficial effects:
[0047] The present invention first determines an etching connected domain in combination with the gradient distribution and relative position distribution of pixel points in the surface image of the watch etching part to be detected, then obtains multiple feature line segments according to the grayscale value distribution of pixel points around each pixel point in the etching connected domain, further determines the change direction vector of the feature line segment according to the grayscale value of the pixel points on the feature line segment and the pixel points adjacent to it, and uses it to describe the grayscale change direction of the feature line segment, and further determines the reference line and comparison line of the feature line segment in consideration of the influence of illumination, and comprehensively evaluates the direction change deviation factor of each feature line segment by comprehensively considering the difference in the change direction vector between the reference line and the comparison line of each feature line segment, the difference in the change direction vector between each feature line segment and its reference line segment, and the difference in the change direction vector between each feature line segment and its comparison line, thereby screening out the etching area with suspected defects, thereby improving the accuracy of the etching quality detection result of the watch parts and components, and ensuring the etching quality of the watch parts and components. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] 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.
[0049] Figure 1 A flow chart of a method for detecting etching quality of watch parts provided by an embodiment of the present invention;
[0050] Figure 2 This is a structural block diagram of a watch parts etching quality inspection system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, a method and system for etching quality inspection of watch parts proposed in accordance with the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments.
[0052] 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.
[0053] The specific scheme of the etching quality detection method and system for watch parts provided by the present invention is described in detail below with reference to the accompanying drawings.
[0054] An embodiment of a method for detecting etching quality of watch parts:
[0055] The specific scenario targeted by this embodiment is: in order to ensure the etching quality of watch parts, after the etching of the watch parts is completed, the surface image of the etched watch parts is collected, and the etching quality of the watch etched parts to be inspected is evaluated based on the features presented in the image.
[0056] This embodiment proposes a method for detecting the etching quality of watch parts. Figure 1 As shown, a method for detecting etching quality of watch parts and components of this embodiment includes the following steps:
[0057] Step S1, obtaining a surface image of a watch etching part to be inspected.
[0058] Etching of watch parts is an important process step in watch manufacturing, mainly used to engrave patterns, text or brand logos on the surface of parts; the specific operation is to coat the surface of watch parts with a protective film, which can protect the metal from being corroded by the etching solution; the designed pattern is transferred to the protective film by photolithography, the parts and the pattern are exposed to ultraviolet light, and the photosensitive adhesive reacts chemically in the exposed area. After exposure, the unexposed part of the protective film will be dissolved by the developer; the processed watch parts are immersed in a chemical etching solution for etching. After etching is completed, the parts need to be removed from the solution, the etching solution remaining on the surface is cleaned off, and the protective film is removed.
[0059] After the etching is completed, the watch parts are cleaned and transferred to the image acquisition area, and the watch parts are photographed using an optical microscope with a suitable magnification to obtain the surface image of the watch parts, and grayscale processing is performed on the surface image, and the normalized image is recorded as the surface image of the watch etching part to be detected. Grayscale processing of images is a prior art and will not be described in detail here.
[0060] Step S2, obtaining each etched line segment based on the gradient distribution of pixel points around each pixel point in the surface image; screening each etched line segment pair according to the relative position distribution between different etched line segments; determining the etched connected domain in combination with the position distribution of each etched line segment pair and the gradient distribution of adjacent pixel points; obtaining each feature line segment according to the gray value distribution of pixel points around each pixel point in the etched connected domain.
[0061] Due to uneven etching liquid or uneven workpiece surface during the etching process, the etching depth of the etched part surface will be uneven after etching, which will affect the effect and the quality of the etched part; the uneven etching depth will be manifested in the image as some parts are etched more clearly while the rest are blurred due to incomplete etching, and there will be some display differences; therefore, it is necessary to obtain the etched part and obtain the etching quality of the accessory based on the changes in the etched part.
[0062] First, the surface image is processed using the Sobel operator to calculate the gradient value of each pixel in the surface image. The Sobel operator is a prior art and will not be described in detail here.
[0063] Next, this embodiment is described by taking a pixel point in a surface image as an example. Other pixel points in the surface image can be processed by the method provided by this embodiment.
[0064] Specifically, any pixel point in the surface image is recorded as a candidate pixel point, and for any pixel point in the neighborhood of the candidate pixel point: if the gradient value of any pixel point in the neighborhood is the maximum gradient value of all pixels in the neighborhood, and the difference between the gradient value of the candidate pixel point and any pixel point in the neighborhood of the candidate pixel point is the smallest, then any pixel point in the neighborhood is determined as the third pixel point, that is, the third pixel point is both the pixel point with the largest gradient value in the neighborhood of the candidate pixel point and the pixel point with the smallest gradient value difference between the candidate pixel point and the candidate pixel point in the neighborhood of the candidate pixel point. It should be noted that the method for obtaining the difference in the gradient values of two pixels is: calculating the absolute value of the difference between the gradient values of the two pixels, and taking the absolute value as the difference in the gradient values of the two pixels. Using the above method, multiple third pixel points in the surface image can be obtained, and all adjacent third pixel points in the surface image are connected to obtain multiple etching line segments.
[0065] For any etched line segment:
[0066] Calculate the DTW (Dynamic TimeWarping) distance between any etched line segment and the etched line segment closest to it; obtain the distance between each pixel point on any etched line segment and the etched line segment closest to it, record the distance as the first distance, and calculate the information entropy of the first distance corresponding to all pixels on any etched line segment according to the first distance corresponding to each pixel point on any etched line segment; the method for calculating the information entropy is a prior art and will not be described in detail here. According to the DTW distance and the information entropy, obtain the correlation between any etched line segment and the etched line segment closest to it, and the DTW distance and the information entropy are both negatively correlated with the correlation.
[0067] 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.
[0068] In this embodiment, a specific calculation formula for the correlation is given, and the correlation between any etching line segment and its nearest etching line segment can be expressed as:
[0069]
[0070] Wherein, G represents the correlation between any etching line segment and its nearest etching line segment, represents a sequence of coordinates of all pixels on any etching line segment, represents a sequence consisting of the coordinates of all pixel points on the etching line segment closest to any etching line segment, Indicates the DTW distance. represents the information entropy of the first distance corresponding to all pixels on any etching line segment, represents the DTW distance between any etched line segment and its nearest etched line segment, and exp( ) represents an exponential function with a natural constant as the base.
[0071] The smaller the DTW distance between the two etched line segments, the closer the change trends of the two etched line segments are. The smaller the information entropy of the first distance corresponding to all pixels on any etched line segment, the more consistent the distance between the pixels on any etched line segment and the nearest etched line segment. When the DTW distance between any etched line segment and its nearest etched line segment is smaller and the information entropy of the first distance corresponding to all pixels on any etched line segment is smaller, it means that the similarity between any etched line segment and its nearest etched line segment is higher, that is, the correlation between any etched line segment and its nearest etched line segment is greater.
[0072] If the correlation between any etched line segment and its nearest etched line segment is greater than a preset correlation threshold, then any etched line segment and its nearest etched line segment form an etched line segment pair. In this embodiment, the preset correlation threshold is 0.7, and in specific applications, the implementer can set it according to specific circumstances.
[0073] By adopting the above method, all etching line segments are analyzed and a plurality of etching line segment pairs are screened.
[0074] Due to the influence of light and other factors, the etched line segments obtained are incomplete, so it is necessary to grow a complete etched line edge. Specifically, for any etched line pair: the etched line pair where the etched line closest to each etched line in any etched line pair is located is obtained and recorded as the first etched line pair; the endpoint of each etched line in any etched line pair is taken as the starting point, and the endpoint of each etched line in the first etched line pair is taken as the ending point, and the pixel point is regionally grown using the regional growing algorithm. After the regional growth is completed, each connected domain obtained is taken as an etched connected domain; wherein the rule of regional growth is: obtain the connecting line between the seed point and the point to be grown, draw a vertical line perpendicular to the connecting line through the point to be grown, and record the two pixel points adjacent to the point to be grown on the vertical line as the first pixel point and the second pixel point respectively, if the difference in the gradient value between the first pixel point and the second pixel point is less than the preset gradient difference threshold, the point to be grown is regionally grown. The preset gradient difference threshold is set by the implementer according to the specific situation, and will not be described in detail here. Regional growth is a prior art, and will not be described in detail here.
[0075] Since uneven etching will lead to inconsistent etching depth, the grayscale value in the etched connected domain will show grayscale change characteristics due to inconsistent depth. And since there will be some differences in the light on the surface of the part, it is necessary to compare the grayscale changes of the etched part with the actual light changes to detect the etching quality.
[0076] Next, this embodiment is described by taking the etching of a pixel point in the connected domain as an example, and other pixel points in the connected domain can be processed by the method provided in this embodiment.
[0077] Specifically, any pixel point in the etched connected domain is recorded as a pixel point to be analyzed, and the pixel point with the smallest grayscale value difference between the pixel point to be analyzed and the pixel point to be analyzed in the preset neighborhood is recorded as the fourth pixel point, and the pixel point to be analyzed and its fourth pixel point are respectively connected by a straight line to obtain a characteristic line segment. In this embodiment, the preset neighborhood is eight neighborhoods, and in specific applications, the implementer can set it according to specific circumstances.
[0078] By using the above method, all pixel points in the etched connected domain are processed to obtain multiple feature line segments.
[0079] Step S3, determining the change direction vector of each feature line segment according to the grayscale values of the pixel points on each feature line segment and its adjacent pixel points; obtaining the reference line and comparison line of each feature line segment in combination with the change direction vector of each feature line segment, the position distribution of each feature line segment and the position distribution of the etched connected domain where each feature line segment is located, and calculating the change direction vector of the reference line and the change direction vector of the comparison line; obtaining the direction change deviation factor of each feature line segment according to the difference in the change direction vector between the reference line and the comparison line of each feature line segment, the difference in the change direction vector between each feature line segment and its reference line segment and the difference in the change direction vector between each feature line segment and its comparison line.
[0080] In this embodiment, a plurality of characteristic line segments are determined in step S2, and then a change direction vector of the characteristic line segment is determined according to the grayscale values of the pixel points on the characteristic line segment and the surrounding pixel points.
[0081] Next, a characteristic line segment is taken as an example for description. Other characteristic line segments can be processed by the method provided in this embodiment.
[0082] Specifically, any feature line segment is recorded as the first feature line segment. For any pixel point on the first feature line segment: a straight line perpendicular to the first feature line segment is drawn through the pixel point, and the two pixel points adjacent to the pixel point on the straight line are recorded as reference pixel points. The reference pixel point with the largest grayscale value among the two reference pixel points corresponding to the pixel point points to the direction of the reference pixel point with the smallest grayscale value, which is used as the direction of the feature vector of the pixel point. The size of the feature vector is 1; the average value of the difference in grayscale value between the pixel point and its reference pixel point is calculated, and recorded as the first eigenvalue of the pixel point. The above method can be used to obtain the first eigenvalue of each pixel point on the first feature line segment. Next, the feature vectors of all pixel points on the first feature line segment and the first eigenvalue are combined to obtain the change direction vector of the first feature line segment.
[0083] In this embodiment, a specific calculation formula for the change direction vector is given, and the change direction vector of the first characteristic line segment can be expressed as:
[0084]
[0085] Wherein, F represents the change direction vector of the first characteristic line segment, N represents the number of pixels on the first characteristic line segment, Represents the feature vector of the nth pixel on the first feature line segment, It represents the average value of the difference in grayscale value between the n-th pixel point on the first characteristic line segment and its reference pixel point, that is, the first eigenvalue of the n-th pixel point on the first characteristic line segment.
[0086] The greater the grayscale difference between the nth pixel on the first characteristic line segment and its reference pixel, the more likely this direction is to be the direction reflecting the change of the characteristic line segment, and therefore the greater its weight. The average value of the grayscale value difference between the pixel on the first characteristic line segment and its reference pixel is used as the weight, and the feature vectors of the pixel on the first characteristic line segment are weighted summed to obtain the change direction vector of the first characteristic line segment. The change direction vector of the first characteristic line segment reflects the change direction of the first characteristic line segment in the etched part. In order to analyze whether the change direction of the first characteristic line segment is normal, it is necessary to analyze the grayscale change of the surface of the part outside the etched part.
[0087] Furthermore, a straight line perpendicular to the direction of the change direction vector of the first characteristic line segment through the center of the first characteristic line segment is recorded as a collinear straight line; the center of the first characteristic line segment is the initial position, and the first characteristic line segment is translated on the collinear straight line until it is translated to the edge line of the etched connected domain where the first characteristic line segment is located and the translation distance is the smallest, and the translated first characteristic line segment is determined as the comparison line of the first characteristic line segment. The existence of a certain depth in the etching line may cause light to form light and shadow in the etching part, so that there are some differences in the grayscale changes of some parts in the etching part. Therefore, it is necessary to analyze the change direction vector of the comparison line part of the characteristic line segment to obtain the influence of light and shadow on the change direction vector. Specifically, the point in the etching connected domain where the first characteristic line segment is located that is closest to the two endpoints of the comparison line is connected by a straight line to obtain the reference line of the first characteristic line segment.
[0088] The method for obtaining the change direction vector of the analog feature line segment is to calculate the change direction vector of the comparison line and the change direction vector of the reference line respectively. The angle between the direction corresponding to the change direction vector of the reference line of the first feature line segment and the direction corresponding to the change direction vector of the comparison line of the first feature line segment is recorded as the first angle; the angle between the direction corresponding to the change direction vector of the first feature line segment and the direction corresponding to the change direction vector of the reference line of the first feature line segment is recorded as the second angle; the difference vector between the change direction vector of the first feature line segment and the change direction vector of the reference line of the first feature line segment is calculated; and the direction change deviation factor of the first feature line segment is obtained according to the first angle, the second angle and the difference vector.
[0089] In this embodiment, a specific calculation formula for the direction change deviation factor is given. The direction change deviation factor of the first characteristic line segment can be expressed as:
[0090]
[0091] In the formula, represents the direction change deviation factor of the first characteristic line segment, represents the difference vector between the change direction vector of the first characteristic line segment and the change direction vector of the reference line of the first characteristic line segment, The angle between the direction corresponding to the change direction vector of the reference line of the first characteristic line segment and the direction corresponding to the change direction vector of the comparison line of the first characteristic line segment, that is, the first angle; represents the angle between the direction corresponding to the change direction vector of the first characteristic line segment and the direction corresponding to the change direction vector of the reference line of the first characteristic line segment, that is, the second angle; represents the modulus length of the orientation vector, Indicates the preset adjustment parameters, Represents the normalization function.
[0092] In this embodiment, a preset adjustment parameter is introduced into the calculation formula of the direction change deviation factor to prevent the denominator from being 0. In this embodiment, the preset adjustment parameter is 0.01. In specific applications, the implementer can set it according to specific circumstances.
[0093] The larger the difference vector between the change direction vector of the first characteristic line segment and the change direction vector of the reference line of the first characteristic line segment is, the larger the difference between the change direction vector of the characteristic line segment of the etched part and the change direction vector of the reference line is, and thus the larger the deviation of the direction change is. The larger the value, the larger the first angle and the smaller the second angle. The smaller the angle between the reference line and the comparison line's change direction vector and the larger the angle with the feature line segment's change direction vector, indicating that the feature line segment is less affected by light and shadow, and therefore has a greater weight.
[0094] By adopting the above method, the direction change deviation factor of each characteristic line segment can be obtained.
[0095] Step S4, screening the etched areas suspected of defects based on the direction change deviation factor.
[0096] In step S3, this embodiment obtains the directional change deviation factor of each characteristic line segment. When the directional change of the characteristic line segment of the etched part deviates, it indicates that the grayscale change is different from that of the normal plane, which means that the etching may have uneven depth. Therefore, this embodiment will screen the etched areas with suspected defects based on the directional change deviation factors of all characteristic line segments in each etched area.
[0097] Specifically, for any etching area: according to the directional change deviation factor of each characteristic line segment in the etching area, the average value of the directional change deviation factors of all characteristic line segments in the etching area is calculated and recorded as the second average value. By adopting this method, the second average value of the directional change deviation factor of the characteristic line segment can be obtained, and one etching area corresponds to one second average value. Based on the second average values corresponding to all etching areas, the Otsu threshold segmentation algorithm is used to divide all etching areas, and the high threshold part in the obtained segmentation result is determined as the etching area of suspected defects. The Otsu threshold segmentation algorithm is a prior art and will not be described in detail here.
[0098] At this point, the method provided in this embodiment has been used to screen out the etched areas with suspected defects in the surface image of the watch etched parts to be inspected. In order to ensure the etching quality of the watch parts, the staff will further inspect the etched areas with suspected defects. If the etching quality is unqualified, remedial measures will be taken in time to ensure the etching quality of the watch parts.
[0099] This embodiment first determines the etching connected domain based on the gradient distribution and relative position distribution of the pixel points in the surface image of the watch etching part to be detected, and then obtains multiple feature line segments based on the grayscale value distribution of the pixel points around each pixel point in the etching connected domain. Further, based on the grayscale values of the pixel points on the feature line segment and the pixel points adjacent to it, the change direction vector of the feature line segment is determined to describe the grayscale change direction of the feature line segment. Further considering the influence of light, the reference line and comparison line of the feature line segment are determined. Based on the difference in the change direction vector between the reference line and the comparison line of each feature line segment, the difference in the change direction vector between each feature line segment and its reference line segment, and the difference in the change direction vector between each feature line segment and its comparison line, the direction change deviation factor of each feature line segment is evaluated, and then the etching area with suspected defects is screened out, thereby improving the accuracy of the etching quality inspection results of watch parts and components and ensuring the etching quality of watch parts and components.
[0100] An embodiment of a system for detecting etching quality of watch parts:
[0101] See also Figure 2 , which shows a structural block diagram of a watch parts etching quality inspection system provided by an embodiment of the present invention. The system may include an image acquisition module, a feature line segment determination module, a calculation module and a suspected defect area determination module.
[0102] The image acquisition module is used to acquire the surface image of the watch etching part to be inspected;
[0103] The feature line segment determination module is used to obtain each etching line segment based on the gradient distribution of the pixel points around each pixel point in the surface image; select each etching line segment pair according to the relative position distribution between different etching line segments; determine the etching connected domain based on the position distribution of each etching line segment pair and the gradient distribution of adjacent pixel points; obtain each feature line segment according to the gray value distribution of the pixel points around each pixel point in the etching connected domain;
[0104] A calculation module is used to determine the change direction vector of each characteristic line segment according to the grayscale values of the pixel points on each characteristic line segment and the pixel points adjacent to it; obtain the reference line and the comparison line of each characteristic line segment in combination with the change direction vector of each characteristic line segment, the position distribution of each characteristic line segment and the position distribution of the etched connected domain where each characteristic line segment is located, and calculate the change direction vector of the reference line and the change direction vector of the comparison line; obtain the direction change deviation factor of each characteristic line segment according to the difference in the change direction vector between the reference line and the comparison line of each characteristic line segment, the difference in the change direction vector between each characteristic line segment and its reference line segment and the difference in the change direction vector between each characteristic line segment and its comparison line;
[0105] The suspected defect area determination module is used to screen the suspected defect etching area based on the direction change deviation factor.
[0106] It should be understood that Figure 2 The structural block diagram of a watch parts etching quality detection system 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, for example, 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 system and its modules of this specification. Not only can the 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. be implemented, they 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).
[0107] For more details about the above modules, please refer to other places in this manual and will not be repeated here.
[0108] In other embodiments, a device for detecting etching quality of watch parts is also provided, comprising a memory and a processor. The memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, so that the device executes the above-mentioned method for detecting etching quality of watch parts. The device can be specifically a chip, a component or a module, and the chip may include a connected processor and a memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute the method for detecting etching quality of watch parts provided in the above-mentioned embodiment.
[0109] In other embodiments, a computer program product is also provided. When the computer program product is run on a computer, the computer executes the above-mentioned related steps to implement a method for detecting etching quality of watch parts provided in the above-mentioned embodiment.
[0110] In other embodiments, a computer-readable storage medium is also provided, in which a computer program code is stored. When the computer program code is run on a computer, the computer executes the above-mentioned related method steps to implement a watch parts etching quality detection method provided in the above embodiment.
[0111] Among them, the provided system, electronic device, computer program product, and computer-readable storage medium 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.
[0112] 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 detecting etching quality of watch parts, characterized in that: The method comprises the following steps: Acquire a surface image of a watch etching part to be inspected; Obtain each etched line segment based on the gradient distribution of the pixel points around each pixel point in the surface image; select each etched line segment pair according to the relative position distribution between different etched line segments; determine the etched connected domain based on the position distribution of each etched line segment pair and the gradient distribution of adjacent pixel points; obtain each characteristic line segment according to the gray value distribution of the pixel points around each pixel point in the etched connected domain; According to the grayscale values of the pixels on each feature line segment and its adjacent pixels, the change direction vector of each feature line segment is determined; in combination with the change direction vector of each feature line segment, the position distribution of each feature line segment and the position distribution of the etched connected domain where each feature line segment is located, the reference line and the comparison line of each feature line segment are obtained, and the change direction vector of the reference line and the change direction vector of the comparison line are calculated; according to the difference in the change direction vector between the reference line and the comparison line of each feature line segment, the difference in the change direction vector between each feature line segment and its reference line, and the difference in the change direction vector between each feature line segment and its comparison line, the direction change deviation factor of each feature line segment is obtained; Screening the etching area of suspected defects based on the direction change deviation factor; The step of determining the change direction vector of each characteristic line segment according to the grayscale values of the pixel points on each characteristic line segment and the pixel points adjacent to the pixel points includes: For any pixel point on the first feature line segment: draw a straight line perpendicular to the first feature line segment through the pixel point, record the two pixel points adjacent to the pixel point on the straight line as reference pixel points, point the reference pixel point with the largest grayscale value among the two reference pixel points corresponding to the pixel point in the direction of the reference pixel point with the smallest grayscale value as the direction of the feature vector of the pixel point, and the size of the feature vector is 1; calculate the average value of the difference in grayscale value between the pixel point and its reference pixel points, and record it as the first feature value of the pixel point; Combining the feature vectors of all pixels on the first feature line segment and the first feature value to obtain a change direction vector of the first feature line segment; The first characteristic line segment is any characteristic line segment; The step of combining the change direction vector of each characteristic line segment, the position distribution of each characteristic line segment, and the position distribution of the etched connected domain where each characteristic line segment is located to obtain the reference line and the comparison line of each characteristic line segment includes: A straight line perpendicular to the direction of the change direction vector of the first characteristic line segment is drawn through the center of the first characteristic line segment as a collinear straight line; the center of the first characteristic line segment is taken as the initial position, the first characteristic line segment is translated on the collinear straight line until it is translated to the edge line of the etched connected domain where the first characteristic line segment is located and the translation distance is the smallest, and the translated first characteristic line segment is determined as the comparison line of the first characteristic line segment; The points in the etched connected domain where the first characteristic line segment is located that are closest to the two end points of the comparison line are connected by straight lines to obtain a reference line of the first characteristic line segment.
2. A method for detecting etching quality of watch parts according to claim 1, characterized in that: The step of obtaining each etching line segment based on the gradient distribution of pixel points around each pixel point in the surface image includes: For any pixel point in the neighborhood of the candidate pixel point: if the gradient value of any pixel point in the neighborhood is the maximum gradient value of all pixels in the neighborhood, and the difference between the gradient value of the candidate pixel point and any pixel point in the neighborhood of the candidate pixel point is the smallest, then any pixel point in the neighborhood is determined as a third pixel point; the candidate pixel point is any pixel point in the surface image; All adjacent third pixel points in the surface image are connected to obtain etching line segments.
3. A method for detecting etching quality of watch parts according to claim 1, characterized in that: The step of screening each etching line segment pair according to the relative position distribution between different etching line segments comprises: For any etched line segment: Obtaining the DTW distance between any etched line segment and the etched line segment closest to it; obtaining the first distance between each pixel point on any etched line segment and the etched line segment closest to it, and calculating the information entropy of the first distance corresponding to all pixels on any etched line segment; According to the DTW distance and the information entropy, a correlation between any etching line segment and its closest etching line segment is obtained, wherein both the DTW distance and the information entropy are negatively correlated with the correlation; If the correlation is greater than a preset correlation threshold, any one of the etching line segments and the etching line segment closest to it constitute an etching line segment pair.
4. A method for detecting etching quality of watch parts according to claim 1, characterized in that: The step of determining the etched connected domain by combining the position distribution of each etched line segment pair and the gradient distribution of adjacent pixel points includes: For any etched line pair: Respectively obtain the etching line pairs where the etching lines closest to each etching line in any etching line pair are located, and record them as the first etching line pairs; Taking the endpoint of each etching line in any etching line pair as a starting point, taking the endpoint of each etching line in the first etching line pair as an ending point, and using a region growing algorithm to perform region growing on pixel points to obtain an etching connected domain; The rule of regional growing is as follows: obtain a line between a seed point and a point to be grown, draw a vertical line perpendicular to the line through the point to be grown, record two pixel points on the vertical line adjacent to the point to be grown as a first pixel point and a second pixel point respectively, and if the difference in gradient values between the first pixel point and the second pixel point is less than a preset gradient difference threshold, perform regional growing on the point to be grown.
5. A method for detecting etching quality of watch parts according to claim 1, characterized in that: The step of obtaining each characteristic line segment according to the gray value distribution of the pixel points around each pixel point in the etched connected domain includes: The pixel point with the smallest gray value difference between the pixel point to be analyzed and the pixel point to be analyzed in the preset neighborhood is recorded as the fourth pixel point; Connecting the pixel to be analyzed and its fourth pixel to obtain characteristic line segments; The pixel point to be analyzed is any pixel point in the etched connected domain.
6. A method for detecting etching quality of watch parts according to claim 1, characterized in that: The direction change deviation factor of each characteristic line segment is obtained according to the difference of the change direction vector between the reference line and the comparison line of each characteristic line segment, the difference of the change direction vector between each characteristic line segment and its reference line, and the difference of the change direction vector between each characteristic line segment and its comparison line, including: The angle between the direction corresponding to the change direction vector of the reference line of the first characteristic line segment and the direction corresponding to the change direction vector of the comparison line of the first characteristic line segment is recorded as the first angle; the angle between the direction corresponding to the change direction vector of the first characteristic line segment and the direction corresponding to the change direction vector of the reference line of the first characteristic line segment is recorded as the second angle; Calculating a difference vector between a change direction vector of a first characteristic line segment and a change direction vector of a reference line of the first characteristic line segment; A direction change deviation factor of the first characteristic line segment is obtained according to the first angle, the second angle and the difference vector.
7. A method for detecting etching quality of watch parts according to claim 1, characterized in that: The screening of the etching area of suspected defects based on the direction change deviation factor includes: For any etching area: calculating the second average value of the direction change deviation factors of all characteristic line segments in the etching area; Based on the second average values corresponding to all etching regions, the Otsu threshold segmentation algorithm is used to screen the etching regions suspected of defects.
8. A watch parts etching quality inspection system, the system is used to implement the method of claim 1, characterized in that: The system includes: An image acquisition module, used to acquire a surface image of a watch etching part to be inspected; The feature line segment determination module is used to obtain each etching line segment based on the gradient distribution of the pixel points around each pixel point in the surface image; select each etching line segment pair according to the relative position distribution between different etching line segments; determine the etching connected domain based on the position distribution of each etching line segment pair and the gradient distribution of adjacent pixel points; obtain each feature line segment according to the gray value distribution of the pixel points around each pixel point in the etching connected domain; A calculation module is used to determine the change direction vector of each characteristic line segment according to the grayscale values of the pixel points on each characteristic line segment and the pixel points adjacent to it; obtain the reference line and the comparison line of each characteristic line segment in combination with the change direction vector of each characteristic line segment, the position distribution of each characteristic line segment and the position distribution of the etched connected domain where each characteristic line segment is located, and calculate the change direction vector of the reference line and the change direction vector of the comparison line; obtain the direction change deviation factor of each characteristic line segment according to the difference in the change direction vector between the reference line and the comparison line of each characteristic line segment, the difference in the change direction vector between each characteristic line segment and its reference line, and the difference in the change direction vector between each characteristic line segment and its comparison line; The suspected defect area determination module is used to screen the suspected defect etching area based on the direction change deviation factor.
Citation Information
Patent Citations
Intelligent detection method for quality of concrete prefabricated bottom plate
CN116703910A
Watch shell quality detection method based on image data
CN117218122A