[go: up one dir, main page]

CN119672026B - Watch bottom cover flaw detection method and system based on machine vision - Google Patents

Watch bottom cover flaw detection method and system based on machine vision Download PDF

Info

Publication number
CN119672026B
CN119672026B CN202510194572.6A CN202510194572A CN119672026B CN 119672026 B CN119672026 B CN 119672026B CN 202510194572 A CN202510194572 A CN 202510194572A CN 119672026 B CN119672026 B CN 119672026B
Authority
CN
China
Prior art keywords
flaw
edge
edge pixel
obtaining
lines
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202510194572.6A
Other languages
Chinese (zh)
Other versions
CN119672026A (en
Inventor
黄优娟
吴国彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Jinsanwei Industry Co ltd
Original Assignee
Shenzhen Jinsanwei Industry Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Jinsanwei Industry Co ltd filed Critical Shenzhen Jinsanwei Industry Co ltd
Priority to CN202510194572.6A priority Critical patent/CN119672026B/en
Publication of CN119672026A publication Critical patent/CN119672026A/en
Application granted granted Critical
Publication of CN119672026B publication Critical patent/CN119672026B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

本发明涉及瑕疵检查技术领域,具体涉及一种基于机器视觉的手表底盖瑕疵检查方法及系统。本发明对于任一张边缘图像,获得每个边缘像素点的噪声因子和瑕疵因子;根据第一张边缘图像上边缘像素点的位置分布,获得多个疑似瑕疵线,并获得疑似瑕疵线之间的过渡线;根据两条疑似瑕疵线之间像素点的梯度方向和过渡线的相对分布特征,获得两条疑似瑕疵线之间的连接程度;结合对应两条疑似瑕疵线之间的同一瑕疵可能性,获得每张边缘图像上每个边缘像素点的瑕疵权重;结合像素点的灰度分布,获得最后一张边缘图像上每个边缘像素点的瑕疵可能性;进行瑕疵检测。本发明通过获得每个边缘像素点准确的瑕疵可能性,提高瑕疵检查的精确度。

The present invention relates to the field of defect inspection technology, and specifically to a method and system for inspecting defect on a bottom cover of a watch based on machine vision. The present invention obtains the noise factor and defect factor of each edge pixel point for any edge image; obtains multiple suspected defect lines according to the position distribution of edge pixels on the first edge image, and obtains transition lines between the suspected defect lines; obtains the degree of connection between the two suspected defect lines according to the gradient direction of the pixels between the two suspected defect lines and the relative distribution characteristics of the transition lines; obtains the defect weight of each edge pixel point on each edge image in combination with the possibility of the same defect between the two corresponding suspected defect lines; obtains the defect possibility of each edge pixel point on the last edge image in combination with the grayscale distribution of the pixels; and performs defect detection. The present invention improves the accuracy of defect inspection by obtaining the accurate defect possibility of each edge pixel point.

Description

Watch bottom cover flaw detection method and system based on machine vision
Technical Field
The invention relates to the technical field of flaw detection, in particular to a machine vision-based watch bottom cover flaw detection method and system.
Background
With the development of watch manufacturing industry, the demands of consumers on the appearance quality of the watch bottom cover are increasing, wherein the watch bottom cover is a key component of the watch, and whether the surface of the watch bottom cover has flaws or not can greatly influence the appearance quality and market competitiveness of a product.
In the prior art, flaws in the bottom cover of the watch are detected by the edge detection algorithm, but because flaws in the bottom cover of the watch are extremely unobvious, the threshold value of the edge detection algorithm is extremely low, so that detection results can be seriously disturbed by noise, and also because flaws are extremely unobvious, if the flaws are denoised, a large amount of flaw information can be lost, so that flaws in the bottom cover of the watch cannot be accurately obtained by the traditional detection means, and the flaw detection effect is poor.
Disclosure of Invention
In order to solve the technical problems that the defects in the bottom cover of the watch cannot be accurately obtained by the traditional detection means and the defect detection effect is poor, the invention aims to provide a machine vision-based method and system for detecting the defects of the bottom cover of the watch, and the adopted technical scheme is as follows:
the invention provides a machine vision-based watch bottom cover flaw detection method, which comprises the following steps:
Acquiring a gray image of a watch bottom cover;
Obtaining a plurality of edge images corresponding to the gray level images based on the descending iteration sequence of the threshold value; obtaining noise factors of each edge pixel point according to the relative distance distribution among different edge pixel points in the neighborhood range of each edge pixel point, and obtaining flaw factors of each edge pixel point on each edge image according to the gradient change characteristics of the edge pixel point in the local range of the same position among different edge images and the noise factors;
Obtaining a plurality of suspected flaw lines according to the position distribution of edge pixel points on a first edge image, obtaining transition lines among the suspected flaw lines, obtaining the connection degree between the two suspected flaw lines according to the gradient direction of the pixel points between the two suspected flaw lines and the relative distribution characteristics of the transition lines, obtaining the same flaw probability among the two suspected flaw lines according to the position distribution of the difference edge pixel points among different edge images and the transition lines between the two suspected flaw lines, the corresponding flaw factors and the connection degree, and obtaining the flaw weight of each edge pixel point on each edge image according to the relative distance between each edge pixel point and different transition lines on each edge image and the same flaw probability among the corresponding two suspected flaw lines;
Obtaining the flaw probability of each edge pixel point on the last edge image according to the flaw weight and the gray distribution of different edge pixel points in the local range of each edge pixel point on the last edge image;
and performing flaw detection according to the flaw probability.
Further, the method for acquiring the edge image comprises the following steps:
and detecting the gray level image by adopting a sobel operator based on the iteration sequence of the threshold value reduction, and obtaining a plurality of corresponding edge images.
Further, the method for obtaining the noise factor comprises the following steps:
obtaining a noise factor according to an obtaining formula of the noise factor, wherein the obtaining formula of the noise factor is expressed as follows for each edge image:
Wherein, the method comprises the steps of, Represent the firstNoise factors of the edge pixel points; Represent the first Variance of relative distances between the edge pixels and other edge pixels in the neighborhood; Represent the first Edge pixel points and neighborhood in-rangeThe relative distance between the other edge pixels; Representing the number of other edge pixel points in the neighborhood range; Represent the first Of edge pixels neighborhood in-range firstOther edge pixel points and the firstThe relative distance between the other edge pixels; Representing a logistic function; The representation takes absolute value.
Further, the method for obtaining the flaw factors comprises the following steps:
obtaining an included angle cosine value of a gradient direction between each edge pixel point on each edge image and each edge pixel point in a local range, and taking the included angle cosine value as gradient direction similarity;
obtaining the ratio between the gradient direction similarity corresponding to different edge pixel points in the local range and the noise factor to be accumulated, and taking the ratio as a first accumulated value;
Obtaining a difference value of a first accumulated value in a local range corresponding to the same position between each other edge image and each edge image as a first difference value; and accumulating the first difference values of all the following edge images to be used as the flaw factors of each edge pixel point on each edge image.
Further, the obtaining a plurality of suspected flaw lines and obtaining transition lines between the suspected flaw lines includes:
For the first edge image, other edge pixel points in an 8 neighborhood range of each edge pixel point are obtained and used as similar pixel points;
And acquiring the relative distance between the two suspected flaw lines and the corresponding edge pixel point, selecting the pixel point with the smallest relative distance, and connecting the corresponding edge pixel point to form a transition line between the two suspected flaw lines.
Further, the method for obtaining the connection degree comprises the following steps:
Obtaining the average value of the gradient directions of all pixel points on each suspected flaw line, and taking the average value as the overall gradient direction of each suspected flaw line;
Obtaining the average value of the included angles between the gradient directions of the two suspected flaw lines and the transition line, and calculating the cosine value of the average value of the included angles as a second connecting coefficient;
and obtaining the product between the first connection coefficient and the second connection coefficient, and comparing the product result with the corresponding relative distance of the transition line to obtain the connection degree between the two suspected flaw lines.
Further, the method for acquiring the same defect possibility comprises the following steps:
Comparing the difference of the edge pixel points between each other edge image and the first edge image to obtain the difference edge pixel point on each other edge image;
And obtaining the same flaw possibility between two suspected flaw lines according to the relative distances between different difference edge pixel points and transition lines on all other edge images, flaw factors and connection degrees between the corresponding two suspected flaw lines, wherein the relative distances between the difference edge pixel points and the transition lines are in negative correlation with the same flaw possibility, and the flaw factors and the connection degrees between the corresponding two suspected flaw lines are in positive correlation with the same flaw possibility.
Further, the method for obtaining the flaw weight comprises the following steps:
For any edge image, according to the relative distance between each edge pixel point and each transition line and the same flaw probability between two suspected flaw lines corresponding to each transition line, the flaw weight of each edge pixel point is obtained, the relative distance between each edge pixel point and each transition line is inversely related to the flaw weight, and the same flaw probability between two suspected flaw lines corresponding to each transition line is positively related to the flaw weight.
Further, the method for obtaining the defect probability of each edge pixel point includes:
For the last edge image, obtaining a difference accumulated value of gray values between each other edge pixel point and different other edge pixel points in the local range of each edge pixel point as a gray difference level;
And obtaining the flaw probability of each edge pixel point according to the flaw weight and the gray level difference of different other edge pixel points in the local range of each edge pixel point, wherein the flaw weight and the flaw probability are positively correlated, and the gray level difference and the flaw probability are negatively correlated.
The invention also provides a watch bottom cover flaw detection system based on machine vision, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the steps of any one of the watch bottom cover flaw detection methods based on machine vision when executing the computer program.
The invention has the following beneficial effects:
According to the method, a plurality of edge images corresponding to the gray level images are obtained based on the descending iteration sequence of the threshold value, so that the extraction of edge information of different levels is facilitated, and fine edge features in the images are captured; the method comprises the steps of obtaining noise factors of each edge pixel point according to relative distance distribution among different edge pixel points in a neighborhood range of each edge pixel point, which is beneficial to evaluating noise levels of the edge pixel points, obtaining gradient change characteristics of the edge pixel points in a local range of the same position between different edge images according to the gradient change characteristics of the edge pixel points and the noise factors of the edge pixel points in the neighborhood range of the same position between the different edge images, obtaining flaw factors of each edge pixel point on each edge image, evaluating flaw degrees of the edge pixel points more accurately, obtaining a plurality of suspected flaw lines according to position distribution of the edge pixel points on a first edge image, obtaining transition lines between the suspected flaw lines, obtaining morphology and characteristics of a flaw area, identifying potential flaw areas according to gradient directions of the pixel points between the two suspected flaw lines, obtaining connection degrees between the two flaw lines, which are beneficial to evaluating connection tightness between the flaw lines, obtaining flaw degrees between the two flaw lines according to the position between the difference edge pixel points between the different edge images, the corresponding flaw lines, and the flaw factors between the two flaw lines, and the flaw lines can be identified according to the relative distribution characteristics of the two flaw lines, and the flaw areas can be more comprehensively identified between the two flaw lines, and the flaw areas can be identified according to the position distribution of the two flaw lines between the two flaw lines, and the two flaw lines can be more comprehensively identified, the method comprises the steps of obtaining the flaw weight of each edge pixel point on each edge image, helping to highlight a flaw area and reduce the influence of a non-flaw area, obtaining the flaw possibility of each edge pixel point on the last edge image according to the flaw weight and gray distribution of different edge pixel points in the local range of each edge pixel point on the last edge image, improving the reliability and accuracy of flaw detection, identifying the flaw area more accurately, and carrying out flaw detection. The invention improves the accuracy of flaw detection by obtaining the accurate flaw probability of each edge pixel point.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for inspecting flaws on a bottom cover of a wristwatch based on machine vision according to an embodiment of the invention;
Fig. 2 is a flowchart of a method for obtaining a defect factor according to an embodiment of the present invention.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following detailed description refers to the specific implementation, structure, characteristics and effects of a machine vision-based watch bottom cover flaw detection method and system according to the invention with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
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.
The following specifically describes a specific scheme of a flaw detection method and a flaw detection system for a watch bottom cover based on machine vision.
Referring to fig. 1, a method flowchart of a method for checking flaws of a bottom cover of a wristwatch based on machine vision according to an embodiment of the invention is shown, and specifically includes:
And S1, acquiring a gray image of the watch bottom cover.
In the embodiment of the invention, in order to ensure the quality of the appearance of the watch, flaw detection is required to be carried out on the watch bottom cover, and firstly, the surface image of the watch bottom cover is acquired through an industrial camera. It should be noted that, the processing method of each watch bottom cover is the same, and is not described herein, and only a surface image of one watch bottom cover is used for example in the following.
In one embodiment of the invention, to facilitate the subsequent image processing process, the acquired surface image of the watch bottom cover is subjected to a preprocessing operation to enhance the quality of the image, and then the processed image is analyzed. It should be noted that the image preprocessing operation is a technical means well known to those skilled in the art, and may be specifically set according to a specific implementation scenario, in one embodiment of the present invention, a gray-scale algorithm is used to obtain a gray-scale image of a bottom cover of a wristwatch, so as to highlight local brightness and variation caused by flaws in the bottom cover of the wristwatch, and outline and details of the image, so that the image is clearer, and is easier to perform operations such as feature extraction and image identification, where the specific gray-scale algorithm is a technical means well known to those skilled in the art, and is not described herein.
Step S2, obtaining a plurality of edge images corresponding to gray images based on a threshold descending iteration sequence, obtaining noise factors of each edge pixel point according to relative distance distribution among different edge pixel points in a neighborhood range of each edge pixel point for any edge image, and obtaining flaw factors of each edge pixel point on each edge image according to gradient change characteristics of each edge pixel point in a local range of the same position among different edge images and the noise factors.
The flaw in the bottom cover of the watch is usually very shallow, when the flaw in the bottom cover is detected, the flaw can be identified by setting the threshold value very low, but the flaw can be identified by the noise of the bottom cover of the watch due to the fact that the flaw is too low, the edge information in the image can be gradually thinned by continuously adjusting the threshold value, the edge images with different finesses can be obtained, the information in the image can be more comprehensively understood, and a plurality of edge images corresponding to the gray level images can be obtained based on the descending iteration sequence of the threshold value.
Preferably, in one embodiment of the present invention, the method for acquiring an edge image includes:
and detecting the gray level image by adopting a sobel operator based on the iteration sequence of the threshold value reduction, and obtaining a plurality of corresponding edge images.
It should be noted that, in one embodiment of the present invention, the descending iteration sequence of the threshold value starts with a preset starting threshold value, and each descending iteration obtains a next threshold value until reaching a terminating threshold value, so as to obtain a plurality of edge images, where the preset starting threshold value is 20, the terminating threshold value is 5, and each descending iteration step is 1, and in other embodiments of the present invention, the sizes of the preset starting threshold value, the terminating threshold value, and the iteration step can be specifically set according to specific situations, which is not limited and described herein.
It should be noted that the specific sobel operator is a technical means well known to those skilled in the art, and will not be described herein.
The defects in the watch bottom cover are generated by unexpected collision in the process of producing the watch bottom cover, so that pixel points corresponding to the defects represent continuous expression forms in the image, noise is randomly distributed at each position in the image, the distance is relatively discrete, the distribution characteristics among the pixel points can be reflected by analyzing the relative distance distribution among different edge pixel points, the noise expression condition of the pixel points can be evaluated, and for any edge image, the noise factor of each edge pixel point is obtained according to the relative distance distribution among different edge pixel points in the neighborhood range of each edge pixel point.
Preferably, in one embodiment of the present invention, the method for acquiring a noise factor includes:
obtaining a noise factor according to an obtaining formula of the noise factor, wherein the obtaining formula of the noise factor is expressed as follows for each edge image:
;
Wherein, Represent the firstNoise factors of the edge pixel points; Represent the first Variance of relative distances between the edge pixels and other edge pixels in the neighborhood; Represent the first Edge pixel points and neighborhood in-rangeThe relative distance between the other edge pixels; Representing the number of other edge pixel points in the neighborhood range; Represent the first Of edge pixels neighborhood in-range firstOther edge pixel points and the firstThe relative distance between the other edge pixels; Representing a logistic function; The representation takes absolute value.
In the formulation of the acquisition of the noise factor,Represent the firstThe average value of the relative distances between the edge pixel points and different edge pixel points in the neighborhood range is reflected by the firstThe larger the average distance between each edge pixel point and other pixels in the neighborhood, the larger the average distance value, the less close the pixels are,Represent the firstThe average value of the relative distances between different other edge pixel points in the neighborhood range of each edge pixel point reflects the general distance degree between other pixel points in the field range, the larger the average value is, the larger the general distance degree between other pixel points is, the less close the pixel points are,Reflecting the firstThe degree of deviation of the average distance degree of the edge pixel points from other pixel points in the neighborhood range relative to the general distance degree between other pixel points in the neighborhood range, the less closely the distance, the more discrete the distribution, the more likely it is a noise pixel point; Represent the first The larger the variance is, the more discrete the relative distance distribution is, the more likely the noise pixel is, and the larger the noise factor is.
It should be noted that, in one embodiment of the present invention, the method for obtaining the relative distance is to calculate the euclidean distance between the pixel points, in other embodiments of the present invention, the relative distance may also be obtained by calculating the manhattan distance, and the specific euclidean distance and the manhattan distance are technical means well known to those skilled in the art, which are not described herein.
In one embodiment of the present invention, the neighborhood range is a range formed by 10 edge pixels with the nearest relative distance to each edge pixel, and in other embodiments of the present invention, the size of the neighborhood range may be specifically set according to specific situations, which is not limited and described herein.
As the edge detection threshold value is continuously lowered, more and more edge pixel points are relatively identified in the subsequent edge image, and the edge pixel points corresponding to the same flaw are more likely to be identified, the trend and trend of the edge pixel points are reflected by analyzing the gradient change characteristics of the edge pixel points in the local range of the edge pixel points at the same position, the flaw degree of the edge pixel points is helped to be evaluated, the more the noise factor is, the more likely the edge pixel points are noise points, the less the flaw factor is, and the flaw factor of each edge pixel point on each edge image is obtained according to the gradient change characteristics of the edge pixel points in the local range of the edge pixel points at the same position between different edge images and the noise factor.
Preferably, in an embodiment of the present invention, referring to fig. 2, a flowchart of a method for obtaining a defect factor is shown, which includes:
step S201, an included angle cosine value of the gradient direction between each edge pixel point on each edge image and each edge pixel point in the local range is obtained and used as the gradient direction similarity.
Because the flaws of the bottom cover of the watch are generated by accidental collision, the flaws possibly appear in a relatively uniform or regular mode, similar gradient directions exist in pixels of the same flaws in the local scope of the flaws, the similarity between the gradient directions of the pixels is reflected by calculating the cosine value of an included angle of the gradient directions of the pixels, and the larger the cosine value of the included angle is, the more similar the gradient directions are, and the more likely the pixels belong to the same edge.
In one embodiment of the present invention, the size of the local range is 10×10 with each edge pixel point as a center, and in other embodiments of the present invention, the size of the local range may be specifically set according to specific situations, which is not limited and repeated herein.
Step S202, obtaining the ratio between the gradient direction similarity corresponding to different edge pixel points in the local range and the noise factor to be accumulated, and taking the ratio as a first accumulated value.
The ratio reflects the relative strength of the pixel point direction consistency of the edge under the influence of noise, and the larger the gradient direction similarity is, the larger the possibility that the pixel points belong to the same edge is, the larger the noise factor is, the larger the possibility that the pixel points appear as noise is, the smaller the first accumulated value is, and the more likely the pixel points are noise.
Step S203, obtaining the difference value of the first accumulated value in the local range corresponding to the same position between each other edge image and each edge image as the first difference value, and accumulating the first difference value of all the edge images as the flaw factors of each edge pixel point on each edge image.
With the continuous decrease of the threshold value, the more the other edge images exist, the difference of the first accumulated value among different edge images is calculated, the difference of the different edge images in the aspect of the consistency of the edge pixel point directions is reflected, the larger the difference is, the more the pixel points existing in the subsequent edge images are not the pixel points on the same flaw, and the less the possibility that the edge pixel points are flaws is.
In one embodiment of the invention, the formula for the blemish factor for each edge image is expressed as:
;
Wherein, Represent the firstA flaw factor of each edge pixel point; Represent the first The edge pixels are at the following otherLocal in-range of corresponding position on the edge imageAnd the first and secondCosine values of included angles in gradient directions among the edge pixel points; Represent the first The edge pixels are at the following otherLocal in-range of corresponding position on the edge imageNoise factors of the edge pixel points; Representing the first on each edge image Local in-range of each edge pixel pointAnd the first and secondCosine values of included angles in gradient directions among the edge pixel points; Representing the first on each edge image Local in-range of each edge pixel pointNoise factors of the edge pixel points; representing the other following On the sheet edge imageThe number of edge pixel points in the local range at the corresponding positions of the edge pixel points; Representing the first on each edge image The number of edge pixel points within the local range of the edge pixel points; Representing the number of other edge images following each edge image.
In the formulation of the flaw factor,Represent the firstThe edge pixels are at the following otherLocal in-range of corresponding position on the edge imageAnd the first and secondCosine value and the first angle in gradient direction between the edge pixel pointsThe ratio between the noise factors of the individual edge pixels,The first accumulated value of each edge image is represented, the larger the first accumulated value is, the larger the cosine value of the included angle is, the larger the included angle of the gradient directions between the pixel points is, the smaller the gradient directions are, and the lower the possibility of flaws is.
The method comprises the steps of S3, obtaining a plurality of suspected flaw lines according to position distribution of edge pixel points on a first edge image, obtaining transition lines among the suspected flaw lines, obtaining connection degrees among the two suspected flaw lines according to gradient directions of the pixel points among the two suspected flaw lines and relative distribution characteristics of the transition lines, obtaining identical flaw probability among the two suspected flaw lines according to position distribution of the transition lines between different edge pixel points and the two suspected flaw lines between different edge images, corresponding flaw factors and connection degrees, and obtaining flaw weight of each edge pixel point on each edge image according to relative distances between each edge pixel point and different transition lines on each edge image and identical flaw probability among the corresponding two suspected flaw lines.
Because the flaw of the watch bottom cover is very shallow, the flaw in the edge image is possibly in a discontinuous state, the more likely the flaw is noise in subsequent judgment, the adjacent discontinuous flaw edge can be more effectively identified by analyzing the position distribution of the edge pixel points, and the flaw edge is constructed into a complete suspected flaw line, so that the noise interference is reduced, and the identification accuracy is improved. And obtaining a plurality of suspected flaw lines according to the position distribution of the edge pixel points on the first edge image, and obtaining transition lines among the suspected flaw lines.
Preferably, in one embodiment of the present invention, obtaining a plurality of suspected flaw lines, and obtaining transition lines between the suspected flaw lines, includes:
For the first edge image, other edge pixel points in an 8 neighborhood range of each edge pixel point are obtained and used as similar pixel points;
And acquiring the relative distance between the two suspected flaw lines and the corresponding edge pixel point, selecting the pixel point with the smallest relative distance, and connecting the corresponding edge pixel point to form a transition line between the two suspected flaw lines.
The gradient directions of the pixel points in the same flaw line are similar, the areas between the two flaw lines are mutually perpendicular to the gradient directions, the connectivity between the two suspected flaw lines is better evaluated by analyzing the gradient directions of the pixel points and the relative distribution characteristics of the transition lines, and the connection degree between the two suspected flaw lines is obtained according to the gradient directions of the pixel points between the two suspected flaw lines and the relative distribution characteristics of the transition lines.
Preferably, in one embodiment of the present invention, the method for obtaining the connection degree includes:
Obtaining the average value of the gradient directions of all pixel points on each suspected flaw line, and taking the average value as the overall gradient direction of each suspected flaw line;
obtaining the average value of the included angles between the gradient directions of the two suspected flaw lines and the transition line, and calculating the cosine value of the average value of the included angles to be used as a second connecting coefficient;
and obtaining the product between the first connection coefficient and the second connection coefficient, and comparing the product result with the corresponding relative distance of the transition line to obtain the connection degree between the two suspected flaw lines.
Along with the continuous reduction of the threshold value of the edge detection operator, new pixel points gradually appear near the transition line between two suspected flaw lines in the same flaw, the spatial relationship between the suspected flaw lines can be reflected by analyzing the position distribution of the difference edge pixel points and the transition line, flaw factors reflect the abnormal degree of the edge pixel points relative to surrounding pixels, the flaw degree is estimated, the connection degree reflects the similarity and continuity of the two suspected flaw lines in terms of gradient directions and the like, the continuous degree is high, the probability caused by the same flaw is high, and the same flaw probability between the two suspected flaw lines is obtained according to the position distribution of the difference edge pixel points between different edge images and the transition line between the two suspected flaw lines, the corresponding flaw factors and the connection degree.
Preferably, in one embodiment of the present invention, the method for obtaining the same defect probability includes:
Comparing the difference of the edge pixel points between each other edge image and the first edge image to obtain the difference edge pixel point on each other edge image;
And obtaining the same flaw possibility between two suspected flaw lines according to the relative distances between different difference edge pixel points and transition lines on all other edge images, flaw factors and connection degrees between the corresponding two suspected flaw lines, wherein the relative distances between the difference edge pixel points and the transition lines are in negative correlation with the same flaw possibility, and the flaw factors and the connection degrees between the corresponding two suspected flaw lines are in positive correlation with the same flaw possibility.
The larger the relative distance between the differential edge pixel point and the transition line is, the more the newly added pixel point is far away from the transition line, the larger the gap between the two suspected flaw lines is, the smaller the probability that the two suspected flaw lines are the same flaw line is, the larger the flaw factor is, the larger the probability that the pixel point is a flaw pixel point is, the larger the connection degree between the two suspected flaw lines is, and the larger the probability that the two suspected flaw lines are the same flaw line is.
In one embodiment of the invention, the same flaw likelihood is formulated as:
;
Wherein, Representing the same likelihood of flaws for two suspected flaw lines; Representing the degree of connection between two suspected flaw lines; Represent the first The first of the other edge imagesThe flaw factors of the pixel points of the difference edge; Represent the first The first of the other edge imagesThe relative distance between each difference edge pixel point and the transition line; Representing the number of differential edge pixels; representing the number of edge images other than the first edge image.
In the same formula of the probability of a flaw,Represent the firstThe first of the other edge imagesFlaw factor sum of each difference edge pixel pointThe larger the ratio of the relative distances between the differential edge pixel points and the transition lines, the larger the flaw factor, the smaller the relative distance, the more likely to be the flaw pixel points located between the suspected flaw lines, and the larger the connection degree between the two suspected flaw lines, the greater the same flaw probability.
By calculating the relative distance between each edge pixel point and different transition lines, the relative position relation between the pixel points and the defect area can be known, the edge pixel points with a smaller distance are more likely to belong to the defect area, the same defect probability reflects the association degree and consistency between two suspected defect lines, and therefore higher defect weight is given, and the defect weight of each edge pixel point on each edge image is obtained according to the relative distance between each edge pixel point and different transition lines on each edge image and the same defect probability between the corresponding two suspected defect lines.
Preferably, in one embodiment of the present invention, the method for obtaining the flaw weight includes:
For any edge image, according to the relative distance between each edge pixel point and each transition line and the same flaw probability between two suspected flaw lines corresponding to each transition line, the flaw weight of each edge pixel point is obtained, the relative distance between each edge pixel point and each transition line is inversely related to the flaw weight, and the same flaw probability between two suspected flaw lines corresponding to each transition line is positively related to the flaw weight.
Wherein the larger the relative distance between each edge pixel point and each transition line is, the more far away from the gap between two suspected flaw lines, the less likely to show the same flaw line, the smaller the flaw weight is, and each edge pixel point corresponds to the firstThe greater the probability of the same flaw between two suspected flaw lines where the transition lines are located, the greater the confidence of the flaw, and the greater the flaw weight.
In one embodiment of the invention, for any edge image, the formula for the blemish weight is expressed as:
;
Wherein, Representing the flaw weight of each edge pixel point; representing that each edge pixel point corresponds to the first The same possibility of flaws between two suspected flaw lines where the transition lines are located; Representing each edge pixel point and the first The relative distance between the transition lines; representing the number of transition lines in the edge image; Representing the normalization function.
In the formula of the flaw weight,Representing that each edge pixel point corresponds to the firstThe same defect probability between two suspected defect lines where the transition lines are located and each edge pixel point and the first edge pixel pointThe ratio of the relative distances between the transition lines, i.e. the greater the ratio, the greater the likelihood of the same flaw, the smaller the relative distance, and the greater the flaw weight.
And S4, obtaining the flaw possibility of each edge pixel point on the last edge image according to the flaw weights and the gray distribution of different edge pixel points in the local range of each edge pixel point on the last edge image.
In the defects generated by the same collision, the stress conditions in all positions of the defects are similar, so that the gray values of pixel points on the defects in the same defects are similar, the gray values of noise are random, and the defect possibility is more comprehensively evaluated by analyzing the defect weight and gray distribution. And obtaining the flaw probability of each edge pixel point on the last edge image according to the flaw weights and the gray distribution of different edge pixel points in the local range of each edge pixel point on the last edge image.
Preferably, in one embodiment of the present invention, the method for obtaining the possibility of flaws includes:
For the last edge image, obtaining a difference accumulated value of gray values between each other edge pixel point and different other edge pixel points in the local range of each edge pixel point as a gray difference level;
And obtaining the flaw probability of each edge pixel point according to the flaw weight and the gray level difference of different other edge pixel points in the local range of each edge pixel point, wherein the flaw weight and the flaw probability are positively correlated, and the gray level difference and the flaw probability are negatively correlated.
The larger the flaw weight is, the larger the possibility of flaws is, the larger the gray level difference level is, the more the noise pixel point distribution is likely, and the lower the flaw possibility is.
In one embodiment of the invention, the formula for the likelihood of flaws is expressed as:
;
Wherein, Represent the firstThe possibility of flaws of the individual edge pixel points; Represent the first Local in-range of each edge pixel pointFlaw weights of other edge pixel points; Represent the first Local in-range of each edge pixel pointGray values of the other edge pixel points; Represent the first Local in-range of each edge pixel pointGray values of the other edge pixel points; Represent the first The number of other edge pixel points in the local range of the edge pixel points; Representing the normalization function.
In the formula of the probability of a flaw,Represent the firstLocal in-range of each edge pixel pointGray value sum of other edge pixelsThe difference between the gray values of the other edge pixels,Represent the firstLocal in-range of each edge pixel pointAnd the difference accumulated value of gray values between the other edge pixel points and different other edge pixel points. I.e. the level of gray scale difference,Represent the firstLocal in-range of each edge pixel pointThe ratio of the flaw weight of each other edge pixel point to the corresponding gray scale difference level,The accumulated value of the corresponding ratios of all other edge pixel points in the local range is represented, the larger the accumulated value is, the larger the ratio is, the larger the flaw weight of the corresponding other edge pixel points is, the smaller the gray level difference is, and the more likely the flaw pixel points are.
And S5, performing flaw detection according to the flaw probability.
The defect possibility of each edge pixel point is obtained, so that defects on the surface of a product can be identified more accurately, and the detection precision and reliability are improved.
It should be noted that in another embodiment of the present invention, after obtaining the defect probability of each edge pixel point on the last edge image, detecting the defect includes comparing the defect probability of each edge pixel point with a preset probability threshold, if the defect probability of each edge pixel point is greater than the preset probability threshold, determining that the edge pixel point is a defective pixel point, obtaining all the defective pixel points on the last edge image, and using the region formed by all the defective pixel points as a defective edge, and connecting all the defective edges by using an edge connection algorithm to obtain a defective region in the bottom cover of the watch, wherein the specific edge connection algorithm is a technical means known to those skilled in the art and will not be repeated herein.
It should be noted that, in one embodiment of the present invention, the preset likelihood threshold is 0.8, and in other embodiments of the present invention, the preset likelihood threshold may be specifically set according to specific situations, which are not limited and described herein.
In summary, the method comprises the steps of obtaining noise factors and flaw factors of each edge pixel point for any edge image, obtaining a plurality of suspected flaw lines according to position distribution of the edge pixel points on a first edge image, obtaining transition lines among the suspected flaw lines, obtaining connection degrees of the two suspected flaw lines according to gradient directions of the pixel points between the two suspected flaw lines and relative distribution characteristics of the transition lines, obtaining flaw weights of each edge pixel point on the last edge image according to relative distances between each edge pixel point on each edge image and different transition lines and the same flaw probability between the corresponding two suspected flaw lines, combining gray scale distribution of the pixel points, and obtaining flaw probability of each edge pixel point on the last edge image. The invention improves the accuracy of flaw detection by obtaining the accurate flaw probability of each edge pixel point.
The invention also provides a watch bottom cover flaw detection system based on machine vision, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes any one step of the watch bottom cover flaw detection method based on machine vision when executing the computer program.
It should be noted that the sequence of the embodiments of the present invention is only for description, and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.

Claims (10)

1. A machine vision based method for inspecting flaws in a bottom cover of a wristwatch, the method comprising:
Acquiring a gray image of a watch bottom cover;
Obtaining a plurality of edge images corresponding to the gray level images based on the descending iteration sequence of the threshold value; obtaining noise factors of each edge pixel point according to the relative distance distribution among different edge pixel points in the neighborhood range of each edge pixel point, and obtaining flaw factors of each edge pixel point on each edge image according to the gradient change characteristics of the edge pixel point in the local range of the same position among different edge images and the noise factors;
Obtaining a plurality of suspected flaw lines according to the position distribution of edge pixel points on a first edge image, obtaining transition lines among the suspected flaw lines, obtaining the connection degree between the two suspected flaw lines according to the gradient direction of the pixel points between the two suspected flaw lines and the relative distribution characteristics of the transition lines, obtaining the same flaw probability among the two suspected flaw lines according to the position distribution of the difference edge pixel points among different edge images and the transition lines between the two suspected flaw lines, the corresponding flaw factors and the connection degree, and obtaining the flaw weight of each edge pixel point on each edge image according to the relative distance between each edge pixel point and different transition lines on each edge image and the same flaw probability among the corresponding two suspected flaw lines;
Obtaining the flaw probability of each edge pixel point on the last edge image according to the flaw weight and the gray distribution of different edge pixel points in the local range of each edge pixel point on the last edge image;
and performing flaw detection according to the flaw probability.
2. The machine vision-based watch bottom cover flaw inspection method of claim 1, wherein the edge image acquisition method comprises:
and detecting the gray level image by adopting a sobel operator based on the iteration sequence of the threshold value reduction, and obtaining a plurality of corresponding edge images.
3. The machine vision based watch bottom cover flaw inspection method of claim 1, wherein the noise factor obtaining method comprises:
obtaining a noise factor according to an obtaining formula of the noise factor, wherein the obtaining formula of the noise factor is expressed as follows for each edge image:
4. The machine vision based watch bottom flaw detection method of claim 1, wherein the flaw factor obtaining method comprises:
obtaining an included angle cosine value of a gradient direction between each edge pixel point on each edge image and each edge pixel point in a local range, and taking the included angle cosine value as gradient direction similarity;
obtaining the ratio between the gradient direction similarity corresponding to different edge pixel points in the local range and the noise factor to be accumulated, and taking the ratio as a first accumulated value;
Obtaining a difference value of a first accumulated value in a local range corresponding to the same position between each other edge image and each edge image as a first difference value; and accumulating the first difference values of all the following edge images to be used as the flaw factors of each edge pixel point on each edge image.
5. The machine vision based watch bottom cover flaw detection method according to claim 1, wherein the obtaining a plurality of suspected flaw lines and obtaining transition lines between the suspected flaw lines comprises:
For the first edge image, other edge pixel points in an 8 neighborhood range of each edge pixel point are obtained and used as similar pixel points;
And acquiring the relative distance between the two suspected flaw lines and the corresponding edge pixel point, selecting the pixel point with the smallest relative distance, and connecting the corresponding edge pixel point to form a transition line between the two suspected flaw lines.
6. The machine vision-based watch bottom cover flaw detection method according to claim 1, wherein the connection degree acquisition method comprises:
Obtaining the average value of the gradient directions of all pixel points on each suspected flaw line, and taking the average value as the overall gradient direction of each suspected flaw line;
Obtaining the average value of the included angles between the gradient directions of the two suspected flaw lines and the transition line, and calculating the cosine value of the average value of the included angles as a second connecting coefficient;
and obtaining the product between the first connection coefficient and the second connection coefficient, and comparing the product result with the corresponding relative distance of the transition line to obtain the connection degree between the two suspected flaw lines.
7. The machine vision based watch bottom cover flaw detection method according to claim 1, wherein the method for obtaining the same flaw probability comprises:
Comparing the difference of the edge pixel points between each other edge image and the first edge image to obtain the difference edge pixel point on each other edge image;
And obtaining the same flaw possibility between two suspected flaw lines according to the relative distances between different difference edge pixel points and transition lines on all other edge images, flaw factors and connection degrees between the corresponding two suspected flaw lines, wherein the relative distances between the difference edge pixel points and the transition lines are in negative correlation with the same flaw possibility, and the flaw factors and the connection degrees between the corresponding two suspected flaw lines are in positive correlation with the same flaw possibility.
8. The machine vision based watch bottom flaw detection method of claim 1, wherein the flaw weight acquisition method comprises:
For any edge image, according to the relative distance between each edge pixel point and each transition line and the same flaw probability between two suspected flaw lines corresponding to each transition line, the flaw weight of each edge pixel point is obtained, the relative distance between each edge pixel point and each transition line is inversely related to the flaw weight, and the same flaw probability between two suspected flaw lines corresponding to each transition line is positively related to the flaw weight.
9. The machine vision based watch bottom cover flaw detection method according to claim 1, wherein the method for obtaining the flaw probability of each edge pixel comprises:
For the last edge image, obtaining a difference accumulated value of gray values between each other edge pixel point and different other edge pixel points in the local range of each edge pixel point as a gray difference level;
And obtaining the flaw probability of each edge pixel point according to the flaw weight and the gray level difference of different other edge pixel points in the local range of each edge pixel point, wherein the flaw weight and the flaw probability are positively correlated, and the gray level difference and the flaw probability are negatively correlated.
10. A machine vision based watch bottom flaw detection system comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, performs the steps of a machine vision based watch bottom flaw detection method according to any one of claims 1 to 9.
CN202510194572.6A 2025-02-21 2025-02-21 Watch bottom cover flaw detection method and system based on machine vision Active CN119672026B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202510194572.6A CN119672026B (en) 2025-02-21 2025-02-21 Watch bottom cover flaw detection method and system based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202510194572.6A CN119672026B (en) 2025-02-21 2025-02-21 Watch bottom cover flaw detection method and system based on machine vision

Publications (2)

Publication Number Publication Date
CN119672026A CN119672026A (en) 2025-03-21
CN119672026B true CN119672026B (en) 2025-04-11

Family

ID=94987963

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202510194572.6A Active CN119672026B (en) 2025-02-21 2025-02-21 Watch bottom cover flaw detection method and system based on machine vision

Country Status (1)

Country Link
CN (1) CN119672026B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110796115A (en) * 2019-11-08 2020-02-14 厦门美图之家科技有限公司 Image detection method and device, electronic equipment and readable storage medium
CN116630309A (en) * 2023-07-21 2023-08-22 微山县天阔纺织有限公司 Cloth weft-break flaw detection method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116977195A (en) * 2023-01-30 2023-10-31 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for adjusting restoration model
CN117314894B (en) * 2023-11-27 2024-03-29 深圳市金三维实业有限公司 Method for rapidly detecting defects of watch bottom cover

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110796115A (en) * 2019-11-08 2020-02-14 厦门美图之家科技有限公司 Image detection method and device, electronic equipment and readable storage medium
CN116630309A (en) * 2023-07-21 2023-08-22 微山县天阔纺织有限公司 Cloth weft-break flaw detection method

Also Published As

Publication number Publication date
CN119672026A (en) 2025-03-21

Similar Documents

Publication Publication Date Title
CN115311292B (en) Strip steel surface defect detection method and system based on image processing
CN113570605A (en) Defect detection method and system based on liquid crystal display panel
CN116152242B (en) Visual detection system of natural leather defect for basketball
CN115861291B (en) Chip circuit board production defect detection method based on machine vision
CN109671078B (en) Method and device for detecting product surface image abnormity
CN111192225B (en) Method, apparatus and computer program medium for determining whether a pipe is defective
CN116883408B (en) Integrating instrument shell defect detection method based on artificial intelligence
CN117830312B (en) Alloy crack nondestructive testing method based on machine vision
CN117649412B (en) Aluminum material surface quality detection method
CN118657740B (en) Hardware processing quality inspection method, electronic equipment and system
CN115274486B (en) Semiconductor surface defect identification method
CN117078679B (en) Automatic assembly line production detection method for cooling fan based on machine vision
CN118657759B (en) Composite pipe quality detection method and system based on machine vision
CN115690089A (en) Image enhancement preprocessing method and system for weak defect detection
CN111462081A (en) Method for quickly extracting characteristic region for workpiece surface quality detection
CN118521591B (en) Visual detection method and system for surface defects of optoelectronic device
CN119295466A (en) Cable defect detection method and system based on image processing
CN119672026B (en) Watch bottom cover flaw detection method and system based on machine vision
CN114638833A (en) Non-ferrous metal rolling quality detection method and system based on machine vision
CN117455801A (en) Visual detection method for production quality of anti-slip gasket
CN116168020B (en) Leather defect detection method
CN117237350A (en) Real-time detection method for quality of steel castings
CN119863453B (en) Watch case defect inspection method and system based on vision assistance
CN118583094B (en) Glass substrate coating detection method and system
CN119643599B (en) A method for detecting internal void defects in MOSFET

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant