CN116952169B - Intelligent detection system and method for straightness of screw rod - Google Patents

Intelligent detection system and method for straightness of screw rod Download PDF

Info

Publication number
CN116952169B
CN116952169B CN202311218702.2A CN202311218702A CN116952169B CN 116952169 B CN116952169 B CN 116952169B CN 202311218702 A CN202311218702 A CN 202311218702A CN 116952169 B CN116952169 B CN 116952169B
Authority
CN
China
Prior art keywords
straightness
edge
area
screw rod
characteristic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311218702.2A
Other languages
Chinese (zh)
Other versions
CN116952169A (en
Inventor
赵志强
赵志刚
万艳艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huizhou Jinjian Precision Parts Co ltd
Original Assignee
Huizhou Jinjian Precision Parts Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huizhou Jinjian Precision Parts Co ltd filed Critical Huizhou Jinjian Precision Parts Co ltd
Priority to CN202311218702.2A priority Critical patent/CN116952169B/en
Publication of CN116952169A publication Critical patent/CN116952169A/en
Application granted granted Critical
Publication of CN116952169B publication Critical patent/CN116952169B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/26Measuring arrangements characterised by the use of optical techniques for measuring angles or tapers; for testing the alignment of axes
    • G01B11/27Measuring arrangements characterised by the use of optical techniques for measuring angles or tapers; for testing the alignment of axes for testing the alignment of axes

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Length Measuring Devices By Optical Means (AREA)

Abstract

The invention relates to the technical field of image processing, in particular to an intelligent detection system and method for screw straightness, wherein the method comprises the following steps: collecting a screw rod surface gray level image right above the screw rod, and obtaining a screw rod region in the screw rod surface gray level image and a light reflection region in the screw rod region; determining the transverse straightness according to the distribution condition of the long edge line of the screw rod area and the edge line of the light reflecting area; obtaining the abnormal degree of each reflecting area according to the gray value distribution condition of the pixel points in each reflecting area and the difference between the gray value distribution condition of the pixel points in other reflecting areas; obtaining longitudinal straightness in the screw rod area according to the abnormal degree of each light reflecting area and the gray level change condition of the adjacent light reflecting area; and determining the comprehensive straightness of the screw rod region according to the transverse straightness and the longitudinal straightness, and detecting the straightness of the screw rod according to the comprehensive straightness. The invention can obtain more accurate straightness detection results.

Description

Intelligent detection system and method for straightness of screw rod
Technical Field
The invention relates to the technical field of image processing, in particular to an intelligent detection system and method for screw straightness.
Background
The screw rod is one of key parts in the manufacturing industry, and the measurement accuracy of the straightness of the screw rod directly influences the quality detection result of a part product. Straightness is a common parameter in the field of machining and is used to describe the degree of flatness of a part surface. In the manufacturing process of the parts, the surfaces of the parts can be bent and deformed due to the influence of various factors, such as material defects, errors in the processing process and the like, so that the flatness of the parts is influenced, and the quality and performance of products are influenced. Therefore, the straightness detection of the screw rod is particularly important. In the prior art, hough straight line detection is often adopted to detect the straightness of the surface of the screw rod, but the accuracy of a detection result is lower due to the influence of an image shooting angle.
Disclosure of Invention
In order to solve the technical problem of lower accuracy of detection results of the existing screw rod straightness detection method, the invention aims to provide an intelligent screw rod straightness detection method, which adopts the following specific technical scheme:
collecting a screw rod surface gray level image right above the screw rod, and obtaining a screw rod region in the screw rod surface gray level image and a light reflection region in the screw rod region;
determining the transverse straightness of the screw rod region according to the distribution condition of the long edge line of the screw rod region and the edge line of the light reflecting region;
obtaining the abnormal degree of each reflecting area according to the gray value distribution condition of the pixel points in each reflecting area and the difference between the gray value distribution condition of the pixel points in other reflecting areas; obtaining the longitudinal straightness of the screw rod region according to the abnormal degree of each light reflecting region and the gray level change condition of the adjacent light reflecting region in the screw rod region;
and determining the comprehensive straightness of the screw rod region according to the transverse straightness and the longitudinal straightness of the screw rod region, and detecting the straightness of the screw rod according to the comprehensive straightness.
Preferably, the determining the lateral straightness of the lead screw area according to the distribution of the long edge line of the lead screw area and the edge line of the light reflecting area specifically includes:
edge detection is carried out on the lead screw area to obtain edge lines of the lead screw area, the edge line with the largest number of edge pixel points is recorded as a long edge line of the lead screw area, and straight line fitting is carried out on the long edge line of the lead screw area to obtain edge characteristic straight lines of the lead screw area;
marking any one reflective area as a target reflective area, and determining a first edge line and a second edge line of the target reflective area according to the distance from each edge pixel point of the target reflective area to the edge characteristic straight line;
respectively performing straight line fitting on the first edge line and the second edge line to obtain a first characteristic straight line and a second characteristic straight line, and respectively obtaining the characteristic weight of the first edge line and the characteristic weight of the second edge line according to the distance between the first edge pixel point and the first characteristic straight line and the distance between the second edge pixel point and the second characteristic straight line of the target light reflecting area;
according to the difference of the inclination degrees between the first characteristic straight line and the edge characteristic straight line and the difference of the inclination degrees between the second characteristic straight line and the edge characteristic straight line, respectively obtaining the characteristic straightness of the first edge line and the characteristic straightness of the second edge line; the corresponding characteristic straightness is weighted and summed by utilizing the characteristic weight to obtain the characteristic straightness of the target reflection area;
taking the average value of the characteristic straightness of all the reflection areas in the screw rod area as the transverse straightness of the screw rod area.
Preferably, the determining the first edge line and the second edge line of the target light reflecting area according to the distance between each edge pixel point of the target light reflecting area and the edge characteristic straight line specifically includes:
calculating the distance from each edge pixel point of the target light reflecting area to the edge characteristic straight line to be marked as a first distance, marking the edge pixel points corresponding to a preset number of first distance threshold values which are smaller than or equal to a preset first distance threshold value in the target light reflecting area as first edge pixel points, and marking the edge pixel points corresponding to a preset number of second distance threshold values which are larger than or equal to a preset first distance threshold value in the target light reflecting area as second edge pixel points; and the edge lines formed by all the first edge pixel points in the target reflective area are first edge lines, and the edge lines formed by all the second edge pixel points are second edge lines.
Preferably, the method for acquiring the feature weights of the first edge line and the feature weights of the second edge line specifically includes:
calculating the average value of the distances from all the first edge pixel points to the first characteristic straight line as a first distance average value for the first edge line of the target reflective area, and performing inverse proportion normalization processing on the first distance average value to obtain the characteristic weight of the first edge line;
and calculating the average value of the distances from all the second edge pixel points to the second characteristic straight line as a second distance average value for the second edge line of the target reflective region, and performing inverse proportion normalization processing on the second distance average value to obtain the characteristic weight of the second edge line.
Preferably, the method for obtaining the characteristic straightness of the first edge line and the characteristic straightness of the second edge line specifically includes:
for the first edge line, marking the difference between the slope of the first characteristic line and the slope of the edge characteristic line as a first edge difference, and obtaining the characteristic straightness of the first edge line according to the first edge difference, wherein the first edge difference and the characteristic straightness of the first edge line are in a negative correlation;
and for the second edge line, marking the difference between the slope of the second characteristic line and the slope of the edge characteristic line as a second edge difference, and obtaining the characteristic straightness of the second edge line according to the second edge difference, wherein the second edge difference and the characteristic straightness of the second edge line are in a negative correlation.
Preferably, the method for acquiring the abnormality degree of each reflection area specifically includes:
marking any one reflective area as a selected reflective area, obtaining a mass center in the selected reflective area, calculating the distance between a pixel point and the mass center for any one pixel point in the selected reflective area to obtain a distance index of the pixel point, calculating the gray value difference between the pixel point and the mass center to obtain a gray index of the pixel point, taking the product of the distance index of the pixel point and the gray index as a characteristic index of the pixel point, and taking the average value of the characteristic indexes of all the pixel points in the selected reflective area as the gray change degree of the selected reflective area;
the average value of the gray scale change degrees of all the light reflecting areas except the selected light reflecting area is obtained and is recorded as a change characteristic value, the ratio between the gray scale change degree of the selected light reflecting area and the change characteristic value is recorded as a first ratio, and the absolute value of the difference between the first preset value and the first ratio is used as the abnormal degree of the selected light reflecting area.
Preferably, the obtaining the longitudinal straightness of the screw rod area according to the abnormal degree of each light reflecting area and the gray level change condition of the adjacent light reflecting area in the screw rod area specifically includes:
respectively calculating the absolute value of the difference between the gray level change degree of the selected light reflecting area and the gray level change degree of two adjacent light reflecting areas, and recording the average value of the two absolute values of the difference as the average difference value of the selected light reflecting areas; acquiring the average value of the average difference values of all the light reflecting areas except the selected light reflecting area and recording the average value as a characteristic difference value; calculating the ratio between the average difference value of the selected reflective area and the characteristic difference value to obtain a second ratio, and taking the absolute value of the difference value between a second preset value and the second ratio as a characteristic coefficient;
obtaining the longitudinal straightness of the selected reflecting area according to the average difference value, the abnormality degree and the characteristic coefficient of the selected reflecting area, wherein the average difference value, the abnormality degree and the characteristic coefficient of the selected reflecting area are in negative correlation with the longitudinal straightness of the selected reflecting area; taking the average value of the longitudinal straightness of all the light reflecting areas in the screw rod area as the longitudinal straightness of the screw rod area.
Preferably, the determining the comprehensive straightness of the screw rod area according to the transverse straightness and the longitudinal straightness of the screw rod area specifically includes:
taking the sum value of the transverse straightness and the longitudinal straightness of the screw rod area as the comprehensive straightness of the screw rod area.
Preferably, the detecting the straightness of the screw rod according to the comprehensive straightness specifically includes:
when the normalized comprehensive straightness is greater than or equal to a preset abnormal threshold, the straightness of the screw rod is abnormal; when the normalized comprehensive straightness is smaller than a preset abnormal threshold, the straightness of the screw rod is not abnormal.
The invention also provides an intelligent detection system for the straightness of the screw rod, which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the computer program realizes the steps of the intelligent detection method for the straightness of the screw rod when being executed by the processor.
The embodiment of the invention has at least the following beneficial effects:
according to the invention, the gray level image on the surface of the screw rod is collected right above the screw rod, so that the image collection position is fixed, multi-angle collection is not needed when the screw rod is subjected to straightness detection in the follow-up process, and part of manpower and material resources are saved. Firstly, a lead screw area in a gray level image of the surface of the lead screw and a light reflecting area in the lead screw area are obtained, and then the transverse flatness of the lead screw area is reflected from the transverse distribution aspect of the lead screw area by analyzing the distribution condition of the long edge line of the lead screw area and the edge line of the light reflecting area. Further, the abnormal degree of the light reflecting area is obtained by analyzing the difference between the gray value distribution condition of the pixel points in each light reflecting area and the gray value distribution condition of the pixel points in other light reflecting areas, the abnormal condition of the light reflecting area is reflected in terms of the difference degree between the gray value distribution change conditions, and further the longitudinal straightness of the screw rod is determined based on the abnormal condition and the gray change condition between the adjacent light reflecting areas, so that the straightness degree of the screw rod can be reflected in terms of the gray difference condition of the light reflecting areas in the screw rod area. Finally, the final comprehensive straightness of the screw rod area is obtained by combining the straightness of the screw rods in two aspects, and then a relatively accurate straightness detection result can be obtained.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a method for intelligently detecting the straightness of a screw rod.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following is a detailed description of specific implementation, structure, characteristics and effects of the intelligent detection system and method for screw straightness according to the invention with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
An embodiment of a method for intelligently detecting straightness of a screw rod comprises the following steps:
the specific scene aimed by the invention is as follows:
the invention provides a specific scheme of an intelligent detection method for screw straightness, which is specifically described below with reference to the accompanying drawings.
Referring to fig. 1, a method flowchart of a method for intelligently detecting straightness of a screw according to an embodiment of the present invention is shown, and the method includes the following steps:
collecting a screw rod surface gray level image right above a screw rod, and obtaining a screw rod region in the screw rod surface gray level image and a light reflection region in the screw rod region.
The existing straightness detection method is easily affected by an image shooting angle, so that the straightness detection result is inaccurate, for example, if a fixed camera is directly above a conveyor belt, a manufactured screw rod is placed on the conveyor belt, the camera directly above the conveyor belt is used for shooting the surface image of the screw rod, if the bending direction of the screw rod placed on the conveyor belt is bending in the vertical direction, namely, the screw rod is bending in the direction approaching to the camera, or the screw rod is bending in the direction far away from the camera, errors can occur according to the straightness detection result of the screw rod surface image obtained by shooting by the camera directly above the existing straightness detection method, namely, the condition that the screw rod is bent cannot be identified, and therefore, the position of the screw rod needs to be adjusted or a plurality of cameras with different angles are required to be arranged for collecting the image, and a large amount of manpower and material resources are consumed easily. Based on the method, the light source is fixed in the scene of detecting the straightness of the screw rod, the reflection condition of the surface of the screw rod is analyzed, and the straightness of the screw rod is detected by combining the straightness detection results in two aspects, so that the accuracy of the detection results is ensured.
Specifically, collecting a screw rod surface image right above the screw rod, and carrying out graying treatment on the screw rod surface image to obtain a screw rod surface gray image. Because the collected images may have interference of background parts, background removal processing is required to be performed on the gray level images on the surface of the screw rod to obtain the screw rod area in the gray level images on the surface of the screw rod. In this embodiment, a semantic segmentation method is used to perform background removal processing on the grayscale image on the surface of the screw rod, and an operator may select other suitable methods to process the grayscale image on the surface of the screw rod according to a specific implementation scene. The method of semantic segmentation is a well-known technique, and will not be described in detail here.
Because the requirements on the surface roughness of the screw rod are higher in the process of manufacturing the screw rod, the surface of the screw rod is very smooth under the general condition, and when the image of the surface of the screw rod is shot, the light source is fixed right above the screw rod, so that when the screw rod is not bent, the surface of the screw rod is uniformly illuminated, and the light reflecting part on the area of the screw rod is also uniform. Based on the method, the straightness detection result of the screw can be obtained by analyzing the reflection condition of the surface of the screw, and the reflection area in the screw area is obtained by firstly carrying out threshold segmentation on the screw area.
Specifically, the maximum inter-class variance method is utilized to process the lead screw area to obtain the gray threshold value, and the area formed by the pixel points which are larger than or equal to the gray threshold value in the lead screw area is used as the light reflecting area, namely the gray value of the part of the lead screw area, which belongs to the light emitting area, is larger, and the gray value of the part, which belongs to the part of the lead screw or the shadow part, is smaller.
And step two, determining the transverse straightness of the lead screw area according to the distribution condition of the long edge line of the lead screw area and the edge line of the light reflecting area.
In this embodiment, the light source is fixed directly above the screw, and the surface of the screw is uniformly illuminated, so that the light reflection portion in the screw area in the gray level image of the surface of the screw is also relatively uniform. Based on the method, firstly, the bending condition and the flatness of the screw rod in the horizontal direction are analyzed, when the screw rod is bent in the plane of the conveying belt, namely, the screw rod is bent towards the edge directions of two sides of the conveying belt, the distribution of the reflecting parts in the screw rod area can be changed, and whether the screw rod area is bent in the transverse direction can be judged by analyzing whether the long axis straight line of the whole screw rod area is parallel to the edge straight line of the reflecting area.
Specifically, the transverse straightness of the screw rod area is determined according to the distribution condition of the long edge line of the screw rod area and the edge line of the light reflecting area.
Firstly, edge detection is carried out on a lead screw area to obtain edge lines of the lead screw area, the edge line with the largest number of edge pixel points is recorded as a long edge line of the lead screw area, and straight line fitting is carried out on the long edge line of the lead screw area to obtain edge characteristic straight lines of the lead screw area.
It should be noted that, when the number of edge pixel points on two edge lines in the lead screw region is the same and is the maximum, one edge line is optionally selected as the long edge line of the lead screw region. Meanwhile, the long edge line is closest to the background part in the gray level image of the surface of the screw rod, namely, the long edge line is the edge parts on two sides of the screw rod, the trend of the long axis of the whole screw rod is represented, and the edge characteristic straight line of the screw rod area represents a fitting straight line corresponding to the long axis of the whole screw rod. In this embodiment, the least square method is used to perform straight line fitting on the edge line, and will not be described here too much.
And marking any one reflective area as a target reflective area, and determining a first edge line and a second edge line of the target reflective area according to the distance from each edge pixel point of the target reflective area to the edge characteristic straight line. Specifically, calculating the distance from each edge pixel point of the target light reflecting area to the edge characteristic straight line to be marked as a first distance, marking the edge pixel points corresponding to a preset number of first distance threshold values which are smaller than or equal to a preset first distance threshold value in the target light reflecting area as first edge pixel points, and marking the edge pixel points corresponding to a preset number of second distance threshold values which are larger than or equal to a preset first distance threshold value in the target light reflecting area as second edge pixel points; and the edge lines formed by all the first edge pixel points in the target reflective area are first edge lines, and the edge lines formed by all the second edge pixel points are second edge lines.
In order to analyze the flatness and bending condition of the screw rod, two edge lines, which are approximately parallel to the long edge line of the screw rod region in each light reflecting region under normal conditions, need to be obtained, and since the long edge line of the screw rod region is located at the most edge part of the screw rod region, the distance from the edge pixel point on the two edge lines, which are parallel to the light reflecting region, of the screw rod region to the long edge line is shortest and longest, but since there may be an error condition or a certain bending condition, the distance from the edge pixel point of the light reflecting region to the edge characteristic line corresponding to the long edge line has a certain fluctuation, in this embodiment, a certain number of pixel points are selected as the characterization for analyzing the bending condition by setting a threshold value.
In this embodiment, the value of the first distance threshold is set to 5, the value of the second distance threshold is set to 15, the preset number of values is set to 6, and the practitioner can set according to the specific implementation scenario. Edge pixels on an edge line in the retroreflective region that is approximately perpendicular to the long edge line may have a distance to the long edge line that is between a first distance threshold and a second distance threshold, based on which the first edge line of the target retroreflective region characterizes an edge that is near the long edge line and may be approximately parallel to the long edge line, and the second edge line characterizes an edge that is principally long edge line and may be approximately parallel to the long edge line.
Further, the first edge line and the second edge line are respectively subjected to linear fitting to obtain a first characteristic line and a second characteristic line, and the characteristic weight of the first edge line and the characteristic weight of the second edge line are respectively obtained according to the distance from the first edge pixel point to the first characteristic line and the distance from the second edge pixel point to the second characteristic line of the target reflection area.
Specifically, for a first edge line of a target reflection area, calculating the average value of the distances from all the first edge pixel points to a first characteristic straight line, recording the average value as a first distance average value, and performing inverse proportion normalization processing on the first distance average value to obtain the characteristic weight of the first edge line. By analyzing the distance between the edge pixel point of the target reflective area and the corresponding first characteristic straight line, the difference condition or the approximate condition between the first edge line and the first characteristic straight line is reflected, namely, the smaller the value of the first distance average value is, the closer the first edge line is to the straight line, and further, the greater the straightness degree of the first edge line of the corresponding target reflective area can be illustrated, so that the greater weight needs to be given. The larger the value of the first distance average value, the less the first edge line is approximated to a straight line, and the larger the bending degree of the first edge line of the target reflection region can be explained, so that the smaller weight needs to be given.
And calculating the characteristic weight of the second edge line according to the same calculation method as the characteristic weight of the first edge line, namely calculating the average value of the distances from all second edge pixel points to the second characteristic line as a second distance average value for the second edge line of the target reflective area, and performing inverse proportion normalization processing on the second distance average value to obtain the characteristic weight of the second edge line. The smaller the value of the second distance average value, the closer the second edge line is to a straight line, and further the greater the straightness of the second edge line of the target reflection area, so that a greater weight needs to be given.
The sum of the feature weights of the first edge line and the second edge line is 1. In particular, if the edge pixel points on the first edge line or the second edge line are on the corresponding feature straight lines, that is, the first edge line is taken as an example for explanation, the distances from all the edge pixel points on the first edge line to the first feature straight lines are all 0, in order to avoid that the value of the weight is 0 to affect the calculation result of the subsequent straightness, in this embodiment, the value of the first distance average value of the first edge line is set to be 0.1, and an implementer can set according to a specific implementation scenario.
And respectively obtaining the characteristic straightness of the first edge line and the characteristic straightness of the second edge line by analyzing the inclination degree difference between the first characteristic straight line and the edge characteristic straight line and the inclination degree difference between the second characteristic straight line and the edge characteristic straight line.
Specifically, for the first edge line, the difference between the slope of the first characteristic line and the slope of the edge characteristic line is recorded as a first edge difference, and the characteristic straightness of the first edge line is obtained according to the first edge difference, wherein the first edge difference and the characteristic straightness of the first edge line are in a negative correlation.
Calculating the characteristic straightness of the second edge line according to the same calculation method as the characteristic straightness of the first edge line, namely, regarding the second edge line, marking the difference between the slope of the second characteristic line and the slope of the edge characteristic line as a second edge difference, and obtaining the characteristic straightness of the second edge line according to the second edge difference, wherein the second edge difference and the characteristic straightness of the second edge line are in a negative correlation.
In this embodiment, taking the t-th reflective area in the lead screw area as the target reflective area and taking the first edge line as an example for explanation, the calculation formula of the characteristic straightness of the first edge line can be expressed as:
wherein,characteristic straightness of the first edge line representing the t-th reflection area,/for the first reflection area>Slope of the first characteristic line representing the t-th retroreflective region, +.>Slope of edge characteristic line representing lead screw area, +.>An exponential function based on a natural constant e is represented.
The larger the difference between the slope of the first characteristic line and the slope of the edge characteristic line, namely the first edge difference, the larger the value of the difference is, which indicates that the difference of the straight degree between the first edge line of the target light reflecting area and the whole long axis of the screw rod area is larger, and further indicates that the smaller the straight degree corresponding to the first edge line is, the smaller the value of the characteristic straightness of the first edge line is.
Finally, the feature straightness corresponding to the feature weight is used for weighted summation to obtain the feature straightness of the target reflection area, and the feature straightness can be expressed as follows:
wherein,characteristic straightness indicating the t-th reflection region, < >>Characteristic weight of the first edge line representing the t-th retroreflective region,/and->Characteristic weight of the second edge line representing the t-th retroreflective region,/or->Characteristic straightness of the first edge line representing the t-th reflection area,/for the first reflection area>And the characteristic straightness of the second edge line of the t-th light reflecting area is shown.
Based on the above, the characteristic straightness of all the light reflecting areas in the screw rod area can be obtained according to the same method, namely, the average value of the characteristic straightness of all the light reflecting areas in the screw rod area is used as the transverse straightness of the screw rod area. The lateral straightness of the lead screw region reflects the straightness or bending of the lead screw from a lateral angle.
Thirdly, obtaining the abnormal degree of each reflecting area according to the difference between the gray value distribution condition of the pixel points in each reflecting area and the gray value distribution condition of the pixel points in other reflecting areas; and obtaining the longitudinal straightness of the screw rod region according to the abnormal degree of each light reflecting region and the gray level change condition of the adjacent light reflecting region in the screw rod region.
When the screw rod is bent in the vertical direction, namely, the screw rod is bent towards the position of the camera or away from the position of the camera, the bending condition of the screw rod cannot be accurately obtained only by approximating the linear degree of the edge of each light reflecting area in the screw rod area, and at the moment, the bent part of the surface of the screw rod is subjected to uneven illumination, so that the gray level distribution condition of the light reflecting area is changed to a certain extent.
Firstly, according to the difference between the gray value distribution condition of the pixel points in each light reflecting area and the gray value distribution condition of the pixel points in other light reflecting areas, the abnormal degree of each light reflecting area is obtained. Specifically, any one light reflecting area is recorded as a selected light reflecting area, the mass center in the selected light reflecting area is obtained, for any one pixel point in the selected light reflecting area, the distance between the pixel point and the mass center is calculated to obtain the distance index of the pixel point, the gray value difference between the pixel point and the mass center is calculated to obtain the gray index of the pixel point, the product of the distance index of the pixel point and the gray index is used as the characteristic index of the pixel point, and the average value of the characteristic indexes of all the pixel points in the selected light reflecting area is used as the gray change degree of the selected light reflecting area.
In this embodiment, taking the nth light reflecting area as the selected light reflecting area, the calculation formula of the gray scale variation degree of the nth light reflecting area can be expressed as:
wherein,represents the gray level variation degree of the nth reflective area, ">Representing the number of pixels contained in the nth reflective region,/->Indicating the distance between the (u) th pixel point in the nth reflecting area and the mass center in the nth reflecting area, namely the distance index of the (u) th pixel point,>representing the gray value of the nth pixel point in the nth reflective area,/th>And the gray value representing the centroid in the nth retroreflective region.
Is the gray index of the u-th pixel,>for the characteristic index of the u-th pixel point, the gray value of the pixel point where the mass center is located can represent the light reflecting degree of the light reflecting area, the larger the gray index value of the pixel point is, the larger the difference between the gray value of the pixel point in the light reflecting area and the mass center is, the larger the distance is, the larger the corresponding value of the characteristic index is, the larger the gray change degree of the light reflecting area is finally, the larger the gray change of the light reflecting area is, and the light reflecting area possibly has the condition of uneven illumination, namely the corresponding screw rod has the bending condition.
And then, acquiring the average value of the gray scale change degrees of all the light reflecting areas except the selected light reflecting area, marking the average value as a change characteristic value, marking the ratio between the gray scale change degree of the selected light reflecting area and the change characteristic value as a first ratio, and marking the absolute value of the difference between the first preset value and the first ratio as the abnormal degree of the selected light reflecting area.
The change characteristic value characterizes the balance of gray level change degree of all the other light reflecting areas except the selected light reflecting area in the screw rod area. In this embodiment, the value of the first preset value is 1, when the first ratio is closer to 1, the gray level change degree of the selected light reflecting area is similar to the gray level change degrees of other light reflecting areas, and when the difference between 1 and the first ratio is larger, the larger the difference between the gray level change degree of the selected light reflecting area and the gray level change degree of the other light reflecting areas is, the larger the corresponding abnormal degree value is, the larger the possibility that the selected light reflecting area is abnormal is, and the light non-uniform condition may exist in the light reflecting area, namely, the corresponding screw rod part has bending condition.
Further, the absolute value of the difference between the gray level change degree of the selected light reflecting area and the gray level change degree of the two adjacent light reflecting areas is calculated respectively, and the average value of the two absolute values of the difference is recorded as the average difference value of the selected light reflecting areas. Because the light reflecting areas in the lead screw area are distributed along the direction of the long edge line of the lead screw area, two light reflecting areas adjacent to each light reflecting area are arranged at each light reflecting area, and further the difference condition of gray scale change conditions of the light reflecting areas in a local range is analyzed, and the abnormal condition of the light reflecting areas is further evaluated.
In particular, the reflective regions at both ends have no adjacent two reflective regions, so only the absolute value of the difference in gray scale variation degree between the reflective region and one of the reflective regions adjacent thereto needs to be calculated as the average difference of the reflective regions.
Acquiring the average value of the average difference values of all the light reflecting areas except the selected light reflecting area and recording the average value as a characteristic difference value; calculating the ratio between the average difference value of the selected reflective area and the characteristic difference value to obtain a second ratio, and taking the absolute value of the difference value between a second preset value and the second ratio as a characteristic coefficient; and obtaining the longitudinal straightness of the selected reflective area according to the average difference value, the abnormality degree and the characteristic coefficient of the selected reflective area, wherein the average difference value, the abnormality degree and the characteristic coefficient of the selected reflective area are in negative correlation with the longitudinal straightness of the selected reflective area.
In this embodiment, taking the nth light reflecting area as the selected light reflecting area, the calculation formula of the longitudinal straightness of the nth light reflecting area can be expressed as:
wherein,represents the longitudinal straightness of the nth reflection area, < >>Indicating the degree of abnormality of the nth reflection region, < >>Represents the average difference of the nth retroreflective regions,/-, and->Representing the characteristic coefficient calculated except for the nth reflection region,/and>exp () represents an exponential function based on a natural constant e, 1 being a second preset value.
The difference of gray level change degree between the nth reflecting area and the adjacent reflecting area is reflected, namely, the difference of the selected reflecting area in a local range is reflected, the larger the value is, the larger the abnormal degree is, the greater the possibility of abnormality of the selected reflecting area is, the smaller the corresponding value of longitudinal straightness is, and the greater the possibility of bending of the screw rod at the position of the reflecting area is.
For a second ratio, ++>The value of the second ratio is closer to 1 for the characteristic coefficient, which indicates that the difference condition of the selected reflecting area in the local range is more similar to other reflecting areas, the value of the corresponding first characteristic coefficient is smaller, which indicates that the possibility of abnormal condition of the selected reflecting area is smaller, the value of the corresponding longitudinal straightness of the selected reflecting area is larger, and the straightness of the screw rod at the position of the reflecting area is larger.
And calculating the longitudinal straightness of each light reflecting area in the screw rod area according to the same calculation method as the selected light reflecting area, and further taking the average value of the longitudinal straightness of all the light reflecting areas in the screw rod area as the longitudinal straightness of the screw rod area, wherein the longitudinal straightness of the screw rod area reflects the straightness of the screw rod from the gray level change aspect of the light reflecting areas in the screw rod area.
And fourthly, determining the comprehensive straightness of the screw rod region according to the transverse straightness and the longitudinal straightness of the screw rod region, and detecting the straightness of the screw rod according to the comprehensive straightness.
The horizontal straightness of the screw rod region reflects the straightness or bending degree of the screw rod from a horizontal angle, the vertical straightness of the screw rod region reflects the straightness or bending degree of the screw rod in the vertical direction from the gray level change aspect of the light reflecting region in the screw rod region, and the final straightness characterization value of the screw rod region can be determined by combining the straightness of the two aspects. Namely, the sum value of the transverse straightness and the longitudinal straightness of the screw rod area is taken as the comprehensive straightness of the screw rod area.
And detecting the straightness of the screw rod according to the comprehensive straightness, wherein the larger the value of the comprehensive straightness of the screw rod area is, the larger the straightness of the screw rod is, and the smaller the value of the comprehensive straightness of the screw rod area is, the larger the bending degree of the screw rod area is. When the normalized comprehensive straightness is greater than or equal to a preset abnormal threshold, the straightness of the screw rod is abnormal; when the normalized comprehensive straightness is smaller than a preset abnormal threshold, the straightness of the screw rod is not abnormal. In this embodiment, the value of the anomaly threshold is set to 0.8, and the implementer can set according to the specific implementation scenario.
An embodiment of an intelligent detection system for screw straightness comprises:
the embodiment provides an intelligent detection system for the straightness of a screw rod, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the computer program realizes the intelligent detection of the straightness of the screw rod when being executed by the processor. Since a specific embodiment of the intelligent detection method for the straightness of the screw has been described in detail, the detailed description will not be repeated here.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the scope of the embodiments of the present application, and are intended to be included within the scope of the present application.

Claims (3)

1. The intelligent detection method for the straightness of the screw rod is characterized by comprising the following steps of:
collecting a screw rod surface gray level image right above the screw rod, and obtaining a screw rod region in the screw rod surface gray level image and a light reflection region in the screw rod region;
determining the transverse straightness of the screw rod region according to the distribution condition of the long edge line of the screw rod region and the edge line of the light reflecting region;
obtaining the abnormal degree of each reflecting area according to the gray value distribution condition of the pixel points in each reflecting area and the difference between the gray value distribution condition of the pixel points in other reflecting areas; obtaining the longitudinal straightness of the screw rod region according to the abnormal degree of each light reflecting region and the gray level change condition of the adjacent light reflecting region in the screw rod region;
determining the comprehensive straightness of the screw rod region according to the transverse straightness and the longitudinal straightness of the screw rod region, and detecting the straightness of the screw rod according to the comprehensive straightness;
according to the distribution condition of the long edge line of the screw rod area and the edge line of the light reflecting area, the transverse straightness of the screw rod area is determined, and the method specifically comprises the following steps:
edge detection is carried out on the lead screw area to obtain edge lines of the lead screw area, the edge line with the largest number of edge pixel points is recorded as a long edge line of the lead screw area, and straight line fitting is carried out on the long edge line of the lead screw area to obtain edge characteristic straight lines of the lead screw area;
marking any one reflective area as a target reflective area, and determining a first edge line and a second edge line of the target reflective area according to the distance from each edge pixel point of the target reflective area to the edge characteristic straight line;
respectively performing straight line fitting on the first edge line and the second edge line to obtain a first characteristic straight line and a second characteristic straight line, and respectively obtaining the characteristic weight of the first edge line and the characteristic weight of the second edge line according to the distance between the first edge pixel point and the first characteristic straight line and the distance between the second edge pixel point and the second characteristic straight line of the target light reflecting area;
according to the difference of the inclination degrees between the first characteristic straight line and the edge characteristic straight line and the difference of the inclination degrees between the second characteristic straight line and the edge characteristic straight line, respectively obtaining the characteristic straightness of the first edge line and the characteristic straightness of the second edge line; the corresponding characteristic straightness is weighted and summed by utilizing the characteristic weight to obtain the characteristic straightness of the target reflection area;
taking the average value of the characteristic straightness of all the reflecting areas in the screw rod area as the transverse straightness of the screw rod area;
the determining a first edge line and a second edge line of the target reflection area according to the distance from each edge pixel point of the target reflection area to the edge characteristic line specifically includes:
calculating the distance from each edge pixel point of the target light reflecting area to the edge characteristic straight line to be marked as a first distance, marking the edge pixel points corresponding to a preset number of first distance threshold values which are smaller than or equal to a preset first distance threshold value in the target light reflecting area as first edge pixel points, and marking the edge pixel points corresponding to a preset number of second distance threshold values which are larger than or equal to a preset first distance threshold value in the target light reflecting area as second edge pixel points; the edge lines formed by all the first edge pixel points in the target reflective area are first edge lines, and the edge lines formed by all the second edge pixel points are second edge lines;
the method for acquiring the characteristic weight of the first edge line and the characteristic weight of the second edge line specifically comprises the following steps:
calculating the average value of the distances from all the first edge pixel points to the first characteristic straight line as a first distance average value for the first edge line of the target reflective area, and performing inverse proportion normalization processing on the first distance average value to obtain the characteristic weight of the first edge line;
calculating the average value of the distances from all the second edge pixel points to the second characteristic straight line as a second distance average value for the second edge line of the target reflective area, and performing inverse proportion normalization processing on the second distance average value to obtain the characteristic weight of the second edge line;
the method for acquiring the characteristic straightness of the first edge line and the characteristic straightness of the second edge line specifically comprises the following steps:
for the first edge line, marking the difference between the slope of the first characteristic line and the slope of the edge characteristic line as a first edge difference, and obtaining the characteristic straightness of the first edge line according to the first edge difference, wherein the first edge difference and the characteristic straightness of the first edge line are in a negative correlation;
for the second edge line, marking the difference between the slope of the second characteristic line and the slope of the edge characteristic line as a second edge difference, and obtaining the characteristic straightness of the second edge line according to the second edge difference, wherein the second edge difference and the characteristic straightness of the second edge line are in a negative correlation;
the method for acquiring the abnormal degree of each reflection area specifically comprises the following steps:
marking any one reflective area as a selected reflective area, obtaining a mass center in the selected reflective area, calculating the distance between a pixel point and the mass center for any one pixel point in the selected reflective area to obtain a distance index of the pixel point, calculating the gray value difference between the pixel point and the mass center to obtain a gray index of the pixel point, taking the product of the distance index of the pixel point and the gray index as a characteristic index of the pixel point, and taking the average value of the characteristic indexes of all the pixel points in the selected reflective area as the gray change degree of the selected reflective area;
the average value of the gray level change degrees of all the light reflecting areas except the selected light reflecting area is obtained and is recorded as a change characteristic value, the ratio between the gray level change degree of the selected light reflecting area and the change characteristic value is recorded as a first ratio, and the absolute value of the difference between the first preset value and the first ratio is used as the abnormal degree of the selected light reflecting area;
the longitudinal straightness of the screw rod region is obtained according to the abnormal degree of each light reflecting region and the gray level change condition of the adjacent light reflecting region in the screw rod region, and the method specifically comprises the following steps:
respectively calculating the absolute value of the difference between the gray level change degree of the selected light reflecting area and the gray level change degree of two adjacent light reflecting areas, and recording the average value of the two absolute values of the difference as the average difference value of the selected light reflecting areas; acquiring the average value of the average difference values of all the light reflecting areas except the selected light reflecting area and recording the average value as a characteristic difference value; calculating the ratio between the average difference value of the selected reflective area and the characteristic difference value to obtain a second ratio, and taking the absolute value of the difference value between a second preset value and the second ratio as a characteristic coefficient;
obtaining the longitudinal straightness of the selected reflecting area according to the average difference value, the abnormality degree and the characteristic coefficient of the selected reflecting area, wherein the average difference value, the abnormality degree and the characteristic coefficient of the selected reflecting area are in negative correlation with the longitudinal straightness of the selected reflecting area; taking the average value of the longitudinal straightness of all the light reflecting areas in the screw rod area as the longitudinal straightness of the screw rod area;
the comprehensive straightness of the screw rod area is determined according to the transverse straightness and the longitudinal straightness of the screw rod area, and the method specifically comprises the following steps:
taking the sum value of the transverse straightness and the longitudinal straightness of the screw rod area as the comprehensive straightness of the screw rod area.
2. The intelligent detection method for straightness of a screw rod according to claim 1, wherein the straightness detection for the screw rod according to the comprehensive straightness comprises the following steps:
when the normalized comprehensive straightness is greater than or equal to a preset abnormal threshold, the straightness of the screw rod is abnormal; when the normalized comprehensive straightness is smaller than a preset abnormal threshold, the straightness of the screw rod is not abnormal.
3. A lead screw straightness intelligent detection system comprising a memory, a processor and a computer program stored on the memory and operable on the processor, wherein the computer program when executed by the processor performs the steps of a lead screw straightness intelligent detection method according to any one of claims 1-2.
CN202311218702.2A 2023-09-21 2023-09-21 Intelligent detection system and method for straightness of screw rod Active CN116952169B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311218702.2A CN116952169B (en) 2023-09-21 2023-09-21 Intelligent detection system and method for straightness of screw rod

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311218702.2A CN116952169B (en) 2023-09-21 2023-09-21 Intelligent detection system and method for straightness of screw rod

Publications (2)

Publication Number Publication Date
CN116952169A CN116952169A (en) 2023-10-27
CN116952169B true CN116952169B (en) 2024-01-05

Family

ID=88449626

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311218702.2A Active CN116952169B (en) 2023-09-21 2023-09-21 Intelligent detection system and method for straightness of screw rod

Country Status (1)

Country Link
CN (1) CN116952169B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008076139A (en) * 2006-09-20 2008-04-03 International Alloy Corp System for measuring straightness of bar
CN102519400A (en) * 2011-12-15 2012-06-27 东南大学 Large slenderness ratio shaft part straightness error detection method based on machine vision
CN114608487A (en) * 2022-04-12 2022-06-10 中国重型机械研究院股份公司 Bar straightness measuring system and measuring method
CN115633259A (en) * 2022-11-15 2023-01-20 深圳市泰迅数码有限公司 Automatic regulation and control method and system for intelligent camera based on artificial intelligence
CN116664557A (en) * 2023-07-28 2023-08-29 无锡市明通动力工业有限公司 Visual detection method for surface defects of fan blade

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008076139A (en) * 2006-09-20 2008-04-03 International Alloy Corp System for measuring straightness of bar
CN102519400A (en) * 2011-12-15 2012-06-27 东南大学 Large slenderness ratio shaft part straightness error detection method based on machine vision
CN114608487A (en) * 2022-04-12 2022-06-10 中国重型机械研究院股份公司 Bar straightness measuring system and measuring method
CN115633259A (en) * 2022-11-15 2023-01-20 深圳市泰迅数码有限公司 Automatic regulation and control method and system for intelligent camera based on artificial intelligence
CN116664557A (en) * 2023-07-28 2023-08-29 无锡市明通动力工业有限公司 Visual detection method for surface defects of fan blade

Also Published As

Publication number Publication date
CN116952169A (en) 2023-10-27

Similar Documents

Publication Publication Date Title
CN115311292B (en) Strip steel surface defect detection method and system based on image processing
CN110992346B (en) Fatigue crack length online detection method based on DIP and DICM
CN115351598A (en) Numerical control machine tool bearing detection method
CN114943739B (en) Aluminum pipe quality detection method
CN115100203B (en) Method for detecting quality of steel bar polishing and rust removal
CN117197141B (en) Method for detecting surface defects of automobile parts
CN115018850B (en) Method for detecting burrs of punched hole of precise electronic part based on image processing
CN107816943B (en) Logistics box volume and weight measurement system and implementation method thereof
CN115131354B (en) Laboratory plastic film defect detection method based on optical means
CN113570605A (en) Defect detection method and system based on liquid crystal display panel
CN116402808B (en) Intelligent detection method for manufacturing cable clamp plate die
CN112446225B (en) Determination of module size of optical code
CN115311629B (en) Abnormal bending precision monitoring system of bending machine
CN113176270B (en) Dimming method, device and equipment
CN116523913B (en) Intelligent detection method for quality of screw rod
CN117557820B (en) Quantum dot optical film damage detection method and system based on machine vision
CN115546155A (en) Rivet size detection method based on machine vision
CN114005108A (en) Pointer instrument degree identification method based on coordinate transformation
CN115115603A (en) Automobile accessory flywheel surface detection method based on artificial intelligence
CN115953409A (en) Injection molding surface defect detection method based on image processing
CN114998333A (en) Computer vision detection method and system for light source characteristics
CN117237350B (en) Real-time detection method for quality of steel castings
CN116952169B (en) Intelligent detection system and method for straightness of screw rod
CN117036358B (en) Method and system for detecting tool wear of numerical control machine tool
CN114998329B (en) Precision stamping quality analysis system of radio frequency shielding case of electronic communication equipment

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