CN115507761A - Internal thread small diameter measuring method and device - Google Patents
Internal thread small diameter measuring method and device Download PDFInfo
- Publication number
- CN115507761A CN115507761A CN202110692263.3A CN202110692263A CN115507761A CN 115507761 A CN115507761 A CN 115507761A CN 202110692263 A CN202110692263 A CN 202110692263A CN 115507761 A CN115507761 A CN 115507761A
- Authority
- CN
- China
- Prior art keywords
- pixel
- radius
- internal thread
- thread
- contour
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 238000005259 measurement Methods 0.000 claims abstract description 36
- 238000011161 development Methods 0.000 claims abstract description 12
- 238000012937 correction Methods 0.000 claims description 46
- 230000009467 reduction Effects 0.000 claims description 41
- 230000006870 function Effects 0.000 claims description 28
- 239000011159 matrix material Substances 0.000 claims description 25
- 238000000605 extraction Methods 0.000 claims description 17
- 238000004590 computer program Methods 0.000 claims description 16
- 238000012545 processing Methods 0.000 claims description 12
- 238000000691 measurement method Methods 0.000 claims description 6
- 238000003860 storage Methods 0.000 claims description 6
- 230000008030 elimination Effects 0.000 claims description 4
- 238000003379 elimination reaction Methods 0.000 claims description 4
- 238000007670 refining Methods 0.000 claims description 4
- 238000011946 reduction process Methods 0.000 claims 1
- 238000010586 diagram Methods 0.000 description 31
- 238000001514 detection method Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 5
- 238000004422 calculation algorithm Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 4
- 238000003384 imaging method Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 238000009795 derivation Methods 0.000 description 3
- 238000007689 inspection Methods 0.000 description 3
- 238000005286 illumination Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 238000011156 evaluation Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000011065 in-situ storage Methods 0.000 description 1
- 238000003754 machining Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000000523 sample Substances 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01B—MEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
- G01B11/00—Measuring arrangements characterised by the use of optical techniques
- G01B11/08—Measuring arrangements characterised by the use of optical techniques for measuring diameters
- G01B11/12—Measuring arrangements characterised by the use of optical techniques for measuring diameters internal diameters
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Geometry (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a method and a device for measuring the minor diameter of an internal thread, wherein the method comprises the steps of fixedly arranging the internal thread to be measured at a preset position of a station, and shooting an inner hole expansion picture of the internal thread to be measured by using an inner hole expansion mirror according to a preset shooting condition; carrying out binarization on the inner hole development image, and determining an initial binary contour image; clustering outline pixel points of the initial binary outline image to form an initial pixel thread map containing threads with different pixel radiuses; and determining the actual radius of the internal thread to be measured according to the pixel radius of the threads in the pixel thread graph sorted according to the pixel radius and the actual radius of the calibrated standard thread piece. The invention clusters the outline pixel points of the binary outline image to form a pixel thread map containing threads with different pixel radiuses and sizes, and uses the pixel radius and the actual radius of the standard thread piece based on the pixel radius of the threads to realize the measurement of the minor diameter of the internal threads and improve the accuracy of measuring the minor diameter of the internal threads.
Description
Technical Field
The invention relates to the technical field of machine vision, in particular to a method and a device for measuring the small diameter of an internal thread.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
The evaluation of the processing quality of the internal thread is an important quality inspection item in the industrial field, particularly the high-accuracy machining field, and the main related detection items comprise the aperture, the thread depth, the hole depth, the thread pitch, the tooth form and the like of the internal thread. At present, two main types of methods for detecting the screw thread are contact type and non-contact type. The contact detection method comprises a go-no go gauge, a screw micrometer and a measuring needle scanning detection method; non-contact methods include tool microscopes and machine vision methods. The machine vision detection of the internal thread is divided more finely according to a light source and an illumination mode, and comprises the step of carrying out development imaging on an inner hole shot above the hole; the optical probe extends into the threaded hole to perform endoscopic imaging of thread photographing; imaging using laser-wordline illumination; imaging using a 3D camera; parameter measurement based on laser triangulation, and the like.
Contact inspection methods are limited by precise mechanical controls and are difficult to use for in situ inspection of large workpieces. The non-contact measurement is easily integrated to the flexible robot, but at present mainly used external screw thread detects, and to the internal thread especially the deep hole of aperture, the ray apparatus subassembly can't go deep into downthehole shooting, and current visual detection technique still can not measure each circle path numerical value in little internal screw thread hole.
Disclosure of Invention
The embodiment of the invention provides an internal thread small diameter measuring method, which is used for improving the accuracy of measuring the internal thread small diameter while realizing the measurement of the internal thread small diameter, and comprises the following steps:
fixedly arranging the internal thread to be detected at a station preset position, and shooting an inner hole expansion picture of the internal thread to be detected by using an inner hole expansion mirror arranged at a preset height right above a threaded hole of the internal thread to be detected;
carrying out binarization on the shot inner hole development image of the internal thread to be detected, and determining an initial binary profile image of the internal thread to be detected;
clustering outline pixel points of the initial binary outline image of the internal thread to be detected to form an initial pixel thread map containing threads with different pixel radiuses;
and determining the actual radius of the internal thread to be measured according to the pixel radius of the threads in the pixel thread graph sorted according to the pixel radius, the pixel radius of the calibrated standard thread part and the actual radius.
The embodiment of the present invention further provides an internal thread small diameter measuring apparatus, which is used for improving the accuracy of measuring the internal thread small diameter while realizing the internal thread small diameter measurement, and the internal thread small diameter measuring apparatus includes:
the shooting module is used for fixedly arranging the internal thread to be detected at a station preset position and shooting an internal hole expansion picture of the internal thread to be detected by using an internal hole expansion mirror arranged at a preset height right above a threaded hole of the internal thread to be detected;
the binarization module is used for binarizing the shot inner hole expansion image of the internal thread to be detected and determining an initial binary contour image of the internal thread to be detected;
the clustering module is used for clustering the contour pixel points of the initial binary contour image of the internal thread to be detected to form an initial pixel thread map containing threads with different pixel radiuses;
and the radius determining module is used for determining the actual radius of the internal thread to be measured according to the pixel radius of the threads in the pixel thread graph sorted according to the pixel radius and the actual radius of the calibrated standard threaded part.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and can be run on the processor, wherein the processor executes the computer program to realize the internal thread small diameter measuring method.
The embodiment of the invention also provides a computer readable storage medium, which stores a computer program for executing the internal thread small diameter measuring method.
In the embodiment of the invention, the internal thread to be detected is fixedly arranged at a station preset position, and an internal hole expansion mirror arranged at a preset height right above a threaded hole of the internal thread to be detected is used for shooting an internal hole expansion picture of the internal thread to be detected; carrying out binarization on the shot inner hole development image of the internal thread to be detected, and determining an initial binary profile image of the internal thread to be detected; clustering outline pixel points of an initial binary outline image of the internal thread to be detected to form an initial pixel thread map containing threads with different pixel radiuses; and determining the actual radius of the internal thread to be measured according to the pixel radius of the threads in the pixel thread graph sorted according to the pixel radius, the pixel radius of the calibrated standard thread part and the actual radius. According to the embodiment of the invention, the pixel thread map containing threads with different pixel radiuses is formed by clustering the contour pixel points of the binary contour image of the internal thread to be measured, and further, the internal thread small diameter measurement is realized by utilizing the pixel radius and the actual radius of the calibrated standard thread part based on the pixel radius of the threads in the pixel thread map, so that the accuracy of measuring the internal thread small diameter is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
fig. 1 is a flowchart illustrating an implementation of a method for measuring a small diameter of an internal thread according to an embodiment of the present invention;
FIG. 1-1 is a schematic diagram illustrating an expanded inner bore of an internal thread to be tested according to an embodiment of the present invention;
fig. 1-2 are schematic diagrams of initial binary profile images of a certain internal thread to be detected according to an embodiment of the present invention;
FIGS. 1-3 are schematic diagrams of an initial pixel thread of a certain internal thread to be tested according to an embodiment of the present invention;
fig. 1-4 are schematic diagrams of pixel threads of a to-be-measured internal thread sorted according to a pixel radius according to an embodiment of the present invention;
fig. 2 is a flowchart of another implementation of the method for measuring a minor diameter of an internal thread according to the embodiment of the present invention;
fig. 2-1 is a schematic diagram of a binary contour image extracted from a certain internal thread skeleton to be detected according to an embodiment of the present invention;
fig. 2-2 is a schematic diagram of a noise-reduced binary profile image of an internal thread profile to be measured according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating an implementation of step 202 in the method for measuring a minor diameter of an internal thread according to an embodiment of the present invention;
FIG. 3-1 is a schematic diagram of noise reduction of a binary profile image profile of a certain internal thread to be tested according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating an implementation of step 203 in the method for measuring a small diameter of an internal thread according to the embodiment of the present invention;
fig. 5 is a flowchart illustrating an implementation of calibrating a pixel radius correction parameter in the method for measuring a minor diameter of an internal thread according to the embodiment of the present invention;
fig. 6 is a functional block diagram of an internal thread small diameter measuring device according to an embodiment of the present invention;
FIG. 7 is a block diagram of another embodiment of the present invention, illustrating a minor diameter measuring device;
fig. 8 is a block diagram illustrating a structure of a profile noise reduction module 702 in the internal thread minor-diameter measuring apparatus according to the embodiment of the present invention;
fig. 9 is a block diagram of a clustering module 703 in the internal thread minor-diameter measuring apparatus according to the embodiment of the present invention;
fig. 10 is a block diagram illustrating a structure of a calibrated pixel radius correction parameter in the internal thread minor-diameter measuring apparatus according to the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
Fig. 1 shows a flow of implementing the internal thread minor-diameter measuring method provided by the embodiment of the present invention, and for convenience of description, only the parts related to the embodiment of the present invention are shown, and the details are as follows:
as shown in fig. 1, the internal thread small diameter measuring method includes:
102, carrying out binarization on a shot inner hole expansion image of the internal thread to be detected, and determining an initial binary profile image of the internal thread to be detected;
103, clustering outline pixel points of the initial binary outline image of the internal thread to be detected to form an initial pixel thread map containing threads with different pixel radiuses;
and step 104, determining the actual radius of the internal thread to be measured according to the pixel radius of the threads in the pixel thread map sorted according to the pixel radius, the pixel radius of the calibrated standard thread part and the actual radius.
When examining screw thread path (internal diameter), will await measuring the internal thread fixed setting in station preset position earlier, for example adopt the fixed centre gripping of holder to wait to detect the internal thread in a certain preset position of station, this station preset position can be according to actual conditions and concrete demand preset, for example utilize the holder will await measuring the internal thread fixed in the draw-in groove, it can to spill the screw hole. After the internal thread to be detected is fixedly arranged at the preset position of the station, the inner hole unfolding mirror is moved, the inner hole unfolding mirror is arranged at the preset height position right above the threaded hole of the internal thread to be detected, and then the internal thread to be detected is shot under the condition that the relative positions of the light source, the inner hole unfolding mirror and the internal thread to be detected are strictly fixed, so that an inner hole unfolding picture of the internal thread to be detected is obtained. Fig. 1-1 shows a schematic diagram of an inner hole expansion diagram of a certain internal thread to be detected provided by the embodiment of the present invention, and it can be seen from fig. 1-1 that the inner hole expansion diagram of the certain internal thread to be detected presents a fuzzy spiral pattern. The light source, the inner hole unfolding mirror, the internal thread to be measured and the like are kept fixed in relative positions in the processes of calibration of the small diameter of the threaded hole and measurement of the small diameter of the threaded hole, so that the accuracy of obtaining an inner hole unfolding diagram of the internal thread to be measured can be improved, and the accuracy of measurement of the small diameter of the internal thread to be measured is further improved.
After an inner hole expanded picture of the internal thread to be detected is obtained, binarization is carried out on the shot inner hole expanded picture of the internal thread to be detected so as to obtain an initial binary profile image of the internal thread to be detected. Fig. 1-2 show an initial binary profile image of a certain internal thread to be detected provided by the embodiment of the present invention, and it can be seen from fig. 1-2 that the initial binary profile image of the certain internal thread to be detected presents a relatively clear thread pattern. Specifically, an inner hole development figure of the internal thread to be measured can be binarized by adopting a self-adaptive threshold binarization method so as to improve the image binarization accuracy and further improve the measurement accuracy of the small threaded hole. It can be understood by those skilled in the art that other binarization methods can be adopted to binarize the inner hole expansion map of the internal thread to be measured. For example, the variance method between maximum classes or the Kittler binarization method, etc., which is not particularly limited in the embodiments of the present invention.
After the initial binary contour image of the internal thread to be detected is obtained, further clustering is carried out on contour pixel points of the initial binary contour image of the internal thread to be detected, the contour pixel points (with the same pixel radius) of the same circle of threads are classified into one class, and an initial pixel thread map containing a plurality of threads is formed. Wherein the initial pixel thread map comprises a plurality of threads with different pixel radii. Fig. 1 to 3 show an initial pixel threading diagram of a certain internal thread to be measured according to an embodiment of the present invention, and as can be seen from fig. 1 to 3, the initial pixel threading diagram of the certain internal thread to be measured is clustered into a plurality of threads with different pixel radius sizes.
After an initial pixel thread map comprising a plurality of threads is formed, the threads contained in the initial pixel thread map are further sequenced according to the size of the pixel radius, and the pixel radius of the threads is sequentially from small to large from inside to outside. The sorting and ordering method of the clustering results comprises the following steps: the expected number of pixels of the contour of the circle is calculated according to the pixel radius R of the classification information, wherein N =2 × 3.14 × R, and if the actual number of pixels is too small (for example, less than N/2), the classification is discarded. And then sorting the rest of the classifications according to the radius from large to small to obtain the pixel radius of each circle of threads. Fig. 1 to 4 are schematic diagrams of pixel thread diagrams of a certain internal thread to be measured, which are ordered according to a pixel radius according to an embodiment of the present invention. And then, based on the pixel radius of the threads in the sorted pixel thread map, determining the actual radius of the internal thread to be measured by using the pixel radius and the actual radius of the calibrated standard thread part, so as to realize the accurate measurement of the small diameter of the threads.
When the pixel radius and the actual radius of the standard threaded part are calibrated, the actual radius of the standard threaded part is measured by using a high-accuracy measuring tool, the pixel radius of the standard threaded part is obtained according to the steps, and then the relation between the pixel radius of the standard threaded part and the actual radius of the standard threaded part is established. Specifically, for example, a standard threaded part is fixedly arranged at a station preset position, and an inner hole unfolding mirror arranged at a preset height right above a threaded hole of the standard threaded part is used for shooting an inner hole unfolding picture of the standard threaded part; carrying out binarization on the shot inner hole development image of the standard threaded part, and determining an initial binary profile image of the standard threaded part; clustering outline pixel points of the initial binary outline image of the standard screw part to form an initial pixel thread map containing threads with different pixel radiuses; and finally, determining the pixel radius of the threads in the pixel thread graph after the sequencing according to the pixel radius.
The actual radius of the internal thread to be measured can be determined by the following formula:
wherein M is i1 、M i2 Respectively representing the actual radius of the internal thread to be measured and the actual radius of the standard threaded part, N i1 And N i2 Respectively representing the pixel radius (or the pixel diameter) of the ith turn of the thread of the internal thread to be measured and the pixel radius (or the pixel diameter) of the ith turn of the thread of the standard screw.
For example, the pixel diameter of the first turn of thread of a standard screw is 1000 (pixel radius is 500), the actual diameter of the first turn of thread of the standard screw is 16.8 mm, the pixel diameter of the first turn of thread of the internal thread to be measured is 998 (pixel radius is 499), and the actual diameter of the first turn of thread of the internal thread to be measured is 16.8 mm × (998 ÷ 1000) =16.766 mm, or 16.8 mm × (498 ÷ 500) =16.766 mm.
In the embodiment of the invention, the pixel thread map containing threads with different pixel radiuses is formed by clustering the contour pixel points of the binary contour image of the internal thread to be measured, and further, the internal thread small diameter measurement is realized by utilizing the pixel radius and the actual radius of the calibrated standard thread part based on the pixel radius of the threads in the pixel thread map, so that the accuracy of measuring the internal thread small diameter is improved.
Fig. 2 illustrates another implementation flow of the internal thread small diameter measurement method provided in the embodiment of the present invention, and for convenience of description, only the portions related to the embodiment of the present invention are shown, and the details are as follows:
in an embodiment of the present invention, in order to improve the accuracy of the binary outline image of the internal thread and further improve the accuracy of the measurement of the small diameter of the internal thread, as shown in fig. 2, on the basis of the above method steps, the internal thread small diameter measuring method further includes:
and clustering the contour pixel points of the binary contour image of the internal thread to be detected to form a pixel thread image containing threads with different pixel radiuses and sizes.
After the inner bore development image of the internal thread to be detected is binarized to obtain an initial binary profile image (spiral coarse texture profile) of the internal thread to be detected, in order to improve the accuracy of the internal thread binary profile image and further improve the accuracy of internal thread small-diameter measurement, the initial binary profile image can be further refined by utilizing skeleton extraction, and the initial binary profile image is thinned to a single pixel (the thickness of the thread profile pixel only contains the single pixel) to obtain the refined binary profile image (spiral fine texture profile). Fig. 2-1 shows a schematic diagram of a binary profile image of a certain internal thread to be measured according to an embodiment of the present invention, and it can be seen from fig. 2-1 that the thread profile is much finer than the thread profile of the initial binary profile image shown in fig. 1-2.
After the binary outline image of the internal thread to be detected is obtained by skeleton extraction, clustering the outline pixel points of the binary outline image of the internal thread to be detected after thinning (skeleton extraction) by a clustering method to obtain a pixel thread map of the internal thread to be detected.
In the embodiment of the invention, the initial binary contour image is refined by using skeleton extraction, the binary contour image is determined, and then the contour pixel points of the binary contour image of the internal thread to be detected are clustered to form the pixel thread map containing threads with different pixel radiuses and sizes. According to the embodiment of the invention, the binary profile image obtained by refining the initial binary profile image by using skeleton extraction is more accurate, and the accuracy of measuring the small diameter of the internal thread can be further improved.
In an embodiment of the present invention, in order to further improve the accuracy of the binary profile image and further improve the accuracy of the internal thread small diameter measurement, as shown in fig. 2, on the basis of the above method steps, the internal thread small diameter measurement method further includes:
202, carrying out contour noise reduction processing on the binary contour image, and determining the binary contour image after contour noise reduction;
clustering outline pixel points of a binary outline image of the internal thread to be detected to form a pixel thread map containing threads with different pixel radiuses and sizes, and the method comprises the following steps:
and 203, clustering the contour pixel points of the denoised binary contour image of the contour of the internal thread to be detected to form a pixel thread map containing threads with different pixel radiuses and sizes.
After the initial binary contour image is refined by using skeleton extraction, in order to further improve the accuracy of the binary contour image, contour noise reduction processing can be continuously performed on the binary contour image so as to eliminate noise contour pixel points in the binary contour image and further improve the accuracy of the binary contour image. Fig. 2-2 shows a schematic view of a noise-reduced binary contour image of a certain internal thread contour to be detected according to an embodiment of the present invention, and compared with the thread contour of the binary contour image shown in fig. 2-1, the thread contour of the binary contour image shown in fig. 2-2 eliminates most noises (contour pixel points), and the binary contour image after the contour noise reduction is clearer and more accurate. And clustering the contour pixel points of the binary contour image after contour noise reduction to form a pixel thread map containing threads with different pixel radiuses and sizes. Specifically, the filtering operator based on the direction may be used to perform contour noise reduction processing on the binary contour image.
In the embodiment of the invention, the binary contour image is subjected to contour noise reduction treatment, the binary contour image after contour noise reduction is determined, and the contour pixel points of the binary contour image after the internal thread contour to be detected is subjected to noise reduction are clustered to form the pixel thread image containing threads with different pixel radiuses and sizes. According to the method and the device, the binary contour image is subjected to contour noise reduction, so that the accuracy of the binary contour image can be further improved, and the accuracy of measuring the small diameter of the internal thread can be further improved.
Fig. 3 shows a flow of implementing step 202 in the internal thread minor diameter measurement method provided by the embodiment of the present invention, and for convenience of description, only the parts related to the embodiment of the present invention are shown, and the details are as follows:
in an embodiment of the present invention, in order to improve the accuracy of the binary contour image noise reduction and further improve the accuracy of the internal thread small diameter measurement, as shown in fig. 3, step 202, performing contour noise reduction processing on the binary contour image, and determining the binary contour image after contour noise reduction includes:
When the noise reduction processing is carried out on the binary contour image of the internal thread to be detected, firstly, a polar coordinate system is established by taking the image center pixel of the binary contour image as an origin O [0,0], and then the polar coordinate [ Pho, theta ] of each contour pixel point is determined based on the origin coordinate (of the image center pixel) and the coordinate of the contour pixel point, wherein the Theta represents a direction angle, and the Pho represents a pixel radius. For an image of m pixels by n pixels, the origin coordinates are (m/2, n/2); assuming that the coordinate of a certain contour pixel point is (i, j), the direction angle and the pixel radius of the contour pixel point can be determined by the following formulas:
Rho=sqrt((i-m/2) 2 +(j-n/2) 2 );
fig. 3-1 shows a schematic diagram of noise reduction of a binary profile image profile of a certain internal thread to be detected, provided by an embodiment of the invention. As can be seen from FIG. 3-1, the image size is m pixels × n pixels, the coordinates of the center pixel O (origin) are [ m/2, n/2], and the coordinates of the outline pixel A are [ x1, y1]. In addition, as can be seen from the lower left corner of fig. 3-1, in the embodiment of the present invention, according to the direction angle of the profile pixel point, the 360 ° thread range is divided into 8 regions (symmetric in pairs), and 4 convolution kernels corresponding to the expected trend (direction) of 4 profiles corresponding to different direction angle regions are obtained. Wherein the convolution kernel [1, 1;3,3,3;1, 1; the corresponding direction angle regions include mutually symmetric i and v regions, convolution kernels [5,2,1;2,5,2;1,2,5; the corresponding azimuthal regions include regions ii and vi, which are symmetric to each other, convolution kernels [1,3,1;1,3,1;1,3,1; the corresponding direction angle region comprises mutually symmetrical III and VII regions, convolution kernel [1,2,5;2,5,2;5,2,1; the corresponding azimuthal regions include regions iv and viii, which are symmetric to each other. In addition, the above-mentioned corresponding relationship between the direction angle and the convolution kernel is only an exemplary illustration, and the direction angle range corresponding to different convolution kernels may be adaptively adjusted according to actual situations and specific requirements, which is not particularly limited in the embodiment of the present invention.
The 360 ° thread range is divided into 8 regions (symmetric two by two), and 4 convolution kernels corresponding to the expected trend (direction) of 4 profiles corresponding to different direction angle regions are only exemplary. In order to improve the accuracy of the internal thread minor diameter measurement, the thread range of 360 ° may be divided into more regions, for example, 16 regions (symmetric in pairs), 8 convolution kernels corresponding to 8 expected trends (directions) of 8 profiles corresponding to different direction angle regions, or the thread range of 360 ° may be divided into 32 regions (symmetric in pairs), and 16 convolution kernels corresponding to 16 expected trends (directions) of 16 profiles corresponding to different direction angle regions. It can be understood that the more the divided regions are, the more the convolution kernels are, the higher the accuracy of the internal thread small diameter measurement is, but the efficiency of the internal thread small diameter measurement is reduced.
The size and the specific numerical value of the convolution kernel matrix corresponding to the direction angle of the outline pixel point are not fixed, and the core idea is that the weight along the expected outline direction is greater than the weight in the noise direction, so that the noise reduction effect of the binary outline image is improved, and the accuracy of measuring the small diameter of the internal thread is improved. In addition, the focal length of the deeper threaded hole may need to be adjusted as necessary, so that all internal threads are shot clearly in a segmented manner, and a small diameter value of the whole threaded hole is obtained by using some combined calculation methods or image stitching algorithms.
First, the direction angle of the contour pixel point A in the figure is calculated as arctan ((x 1-m/2)/(y 1-n/2)). Assuming that the direction angle of the contour pixel point A obtained through calculation is 135 degrees, and the expected contour trend of the screw thread in the direction (the expected tangential direction of the contour pixel point A on the radius of the pixel) is in a '/' type, while the actual contour trend of the screw thread of the contour pixel point A in the direction angle of 135 degrees (the actual tangential direction of the contour pixel point A on the radius of the pixel) is in a '\\', the neighborhood matrix of the contour pixel point A is [1, 0;0,1,0;0, 1; at this time, the convolution kernel corresponding to the contour pixel point a is the convolution kernel [1,2,5;2,5,2;5,2,1; h, all matrices are [1, 1;1, 1;1, 1; ].
And then, after determining the direction angle and the neighborhood matrix of the contour pixel point and the convolution kernel corresponding to the direction angle of the contour pixel point, determining the actual convolution result of the convolution kernel corresponding to the neighborhood matrix of the contour pixel point and the direction angle of the contour pixel point. For example, a neighborhood matrix of contour pixels A [1, 0;0,1,0;0, 1; a convolution kernel [1,2,5;2,5,2;5,2,1; the convolution result of ] is 7.
After the actual convolution result is determined, if the actual convolution result is smaller than the rejection threshold, the deviation between the actual contour direction and the expected contour direction of the contour pixel point is more, the contour pixel point can be determined to be noise, and then the contour pixel point is rejected. The elimination threshold is a preset proportion of a convolution kernel corresponding to the direction angle of the contour pixel point to a convolution result of the full matrix. For example, for the contour pixel point a, the elimination threshold is a convolution kernel [1,2,5;2,5,2;5,2,1; and all-one matrix is [1, 1;1, 1;1, 1; a predetermined proportion of the convolution result 25. It can be understood that the contour pixel points of different direction angles correspond to different convolution kernels of different direction angles and different rejection thresholds. In the present application, a total of eight direction angles correspond to four convolution kernels, and there are four rejection thresholds (actually there are eight, and two-by-two symmetry is four).
The preset proportion is a preset rejection proportion, and those skilled in the art can understand that the preset proportion can be preset according to actual conditions and specific requirements. For example, based on the preset ratio being set to 32% in advance or the preset ratio being set to 28% in advance, it can be understood by those skilled in the art that the preset ratio can also be set to other rejection ratio thresholds besides 32% or 28% in advance, for example, 36%, etc., and the embodiment of the present invention is not limited thereto.
In the embodiment of the invention, a polar coordinate system is established by taking the image central pixel of the binary contour image as an origin, and a neighborhood matrix of contour pixel points and a convolution kernel corresponding to the direction angle of the contour pixel points are determined; determining an actual convolution result of a convolution kernel corresponding to the direction angle of the contour pixel point and the neighborhood matrix of the contour pixel point; and when the actual convolution result is smaller than the rejection threshold value, rejecting the contour pixel point as noise. According to the method, whether the contour pixel points are noise contour pixel points or not is determined through the direction angles and the neighborhood matrixes of the contour pixel points and the convolution kernels corresponding to the direction angles of the all-one matrixes and the contour pixel points, the accuracy of noise reduction of the binary contour image contour can be improved, and the accuracy of measurement of the minor diameter of the internal thread is further improved.
Fig. 4 shows an implementation flow of step 203 in the internal thread minor diameter measurement method provided by the embodiment of the present invention, and for convenience of description, only the parts related to the embodiment of the present invention are shown, and the details are as follows:
in an embodiment of the present invention, in order to improve the clustering effect of the contour pixel points and further improve the accuracy of measuring the small diameter of the internal thread, as shown in fig. 4, in step 203, the contour pixel points of the denoised binary contour image of the internal thread contour to be measured are clustered to form a pixel thread map including threads with different pixel radii, including:
and 403, when the initial pixel radius difference is not less than the preset proportion of the calibrated pixel radius correction parameter, taking the contour pixel point as a pixel point of a new thread, and taking the pixel radius of the updated contour pixel point as the pixel radius of the new thread.
When clustering the contour pixel points of the binary contour image after the contour noise reduction, the pixel radius of the contour pixel points can be updated based on the direction angle and the pixel radius of the contour pixel points in the binary contour image after the contour noise reduction and the calibrated pixel radius correction parameters. The pixel radius correction parameter is a pixel radius correction parameter calibrated in advance. As shown in fig. 3-1, for the contour pixel point with the direction angle θ of [0 °,180 °), outward correction is performed according to the angle ratio (180 ° - θ)/180 °; and (4) inward correction is carried out on the contour pixel points with the direction angle theta of [180 degrees and 360 degrees according to the angle proportion of (theta-180 degrees)/180 degrees.
After the direction angle Theta and the pixel radius Rho of the outline pixel point are determined, the pixel radius of the outline pixel point is updated according to the angle proportion and the correction direction corresponding to the angle range to which the outline pixel point belongs based on the direction angle Theta and the pixel radius Rho of the outline pixel point and the calibrated pixel radius correction parameter.
Specifically, the pixel radius of the contour pixel point can be updated by the following formula:
rho _ new represents the pixel radius of the updated contour pixel point, rho represents the pixel radius of the (pre-updated) contour pixel point, and dr represents the calibrated pixel radius correction parameter.
After the pixel radius Rho _ new of the updated contour pixel point is obtained, the pixel radius which is closest to the thread of the updated pixel radius of the contour pixel point is determined, then the pixel radius difference value between the pixel radius which is closest to the thread of the updated pixel radius of the contour pixel point and the pixel radius which is updated of the contour pixel point is compared with the initial pixel radius difference value, when the pixel radius difference value between the pixel radius which is closest to the thread of the updated pixel radius of the contour pixel point and the pixel radius which is updated of the contour pixel point is smaller than the initial pixel radius difference value, the pixel radius of the contour pixel point is similar to the pixel radius which is closest to the thread of the updated pixel radius of the contour pixel point, the contour pixel point is used as the contour pixel point which is closest to the thread of the updated pixel radius of the contour pixel point, the thread which is closest to the updated pixel radius of the contour pixel point is attributed to the pixel radius of the contour pixel point, and the initial pixel radius difference value is updated as the pixel radius difference value.
If the pixel radius difference value between the pixel radius of the updated contour pixel point closest to the thread and the pixel radius of the updated contour pixel point is not smaller than the initial pixel radius difference and the initial pixel radius difference is not smaller than the preset proportion of the calibrated pixel radius correction parameter, it is indicated that no cluster of the contour pixel point exists in the existing cluster, at the moment, the contour pixel point is taken as the pixel point of the new thread, and the pixel radius of the updated contour pixel point is taken as the pixel radius of the new thread.
Contour pixels with the same pixel radius can be easily classified into a class, and each circle of thread corresponds to a class with the same pixel radius. The algorithm is implemented by using a loop structure, and the pseudo code of the loop structure is as follows:
algorithm, inner bore expansion thread theory profile clustering
Inputting a binary profile image I of the thread
Outputting the thread contour clustering image, various radiuses and pixel points
The three parts in the cycle respectively realize the functions of pixel radius correction, pixel radius classification and pixel radius updating classification. And finally, clustering all contour pixel points according to the size of the pixel radius to obtain a plurality of classified pixel radii and pixel point number information. The algorithm relates to a pixel radius correction parameter dr which changes along with the radius of a pixel and represents the size of the correction amount of the radius of the pixel, the correction amount is smaller as the threads in an image shot inwards are denser, and the actual value of the pixel radius correction parameter can be manually calibrated by using simple calculation or accurately obtained in a small-diameter calibration link.
In the embodiment of the invention, the pixel radius of the outline pixel point is updated according to the direction angle and the pixel radius of the outline pixel point in the binary outline image after the outline noise reduction and the calibrated pixel radius correction parameter so as to determine the updated pixel radius of the outline pixel point; when the pixel radius difference value between the pixel radius closest to the thread and the updated pixel radius of the outline pixel point is smaller than the initial pixel radius difference value, taking the outline pixel point as the outline pixel point closest to the thread and the updated pixel radius of the outline pixel point, and updating the initial pixel radius difference value to be the pixel radius difference value; and when the initial pixel radius difference is not less than the preset proportion of the calibrated pixel radius correction parameter, taking the contour pixel point as a pixel point of the new thread, and taking the pixel radius of the contour pixel point as the pixel radius of the new thread. According to the embodiment of the invention, the pixel radius of the outline pixel point is updated, and the outline pixel point is clustered by using the calibrated pixel radius correction parameter, so that the clustering effect of the outline pixel point can be improved, and the measurement accuracy of the small diameter of the internal thread is improved.
Fig. 5 illustrates a flow of implementing the method for calibrating the pixel radius correction parameter in the internal thread minor-diameter measurement method provided in the embodiment of the present invention, and for convenience of description, only the portions related to the embodiment of the present invention are shown, and the details are as follows:
in an embodiment of the present invention, in order to improve the accuracy of measuring the minor diameter of the internal thread, as shown in fig. 5, the calibrating the pixel radius correction parameter includes:
and 502, taking the derivative of the radius-turn number relation function as a calibrated pixel radius correction parameter.
And when the calibrated pixel radius correction parameter is obtained, obtaining a pixel thread map of the standard thread piece through the steps, and performing polynomial fitting on the pixel radius and the turn number of the thread included in the pixel thread map of the standard thread piece to determine a radius turn number relation function reflecting the relation between the pixel radius and the turn number of the thread. And further, carrying out derivation on the radius-turn number relation function, and taking the derivative of the radius-turn number relation function as a calibrated pixel radius correction parameter.
In the embodiment of the invention, polynomial fitting is carried out on the pixel radius and the turn number of the thread contained in the pixel thread map of the standard thread piece, and a relation function of the radius and the turn number is determined; the radius-turn relation function reflects the relation between the pixel radius of the thread and the turn; and taking the derivative of the radius-circle-number relation function as a calibrated pixel radius correction parameter. According to the embodiment of the invention, the derivative of the radius turn number relation function is used as the calibrated pixel radius correction parameter through polynomial fitting and derivation, so that the accuracy of measuring the minor diameter of the internal thread can be improved.
In addition, the thread pitch type (fine tooth, coarse tooth and standard) can be judged according to the density of the pixel radius set; according to the comparison of the number of the pixel points of each circle of threads and the expected number of the pixel points, whether the threads break can be judged; using the product of the total number of turns of the thread and the pitch, the thread depth, etc. can be calculated.
The embodiment of the invention also provides an internal thread small diameter measuring device, which is described in the following embodiment. Because the principle of solving the problems of the devices is similar to the internal thread small diameter measuring method, the implementation of the devices can be referred to the implementation of the method, and repeated details are not repeated.
Fig. 6 shows a functional module of the internal thread small diameter measurement device provided in the embodiment of the present invention, and only the parts related to the embodiment of the present invention are shown for convenience of description, and the details are as follows:
referring to fig. 6, each module included in the internal thread small diameter measurement apparatus is used to execute each step in the embodiment corresponding to fig. 1, and specifically, please refer to fig. 1 and the related description in the embodiment corresponding to fig. 1, which are not repeated herein. In the embodiment of the present invention, the internal thread minor diameter measuring apparatus includes a shooting module 601, a binarization module 602, a clustering module 603, and a radius determining module 604.
The shooting module 601 is used for fixedly arranging the internal thread to be detected at a station preset position and shooting an internal hole expansion picture of the internal thread to be detected by using an internal hole expansion mirror with a preset height arranged right above a threaded hole of the internal thread to be detected.
And a binarization module 602, configured to perform binarization on the captured inner hole development map of the internal thread to be detected, and determine an initial binary profile image of the internal thread to be detected.
The clustering module 603 is configured to cluster contour pixel points of the initial binary contour image of the internal thread to be tested, so as to form an initial pixel thread map including threads with different pixel radii.
And a radius determining module 604, configured to determine an actual radius of the internal thread to be measured according to the pixel radius of the threads in the pixel thread map sorted according to the pixel radius, and the pixel radius and the actual radius of the calibrated standard thread.
In the embodiment of the invention, the shooting module 601 fixedly arranges the internal thread to be detected at a station preset position, and shoots an inner hole expansion picture of the internal thread to be detected by using an inner hole expansion mirror arranged at a preset height right above a threaded hole of the internal thread to be detected; the binarization module 602 binarizes the shot inner hole development image of the internal thread to be detected to determine an initial binary profile image of the internal thread to be detected; the clustering module 603 clusters the contour pixel points of the initial binary contour image of the internal thread to be detected to form an initial pixel thread map containing threads with different pixel radiuses; the radius determination module 604 determines the actual radius of the thread to be detected according to the pixel radius of the thread in the pixel thread map sorted according to the pixel radius, and the pixel radius and the actual radius of the calibrated standard thread. The clustering module 603 in the embodiment of the present invention clusters the contour pixel points of the binary contour image of the internal thread to be measured to form a pixel thread map including threads with different pixel radii and sizes, and then the radius determination module 604 uses the pixel radius and the actual radius of the calibrated standard thread piece based on the pixel radius of the threads in the pixel thread map to realize the measurement of the internal thread small diameter, thereby improving the accuracy of measuring the internal thread small diameter.
Fig. 7 illustrates another functional module of the internal thread small diameter measurement device provided in the embodiment of the present invention, and for convenience of description, only the portions related to the embodiment of the present invention are illustrated, and the details are as follows:
in an embodiment of the present invention, in order to improve the accuracy of the internal thread binary contour image and further improve the accuracy of the internal thread small diameter measurement, referring to fig. 7, each module included in the internal thread small diameter measurement apparatus is configured to execute each step in the embodiment corresponding to fig. 2, and specifically, please refer to fig. 2 and the related description in the embodiment corresponding to fig. 2, which is not described herein again. In the embodiment of the present invention, on the basis of the above module structure, the internal thread small diameter measuring apparatus further includes a skeleton extraction module 701.
And a skeleton extraction module 701, configured to refine the initial binary contour image by using skeleton extraction, and determine the binary contour image.
The clustering module 603 is specifically configured to cluster contour pixel points of the binary contour image of the internal thread to be detected, so as to form a pixel thread map including threads with different pixel radii and sizes.
In the embodiment of the present invention, the skeleton extraction module 701 refines the initial binary profile image by using skeleton extraction, determines the binary profile image, and then the clustering module 603 clusters the profile pixel points of the binary profile image of the internal thread to be detected, so as to form a pixel thread map including threads with different pixel radii and sizes. The skeleton extraction module 801 in the embodiment of the invention refines the initial binary contour image by using skeleton extraction to obtain a binary contour image which is more accurate, and can further improve the accuracy of measuring the small diameter of the internal thread.
In an embodiment of the present invention, in order to further improve the accuracy of the binary profile image and further improve the accuracy of the internal thread small diameter measurement, referring to fig. 8, on the basis of the above-mentioned module structure, the internal thread small diameter measurement apparatus further includes a profile noise reduction module 702.
And the contour denoising module 702 is configured to perform contour denoising processing on the binary contour image, and determine a binary contour image after contour denoising.
The clustering module 603 is specifically configured to cluster contour pixel points of the noise-reduced binary contour image of the internal thread contour to be detected, so as to form a pixel thread map including threads with different pixel radii and sizes.
In the embodiment of the present invention, the contour noise reduction module 702 performs contour noise reduction on the binary contour image to determine the binary contour image after the contour noise reduction, and the clustering module 603 clusters the contour pixel points of the binary contour image after the internal thread contour noise reduction to be detected to form a pixel thread map including threads with different pixel radii and sizes. According to the embodiment of the invention, the contour noise reduction module 702 carries out contour noise reduction treatment on the binary contour image, so that the accuracy of the binary contour image can be further improved, and the accuracy of measurement of the small diameter of the internal thread can be further improved.
Fig. 8 shows a structural schematic diagram of a profile noise reduction module 702 in the internal thread small-diameter measuring device provided by the embodiment of the present invention, and for convenience of description, only the parts related to the embodiment of the present invention are shown, and the details are as follows:
in an embodiment of the present invention, in order to improve the accuracy of the binary contour image noise reduction and further improve the accuracy of the internal thread small diameter measurement, referring to fig. 8, each unit included in the contour noise reduction module 702 is configured to execute each step in the embodiment corresponding to fig. 3, specifically refer to fig. 3 and the related description in the embodiment corresponding to fig. 3, and details are not repeated here. In this embodiment of the present invention, the contour noise reduction module 702 includes a matrix convolution kernel determining unit 801, a convolution result determining unit 802, and a first culling unit 803.
The matrix convolution kernel determining unit 801 is configured to establish a polar coordinate system with an image center pixel of the binary contour image as an origin, and determine a neighborhood matrix of contour pixel points and a convolution kernel corresponding to a direction angle of the contour pixel points.
And a convolution result determining unit 802, configured to determine an actual convolution result of a convolution kernel corresponding to the domain matrix of the contour pixel and the direction angle of the contour pixel.
And a first eliminating unit 803, configured to eliminate the contour pixel point as noise when a ratio of the actual convolution result to the convolution result threshold is smaller than a first preset eliminating ratio threshold.
In the embodiment of the present invention, the matrix convolution kernel determining unit 801 establishes a polar coordinate system with an image center pixel of a binary contour image as an origin, and determines a neighborhood matrix of contour pixel points and convolution kernels corresponding to direction angles of the contour pixel points; the convolution result determining unit 802 determines an actual convolution result of a convolution kernel corresponding to the domain matrix of the contour pixel point and the direction angle of the contour pixel point; the first eliminating unit 803 eliminates the contour pixel point as noise when the ratio of the actual convolution result to the convolution result threshold is smaller than a first preset eliminating proportion threshold. According to the method, whether the contour pixel points are noise contour pixel points or not is determined through the direction angles of the contour pixel points, the actual contour direction matrix and the convolution kernels corresponding to the direction angles of the all-one matrix and the contour pixel points, the accuracy of the noise reduction of the binary contour image contour can be improved, and the accuracy of the measurement of the small diameter of the internal thread is further improved.
Fig. 9 shows a schematic structure of the clustering module 603 in the internal thread small-diameter measuring apparatus provided in the embodiment of the present invention, and for convenience of description, only the parts related to the embodiment of the present invention are shown, and the details are as follows:
in an embodiment of the present invention, in order to improve the clustering effect of the contour pixel points and further improve the measurement accuracy of the small diameter of the internal thread, referring to fig. 9, each unit included in the clustering module 603 is configured to execute each step in the embodiment corresponding to fig. 4, specifically please refer to fig. 4 and the description related to the embodiment corresponding to fig. 4, which is not repeated herein. In the embodiment of the present invention, the clustering module 603 includes a pixel radius updating unit 901, a contour point clustering unit 902, and a thread classification adding unit 903.
The pixel radius updating unit 901 is configured to update the pixel radius of the contour pixel point according to the direction angle and the pixel radius of the contour pixel point in the binary contour image after the contour noise reduction and the calibrated pixel radius correction parameter, so as to determine the updated pixel radius of the contour pixel point.
And the contour point clustering unit 902 is configured to, when a pixel radius difference between the pixel radius closest to the thread after the update of the contour pixel point and the pixel radius after the update of the contour pixel point is smaller than the initial pixel radius difference, take the contour pixel point as the contour pixel point closest to the thread after the update of the contour pixel point, and update the initial pixel radius difference as the pixel radius difference.
And the thread classification newly-added unit 903 is used for taking the contour pixel point as the pixel point of the new thread and taking the pixel radius after the contour pixel point is updated as the pixel radius of the new thread when the initial pixel radius difference is not less than the preset proportion of the calibrated pixel radius correction parameter.
In the embodiment of the present invention, the pixel radius updating unit 901 updates the pixel radius of the contour pixel point according to the direction angle and the pixel radius of the contour pixel point in the binary contour image after the contour noise reduction, and the calibrated pixel radius correction parameter, so as to determine the updated pixel radius of the contour pixel point; when the pixel radius difference between the pixel radius closest to the thread and the updated pixel radius is smaller than the initial pixel radius difference, the contour point clustering unit 902 takes the contour pixel as the contour pixel closest to the thread and the updated pixel radius as the pixel radius difference; when the difference of the initial pixel radius is not smaller than the preset proportion of the calibrated pixel radius correction parameter, the thread classification adding unit 903 takes the contour pixel point as the pixel point of the new thread, and takes the pixel radius of the contour pixel point as the pixel radius of the new thread. The pixel radius updating unit 901 updates the pixel radius of the contour pixel point, and the contour point clustering unit 902 clusters the contour pixel point by using the calibrated pixel radius correction parameter, so that the clustering effect of the contour pixel point can be improved, and the measurement accuracy of the small diameter of the internal thread can be improved.
Fig. 10 is a schematic diagram illustrating a structure of a calibrated pixel radius correction parameter in an internal thread minor-diameter measuring apparatus according to an embodiment of the present invention, and for convenience of description, only the portions related to the embodiment of the present invention are shown, and the detailed description is as follows:
in an embodiment of the present invention, in order to improve the accuracy of measuring the minor diameter of the internal thread, referring to fig. 10, each unit included in the calibration pixel radius correction parameter is used to execute each step in the embodiment corresponding to fig. 5, and specifically, refer to fig. 5 and the related description in the embodiment corresponding to fig. 5, which are not repeated herein. In the embodiment of the present invention, the calibrating pixel radius correction parameter includes a function fitting unit 1001 and a pixel radius correction parameter determining unit 1002.
The function fitting unit 1001 is used for performing polynomial fitting on the pixel radius and the turn number of the threads contained in the pixel thread map of the standard thread piece to determine a radius turn number relation function; the radius-turn relationship function reflects the relationship between the pixel radius of the thread and the turn.
The pixel radius correction parameter determining unit 1002 is configured to use a derivative of the radius-turn number relation function as a calibrated pixel radius correction parameter.
In the embodiment of the present invention, the function fitting unit 1001 performs polynomial fitting using the pixel thread map of the standard threaded component, including the pixel radius and the number of turns of the thread, to determine a radius-turn number relation function; the radius-turn relation function reflects the relation between the pixel radius of the thread and the turn; the pixel radius correction parameter determining unit 1002 uses the derivative of the radius-turn number relation function as the calibrated pixel radius correction parameter. According to the embodiment of the invention, the derivative of the radius turn number relation function is used as the calibrated pixel radius correction parameter through polynomial fitting and derivation, so that the accuracy of measuring the small diameter of the internal thread can be improved.
The invention can measure the minor diameter value of each circle of internal thread, and can measure the thread depth and judge the thread pitch type and whether the thread is broken, not only the thread aperture is estimated. The method is based on the calibration process of the threads with the same specification, and specifies the image acquisition standard, so that the error can be effectively reduced, the calculation amount is reduced, and the rapid visual measurement of the minor diameter of the threads is realized. The real-time updating of the pixel radius in the clustering process is equivalent to additionally introducing spatial information, reduces the alignment requirement on a threaded hole during shooting, has better robustness, and improves the accuracy of measuring the minor diameter of the internal thread.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the computer program to realize the internal thread small diameter measuring method.
The embodiment of the invention also provides a computer readable storage medium, which stores a computer program for executing the internal thread small diameter measuring method.
In summary, in the embodiment of the present invention, the internal thread to be detected is fixedly disposed at the station preset position, and the internal hole unfolding mirror disposed at the preset height right above the threaded hole of the internal thread to be detected is used to shoot the internal hole unfolding diagram of the internal thread to be detected; carrying out binarization on the shot inner hole development image of the internal thread to be detected, and determining an initial binary profile image of the internal thread to be detected; clustering outline pixel points of an initial binary outline image of the internal thread to be detected to form an initial pixel thread map containing threads with different pixel radiuses; and determining the actual radius of the internal thread to be measured according to the pixel radius of the threads in the pixel thread graph sorted according to the pixel radius and the actual radius of the calibrated standard thread piece. According to the embodiment of the invention, the pixel thread map containing threads with different pixel radiuses is formed by clustering the contour pixel points of the binary contour image of the internal thread to be measured, and further, the internal thread small diameter measurement is realized by utilizing the pixel radius and the actual radius of the calibrated standard thread part based on the pixel radius of the threads in the pixel thread map, so that the accuracy of measuring the internal thread small diameter is improved.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are provided to further explain the objects, technical solutions and advantages of the present invention in detail, and it should be understood that the above-mentioned embodiments are only examples of the present invention and should not be used to limit the scope of the present invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims (10)
1. A method for measuring the minor diameter of an internal thread is characterized by comprising the following steps:
fixedly arranging the internal thread to be detected at a station preset position, and shooting an inner hole expansion picture of the internal thread to be detected by using an inner hole expansion mirror with a preset height right above a threaded hole of the internal thread to be detected;
carrying out binarization on the shot inner hole development image of the internal thread to be detected, and determining an initial binary profile image of the internal thread to be detected;
clustering outline pixel points of an initial binary outline image of the internal thread to be detected to form an initial pixel thread map containing threads with different pixel radiuses;
and determining the actual radius of the internal thread to be measured according to the pixel radius of the threads in the pixel thread graph sorted according to the pixel radius and the actual radius of the calibrated standard thread piece.
2. The method for measuring a minor diameter of an internal thread according to claim 1, further comprising:
refining the initial binary contour image by utilizing skeleton extraction to determine a binary contour image;
clustering the outline pixel points of the initial binary outline image of the internal thread to be detected to form a pixel thread map containing threads with different pixel radiuses and sizes, comprising the following steps:
and clustering the outline pixel points of the binary outline image of the internal thread to be detected to form a pixel thread map containing threads with different pixel radiuses and sizes.
3. The method for measuring a minor diameter of an internal thread according to claim 2, further comprising:
carrying out contour noise reduction processing on the binary contour image, and determining the binary contour image after contour noise reduction;
clustering the outline pixel points of the binary outline image of the internal thread to be detected to form a pixel thread map containing threads with different pixel radiuses and sizes, comprising the following steps:
clustering the contour pixel points of the two-value contour image after the noise reduction of the contour of the internal thread to be detected to form a pixel thread map containing threads with different pixel radiuses and sizes.
4. The method for measuring a minor diameter of an internal thread according to claim 3, wherein the step of performing a profile noise reduction process on the binary profile image to determine a binary profile image after the profile noise reduction comprises:
establishing a polar coordinate system by taking an image center pixel of the binary contour image as an origin, and determining a neighborhood matrix of contour pixel points and a convolution kernel corresponding to a direction angle of the contour pixel points;
determining an actual convolution result of a convolution kernel corresponding to the direction angle of the contour pixel point and the field matrix of the contour pixel point;
when the actual convolution result is smaller than a rejection threshold value, the contour pixel points are taken as noise to be rejected; the elimination threshold is a preset proportion of the convolution kernel corresponding to the direction angle of the outline pixel point and the convolution result of the full matrix.
5. The method for measuring the minor diameter of the internal thread according to claim 4, wherein the step of clustering the contour pixels of the denoised binary contour image of the internal thread contour to be measured to form a pixel thread map including threads with different pixel radii comprises the steps of:
updating the pixel radius of the outline pixel point according to the direction angle and the pixel radius of the outline pixel point in the binary outline image after the outline noise reduction and the calibrated pixel radius correction parameter so as to determine the updated pixel radius of the outline pixel point;
when the pixel radius difference value between the pixel radius closest to the thread and the updated pixel radius of the outline pixel point is smaller than the initial pixel radius difference value, taking the outline pixel point as the outline pixel point closest to the thread and the updated pixel radius of the outline pixel point, and updating the initial pixel radius difference value to be the pixel radius difference value;
and when the initial pixel radius difference is not less than the preset proportion of the calibrated pixel radius correction parameter, taking the contour pixel point as a pixel point of a new thread, and taking the pixel radius after the contour pixel point is updated as the pixel radius of the new thread.
6. The method of measuring a minor diameter of an internal thread of claim 5, wherein calibrating the pixel radius correction parameter comprises:
performing polynomial fitting by utilizing a pixel thread map of a standard thread piece to contain the pixel radius and the number of turns of the thread, and determining a radius-turn number relation function; the radius-turn relation function reflects the relation between the pixel radius of the thread and the turn;
and taking the derivative of the radius-turn number relation function as a calibrated pixel radius correction parameter.
7. An internal thread minor diameter measuring device, comprising:
the shooting module is used for fixedly arranging the internal thread to be detected at a station preset position and shooting an internal hole expansion picture of the internal thread to be detected by using an internal hole expansion mirror arranged at a preset height right above a threaded hole of the internal thread to be detected;
the binarization module is used for binarizing the shot inner hole development image of the internal thread to be detected and determining an initial binary profile image of the internal thread to be detected;
the clustering module is used for clustering contour pixel points of the initial binary contour image of the internal thread to be detected to form an initial pixel thread map containing threads with different pixel radiuses;
and the radius determining module is used for determining the actual radius of the internal thread to be measured according to the pixel radius of the threads in the pixel thread graph sorted according to the pixel radius, the pixel radius of the calibrated standard thread part and the actual radius.
8. The internal thread minor diameter measurement apparatus of claim 7, further comprising:
the skeleton extraction module is used for refining the initial binary contour image by utilizing skeleton extraction to determine the binary contour image;
and the clustering module is also used for clustering the outline pixel points of the binary outline image of the internal thread to be detected to form a pixel thread map containing threads with different pixel radiuses and sizes.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the internal thread small diameter measurement method according to any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program for executing the method for measuring a minor diameter of an internal thread according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110692263.3A CN115507761A (en) | 2021-06-22 | 2021-06-22 | Internal thread small diameter measuring method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110692263.3A CN115507761A (en) | 2021-06-22 | 2021-06-22 | Internal thread small diameter measuring method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115507761A true CN115507761A (en) | 2022-12-23 |
Family
ID=84500012
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110692263.3A Pending CN115507761A (en) | 2021-06-22 | 2021-06-22 | Internal thread small diameter measuring method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115507761A (en) |
-
2021
- 2021-06-22 CN CN202110692263.3A patent/CN115507761A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11313806B2 (en) | Defect inspection method and defect inspection device | |
CN112767398B (en) | Method and device for detecting wafer defects | |
US20090208090A1 (en) | Method and apparatus for inspecting defect of pattern formed on semiconductor device | |
JP2011017705A (en) | Pattern inspection device, pattern inspection method, and recording medium | |
TWI533383B (en) | Design-based inspection using repeating structures | |
US20140376802A1 (en) | Wafer Inspection Using Free-Form Care Areas | |
CN109816051B (en) | Hazardous chemical cargo feature point matching method and system | |
CN106815830B (en) | Image defect detection method | |
CN112200790B (en) | Cloth defect detection method, device and medium | |
CN117392112A (en) | Method, device and system for detecting wafer surface defects | |
CN112819842B (en) | Workpiece contour curve fitting method, device and medium suitable for workpiece quality inspection | |
JP4597509B2 (en) | Pattern inspection apparatus and pattern inspection method | |
CN115507761A (en) | Internal thread small diameter measuring method and device | |
CN117173107A (en) | Product defect detection method, device, equipment, system and readable storage medium | |
US20190355110A1 (en) | Cross talk reduction | |
JP6597469B2 (en) | Defect inspection equipment | |
Lin et al. | X-ray imaging inspection system for blind holes in the intermediate layer of printed circuit boards with neural network identification | |
Hargas et al. | Novel machine vision tools applied in biomechatronic tasks | |
CN113222880A (en) | Analytical detection method | |
CN114882027B (en) | Electronic equipment chip pin defect detection method and system | |
CN109443244A (en) | The method for rejecting high light reflectivity exception error point based on stereoscopic vision and the constraint of light-knife face | |
CN117576088B (en) | Intelligent liquid impurity filtering visual detection method and device | |
Wang et al. | A Machine Vision Based In-Line Quality Assessment Method for the Fabrication of Structured Surfaces | |
Pan et al. | Research on the examination technology of connector pin skewing according to Blob analysis | |
CN108898590B (en) | Self-feature extraction method applied to product appearance visual detection |
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 |