CN115690105B - Milling cutter scratch detection method based on computer vision - Google Patents
Milling cutter scratch detection method based on computer vision Download PDFInfo
- Publication number
- CN115690105B CN115690105B CN202211718931.6A CN202211718931A CN115690105B CN 115690105 B CN115690105 B CN 115690105B CN 202211718931 A CN202211718931 A CN 202211718931A CN 115690105 B CN115690105 B CN 115690105B
- Authority
- CN
- China
- Prior art keywords
- milling cutter
- scratch
- image
- characteristic
- haar
- 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
Links
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Image Processing (AREA)
Abstract
The invention relates to the technical field of image data processing, in particular to a milling cutter scratch detection method based on computer vision, which is characterized in that semantic segmentation is respectively carried out on each surface gray level image of the surface of a milling cutter to obtain a milling cutter gray level image, and each milling cutter gray level image is uniformly divided into at least two sub-images; acquiring a characteristic circle-like coefficient of each pixel point according to the gradient of the pixel points in the subimages; constructing a milling cutter surface scratch haar operator according to the characteristic circle-like coefficient of each pixel point, and acquiring a surface roughness complex factor of the subimage by using the milling cutter surface scratch haar operator; obtaining the surface scratch defect probability of the milling cutter gray level image according to the surface roughness complex factor of each subimage; and carrying out milling cutter scratch detection according to the surface scratch defect probability of each milling cutter gray level image. The invention improves the accuracy of the scratch detection result of the milling cutter.
Description
Technical Field
The invention relates to the technical field of image data processing, in particular to a milling cutter scratch detection method based on computer vision.
Background
The die is cut and rubbed by the milling cutter on the numerical control machine tool, so that machine parts meeting requirements are finally obtained, but the milling cutter in the numerical control machine tool can be worn after the die is machined for a long time, and the surface of the milling cutter is scratched and worn.
The worn milling cutter may lose the raw material of the die when processing the mechanical parts with high precision, so that the difference between the finally processed mechanical parts and the required precision is large, and the machine tool can be vibrated in serious conditions, so that production accidents are caused, and the production and processing costs of enterprises are increased.
At present, for the scratch abrasion detection of a milling cutter, firstly, a surface image of the milling cutter is collected, then, threshold segmentation is carried out on the surface image based on a segmentation threshold set by experience, and the scratch defect detection is realized according to a threshold segmentation result. However, the empirically set segmentation threshold is easily affected by subjectivity, which results in inaccurate detection results of the scratch defects.
Disclosure of Invention
In order to solve the problem that the result of the scratch defect detection is inaccurate due to the segmentation threshold set by experience, the invention aims to provide a milling cutter scratch detection method based on computer vision, and the adopted technical scheme is as follows:
one embodiment of the invention provides a milling cutter scratch detection method based on computer vision, which comprises the following steps:
acquiring at least two surface gray level images of the surface of the milling cutter; performing semantic segmentation on each surface gray level image to obtain a milling cutter gray level image, and uniformly dividing each milling cutter gray level image into at least two sub-images;
for any sub-image of any milling cutter gray level image, acquiring a characteristic circle-like coefficient of each pixel point according to the gradient of the pixel points in the sub-image; constructing a milling cutter surface scratch haar operator according to the characteristic circle-like coefficient of each pixel point, acquiring a haar characteristic value of each pixel point in the subimage by using the milling cutter surface scratch haar operator, and acquiring a characteristic image according to the haar characteristic value; acquiring a surface roughness complex factor of the subimage according to the characteristic image;
for any milling cutter gray level image, obtaining the surface scratch defect probability of the milling cutter gray level image according to the surface roughness complex factor and the characteristic image of each sub-image under the milling cutter gray level image; and carrying out milling cutter scratch detection according to the surface scratch defect probability of each milling cutter gray level image.
Further, the method for obtaining the characteristic circle-like coefficient of each pixel point according to the gradient of the pixel points in the sub-image comprises the following steps:
and for any pixel point in the sub-image, constructing a Hessian matrix according to the gradient of the pixel point, taking the maximum characteristic value of the Hessian matrix as the scratch orthogonal direction characteristic value of the pixel point, taking the minimum characteristic value of the Hessian matrix as the scratch extending direction characteristic value of the pixel point, and taking the ratio of the scratch orthogonal direction characteristic value to the scratch extending direction characteristic value as the characteristic circle-like coefficient of the pixel point.
Further, the method for constructing the milling cutter surface scratch haar operator according to the characteristic circle-like coefficient of each pixel point comprises the following steps:
setting a characteristic circle-like coefficient threshold, counting the number of pixels of which the characteristic circle-like coefficient is smaller than the characteristic circle-like coefficient threshold as a first number, and calculating the ratio of the first number to the total number of pixels in the subimage and recording the ratio as a first ratio;
the milling cutter surface scratch haar operator is composed of a black rectangle and a white rectangle, the milling cutter surface scratch haar operator is set to be a diagonal characteristic, and the direction of a characteristic vector corresponding to a characteristic value in the scratch orthogonal direction is the same as the distribution direction of the black rectangle in the milling cutter surface scratch haar operator;
acquiring a difference value between a constant 1 and a first ratio, and taking the product of the side length of the sub-image and the difference value as the side length of a black rectangle in a milling cutter surface scratch haar operator; and acquiring an adjusting proportion coefficient according to the first ratio, and acquiring the size of the milling cutter surface scratch haar operator according to the product of the side length of a black rectangle in the milling cutter surface scratch haar operator and the adjusting proportion coefficient.
Further, the method for obtaining the adjustment scaling factor according to the first ratio includes:
when the difference value between the constant 1 and the first ratio is smaller than a first threshold value, the adjusting proportion coefficient takes a first set value, and when the difference value between the constant 1 and the first ratio is larger than or equal to the first threshold value, the adjusting proportion coefficient takes a second set value.
Further, the method for acquiring the characteristic image includes:
and normalizing the haar characteristic value of each pixel point in the subimage to obtain a corresponding normalized haar characteristic value, wherein an image formed by the normalized haar characteristic values of all the pixel points in the subimage is a characteristic image.
Further, the method for acquiring the surface roughness complexity factor of the sub-image according to the characteristic image comprises the following steps:
and constructing a Weber distribution model of the characteristic image, acquiring shape parameters and proportion parameters of the Weber distribution model by using a maximum likelihood estimation method, acquiring corresponding ratios by using the shape parameters as numerators and the proportion parameters as denominators, and recording results obtained by using the opposite numbers of the ratios as indexes of natural constants as surface roughness complex factors of the subimages.
Further, the method for obtaining the probability of the surface scratch defect of the milling cutter gray-scale image according to the surface roughness complex factor and the characteristic image of each sub-image in the milling cutter gray-scale image comprises the following steps:
constructing a rectangular coordinate system by taking the shape parameters as a longitudinal axis and the proportion parameters as a transverse axis, acquiring parameter points of each sub-image in the rectangular coordinate system, acquiring scratch defect parameter points by using the Otsu method based on the shape parameters and the proportion parameters corresponding to the parameter points, and counting the number of the scratch defect parameter points as a second number;
and calculating the ratio of the second quantity to the quantity of the sub-images, acquiring the addition result of the surface roughness complex factors of all the sub-images, and taking the product of the addition result and the ratio as the surface scratch defect probability of the milling cutter gray level image.
Further, the method for detecting the milling cutter scratches according to the probability of the surface scratch defects of each milling cutter grayscale image comprises the following steps:
respectively carrying out normalization processing on the surface scratch defect probability of each milling cutter gray level image to obtain the corresponding normalized surface scratch defect probability; and setting a surface scratch defect probability threshold, and when the normalized surface scratch defect probability of any one of the milling cutter gray level images is greater than the surface scratch defect probability threshold, determining that the milling cutter has scratch defects.
Further, the method for obtaining the haar characteristic value of each pixel point in the sub-image by using the haar operator of the scratch on the surface of the milling cutter comprises the following steps:
and for any pixel point in the sub-image, calculating the sum of gray values of all pixel points in a black rectangle in the milling cutter surface scratch haar operator corresponding to the pixel point, calculating the sum of gray values of all pixel points in a white rectangle in the milling cutter surface scratch haar operator corresponding to the pixel point, and taking the difference value between the sum of gray values of all pixel points in the black rectangle and the sum of gray values of all pixel points in the white rectangle as the haar characteristic value of the pixel point.
The invention has the following beneficial effects:
in order to ensure that the complete surface of the milling cutter is acquired, at least two surface gray level images of the surface of the milling cutter are acquired, in order to avoid background interference, semantic segmentation is respectively carried out on each surface gray level image to obtain a milling cutter gray level image, each milling cutter gray level image is uniformly divided into at least two sub-images, the complex process of acquiring the standard milling cutter surface image is reduced, and meanwhile, the accuracy of subsequent scratch defect detection can be improved; based on the direction extension characteristic of scratches on the surface of the milling cutter, the characteristic circle-like coefficients of the pixel points are obtained according to the gradient of each pixel point in the subimage, and the anisotropy of the pixel points in the image can be reflected; in order to improve the accuracy of scratch feature extraction in an image, a milling cutter surface scratch haar operator is constructed according to the characteristic circle-like coefficient of each pixel point, and the haar feature value of each pixel point in a subimage is obtained by using the milling cutter surface scratch haar operator so as to obtain a feature image; the characteristic image represents scratch characteristics in the sub-image, so that a surface roughness complex factor of the sub-image is obtained according to the characteristic image; the surface scratch defect probability is obtained by combining the surface roughness complex factor of each sub-image in the milling cutter gray level image, and under the condition that each region in the milling cutter gray level image is analyzed with the same characteristics, the analysis error of only a single region is reduced, so that the surface scratch defect probability of the milling cutter gray level image is more rigorous, and the result of milling cutter scratch detection according to the surface scratch defect probability of each milling cutter gray level image is more accurate.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions and advantages of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart illustrating steps of a method for detecting scratches of a milling cutter based on computer vision according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a haar operator of the surface scratch of the milling cutter in the embodiment of the invention.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of a method for detecting scratches of a milling cutter based on computer vision, which is provided by the present invention, with reference to the accompanying drawings and preferred embodiments, describes specific embodiments, structures, features and effects thereof. In the following description, different "one embodiment" or "another embodiment" refers to not necessarily the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
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 describes a specific scheme of the milling cutter scratch detection method based on computer vision in detail with reference to the accompanying drawings.
Referring to fig. 1, a flow chart illustrating steps of a computer vision-based milling cutter scratch detection method according to an embodiment of the present invention is provided, where the method includes:
s001, acquiring at least two surface gray level images of the surface of the milling cutter; and performing semantic segmentation on each surface gray level image to obtain a milling cutter gray level image, and uniformly dividing each milling cutter gray level image into at least two sub-images.
Specifically, in order to obtain a higher-quality milling cutter surface image and enable the subsequent milling cutter scratch detection process to use scratch detail information of the milling cutter surface, a proper image shooting and collecting device needs to be selected. Compared with the traditional CMOS camera, the CCD camera has better image quality and clearer imaging details when shooting and acquiring, so that the CCD camera is used for shooting and acquiring the surface of the milling cutter to obtain the surface image of the milling cutter in the RGB color space.
Considering that the abstract mathematical model of the milling cutter is a cylindrical three-dimensional structure and different side surfaces may have different defects, in order to acquire the whole surface of the milling cutter, the surface of the milling cutter to be detected is shot by using a CCD camera to obtain at least two milling cutter surface images.
The milling cutter surface image in the RGB color space obtained by shooting has three different color channels, analysis and calculation may need to be carried out in the three different channels when subsequently carrying out calculation analysis detection on the milling cutter surface scratch, and in order to reduce the calculation cost and improve the accuracy detection effect on the milling cutter surface scratch identification, the milling cutter surface image in the RGB color space is converted into a surface gray level image of the milling cutter surface by using a weighted average method. Meanwhile, in order to avoid the influence of random natural noise on the subsequent detection of the scratch quality of the surface of the milling cutter in a shooting and collecting environment, a Gaussian filtering method is used for preprocessing the surface gray level image.
The weighted average method and the gaussian filtering method are known techniques, and are not described in detail in this embodiment.
The method comprises the steps that a surface gray image of the surface of the milling cutter is mainly divided into two pixel points, namely the milling cutter surface pixel point and a background pixel point, in order to avoid the influence of the background pixel point on subsequent milling cutter scratch defect detection, the GrabCT algorithm is used for carrying out semantic segmentation on each surface gray image, the background part is removed, only the milling cutter part is reserved, and then the milling cutter gray image is obtained. The GrabCut algorithm is a known technology, and is not described in detail in the embodiment of the scheme.
For any milling cutter gray level image, uniformly dividing the milling cutter gray level image into at least two sub-images, and setting the size of the uniformly divided sub-images as. By dividing the grey scale image of the milling cutter, the method canThe detection of scratches on the surface of the milling cutter is completed by utilizing the difference effect among different areas, so that the complicated process of obtaining the image of the surface of the standard milling cutter is reduced.
S002, for any sub-image of any milling cutter gray level image, obtaining a characteristic circle-like coefficient of each pixel point according to the gradient of the pixel points in the sub-image; constructing a milling cutter surface scratch haar operator according to the characteristic circle-like coefficient of each pixel point, acquiring a haar characteristic value of each pixel point in the subimage by using the milling cutter surface scratch haar operator, and acquiring a characteristic image according to the haar characteristic value; and acquiring the surface roughness complexity factor of the sub-image according to the characteristic image.
Specifically, if a scratch defect occurs in the milling cutter grayscale image, the scratch defect extends in a certain direction, and meanwhile, in the scratch extending direction, fluctuation of the grayscale value is stable, but a large grayscale value change occurs in the orthogonal direction perpendicular to the scratch extending direction, so that the scratch condition in the milling cutter grayscale image is analyzed based on the characteristic.
Taking the jth sub-image of the a-th milling cutter gray scale image as an example, the specific analysis process of the scratch condition in the sub-image is as follows:
(1) Analyzing the anisotropy of each pixel point in the subimage according to the gradient of each pixel point in the subimage, which specifically comprises the following steps: and for any pixel point in the sub-image, constructing a Hessian matrix according to the gradient of the pixel point, taking the maximum characteristic value of the Hessian matrix as the scratch orthogonal direction characteristic value of the pixel point, taking the minimum characteristic value of the Hessian matrix as the scratch extending direction characteristic value of the pixel point, and taking the ratio of the scratch orthogonal direction characteristic value to the scratch extending direction characteristic value as the characteristic circle-like coefficient of the pixel point.
As an example, taking the pixel point i in the jth sub-image as an example, first calculating a second-order gradient of the pixel point i, and then constructing a hessian matrix by using the second-order gradient, where the acquisition of the hessian matrix is a known technology, and is not described in detail in this scheme. Since the eigenvalue of the hessian matrix describes the concavity and convexity on the eigenvector of the corresponding point, the existence of scratches in the sub-image can be reflectedThe condition is that when no scratch defect exists in the sub-image, the characteristic values of the Hessian matrix have consistency and are not greatly different, the contour line taking any pixel point as the center is approximately circular, when the scratch defect exists in the sub-image, the characteristic values of the Hessian matrix have obvious difference, the contour line taking any pixel point as the center is oval, therefore, for the two characteristic values of the Hessian matrix, the direction of the characteristic vector with smaller characteristic value is the extending direction of the scratch defect on the surface of the milling cutter, the direction of the characteristic vector with larger characteristic value is the direction perpendicular to the extending direction of the scratch on the surface of the milling cutter, and therefore, the larger characteristic value is taken as the characteristic value of the scratch orthogonal direction of the pixel point iTaking the smaller characteristic value as the characteristic value of the scratch extending direction of the pixel point iAnd then obtaining the characteristic circle-like coefficient of the pixel point i according to the scratch orthogonal direction characteristic value and the scratch extending direction characteristic value of the pixel point i, wherein the calculation formula of the characteristic circle-like coefficient is as follows:
wherein the content of the first and second substances,the characteristic circle-like coefficient of the pixel point i;the scratch extension direction characteristic value of the pixel point i is obtained;is the scratch orthogonal direction characteristic value.
It should be noted that, when there is no scratch defect on the surface of the milling cutter, the values of the eigenvalues calculated by the hessian matrix should have the consistency characteristic, so that the eigenvalues are perpendicular to the orthogonal directionThe difference from the characteristic value of the extension direction is not large, that isThe closer the value of (a) is to 1; on the contrary, when the surface of the milling cutter has scratch defects, the characteristic value of the vertical orthogonal directionLarger, characteristic value of extension directionSmaller, corresponding pixel pointIs characterized by a value of the circle-like coefficient of less than 1.
(2) Constructing a milling cutter surface scratch haar operator according to the characteristic circle-like coefficient of each pixel point, which specifically comprises the following steps: setting a characteristic circle-like coefficient threshold, counting the number of pixels of which the characteristic circle-like coefficient is smaller than the characteristic circle-like coefficient threshold as a first number, and calculating the ratio of the first number to the total number of pixels in the subimage and recording the ratio as a first ratio; the milling cutter surface scratch haar operator is composed of a black rectangle and a white rectangle, the milling cutter surface scratch haar operator is set to be a diagonal characteristic, and the direction of a characteristic vector corresponding to a characteristic value in the scratch orthogonal direction is the same as the distribution direction of the black rectangle in the milling cutter surface scratch haar operator; acquiring a difference value between a constant 1 and a first ratio, and taking the product of the side length of the sub-image and the difference value as the side length of a black rectangle in a milling cutter surface scratch haar operator; and acquiring an adjusting proportion coefficient according to the first ratio, and acquiring the size of the milling cutter surface scratch haar operator according to the product of the side length of a black rectangle in the milling cutter surface scratch haar operator and the adjusting proportion coefficient.
As an example, a haar operator (Harr feature descriptor) has black and white rectangle features, the size of the white rectangle is the same as that of the black rectangle, and the proportion and distribution direction of the black rectangle and the white rectangle affect the final extracted feature effect of the haar operator, so the scheme considers that there is a large difference in the gray distribution variation of the pixel points in the perpendicular orthogonal direction along the milling cutter scratch, and the difference in the gray distribution variation of the pixel points in the scratch direction along the milling cutter is small, and meanwhile, the haar operator includes three haar features: the milling cutter surface scratch haar operator in the embodiment of the invention uses the diagonal features, and then determines the ratio of black and white rectangles of the milling cutter surface scratch haar operator by using the characteristic circle-like coefficient of each pixel point in the sub-image, so that the calculation formula of the side length of the black rectangle in the milling cutter surface scratch haar operator is as follows:
wherein the content of the first and second substances,the side length of a black rectangle in a haar operator for the scratch on the surface of the milling cutter is determined;is the side length of the sub-image;the number of pixels in the sub-image with the characteristic circle-like coefficient smaller than the threshold value of the characteristic circle-like coefficient is 0.4, namely the first number;the total number of pixel points in the subimages;is a first ratio.
It should be noted that, since the size of the characteristic circle-like coefficient can reflect whether the surface of the milling cutter has scratch defects, the first ratio of the number of pixels with the characteristic circle-like coefficient smaller than the threshold of the characteristic circle-like coefficient to the total number of pixels in the subimage is calculatedThe side length of the black rectangle in the milling cutter surface scratch haar operator is obtained by combining the first ratio and the side length of the subimage, the larger the first ratio is, the more serious the scratch defect is, the finer the division is, so that the side length of the black rectangle in the milling cutter surface scratch haar operator is smaller correspondingly, and the side length of the black rectangle in the milling cutter surface scratch haar operator isTo the first ratioIn a negative correlation relationship.
The size of the milling cutter surface scratch haar operator is set based on the side length of a black rectangle in the milling cutter surface scratch haar operator, namely the size of a detection window corresponding to the milling cutter surface scratch haar operator. In order to make the scratch defect more serious and the division finer, an adjusting scale factor is obtained according to a first ratio: and obtaining a difference value between the constant 1 and the first ratio, when the difference value is smaller than a first threshold value, adjusting the proportional coefficient to obtain a first set value, and when the difference value is larger than or equal to the first threshold value, adjusting the proportional coefficient to obtain a second set value.
As an example, the formula for calculating the adjustment scaling factor is:
wherein the content of the first and second substances,to adjust the proportionality coefficient; 0.3 is a first threshold; 3 is a first set value; and 9 is a second set value.
The first ratio isSmaller indicates less severe scratch defect, corresponding to the differenceThe larger the difference value is, the larger the detection window corresponding to the milling cutter surface scratch haar operator is, and the smaller the division is, the larger the corresponding adjustment proportionality coefficient is.
Further, according to the side length of the black rectangle in the milling cutter surface scratch haar operatorAnd adjusting the proportionality coefficientThe product of the two parameters is used for obtaining the size of the milling cutter surface scratch haar operator, namely the side length of a black rectangle in the milling cutter surface scratch haar operatorAnd adjusting the proportionality coefficientThe product of the two is used as the side length of a detection window corresponding to a haar operator of the scratch on the surface of the milling cutter, and meanwhile, the characteristic value of the extension direction of the scratch is utilizedDirection of corresponding characteristic vector and characteristic value of scratch orthogonal directionThe position of the haar operator of the surface scratch of the milling cutter is fixed by the direction of the corresponding characteristic vector, namely the characteristic value of the orthogonal direction of the scratch is enabledThe direction of the corresponding feature vector is the same as the distribution direction of the black rectangle in the milling cutter surface scratch haar, as shown in fig. 2, which shows a schematic diagram of the milling cutter surface scratch haar,as milling cuttersThe haar operator of the surface scratch corresponds to the side length of the detection window,the side length and the scratch extending direction characteristic value of a black rectangle in a scratch haar operator on the surface of the milling cutterDirection of corresponding eigenvector and scratch orthogonal direction eigenvalueAnd fixing the position of the scratch haar operator on the surface of the milling cutter in the direction of the corresponding characteristic vector.
(3) The method comprises the following steps of obtaining a haar characteristic value of each pixel point in a subimage by using a milling cutter surface scratch haar operator, and specifically comprises the following steps: and for any pixel point in the sub-image, calculating the sum of gray values of all pixel points in a black rectangle in the milling cutter surface scratch haar operator corresponding to the pixel point, calculating the sum of gray values of all pixel points in a white rectangle in the milling cutter surface scratch haar operator corresponding to the pixel point, and taking the difference value between the sum of gray values of all pixel points in the black rectangle and the sum of gray values of all pixel points in the white rectangle as the haar characteristic value of the pixel point.
It should be noted that the haar operator of the milling cutter surface scratch traverses the jth sub-image by step 1.
(4) Obtaining a characteristic image according to the haar characteristic value: and normalizing the haar characteristic value of each pixel point in the subimage to obtain a corresponding normalized haar characteristic value, wherein an image formed by the normalized haar characteristic values of all the pixel points in the subimage is a characteristic image.
Specifically, a haar characteristic value of each pixel point in the jth sub-image is obtained, normalization processing is carried out on the haar characteristic value of each pixel point by utilizing a range normalization algorithm to obtain a normalized haar characteristic value of each pixel point, and an image formed by the normalized haar characteristic values of all the pixel points in the jth sub-image is used as a characteristic image. The range normalization algorithm is a known technique, and is not described in detail in the scheme.
(5) Acquiring a surface roughness complex factor of the subimage according to the characteristic image, specifically: and constructing a Weber distribution model of the characteristic image, acquiring shape parameters and proportion parameters of the Weber distribution model by using a maximum likelihood estimation method, acquiring corresponding ratios by using the shape parameters as numerators and the proportion parameters as denominators, and recording results obtained by using the opposite numbers of the ratios as indexes of natural constants as surface roughness complex factors of the subimages.
As an example, the Weber distribution model is a distribution form for the wear accumulation failure of mechanical products, and according to the distribution model, distribution parameters of the weber distribution model can be easily deduced by using probability values, and then characteristic images are constructedThe weber distribution model is:
wherein the content of the first and second substances,for characteristic imagesThe center coordinate isThe distribution probability density of the pixel values of the pixel points;for characteristic imagesThe center coordinate isThe pixel value of the pixel point of (1) is also a normalized haar characteristic value;is a natural constant;in order to be a proportional parameter,;in order to be a parameter of the shape,。
utilizing a maximum likelihood estimation method to obtain a shape parameter and a proportion parameter of a Weber distribution model, and then combining the shape parameter and the proportion parameter to obtain a surface roughness complex factor of the jth sub-image, wherein the calculation formula of the surface roughness complex factor is as follows:
wherein the content of the first and second substances,the surface roughness complexity factor of the jth sub-image;is a natural constant;the shape parameter of the jth sub-image;the scale parameter of the jth sub-image.
It should be noted that the ratio parameterCharacteristic image of j sub-imageThe size of the pixel value in (1) is related to the characteristic imageThe larger the pixel value in (1), the more obvious the scratch defect is, the proportional parameterThe larger, the surface roughness complexity factorThe larger the image is, the more scratch defects exist in the jth sub-image, and the proportional parameter and the surface roughness complex factor are in positive correlation; shape parameterThe shape parameter is related to the number of scratches in the jth sub-image, the larger the number of scratches isThe smaller the value of (A), the corresponding surface roughness complexity factorThe larger the shape parameter, the inversely related to the surface roughness complexity factor.
Similarly, the surface roughness complex factor of each sub-image under each milling cutter gray scale image is obtained by using the method of the surface roughness complex factor of the jth sub-image of the ith milling cutter gray scale image.
Step S003, for any milling cutter gray level image, obtaining the surface scratch defect probability of the milling cutter gray level image according to the surface roughness complex factor of each sub-image under the milling cutter gray level image; and carrying out milling cutter scratch detection according to the surface scratch defect probability of each milling cutter gray level image.
Specifically, the surface roughness complex factor of each sub-image under each milling cutter gray level image is obtained according to the step S002, and since the surface roughness complex factor reflects the severity of the scratch defect in the corresponding sub-image, when the number of scratches is larger, the gray level difference between the pixel points in the scratch position region and the surrounding region is more obvious, and the shape parameter is moreThe smaller, the ratio parameterThe larger the surface roughness complex factor is, the larger the corresponding surface roughness complex factor is, the larger the surface roughness complex factor is, for any milling cutter gray level image, the surface scratch defect probability of the milling cutter gray level image is obtained according to the surface roughness complex factor of each sub-image under the milling cutter gray level image, and specifically: constructing a rectangular coordinate system by taking the shape parameters as a longitudinal axis and the proportion parameters as a transverse axis, acquiring parameter points of each sub-image in the rectangular coordinate system, acquiring scratch defect parameter points by using the Otsu method based on the shape parameters and the proportion parameters corresponding to the parameter points, and counting the number of the scratch defect parameter points as a second number; and calculating the ratio of the second quantity to the quantity of the sub-images, acquiring the addition result of the surface roughness complex factors of all the sub-images, and taking the product of the addition result and the ratio as the surface scratch defect probability of the milling cutter gray level image.
As an example, taking an a-th milling cutter grayscale image as an example, since each sub-image under the a-th milling cutter grayscale image has a shape parameter and a proportion parameter, a rectangular coordinate system is constructed by taking the shape parameter as a vertical axis and the proportion parameter as a horizontal axis, the shape parameter and the proportion parameter corresponding to each sub-image are mapped in the rectangular coordinate system to form a parameter point, one sub-image corresponds to one parameter point, then based on the shape parameter and the proportion parameter corresponding to the parameter points, an ohkin method is used to respectively obtain a shape parameter segmentation threshold and a proportion parameter segmentation threshold, the parameter point corresponding to the shape parameter being smaller than the shape parameter segmentation threshold and the proportion parameter being larger than the proportion parameter segmentation threshold is taken as a scratch defect parameter point, the number of the scratch defect parameter points is counted, and the surface defect probability of the a-th milling cutter grayscale image is calculated according to the surface roughness complex factor of each sub-image and the number of the scratch defect parameter points, and the calculation formula of the surface scratch defect probability is:
wherein the content of the first and second substances,the probability of the surface scratch defects of the a-th milling cutter gray level image is obtained;the number of scratch defect parameter points is also a second number;the number of sub-images under the a-th milling cutter gray level image is obtained;and the surface roughness complexity factor of the jth sub-image under the alpha milling cutter gray scale image is obtained.
It should be noted that the sub-images with scratch defects are indirectly reflected by counting the number of the scratch defect parameter points, and then the ratio of the number of the scratch defect parameter points to the number of the sub-images is calculatedThe proportion of the subimage with the scratch defects in the whole milling cutter gray level image is reflected, and then the sum of the surface roughness complex factors corresponding to the whole milling cutter gray level image is basedObtaining a table of sub-images having scratch defects by using the ratioThe proportion corresponding to the surface roughness complex factor is used for explaining the condition that the milling cutter gray level image has the scratch defect, the larger the proportion is, the more sub-images which indicate the existence of the scratch defect are, the more likely the milling cutter gray level image has the scratch defect, and the probability of the corresponding surface scratch defectThe larger.
Acquiring the surface scratch defect probability of each milling cutter gray level image based on a calculation formula of the surface scratch defect probability, and carrying out milling cutter scratch detection according to the surface scratch defect probability of each milling cutter gray level image: respectively carrying out normalization processing on the surface scratch defect probability of each milling cutter gray level image to obtain corresponding normalized surface scratch defect probability; and setting a surface scratch defect probability threshold, and determining that the milling cutter has scratch defects when the normalized surface scratch defect probability of the milling cutter gray level image is greater than the surface scratch defect probability threshold.
As an example, the embodiment of the present invention uses a range normalization method to map the surface scratch defect probability of each milling cutter grayscale image into an interval [0,1], obtain the normalized surface scratch defect probability of each milling cutter grayscale image, set the threshold value of the surface scratch defect probability to be 0.75, when the normalized surface scratch defect probability of any milling cutter grayscale image is greater than the threshold value of the surface scratch defect probability, it is determined that a milling cutter has a scratch defect, and conversely, when the normalized surface scratch defect probability of each milling cutter grayscale image is less than or equal to the threshold value of the surface scratch defect probability, it is determined that the milling cutter does not have a scratch defect.
It should be noted that: the precedence order of the above embodiments of the present invention is only for description, and does not represent the merits of the embodiments. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that are within the spirit of the present invention are intended to be included therein.
Claims (3)
1. A milling cutter scratch detection method based on computer vision is characterized by comprising the following steps:
acquiring at least two surface gray level images of the surface of the milling cutter; performing semantic segmentation on each surface gray level image by using a GrabCT algorithm to obtain a milling cutter gray level image, and uniformly dividing each milling cutter gray level image into at least two sub-images;
for any sub-image of any milling cutter gray level image, acquiring a characteristic circle-like coefficient of each pixel point according to the gradient of the pixel points in the sub-image; constructing a milling cutter surface scratch haar operator according to the characteristic circle-like coefficient of each pixel point, acquiring a haar characteristic value of each pixel point in the subimage by using the milling cutter surface scratch haar operator, and acquiring a characteristic image according to the haar characteristic value; acquiring a surface roughness complex factor of the subimage according to the characteristic image;
for any milling cutter gray level image, obtaining the surface scratch defect probability of the milling cutter gray level image according to the surface roughness complex factor and the characteristic image of each sub-image under the milling cutter gray level image; carrying out milling cutter scratch detection according to the surface scratch defect probability of each milling cutter gray level image;
the method for acquiring the characteristic circle-like coefficient of each pixel point according to the gradient of the pixel points in the sub-image comprises the following steps:
for any pixel point in the sub-image, constructing a Hessian matrix according to the gradient of the pixel point, taking the maximum characteristic value of the Hessian matrix as the scratch orthogonal direction characteristic value of the pixel point, taking the minimum characteristic value of the Hessian matrix as the scratch extending direction characteristic value of the pixel point, and taking the ratio of the scratch orthogonal direction characteristic value to the scratch extending direction characteristic value as the characteristic quasi-circle coefficient of the pixel point;
the method for constructing the milling cutter surface scratch haar operator according to the characteristic circle-like coefficient of each pixel point comprises the following steps:
setting a characteristic circle-like coefficient threshold, counting the number of pixels of which the characteristic circle-like coefficient is smaller than the characteristic circle-like coefficient threshold as a first number, and calculating the ratio of the first number to the total number of pixels in the subimage and recording the ratio as a first ratio;
the milling cutter surface scratch haar operator is composed of a black rectangle and a white rectangle, the milling cutter surface scratch haar operator is set to be a diagonal characteristic, and the direction of a characteristic vector corresponding to a characteristic value in the scratch orthogonal direction is the same as the distribution direction of the black rectangle in the milling cutter surface scratch haar operator;
obtaining a difference value between a constant 1 and a first ratio, and taking the product of the side length of the sub-image and the difference value as the side length of a black rectangle in a milling cutter surface scratch haar operator; acquiring an adjustment proportionality coefficient according to the first ratio, and acquiring the size of the milling cutter surface scratch haar operator according to the product of the side length of a black rectangle in the milling cutter surface scratch haar operator and the adjustment proportionality coefficient;
the method for obtaining the adjusting proportionality coefficient according to the first ratio comprises the following steps:
when the difference value between the constant 1 and the first ratio is smaller than a first threshold value, the adjusting proportion coefficient takes a first set value, and when the difference value between the constant 1 and the first ratio is larger than or equal to the first threshold value, the adjusting proportion coefficient takes a second set value;
the method for acquiring the characteristic image comprises the following steps:
normalizing the haar characteristic value of each pixel point in the subimage to obtain a corresponding normalized haar characteristic value, wherein an image formed by the normalized haar characteristic values of all the pixel points in the subimage is a characteristic image;
the method for acquiring the surface roughness complex factor of the sub-image according to the characteristic image comprises the following steps:
constructing a Weber distribution model of the characteristic image, acquiring shape parameters and proportion parameters of the Weber distribution model by using a maximum likelihood estimation method, obtaining corresponding ratios by using the shape parameters as numerators and the proportion parameters as denominators, and recording results obtained by using the opposite numbers of the ratios as indexes of natural constants as surface roughness complex factors of the subimages;
the method for acquiring the haar characteristic value of each pixel point in the subimage by using the milling cutter surface scratch haar operator comprises the following steps:
and for any pixel point in the sub-image, calculating the sum of gray values of all pixel points in a black rectangle in the milling cutter surface scratch haar operator corresponding to the pixel point, calculating the sum of gray values of all pixel points in a white rectangle in the milling cutter surface scratch haar operator corresponding to the pixel point, and taking the difference value between the sum of gray values of all pixel points in the black rectangle and the sum of gray values of all pixel points in the white rectangle as the haar characteristic value of the pixel point.
2. The milling cutter scratch detection method based on computer vision according to claim 1, wherein the obtaining method for obtaining the surface scratch defect probability of the milling cutter gray-scale image according to the surface roughness complexity factor and the feature image of each sub-image in the milling cutter gray-scale image comprises:
constructing a rectangular coordinate system by taking the shape parameters as a longitudinal axis and the proportion parameters as a transverse axis, acquiring parameter points of each sub-image in the rectangular coordinate system, acquiring scratch defect parameter points by using the Otsu method based on the shape parameters and the proportion parameters corresponding to the parameter points, and counting the number of the scratch defect parameter points as a second number;
and calculating the ratio of the second quantity to the quantity of the sub-images, acquiring the addition result of the surface roughness complex factors of all the sub-images, and taking the product of the addition result and the ratio as the surface scratch defect probability of the milling cutter gray level image.
3. The computer vision-based milling cutter scratch detection method according to claim 1, wherein the method for milling cutter scratch detection according to the surface scratch defect probability of each milling cutter gray scale image comprises:
respectively carrying out normalization processing on the surface scratch defect probability of each milling cutter gray level image to obtain the corresponding normalized surface scratch defect probability; and setting a surface scratch defect probability threshold, and when the normalized surface scratch defect probability of any one of the milling cutter gray level images is greater than the surface scratch defect probability threshold, determining that the milling cutter has scratch defects.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211718931.6A CN115690105B (en) | 2022-12-30 | 2022-12-30 | Milling cutter scratch detection method based on computer vision |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211718931.6A CN115690105B (en) | 2022-12-30 | 2022-12-30 | Milling cutter scratch detection method based on computer vision |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115690105A CN115690105A (en) | 2023-02-03 |
CN115690105B true CN115690105B (en) | 2023-03-21 |
Family
ID=85057402
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211718931.6A Active CN115690105B (en) | 2022-12-30 | 2022-12-30 | Milling cutter scratch detection method based on computer vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115690105B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116309578B (en) * | 2023-05-19 | 2023-08-04 | 山东硅科新材料有限公司 | Plastic wear resistance image auxiliary detection method using silane coupling agent |
CN116309602B (en) * | 2023-05-24 | 2023-08-04 | 济南章力机械有限公司 | Numerical control drilling and milling machine working state detection method based on machine vision |
CN117554377B (en) * | 2023-11-25 | 2024-04-30 | 广东博勒科技有限公司 | Milling cutter scratch detection and repair device and application method thereof |
CN117635609B (en) * | 2024-01-25 | 2024-03-29 | 深圳市智宇精密五金塑胶有限公司 | Visual inspection method for production quality of plastic products |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106338521A (en) * | 2016-09-22 | 2017-01-18 | 华中科技大学 | Additive manufacturing surface defect, internal defect and shape composite detection method and device |
WO2019104767A1 (en) * | 2017-11-28 | 2019-06-06 | 河海大学常州校区 | Fabric defect detection method based on deep convolutional neural network and visual saliency |
CN114332026A (en) * | 2021-12-29 | 2022-04-12 | 深圳市前海研祥亚太电子装备技术有限公司 | Visual detection method and device for scratch defects on surface of nameplate |
CN114998216A (en) * | 2022-05-06 | 2022-09-02 | 湖北文理学院 | Method and device for rapidly detecting surface defects of transparent part |
CN115147414A (en) * | 2022-09-01 | 2022-10-04 | 南通三信塑胶装备科技股份有限公司 | Method for detecting surface breakdown defect of bipolar power transistor |
-
2022
- 2022-12-30 CN CN202211718931.6A patent/CN115690105B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106338521A (en) * | 2016-09-22 | 2017-01-18 | 华中科技大学 | Additive manufacturing surface defect, internal defect and shape composite detection method and device |
WO2019104767A1 (en) * | 2017-11-28 | 2019-06-06 | 河海大学常州校区 | Fabric defect detection method based on deep convolutional neural network and visual saliency |
CN114332026A (en) * | 2021-12-29 | 2022-04-12 | 深圳市前海研祥亚太电子装备技术有限公司 | Visual detection method and device for scratch defects on surface of nameplate |
CN114998216A (en) * | 2022-05-06 | 2022-09-02 | 湖北文理学院 | Method and device for rapidly detecting surface defects of transparent part |
CN115147414A (en) * | 2022-09-01 | 2022-10-04 | 南通三信塑胶装备科技股份有限公司 | Method for detecting surface breakdown defect of bipolar power transistor |
Non-Patent Citations (1)
Title |
---|
章鹏.多尺度特征检测:方法和应用研究.2011,全文. * |
Also Published As
Publication number | Publication date |
---|---|
CN115690105A (en) | 2023-02-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115690105B (en) | Milling cutter scratch detection method based on computer vision | |
CN114862862B (en) | Pump body cold shut defect identification method and system based on image processing | |
CN109580630B (en) | Visual inspection method for defects of mechanical parts | |
CN115861291B (en) | Chip circuit board production defect detection method based on machine vision | |
CN112819772B (en) | High-precision rapid pattern detection and recognition method | |
CN114820773B (en) | Silo transport vehicle carriage position detection method based on computer vision | |
CN113963042B (en) | Metal part defect degree evaluation method based on image processing | |
CN112907519A (en) | Metal curved surface defect analysis system and method based on deep learning | |
CN116385450B (en) | PS sheet wear resistance detection method based on image processing | |
CN114998198A (en) | Injection molding surface defect identification method | |
CN115578374A (en) | Mechanical part casting quality evaluation method and system | |
CN116228768B (en) | Method for detecting scratches on surface of electronic component | |
CN116990323B (en) | High-precision printing plate visual detection system | |
CN115359053A (en) | Intelligent detection method and system for defects of metal plate | |
CN114881915A (en) | Symmetry-based mobile phone glass cover plate window area defect detection method | |
CN115096206B (en) | High-precision part size measurement method based on machine vision | |
CN116740072B (en) | Road surface defect detection method and system based on machine vision | |
CN110648330B (en) | Defect detection method for camera glass | |
CN111354047B (en) | Computer vision-based camera module positioning method and system | |
CN117557820B (en) | Quantum dot optical film damage detection method and system based on machine vision | |
CN114581805A (en) | Coating roller surface defect detection method adopting 3D line laser profile technology | |
CN116152115A (en) | Garbage image denoising processing method based on computer vision | |
CN110186929A (en) | A kind of real-time product defect localization method | |
CN116993719A (en) | OCA optical film surface defect visual detection method and system | |
CN113763404B (en) | Foam image segmentation method based on optimization mark and edge constraint watershed algorithm |
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 |