CN113989233A - Image-based part surface roughness support vector machine detection method and system - Google Patents

Image-based part surface roughness support vector machine detection method and system Download PDF

Info

Publication number
CN113989233A
CN113989233A CN202111262722.0A CN202111262722A CN113989233A CN 113989233 A CN113989233 A CN 113989233A CN 202111262722 A CN202111262722 A CN 202111262722A CN 113989233 A CN113989233 A CN 113989233A
Authority
CN
China
Prior art keywords
image
pixel
roughness
vector machine
support vector
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.)
Pending
Application number
CN202111262722.0A
Other languages
Chinese (zh)
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.)
Taiyuan University of Technology
Original Assignee
Taiyuan University of Technology
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 Taiyuan University of Technology filed Critical Taiyuan University of Technology
Priority to CN202111262722.0A priority Critical patent/CN113989233A/en
Publication of CN113989233A publication Critical patent/CN113989233A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2411Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30164Workpiece; Machine component

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Length Measuring Devices By Optical Means (AREA)

Abstract

The invention discloses a part surface roughness support vector machine detection method and system based on images, which comprises the following steps: collecting images of all areas of the surface of the part through a part surface image collecting system; carrying out image preprocessing on the part image; converting the surface image of the part into a gray image by using a pixel component to perform a phase comparison addition method, and performing filtering processing by using a Gaussian window; extracting four texture features of energy, entropy, moment of inertia and correlation of the image based on the gray level co-occurrence matrix, and respectively solving the mean value and the variance to generate an 8-dimensional feature vector as the input of a support vector machine; the support vector machine detects the model and outputs a roughness value; the surface roughness of the part can be comprehensively measured in a non-contact manner, the problems that sampling is random in the process of extracting image characteristics and the extracted characteristics cannot effectively distinguish parts with different roughness grades are solved, and the detection precision of the non-contact type detection of the surface roughness of the part is greatly improved.

Description

Image-based part surface roughness support vector machine detection method and system
Technical Field
The invention belongs to the technical field of detection, and particularly relates to a part surface roughness support vector machine detection method and system based on an image technology.
Background
The surface roughness of the part is one of important indexes for evaluating the surface quality of the part in modern mechanical manufacturing. The image technology has the advantages of large information amount, non-contact, low cost and the like, and has obvious non-contact detection effect on the surface roughness of the part. The existing image-based roughness detection method has random sampling, the whole part surface cannot be comprehensively collected, and the extracted part surface characteristics cannot effectively represent the roughness, so that the detection precision of the roughness can be greatly influenced, and further, the assembly performance, the wear resistance, the fatigue resistance and the like of the precision part are greatly influenced. Therefore, it is necessary to design a detection model of the surface roughness of the part based on the image technology to realize the comprehensive non-contact detection of the roughness.
Disclosure of Invention
In view of the above situation, an object of the present invention is to provide a method and a system for detecting a support vector machine for part surface roughness based on an image, which can automatically divide the surface of a part into a plurality of regions with suitable sizes, continuously and comprehensively collect part surface images in multiple regions and extract features capable of effectively characterizing the part surface roughness, thereby completing roughness detection and avoiding the problem that random sampling and extracted features cannot effectively characterize the part surface roughness.
A part surface roughness support vector machine detection method based on images comprises the following steps:
s1, dividing the surface of the part into proper areas by using a part surface dividing method, and collecting images of all the areas on the surface of the part by using a part surface image collecting system;
s2, carrying out image preprocessing on the part image; converting the surface image of the part into a gray image by using a pixel component to perform a phase comparison addition method, and performing filtering processing by using a Gaussian window;
s3, extracting four texture features of energy, entropy, moment of inertia and correlation of the image based on the gray level co-occurrence matrix, and respectively solving the mean value and the variance to generate an 8-dimensional feature vector as the input of the support vector machine;
s4 support the vector machine detection model to output the roughness value, and the detection result of the roughness value of the surface of the part is displayed through the upper computer interface.
In the detecting method, in step S1, the method for dividing the surface of the part is as follows: the part is evenly divided into a plurality of areas, and when the area of the divided area is smaller than the visible area of the digital microscope, the division is considered to be effective and can be used for roughness detection; when the area of the divided area exceeds the visible area of the digital microscope, the area exceeding the visible area of the digital microscope is divided for the second time, and is still divided into a plurality of areas evenly for detection, so that the secondary divided area is ensured to be smaller than the visible area of the digital microscope, if the division is still invalid, the division is carried out for the third time, and the like until the area of all the divided areas is smaller than the visible area of the digital microscope.
The detection method, in step S1, the step of collecting the images of the regions on the surface of the part includes the following steps:
s11, placing the parts on sampling points of the horizontal tray, sending images by the upper computer to start collecting signals, receiving the signals by the single chip microcomputer to output PWM waves, and driving the horizontal tray and the parts on the horizontal tray to rotate to a division area by the stepping motor;
s12, the single chip microcomputer suspends PWM wave output and sends an image acquisition signal to the upper computer;
s13, the upper computer receives the image acquisition signal, controls the digital microscope to acquire the part image and stores the part image in the upper computer, and then sends an image acquisition completion signal to the single chip microcomputer through the serial port;
and S14, the single chip microcomputer receives the image acquisition completion signal, continues to output PWM waves to drive the stepping motor, and repeats the steps S11, S12 and S13 until the acquisition of all the divided areas of the parts is completed.
In step S2, the detection method performs gaussian filtering operation on the grayscale image of the surface of the part by using a gaussian window with dimension of 3 × 3 and standard deviation of 0.8.
The detection method, the specific method of S3 is as follows: extracting the surface texture characteristics of the part, and establishing a relation model between the surface texture characteristics of the part and the surface roughness of the part;
constructing a probability matrix P (i, j) by analyzing the probability of the simultaneous occurrence of a pixel with the gray level of i and a pixel with the gray level of j in the point (x, y) in the surface image of the part, wherein the formula is as follows:
probability matrix
Figure BDA0003326354460000021
Wherein, i is 1, 2.. times.m; j ═ 1,2,. N; f (x, y) and f (x + a, y + b) represent the gray values of pixel points (x, y), (x + a, y + b) in the surface image of the part;
based on the gray level co-occurrence matrix, the following features are extracted: energy, entropy, moment of inertia and correlation are calculated as follows:
(Energy)
Figure BDA0003326354460000031
entropy of the entropy
Figure BDA0003326354460000032
Moment of inertia
Figure BDA0003326354460000033
Correlation
Figure BDA0003326354460000034
In the formula: m, N are the number of pixels in the horizontal and vertical directions, respectively, in the part surface image; mu is the average value of pixel points of the surface image of the part; x 'and y' represent the gradients of the horizontal and vertical directions of the surface image of the part respectively; l represents the gray level of the pixel point of the image on the surface of the part; l represents the maximum gray level, L is 255; p (l) is the pixel ratio of the gray level l in the part surface image.
Generating feature vectors, and calculating WA,WB,WC,WDMean value of WA1,WB1,WC1,WD1Sum variance WA2,WB2,WC2,WD2The 8-dimensional feature vectors are generated by the 8 features as the features for describing the surface texture of the part and are used as the input of the support vector machine.
The detection method, the specific method of S4 is as follows:
s41, the output value of the support vector machine-based roughness detection model can be represented as a non-linear regression model as follows:
nonlinear regression model RaModel (model)=wTx+b (8)
In the formula, RaModel (model)Detecting the roughness of the surface of the part output by the model for a support vector machine, wherein w is a linear combination of the feature vector input of the surface image of the part extracted based on the gray level co-occurrence matrix; b is the functional bias.
And S42, selecting a Gaussian kernel function as a kernel function of the support vector machine detection model, and setting a penalty parameter C to be 0.1 and a width parameter sigma to be 0.8 according to the input part surface feature vector. Through training and verification of the model, the root mean square error of the roughness detection of the support vector machine based on the Gaussian kernel function is 0.0316, the average relative error is 0.0296, the detection precision is high, and the running time is appropriate.
And S44, taking the extracted feature vector of the part surface texture as the input of a support vector machine detection model, wherein the output of the model is the roughness value of the part surface.
In the detection method, the pixel component comparison method comprises the following steps:
(1) based on the collected image, calibrating pixel points X at equal intervals along the direction vertical to the texture direction of the image, and obtaining red (R), green (G) and blue (B) components of the pixel values of the points;
(2) the pixel components B, R, B and G are compared and added, and the normalized value is used as the new pixel value for the point, which is expressed as follows:
pixel component addition method
Figure BDA0003326354460000041
And R (i, j), B (i, j) and G (i, j) are respectively component values of R, G and B of the pixel point with the coordinate of (i, j) in the part surface image.
The part surface roughness support vector machine detection system of any one of the detection methods is characterized by comprising:
part surface image acquisition device: dividing the surface of the part into proper areas by using a part surface dividing method, and collecting images of all the areas on the surface of the part;
an image preprocessing module: converting the surface image of the part into a gray image by using a pixel component to perform a phase comparison addition method, and performing filtering processing by using a Gaussian window;
the texture feature extraction module: extracting four texture features of energy, entropy, moment of inertia and correlation of the image based on the gray level co-occurrence matrix, and respectively solving the mean value and the variance to generate an 8-dimensional feature vector as the input of a support vector machine;
the support vector machine detection module: and the support vector machine detection module outputs a roughness value, and a detection result of the roughness value of the surface of the part is displayed through an upper computer interface.
The detection system, the texture feature extraction module: extracting the surface texture characteristics of the part, and establishing a relation model between the surface texture characteristics of the part and the surface roughness of the part;
constructing a probability matrix P (i, j) by analyzing the probability of the simultaneous occurrence of a pixel with the gray level of i and a pixel with the gray level of j in the point (x, y) in the surface image of the part, wherein the formula is as follows:
probability matrix
Figure BDA0003326354460000051
Wherein, i is 1, 2.. times.m; j ═ 1,2,. N; f (x, y) and f (x + a, y + b) represent the gray values of pixel points (x, y), (x + a, y + b) in the surface image of the part;
based on the gray level co-occurrence matrix, the following features are extracted: energy, entropy, moment of inertia and correlation are calculated as follows:
(Energy)
Figure BDA0003326354460000052
entropy of the entropy
Figure BDA0003326354460000053
Moment of inertia
Figure BDA0003326354460000054
Correlation
Figure BDA0003326354460000055
In the formula: m, N are the number of pixels in the horizontal and vertical directions, respectively, in the part surface image; mu is the average value of pixel points of the surface image of the part; x 'and y' represent the gradients of the horizontal and vertical directions of the surface image of the part respectively; l represents the gray level of the pixel point of the image on the surface of the part; l represents the maximum gray level, L is 255; p (l) is the pixel ratio of the gray level l in the part surface image.
Generating feature vectors, and calculating WA,WB,WC,WDMean value of WA1,WB1,WC1,WD1Sum variance WA2,WB2,WC2,WD2The 8-dimensional feature vectors are generated by the 8 features as the features for describing the surface texture of the part and are used as the input of the support vector machine.
The detection system, the image preprocessing module includes a pixel component comparing unit, and the method of the pixel component comparing unit is as follows:
(1) based on the collected image, calibrating pixel points X at equal intervals along the direction vertical to the texture direction of the image, and obtaining red (R), green (G) and blue (B) components of the pixel values of the points;
(2) the pixel components B, R, B and G are compared and added, and the normalized value is used as the new pixel value for the point, which is expressed as follows:
pixel component addition method
Figure BDA0003326354460000061
And R (i, j), B (i, j) and G (i, j) are respectively component values of R, G and B of the pixel point with the coordinate of (i, j) in the part surface image.
The invention has the beneficial effects that: the surface roughness of the part can be comprehensively measured in a non-contact manner, the problems that sampling is random in the process of extracting image characteristics and the extracted characteristics cannot effectively distinguish parts with different roughness grades are solved, and the detection precision of the non-contact type detection of the surface roughness of the part is greatly improved.
Drawings
FIG. 1 is a flow chart of the overall process of detecting the surface roughness of a part according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a surface sampling area of a partitioned part according to an embodiment of the present invention;
FIG. 3 is a diagram of pixel component scaling provided in accordance with an embodiment of the present invention;
FIG. 4 is a graph of an original image and an image contrast obtained using different graying methods according to an embodiment of the present invention; (a1) ra 0.4 μm original image, (a2) Ra 0.4 μm weighted average method, and (a3) Ra 0.4 μm pixel component addition method; (b1) ra 0.8 μm original image, (b2) Ra 0.8 μm weighted average method, and (b3) Ra 0.8 μm pixel component ratio addition method; (c1) ra 1.6 μm original image, (c2) Ra 1.6 μm weighted average method, and (c3) Ra 1.6 μm pixel component ratio addition method;
fig. 5 is a comparison diagram of gray scale image quality obtained by four graying methods provided by the embodiment of the present invention; (a) standard deviation contrast of different graying methods (b) average gradient contrast of different graying methods (c) information entropy contrast of different graying methods;
FIG. 6 is a comparison graph of the filtering effects of three filtering methods provided by the embodiment of the present invention;
FIG. 7 is a comparison graph of the actual roughness values and the detected roughness values of 16 collected regions on the surface of a set of test sample parts according to an embodiment of the present invention;
FIG. 8 is a graph of percentage of the number of images in each area of the surface of the roughness detecting part divided by the different modeling methods according to the embodiment of the present invention, in which the relative error is lower than the threshold;
fig. 9 is a flowchart of a part surface image acquisition process according to an embodiment of the present invention.
Detailed Description
The present invention will be described in detail with reference to specific examples.
As shown in fig. 1, is a complete step of the part surface roughness measurement. The image acquisition module is used for acquiring images of all areas on the surface of the part, the image processing module is used for carrying out graying, filtering and feature extraction on the images, and the obtained feature vectors are input into the roughness detection module to obtain the roughness value of the surface of the part.
As shown in FIG. 2, the present invention provides a method for dividing the surface of a part into 16 regions, for example, a circular part, and the size of each region is controlled within the range of the visual field observable by the digital microscope.
In addition, for the surface of the part with any shape, an average division method can be adopted. The part can be evenly divided into a plurality of regions, and when the area of the divided region is smaller than the visible area of the digital microscope, the division is considered to be effective and can be used for roughness detection; when the area of the divided area exceeds the visible area of the digital microscope, the area exceeding the visible area of the digital microscope is divided for the second time, and is still divided into a plurality of areas evenly for detection, so that the secondary divided area is ensured to be smaller than the visible area of the digital microscope, if the division is still invalid, the division is carried out for the third time, and the like until the area of all the divided areas is smaller than the visible area of the digital microscope.
The image processing module is divided into three parts, which are respectively as follows:
firstly, graying processing is carried out on a part surface image, and the specific process is as follows:
(1) based on the collected part surface image, the pixel points X are calibrated at equal intervals along the direction perpendicular to the image texture direction, and the red (R), green (G) and blue (B) components of the pixel values of the points are obtained, and the pixel component calibration graph is shown in fig. 3.
(2) Comparing two components of R, G, B three pixel components, which are defined as graying 1-6:
Figure BDA0003326354460000071
wherein R (i, j), B (i, j) and G (i, j) are component values of R, G and B of a pixel point with the coordinate of (i, j) in the surface image of the part respectively;
(3) since the division of each pixel component may result in a gray value that exceeds the range of 0 to 1 specified by the pixel, normalization is required, and the calculation formula is as follows:
normalization
Figure BDA0003326354460000081
In the formula, Gray' (i, j)minAnd Gray (i, j)minAnd the maximum gray value and the minimum gray value of the pixel points of the image on the surface of the part are obtained.
The image quality ratios processed by the methods of graying 1 to graying 6 are shown in table 1.
TABLE 1 part surface image quality contrast with grayscales 1-6
Figure BDA0003326354460000082
As can be seen from table 1, the image quality obtained by graying 5 and graying 6 is excellent, and in order to comprehensively consider three components of RGB, graying 5 and graying 6 are combined and defined as a pixel component by a ratio addition method, and the calculation formula is as follows:
pixel component addition method
Figure BDA0003326354460000083
As shown in fig. 4, the original part surface image, the weighted average method, and the part surface image in which pixel components are grayed by the addition method are shown. In order to analyze the image quality after the pixel components are subjected to the gray scaling by the phase comparison method, three evaluation indexes of standard deviation, average gradient and information entropy of the gray image are respectively calculated and compared with the weighted average value method which is most commonly used in the gray scaling 5, the gray scaling 6 and the image gray scaling method. The comparison results are shown in FIG. 5. As can be seen from fig. 5, the pixel components are subjected to the standard deviation, the average gradient and the information entropy extracted by the phase comparison method, and compared with the graying method 5, the graying method 6 and the weighted average method, the corresponding image texture changes more obviously, which is more favorable for extracting the texture features representing the surface roughness of the part. Therefore, the method is adopted to carry out gray processing on the collected image
Secondly, filtering the part surface gray level image:
a gaussian window with dimension of 3 × 3 and standard deviation of 0.8 is used to perform gaussian filtering operation on the surface gray level image of the part, and mean square error and peak signal-to-noise ratio are selected to compare filtering effects with mean filtering, median filtering and gaussian filtering, and the specific result is shown in fig. 6. As can be seen from fig. 6, the mean square error of the surface image of the part obtained by gaussian filtering is much smaller than those of the other two methods, and the peak signal-to-noise ratio is greater than those of the other two methods, so that the corresponding image quality is higher. Therefore, gaussian filtering is selected to perform filtering processing on the acquired image.
And thirdly, extracting four texture features of energy, entropy, moment of inertia and correlation based on the gray level co-occurrence matrix, and respectively solving the mean value and the variance to generate 8-dimensional feature vectors.
And extracting the surface texture characteristics of the part, and establishing a relation model of the surface texture characteristics of the part and the surface roughness of the part. The gray level co-occurrence matrix represents the adjacent interval and the change amplitude of the surface image of the part by analyzing the gray level change of the pixels of the surface image of the part, and further describes the surface texture of the part.
Constructing a probability matrix P (i, j) by analyzing the probability of the simultaneous occurrence of a pixel with the gray level of i and a pixel with the gray level of j in the point (x, y) in the surface image of the part, wherein the formula is as follows:
probability matrix
Figure BDA0003326354460000091
Wherein, i is 1, 2.. times.m; j ═ 1,2,. N; f (x, y) and f (x + a, y + b) represent the gray values of pixel points (x, y), (x + a, y + b) in the part surface image.
Based on the gray level co-occurrence matrix, the following features are extracted: energy, entropy, moment of inertia and correlation are calculated as follows:
(Energy)
Figure BDA0003326354460000092
entropy of the entropy
Figure BDA0003326354460000093
Moment of inertia
Figure BDA0003326354460000094
Correlation
Figure BDA0003326354460000101
In the formula: m, N are the number of pixels in the horizontal and vertical directions, respectively, in the part surface image; mu is the average value of pixel points of the surface image of the part; x 'and y' represent the gradients of the horizontal and vertical directions of the surface image of the part respectively; l represents the gray level of the pixel point of the image on the surface of the part; l represents the maximum gray level, L is 255; p (l) is the pixel ratio of the gray level l in the part surface image.
S24, generating characteristic vectors, and respectively obtaining WA,WB,WC,WDMean value of WA1,WB1,WC1,WD1Sum variance WA2,WB2,WC2,WD2The 8-dimensional feature vectors are generated by the 8 features as the features for describing the surface texture of the part and are used as the input of the support vector machine.
As shown in table 2, the results of extracting texture features from the surface of the part having Ra of 0.4 μm, 0.8 μm, and 1.6 μm by different graying methods were obtained.
TABLE 2 comparison of surface texture characteristics of parts of different roughness grades
Figure BDA0003326354460000102
As can be seen from table 2, when Ra is 0.8 μm to 1.6 μm, the texture feature W extracted after the pretreatment by the weighted average methodA1、WB1、WC1、WD1The change amplitude is smaller relative to the pixel component by the phase comparison addition method, and the similar roughness is not easy to distinguish; and based on the partial correlation mean value W extracted after the pretreatment of the weighted average value methodD1Increase with increasing roughness, and correlation mean value WD1The tendency to decrease with increasing roughness does not match. Therefore, the image preprocessed by the phase comparison method by adopting the pixel components is more beneficial to extracting the texture features with obvious roughness distinction, so that the surface roughness of the part can be better identified.
The detection process of the roughness detection module is as follows:
and taking the 8-dimensional characteristic vector extracted based on the gray level co-occurrence matrix as the input of a support vector machine detection model, wherein the output of the model is the roughness value of each area of the surface of the part, and finally, solving the mean value of the roughness values of each area as the roughness value of the surface of the part.
The Support Vector Machine (SVM) is based on the principle of minimizing the structural risk, can effectively solve the problems of data nonlinearity, few samples and the like, has the advantages of fast training, strong generalization capability and the like, establishes the relationship between the surface texture characteristics of the part and the surface roughness of the part, and detects the surface roughness of the part based on the SVM.
The output values of the roughness detection model based on the support vector machine can be represented as a non-linear regression model as follows:
nonlinear regression model RaModel (model)=wTx+b (8)
In the formula, RaModel (model)Detecting the roughness of the surface of the part output by the model for a support vector machine, wherein w is a linear combination of the feature vector input of the surface image of the part extracted based on the gray level co-occurrence matrix; b is the functional bias.
And a Gaussian kernel function is selected as a kernel function of the support vector machine detection model, and a penalty parameter C is set to be 0.1 and a width parameter sigma is set to be 0.8 according to the input part surface feature vector. Through training and verification of the model, the root mean square error of the roughness detection of the support vector machine based on the Gaussian kernel function is 0.0316, the average relative error is 0.0296, the detection precision is high, and the running time is appropriate.
And taking the extracted feature vector of the surface texture of the part as the input of a detection model of a support vector machine, wherein the output of the model is the roughness value of the surface of the part.
As shown in table 3, the detection accuracy of parts with different roughness levels is supported by the vector machine model.
TABLE 3 parts roughness test results for different roughness grades
Figure BDA0003326354460000111
As shown in FIG. 7, the roughness real value and the detected value of a set of 16 collected areas on the surface of the test sample part are compared.
In order to analyze the influence on the roughness detection accuracy before and after the improvement of the graying, a weighted average method and a texture feature extracted after the image is subjected to the phase comparison and addition processing of the pixel component are respectively selected as input, and the simulation of multiple batches is performed based on a support vector machine, wherein the detection accuracy is shown in table 4.
TABLE 4 comparison of roughness measurement accuracy under different graying methods
Figure BDA0003326354460000121
In order to analyze the rationality of the selection of the detection models, the detection accuracy of a plurality of models is compared, 5% of detection relative error is used as a threshold, the percentage of the number of images with the detection relative error lower than the threshold in each region divided by the surface of the part is calculated, and the comparison result is shown in fig. 8. As can be seen from fig. 8, the roughness detection relative errors of the regions of the surface of the part based on the support vector machine are all less than 5%, and the percentage of the number of the images detected by the remaining three methods, in which the detection relative errors of the regions are less than the threshold, is 68.75%, 37.5%, and 43.75%, respectively. Compared with the other three methods, the support vector machine model has higher detection precision on the surface roughness of the part.
The invention provides an image acquisition device for each area of the surface of a part, which comprises: the system comprises an STM32 singlechip, a two-phase four-wire stepping motor, an SGO-1000BX digital microscope, an upper computer and a part surface image acquisition and part surface roughness detection system built on the upper computer; the single chip microcomputer is respectively connected with the stepping motor and the upper computer, and the stepping motor drives the horizontal tray to operate; the upper computer is connected with the digital microscope, and the digital microscope is distributed above the horizontal tray.
As shown in fig. 9, the method for acquiring the image of each region on the surface of the part specifically comprises the following steps:
(1) placing the parts on a horizontal tray, and sending an image acquisition starting signal to the single chip microcomputer by the upper computer through a serial port;
(2) the single chip microcomputer receives an image acquisition starting signal, outputs a PWM wave with a certain period to drive the stepping motor to rotate, and the stepping motor drives the horizontal tray and the upper parts thereof to rotate to a division area;
(3) the single chip microcomputer suspends the output of the PWM wave and sends an image acquisition signal to an upper computer through a serial port;
(4) the upper computer receives the image acquisition signal, controls the digital microscope to acquire and store the part surface image, and sends an image acquisition completion signal to the single chip microcomputer through serial port communication;
(5) and (4) receiving the signal by the singlechip, continuously outputting PWM (pulse-width modulation) waves to drive the stepping motor to rotate, driving the horizontal tray and the parts on the horizontal tray to rotate to the next divided area by the stepping motor, and repeating the steps (3) and (4) until all the images of the divided area on the surface of the part are acquired.
(6) And the upper computer sends an image acquisition stopping signal to the singlechip through the serial port.
(7) The single chip microcomputer receives an image acquisition stopping signal, stops outputting PWM waves, stops rotating the stepping motor, and stops acquiring the surface image of the part.
It will be understood that modifications and variations can be made by persons skilled in the art in light of the above teachings and all such modifications and variations are intended to be included within the scope of the invention as defined in the appended claims.

Claims (10)

1. A part surface roughness support vector machine detection method based on images is characterized by comprising the following steps:
s1, dividing the surface of the part into proper areas by using a part surface dividing method, and collecting images of all the areas on the surface of the part by using a part surface image collecting system;
s2, carrying out image preprocessing on the part image; converting the surface image of the part into a gray image by using a pixel component to perform a phase comparison addition method, and performing filtering processing by using a Gaussian window;
s3, extracting four texture features of energy, entropy, moment of inertia and correlation of the image based on the gray level co-occurrence matrix, and respectively solving the mean value and the variance to generate an 8-dimensional feature vector as the input of the support vector machine;
s4 support the vector machine detection model to output the roughness value, and the detection result of the roughness value of the surface of the part is displayed through the upper computer interface.
2. The inspection method according to claim 1, wherein in step S1, the method of dividing the surface of the part is as follows: the part is evenly divided into a plurality of areas, and when the area of the divided area is smaller than the visible area of the digital microscope, the division is considered to be effective and can be used for roughness detection; when the area of the divided area exceeds the visible area of the digital microscope, the area exceeding the visible area of the digital microscope is divided for the second time, and is still divided into a plurality of areas evenly for detection, so that the secondary divided area is ensured to be smaller than the visible area of the digital microscope, if the division is still invalid, the division is carried out for the third time, and the like until the area of all the divided areas is smaller than the visible area of the digital microscope.
3. The inspection method according to claim 1, wherein the step of collecting images of the regions on the surface of the part in step S1 comprises the steps of:
s11, placing the parts on sampling points of the horizontal tray, sending images by the upper computer to start collecting signals, receiving the signals by the single chip microcomputer to output PWM waves, and driving the horizontal tray and the parts on the horizontal tray to rotate to a division area by the stepping motor;
s12, the single chip microcomputer suspends PWM wave output and sends an image acquisition signal to the upper computer;
s13, the upper computer receives the image acquisition signal, controls the digital microscope to acquire the part image and stores the part image in the upper computer, and then sends an image acquisition completion signal to the single chip microcomputer through the serial port;
and S14, the single chip microcomputer receives the image acquisition completion signal, continues to output PWM waves to drive the stepping motor, and repeats the steps S11, S12 and S13 until the acquisition of all the divided areas of the parts is completed.
4. The inspection method according to claim 1, wherein in step S2, the part surface gray scale image is subjected to a gaussian filtering operation using a gaussian window having dimensions of 3 x 3 and a standard deviation of 0.8.
5. The detection method according to claim 1, wherein the specific method of S3 is: extracting the surface texture characteristics of the part, and establishing a relation model between the surface texture characteristics of the part and the surface roughness of the part;
constructing a probability matrix P (i, j) by analyzing the probability of the simultaneous occurrence of a pixel with the gray level of i and a pixel with the gray level of j in the point (x, y) in the surface image of the part, wherein the formula is as follows:
probability matrix
Figure FDA0003326354450000021
Wherein, i is 1, 2.. times.m; j ═ 1,2,. N; f (x, y) and f (x + a, y + b) represent the gray values of pixel points (x, y), (x + a, y + b) in the surface image of the part;
based on the gray level co-occurrence matrix, the following features are extracted: energy, entropy, moment of inertia and correlation are calculated as follows:
(Energy)
Figure FDA0003326354450000022
entropy of the entropy
Figure FDA0003326354450000023
Moment of inertia
Figure FDA0003326354450000024
Correlation
Figure FDA0003326354450000025
In the formula: m, N are the number of pixels in the horizontal and vertical directions, respectively, in the part surface image; mu is the average value of pixel points of the surface image of the part; x 'and y' represent the gradients of the horizontal and vertical directions of the surface image of the part respectively; l represents the gray level of the pixel point of the image on the surface of the part; l represents the maximum gray level, L is 255; p (l) is the pixel ratio of the gray level l in the part surface image.
Generating feature vectors, and calculating WA,WB,WC,WDMean value of WA1,WB1,WC1,WD1Sum variance WA2,WB2,WC2,WD2The 8-dimensional feature vectors are generated by the 8 features as the features for describing the surface texture of the part and are used as the input of the support vector machine.
6. The detection method according to claim 1, wherein the specific method of S4 is:
s41, the output value of the support vector machine-based roughness detection model can be represented as a non-linear regression model as follows:
nonlinear regression model RaModel (model)=wTx+b (8)
In the formula, RaModel (model)Part surface roughness output by a support vector machine detection model, w is part surface extracted based on a gray level co-occurrence matrixLinear combination of image feature vector inputs; b is a function bias;
s42, selecting a Gaussian kernel function as a kernel function of the support vector machine detection model, and setting a penalty parameter C to be 0.1 and a width parameter sigma to be 0.8 according to the input part surface feature vector;
and S44, taking the extracted feature vector of the part surface texture as the input of a support vector machine detection model, wherein the output of the model is the roughness value of the part surface.
7. The detection method according to claim 1, wherein the pixel component comparison procedure is as follows:
(1) based on the collected image, calibrating pixel points X at equal intervals along the direction vertical to the texture direction of the image, and obtaining red (R), green (G) and blue (B) components of the pixel values of the points;
(2) the pixel components B, R, B and G are compared and added, and the normalized value is used as the new pixel value for the point, which is expressed as follows:
pixel component addition method
Figure FDA0003326354450000031
And R (i, j), B (i, j) and G (i, j) are respectively component values of R, G and B of the pixel point with the coordinate of (i, j) in the part surface image.
8. The part surface roughness support vector machine inspection system of the inspection method of any one of claims 1 to 7, comprising:
part surface image acquisition device: dividing the surface of the part into proper areas by using a part surface dividing method, and collecting images of all the areas on the surface of the part;
an image preprocessing module: converting the surface image of the part into a gray image by using a pixel component to perform a phase comparison addition method, and performing filtering processing by using a Gaussian window;
the texture feature extraction module: extracting four texture features of energy, entropy, moment of inertia and correlation of the image based on the gray level co-occurrence matrix, and respectively solving the mean value and the variance to generate an 8-dimensional feature vector as the input of a support vector machine;
the support vector machine detection module: and the support vector machine detection module outputs a roughness value, and a detection result of the roughness value of the surface of the part is displayed through an upper computer interface.
9. The detection system of claim 8, wherein the texture feature extraction module: extracting the surface texture characteristics of the part, and establishing a relation model between the surface texture characteristics of the part and the surface roughness of the part;
constructing a probability matrix P (i, j) by analyzing the probability of the simultaneous occurrence of a pixel with the gray level of i and a pixel with the gray level of j in the point (x, y) in the surface image of the part, wherein the formula is as follows:
probability matrix
Figure FDA0003326354450000041
Wherein, i is 1, 2.. times.m; j ═ 1,2,. N; f (x, y) and f (x + a, y + b) represent the gray values of pixel points (x, y), (x + a, y + b) in the surface image of the part;
based on the gray level co-occurrence matrix, the following features are extracted: energy, entropy, moment of inertia and correlation are calculated as follows:
(Energy)
Figure FDA0003326354450000042
entropy of the entropy
Figure FDA0003326354450000043
Moment of inertia
Figure FDA0003326354450000044
Correlation
Figure FDA0003326354450000045
In the formula: m, N are the number of pixels in the horizontal and vertical directions, respectively, in the part surface image; mu is the average value of pixel points of the surface image of the part; x 'and y' represent the gradients of the horizontal and vertical directions of the surface image of the part respectively; l represents the gray level of the pixel point of the image on the surface of the part; l represents the maximum gray level, L is 255; p (l) is the pixel ratio of the gray level l in the part surface image.
Generating feature vectors, and calculating WA,WB,WC,WDMean value of WA1,WB1,WC1,WD1Sum variance WA2,WB2,WC2,WD2The 8-dimensional feature vectors are generated by the 8 features as the features for describing the surface texture of the part and are used as the input of the support vector machine.
10. The detection system according to claim 8, wherein the image preprocessing module comprises a pixel component comparison unit, and the pixel component comparison unit is configured to:
(1) based on the collected image, calibrating pixel points X at equal intervals along the direction vertical to the texture direction of the image, and obtaining red (R), green (G) and blue (B) components of the pixel values of the points;
(2) the pixel components B, R, B and G are compared and added, and the normalized value is used as the new pixel value for the point, which is expressed as follows:
pixel component addition method
Figure FDA0003326354450000051
And R (i, j), B (i, j) and G (i, j) are respectively component values of R, G and B of the pixel point with the coordinate of (i, j) in the part surface image.
CN202111262722.0A 2021-10-28 2021-10-28 Image-based part surface roughness support vector machine detection method and system Pending CN113989233A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111262722.0A CN113989233A (en) 2021-10-28 2021-10-28 Image-based part surface roughness support vector machine detection method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111262722.0A CN113989233A (en) 2021-10-28 2021-10-28 Image-based part surface roughness support vector machine detection method and system

Publications (1)

Publication Number Publication Date
CN113989233A true CN113989233A (en) 2022-01-28

Family

ID=79743345

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111262722.0A Pending CN113989233A (en) 2021-10-28 2021-10-28 Image-based part surface roughness support vector machine detection method and system

Country Status (1)

Country Link
CN (1) CN113989233A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114359112A (en) * 2022-03-11 2022-04-15 领伟创新智能系统(浙江)有限公司 Surface roughness evaluation method based on Hoyer coefficient of machined surface image
CN114693678A (en) * 2022-05-31 2022-07-01 武汉东方骏驰精密制造有限公司 Intelligent detection method and device for workpiece quality
CN114998311A (en) * 2022-07-11 2022-09-02 江苏名欧精密机械有限公司 Part precision detection method based on homomorphic filtering

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114359112A (en) * 2022-03-11 2022-04-15 领伟创新智能系统(浙江)有限公司 Surface roughness evaluation method based on Hoyer coefficient of machined surface image
CN114359112B (en) * 2022-03-11 2022-06-14 领伟创新智能系统(浙江)有限公司 Surface roughness evaluation method based on Hoyer statistic value of machined surface image
CN114693678A (en) * 2022-05-31 2022-07-01 武汉东方骏驰精密制造有限公司 Intelligent detection method and device for workpiece quality
CN114998311A (en) * 2022-07-11 2022-09-02 江苏名欧精密机械有限公司 Part precision detection method based on homomorphic filtering

Similar Documents

Publication Publication Date Title
CN113989233A (en) Image-based part surface roughness support vector machine detection method and system
CN109635806B (en) Ammeter value identification method based on residual error network
CN105260709B (en) Water meter calibration method, apparatus based on image procossing and system
CN112818988B (en) Automatic identification reading method and system for pointer instrument
CN105260710B (en) Water meter calibration method, apparatus based on image procossing and system
CN109612888B (en) Powder mixing uniformity detection method based on image technology
CN110210448B (en) Intelligent face skin aging degree identification and evaluation method
CN115619793B (en) Power adapter appearance quality detection method based on computer vision
CN105300482A (en) Water meter calibration method, apparatus and system based on image processing
CN101561932A (en) Method and device for detecting real-time movement target under dynamic and complicated background
CN108257125B (en) Depth image quality non-reference evaluation method based on natural scene statistics
CN108550146A (en) A kind of image quality evaluating method based on ROI
CN115082477B (en) Semiconductor wafer processing quality detection method based on light reflection removing effect
CN115018835B (en) Automobile starter gear detection method
CN112381751A (en) Online intelligent detection system and method based on image processing algorithm
CN109272484B (en) Rainfall detection method based on video image
CN112597923B (en) Pulse pile-up correction method based on morphology and optimized gray model
CN116740053B (en) Management system of intelligent forging processing production line
CN112381177A (en) Dial digital character recognition method and system based on deep learning
CN116309493A (en) Method and system for detecting defects of textile products
TW200842339A (en) Mura detection method and system
CN112699824B (en) Method and device for detecting constant of electric energy meter and storage medium
CN114881984A (en) Detection method and device for rice processing precision, electronic equipment and medium
CN114782822A (en) Method and device for detecting state of power equipment, electronic equipment and storage medium
CN113792666A (en) Concrete classification method and system based on scanning electron microscope images

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