Method and apparatus for measuring minor diameter of internal thread
By using an internal bore expansion mirror for imaging and image processing, combined with the pixel radius of a calibrated standard threaded component, high-precision measurement of small-diameter internal threads was achieved, solving the problem of insufficient accuracy in internal thread detection in existing technologies.
Patent Information
- Application Number
- CN202110692263.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-22
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-06-22
AI Technical Summary
Existing technologies cannot effectively measure the minor diameter of each turn of a small-diameter internal thread, especially since the optomechanical components cannot penetrate deep into small-diameter holes to take pictures, resulting in insufficient accuracy in internal thread detection.
An internal hole development mirror is used to take an image of the developed internal hole directly above the threaded hole. The image is processed by binarization and clustering techniques. The actual radius of the internal thread to be tested is determined by combining the pixel radius of the calibrated standard threaded part with the actual radius.
It improves the accuracy and precision of measuring the minor diameter of internal threads and solves the problem of detecting small-diameter internal threads.
Smart Images

Figure CN115507761B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of machine vision, and in particular to a method and device for measuring the minor diameter of an internal thread. BACKGROUND
[0002] This section is intended to provide background information to facilitate a better understanding of embodiments of the present application as set forth in the claim section. It is not admitted that any of the information provided in this section constitutes prior art.
[0003] Internal thread processing quality evaluation is an important quality inspection project in the industrial field, especially in the field of high accuracy machining, mainly involving detection items such as internal thread hole diameter, thread depth, hole depth, pitch, tooth type, etc. The current thread detection methods mainly include two categories: contact type and non-contact type. Among them, the contact detection method includes go-no-go gauge, thread micrometer, and needle scanning detection method; the non-contact method includes tool microscope and machine vision method. The machine vision detection of internal thread is further divided according to the light source and illumination method, including internal hole unwinding imaging by shooting above the hole; endoscopic imaging by inserting an optical probe into the thread hole to take a picture of the thread; imaging using a laser line illumination; imaging using a 3D camera; parameter measurement based on laser triangulation, etc.
[0004] The contact detection method is limited by precise mechanical control and is difficult to be used for in-situ detection of large workpieces. The non-contact measurement is easy to integrate into a flexible robot, but it is mainly used for external thread detection, and for internal threads, especially small-diameter deep holes, the optical and mechanical components cannot be inserted into the hole to take pictures, and the existing visual detection technology cannot measure the diameter value of each circle of small-diameter internal threads. SUMMARY
[0005] The embodiments of the present application provide a method for measuring the minor diameter of an internal thread, which can measure the minor diameter of an internal thread while improving the accuracy of measuring the minor diameter of an internal thread. The method comprises the following steps:
[0006] The internal thread to be measured is fixedly arranged at a preset position of a work station, and an internal hole unwinding mirror arranged at a preset height directly above the thread hole of the internal thread to be measured is used to take an internal hole unwinding image of the internal thread to be measured.
[0007] The internal hole unwinding image of the internal thread to be measured is binarized to determine an initial binary contour image of the internal thread to be measured.
[0008] The contour pixel points of the initial binary contour image of the internal thread to be measured are clustered to form an initial pixel thread image containing threads with different pixel radius sizes.
[0009] The actual radius of the internal thread to be measured is determined according to the pixel radius of the thread in the pixel thread image sorted according to the pixel radius and the pixel radius and actual radius of the standard thread after calibration.
[0010] This invention also provides an internal thread minor diameter measuring device to improve the accuracy of internal thread minor diameter measurement while simultaneously measuring it. The internal thread minor diameter measuring device includes:
[0011] The imaging module is used to fix the internal thread to be tested at a preset position on the workstation and use an internal hole development mirror set at a preset height directly above the thread hole of the internal thread to be tested to take an image of the internal hole development of the internal thread to be tested.
[0012] The binarization module is used to binarize the captured image of the inner hole development of the internal thread to be tested, and to determine the initial binary contour image of the internal thread to be tested.
[0013] The clustering module is used to cluster the contour pixels of the initial binary contour image of the internal thread to be tested, forming an initial pixel thread map containing threads of different pixel radii.
[0014] The radius determination module is used to determine the actual radius of the internal thread to be tested based on the pixel radius of the thread in the pixel thread diagram sorted by pixel radius size, the pixel radius of the calibrated standard threaded part, and the actual radius.
[0015] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described method for measuring the minor diameter of internal threads.
[0016] This invention also provides a computer-readable storage medium storing a computer program that performs the above-described method for measuring the minor diameter of internal threads.
[0017] In this embodiment of the invention, the internal thread to be tested is fixedly positioned at a preset location on the workstation. An internal hole development mirror, positioned at a preset height directly above the threaded hole of the internal thread to be tested, is used to capture the developed image of the internal hole of the internal thread to be tested. The captured developed image of the internal hole of the internal thread to be tested is binarized to determine an initial binary contour image of the internal thread to be tested. The contour pixels of the initial binary contour image of the internal thread to be tested are clustered to form an initial pixel thread image containing threads of different pixel radii. Based on the pixel radii of the threads in the pixel thread image sorted by pixel radius, the pixel radius of the calibrated standard thread component, and the actual radius, the actual radius of the internal thread to be tested is determined. This embodiment of the invention clusters the contour pixels of the binary contour image of the internal thread to be tested to form a pixel thread image containing threads of different pixel radii. Then, based on the pixel radii of the threads in the pixel thread image, and using the pixel radius of the calibrated standard thread component and the actual radius, the minor diameter of the internal thread is measured, improving the accuracy of measuring the minor diameter of the internal thread. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:
[0019] Figure 1 A flowchart illustrating the implementation of the internal thread minor diameter measurement method provided in this embodiment of the invention;
[0020] Figure 1-1 This is a schematic diagram of the inner hole development of a certain internal thread to be tested, provided in an embodiment of the present invention.
[0021] Figure 1-2 This is a schematic diagram of the initial binary profile of a certain internal thread to be tested, provided in an embodiment of the present invention.
[0022] Figure 1-3 This is a schematic diagram of the initial pixel thread pattern of a certain internal thread to be tested, provided in an embodiment of the present invention.
[0023] Figure 1-4 This is a schematic diagram of a pixel thread image of an internal thread to be tested, sorted by pixel radius, provided in an embodiment of the present invention.
[0024] Figure 2 This is another implementation flowchart of the internal thread minor diameter measurement method provided in the embodiments of the present invention;
[0025] Figure 2-1 This is a schematic diagram of a binary contour image of a certain internal thread skeleton after extraction, provided in an embodiment of the present invention.
[0026] Figure 2-2 A schematic diagram of a binary contour image of a certain internal thread profile after noise reduction, provided in an embodiment of the present invention;
[0027] Figure 3 A flowchart illustrating the implementation of step 202 in the internal thread minor diameter measurement method provided in this embodiment of the invention;
[0028] Figure 3-1 This is a schematic diagram of contour noise reduction for a binary contour image of an internal thread under test provided in an embodiment of the present invention;
[0029] Figure 4 The flowchart illustrates the implementation of step 203 in the internal thread minor diameter measurement method provided in this embodiment of the invention.
[0030] Figure 5 This is a flowchart illustrating the implementation of the pixel radius correction parameter calibration in the internal thread minor diameter measurement method provided in this embodiment of the invention.
[0031] Figure 6 A functional block diagram of the internal thread minor diameter measuring device provided in an embodiment of the present invention;
[0032] Figure 7 Another functional module diagram of the internal thread minor diameter measuring device provided in the embodiment of the present invention;
[0033] Figure 8 This is a structural block diagram of the contour noise reduction module 702 in the internal thread minor diameter measuring device provided in an embodiment of the present invention;
[0034] Figure 9 This is a structural block diagram of the clustering module 703 in the internal thread minor diameter measuring device provided in an embodiment of the present invention;
[0035] Figure 10 This is a structural block diagram of the internal thread minor diameter measuring device provided in an embodiment of the present invention for calibrating pixel radius correction parameters. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0037] Figure 1 The implementation flow of the internal thread minor diameter measurement method provided by the embodiment of the present invention is shown. For ease of description, only the parts related to the embodiment of the present invention are shown, and are detailed below:
[0038] like Figure 1 As shown, the method for measuring the minor diameter of internal threads includes:
[0039] Step 101: Fix the internal thread to be tested at the preset position of the workstation, and take a picture of the internal hole development of the internal thread to be tested using an internal hole development mirror set at a preset height directly above the thread hole of the internal thread to be tested.
[0040] Step 102: Binarize the captured image of the inner hole development of the internal thread to be tested to determine the initial binary profile image of the internal thread to be tested.
[0041] Step 103: Cluster the contour pixels of the initial binary contour image of the internal thread to be tested to form an initial pixel thread image containing threads of different pixel radii.
[0042] Step 104: Determine the actual radius of the internal thread to be tested based on the pixel radius of the thread in the pixel thread diagram sorted by pixel radius size, the pixel radius of the calibrated standard threaded part, and the actual radius.
[0043] When inspecting the minor diameter (inner diameter) of a thread, the thread to be tested is first fixed at a preset position on the workstation. For example, a clamp is used to hold the thread to be tested at a preset position on the workstation. This preset position can be set in advance according to the actual situation and specific needs. For example, the clamp can be used to fix the thread to be tested in a slot, exposing the threaded hole. After fixing the thread to be tested at the preset position on the workstation, the inner hole development mirror is moved and positioned at a preset height directly above the threaded hole of the thread to be tested. Then, while keeping the relative positions of the light source, the inner hole development mirror, and the thread to be tested strictly fixed, the inner hole development image of the thread to be tested is photographed to obtain the inner hole development image of the thread to be tested. Figure 1-1 This diagram illustrates the internal bore development of a certain internal thread to be tested, provided by an embodiment of the present invention. Figure 1-1 As can be seen, the development diagram of the inner hole of the internal thread under test presents a rather blurry spiral pattern. Maintaining a fixed relative position between the light source, the development mirror, and the internal thread under test during the minor diameter calibration and measurement of the thread hole can improve the accuracy of obtaining the development diagram of the inner hole of the internal thread under test, thereby improving the accuracy of the minor diameter measurement of the internal thread under test.
[0044] After obtaining the developed inner hole diagram of the internal thread to be tested, the acquired developed inner hole diagram of the internal thread to be tested is binarized to obtain the initial binary profile image of the internal thread to be tested. Figure 1-2 This diagram illustrates the initial binary profile image of a certain internal thread to be tested, provided by an embodiment of the present invention. Figure 1-2 As can be seen, the initial binary profile image of the internal thread under test presents a relatively clear thread pattern. Specifically, an adaptive threshold binarization method can be used to binarize the developed image of the internal thread under test to improve the accuracy of image binarization, thereby improving the measurement accuracy of the threaded hole. Those skilled in the art will understand that other binarization methods can also be used to binarize the developed image of the internal thread under test. For example, the Otsu's method or the Kittler binarization method, etc., are not particularly limited in this embodiment of the invention.
[0045] After obtaining the initial binary contour image of the internal thread to be tested, the contour pixels of the initial binary contour image are further clustered. Contour pixels of the same thread (with the same pixel radius) are grouped together to form an initial pixel thread image containing multiple threads. The pixel radii of the multiple threads contained in this initial pixel thread image are all different. Figure 1-3 This diagram illustrates the initial pixel thread pattern of a certain internal thread to be tested according to an embodiment of the present invention. Figure 1-3 As can be seen, the initial pixel thread image of a certain internal thread under test is clustered into multiple threads with different pixel radii.
[0046] After forming an initial pixel thread pattern containing multiple threads, the threads in the initial pixel thread pattern are further sorted according to their pixel radii, with the pixel radii of the threads increasing from the inside out. The sorting method for the clustering results is as follows: The expected number of pixels for this contour is calculated based on the pixel radius R of the classification information: N = 2 × 3.14 × R. If the actual number of pixels is too small (e.g., less than N / 2), this classification is discarded. Then, the remaining classifications are sorted by radius from largest to smallest to obtain the pixel radius of each thread. Figure 1-4 This illustration shows a pixel thread diagram of a certain internal thread to be tested, sorted by pixel radius according to an embodiment of the present invention. Furthermore, based on the pixel radius of the thread in the sorted pixel thread diagram, the actual radius of the internal thread to be tested is determined using the pixel radius and actual radius of a calibrated standard threaded component, thereby achieving accurate measurement of the thread minor diameter.
[0047] When calibrating the pixel radius and actual radius of a standard threaded component, a high-accuracy measuring tool is used to measure the actual radius of the standard threaded component. Following the steps described above, the pixel radius of the standard threaded component is obtained, and a relationship between the pixel radius and the actual radius is established. Specifically, for example, the standard threaded component is fixed at a preset position on the workstation. An internal hole development mirror, positioned at a preset height directly above the threaded hole of the standard threaded component, is used to photograph the developed internal hole image of the standard threaded component. The photographed developed internal hole image is binarized to determine the initial binary contour image of the standard threaded component. The contour pixels of the initial binary contour image of the standard threaded component are clustered to form an initial pixel thread image containing threads of different pixel radius sizes. Finally, the pixel radius of the threads in the pixel thread image sorted by pixel radius size is determined.
[0048] The actual radius of the internal thread to be measured can be determined using the following formula:
[0049]
[0050] Among them, M i1 M i2 N represents the actual radius of the internal thread to be measured and the actual radius of the standard threaded part, respectively. i1 and N i2 These represent the pixel radius (or pixel diameter) of the i-th turn of the internal thread to be tested and the pixel radius (or pixel diameter) of the i-th turn of the standard threaded part, respectively.
[0051] For example, if the pixel diameter of the first thread of a standard threaded part is 1000 (pixel radius is 500), and the actual diameter of the first thread of the standard threaded part is 16.8 mm, and the pixel diameter of the first thread of the internal thread to be tested is 998 (pixel radius is 499), then the actual diameter of the first thread of the internal thread to be tested is 16.8 mm × (998 ÷ 1000) = 16.766 mm, or 16.8 mm × (498 ÷ 500) = 16.766 mm.
[0052] In this embodiment of the invention, the contour pixels of the binary contour image of the internal thread to be measured are clustered to form a pixel thread image containing threads of different pixel radii. Then, based on the pixel radius of the thread in the pixel thread image, the pixel radius of the calibrated standard threaded part and the actual radius are used to realize the measurement of the minor diameter of the internal thread, thereby improving the accuracy of measuring the minor diameter of the internal thread.
[0053] Figure 2 Another implementation flow of the internal thread minor diameter measurement method provided in the embodiment of the present invention is shown. For ease of description, only the parts related to the embodiment of the present invention are shown, and are described in detail below:
[0054] In one embodiment of the present invention, in order to improve the accuracy of the binary profile image of the internal thread, and thus improve the accuracy of the minor diameter measurement of the internal thread, such as... Figure 2 As shown, based on the above method steps, the method for measuring the minor diameter of internal threads also includes:
[0055] Step 201: Use skeleton extraction to refine the initial binary contour image to determine the binary contour image;
[0056] Step 103: Cluster the contour pixels of the initial binary contour image of the internal thread to be tested to form a pixel thread map containing threads of different pixel radii, including:
[0057] Cluster the contour pixels of the binary contour image of the internal thread to be tested to form a pixel thread image containing threads of different pixel radii.
[0058] After binarizing the developed image of the internal thread to be measured to obtain the initial binary profile image (spiral coarse texture profile) of the internal thread, in order to improve the accuracy of the internal thread binary profile image and further improve the accuracy of the internal thread minor diameter measurement, skeleton extraction can be used to refine the initial binary profile image, reducing the initial binary profile image to a single pixel (the thread profile pixel thickness only contains a single pixel) to obtain a refined binary profile image (spiral fine texture profile). Figure 2-1 This diagram illustrates a binary profile image of a certain internal thread to be tested, provided by an embodiment of the present invention. Figure 2-1 It can be seen that the thread profile is compared to Figure 1-2The thread profile shown in the initial binary profile image is much more refined.
[0059] After obtaining the binary contour image of the internal thread to be tested using skeleton extraction, the contour pixels of the thinned (skeleton extracted) binary contour image of the internal thread to be tested are clustered using a clustering method to obtain the pixel thread image of the internal thread to be tested.
[0060] In this embodiment of the invention, skeleton extraction is used to refine the initial binary contour image, thereby determining the binary contour image. Then, the contour pixels of the binary contour image of the internal thread to be measured are clustered to form a pixel thread image containing threads of different pixel radii. The binary contour image obtained by refining the initial binary contour image using skeleton extraction in this embodiment of the invention is more accurate, further improving the accuracy of internal thread minor diameter measurement.
[0061] In one embodiment of the present invention, in order to further improve the accuracy of the binary contour image, and thus further improve the accuracy of the internal thread minor diameter measurement, such as... Figure 2 As shown, based on the above method steps, the method for measuring the minor diameter of internal threads also includes:
[0062] Step 202: Perform contour denoising on the binary contour image to determine the denoised binary contour image.
[0063] The steps involve clustering the contour pixels of the binary contour image of the internal thread to be tested, forming a pixel thread map containing threads of different pixel radii, including:
[0064] Step 203: Cluster the contour pixels of the binary contour image after noise reduction of the internal thread contour to be tested to form a pixel thread map containing threads of different pixel radii.
[0065] After refining the initial binary contour image using skeleton extraction, further contour denoising processing can be performed to eliminate noisy contour pixels and improve the accuracy of the binary contour image. Figure 2-2 This illustration shows a binary contour image of a tested internal thread profile after noise reduction, provided by an embodiment of the present invention. Figure 2-2 The thread profile shown in the binary profile image is relatively... Figure 2-1 The spiral contour of the binary contour image shown has had most of the noise (contour pixels) eliminated, resulting in a clearer and more accurate image after contour denoising. Furthermore, the contour pixels of the denoised binary contour image are clustered to form a pixel spiral map containing spirals of different pixel radii. Specifically, a direction-based filtering operator can be used to perform contour denoising on the binary contour image.
[0066] In this embodiment of the invention, contour denoising processing is performed on the binary contour image to determine the denoised binary contour image. The contour pixels of the denoised binary contour image of the internal thread to be measured are then clustered to form a pixel thread image containing threads of different pixel radii. This embodiment of the invention performs contour denoising processing on the binary contour image, which can further improve the accuracy of the binary contour image, and thus further improve the accuracy of the internal thread minor diameter measurement.
[0067] Figure 3 The implementation flow of step 202 in the internal thread minor diameter measurement method provided by the embodiment of the present invention is shown. For ease of description, only the parts related to the embodiment of the present invention are shown, and are detailed below:
[0068] In one embodiment of the present invention, in order to improve the accuracy of noise reduction of binary contour images, and thus improve the accuracy of internal thread minor diameter measurement, such as... Figure 3 As shown, step 202 involves performing contour denoising on the binary contour image to determine the denoised binary contour image, including:
[0069] Step 301: Establish a polar coordinate system with the image center pixel of the binary contour image as the origin, and determine the neighborhood matrix, the neighborhood matrix, and the convolution kernel corresponding to the orientation angle of the contour pixel.
[0070] Step 302: Determine the actual convolution result of the convolution kernel corresponding to the orientation angle of the contour pixel and the neighborhood matrix of the contour pixel.
[0071] Step 303: When the actual convolution result is less than the rejection threshold, the contour pixels are rejected as noise; the rejection threshold is a preset ratio of the convolution result of the convolution kernel corresponding to the orientation angle of the contour pixel and the convolution result of the all-one matrix.
[0072] When performing noise reduction on the binary contour image of the internal thread under test, a polar coordinate system is first established with the image center pixel of the binary contour image as the origin O[0,0]. Then, the polar coordinates [Pho,Theta] of each contour pixel are determined based on the coordinates of the origin (image center pixel) and the coordinates of the contour pixel, where Theta represents the orientation angle and Pho represents the pixel radius. For an m pixel × n pixel image, the origin coordinates are (m / 2, n / 2); assuming the coordinates of a certain contour pixel are (i, j), the orientation angle and pixel radius of the contour pixel can be determined by the following formula:
[0073]
[0074] Rho = sqrt((im / 2) 2 +(jn / 2) 2 );
[0075] Figure 3-1 This illustration shows a contour noise reduction diagram of a binary contour image of an internal thread under test, provided by an embodiment of the present invention. Figure 3-1 As can be seen, in an image of size m pixels × n pixels, the coordinates of the center pixel O (origin) are [m / 2, n / 2], and the coordinates of the contour pixel A are [x1, y1]. Furthermore, from... Figure 3-1 As can be seen in the lower left corner, this embodiment of the invention divides the 360° thread range into 8 regions (pairwise symmetrical) according to the direction angle of the contour pixels. The 4 expected contour trends (directions) corresponding to different direction angle regions are represented by 4 convolution kernels. Specifically, the direction angle regions corresponding to convolution kernels [1,1,1; 3,3,3; 1,1,1;] include mutually symmetrical regions I and V; the direction angle regions corresponding to convolution kernels [5,2,1; 2,5,2; 1,2,5;] include mutually symmetrical regions II and VI; the direction angle regions corresponding to convolution kernels [1,3,1; 1,3,1; 1,3,1;] include mutually symmetrical regions III and VII; and the direction angle regions corresponding to convolution kernels [1,2,5; 2,5,2; 5,2,1;] include mutually symmetrical regions IV and VIII. Furthermore, the above correspondence between orientation angles and convolution kernels is merely an illustrative example. The range of orientation angles corresponding to different convolution kernels can be adaptively adjusted according to actual conditions and specific needs. This embodiment of the invention does not impose any special limitations on this.
[0076] The 360° thread range is divided into 8 regions (pairwise symmetrical), and 4 convolution kernels are used corresponding to the 4 expected contour trends (directions) of different direction angle regions. This is only an example. To improve the accuracy of internal thread minor diameter measurement, the 360° thread range can be divided into more regions, such as 16 regions (pairwise symmetrical), with 8 convolution kernels corresponding to the 8 expected contour trends (directions) of different direction angle regions, or 32 regions (pairwise symmetrical), with 16 convolution kernels corresponding to the 16 expected contour trends (directions) of different direction angle regions. It is understandable that the more regions and convolution kernels there are, the higher the accuracy of internal thread minor diameter measurement, but the efficiency of internal thread minor diameter measurement will decrease.
[0077] The size and specific value of the convolution kernel matrix corresponding to the orientation angle of the contour pixels are not fixed. The core idea is that the weight along the expected contour direction is greater than the weight along the noise direction, thereby improving the noise reduction effect of the binary contour image and thus improving the accuracy of the minor diameter measurement of the internal thread. In addition, for deeper threaded holes, it may be necessary to adjust the focal length to capture the entire internal thread in segments, and use some combined calculation methods or image stitching algorithms to obtain the minor diameter value of the entire threaded hole.
[0078] First, calculate the orientation angle of the contour pixel A in the image as arctan((x1-m / 2) / (y1-n / 2)). Assume the calculated orientation angle of contour pixel A is 135°. In this direction, the expected contour trend of the thread (the expected tangent direction of contour pixel A on its respective pixel radius) is of the " / " shape. However, the actual contour trend of the thread at the 135° orientation angle (the actual tangent direction of contour pixel A on its respective pixel radius) is of the "\" shape. Therefore, the neighborhood matrix of contour pixel A is [1,0,0; 0,1,0; 0,0,1;]. At this time, the convolution kernel corresponding to contour pixel A is... Figure 3-1 The convolution kernel in the lower left corner is [1,2,5; 2,5,2; 5,2,1;], and the all-one matrix is [1,1,1; 1,1,1; 1,1,1;].
[0079] Furthermore, after determining the orientation angle, neighborhood matrix, and convolution kernel corresponding to the orientation angle of the contour pixel, the actual convolution result between the neighborhood matrix and the convolution kernel corresponding to the orientation angle of the contour pixel is determined. For example, the convolution result between the neighborhood matrix [1,0,0; 0,1,0; 0,0,1;] of contour pixel A and the convolution kernel [1,2,5; 2,5,2; 5,2,1;] corresponding to the orientation angle of contour pixel A is 7.
[0080] After determining the actual convolution result, if the actual convolution result is less than the rejection threshold, it indicates that the actual contour direction of the contour pixel deviates significantly from the expected contour direction. Therefore, the contour pixel can be identified as noise and rejected. The rejection threshold is a preset ratio between the convolution kernel corresponding to the contour pixel's orientation angle and the convolution result of the all-one matrix. For example, for contour pixel A, the rejection threshold is a preset ratio between the convolution kernel [1,2,5; 2,5,2; 5,2,1;] corresponding to the orientation angle of contour pixel A and the convolution result 25 of the all-one matrix [1,1,1; 1,1,1; 1,1,1;]. It is understood that contour pixels with different orientation angles correspond to convolution kernels with different orientation angles, and thus different rejection thresholds. In this application, there are a total of eight orientation angles, corresponding to four convolution kernels, and four rejection thresholds (actually there are eight, which are symmetrical in pairs).
[0081] The preset ratio is a pre-set rejection ratio. Those skilled in the art will understand that the preset ratio can be preset according to actual conditions and specific needs. For example, based on the above-mentioned preset ratio of 32% or 28%, those skilled in the art will understand that the preset ratio can also be preset to other rejection ratio thresholds besides the above-mentioned 32% or 28%, such as 36%, etc. The embodiments of the present invention do not impose any special limitations on this.
[0082] In this embodiment of the invention, a polar coordinate system is established with the image center pixel of the binary contour image as the origin. The neighborhood matrix of the contour pixel and the convolution kernel corresponding to the orientation angle of the contour pixel are determined. The actual convolution result of the neighborhood matrix and the convolution kernel corresponding to the orientation angle of the contour pixel is determined. When the actual convolution result is less than the rejection threshold, the contour pixel is rejected as noise. This invention determines whether a contour pixel is a noise contour pixel by using the orientation angle and neighborhood matrix of the contour pixel, the all-one matrix, and the convolution kernel corresponding to the orientation angle of the contour pixel. This improves the accuracy of contour denoising in binary contour images, and further improves the accuracy of internal thread minor diameter measurement.
[0083] Figure 4 The implementation flow of step 203 in the internal thread minor diameter measurement method provided by the embodiment of the present invention is shown. For ease of description, only the parts related to the embodiment of the present invention are shown, and are detailed below:
[0084] In one embodiment of the present invention, in order to improve the clustering effect of contour pixels and thus improve the measurement accuracy of the minor diameter of the internal thread, such as... Figure 4 As shown, step 203 involves clustering the contour pixels of the denoised binary contour image of the internal thread profile to be tested, forming a pixel thread map containing threads of different pixel radii, including:
[0085] Step 401: Based on the orientation angle and pixel radius of the contour pixels in the binary contour image after contour denoising, and the calibrated pixel radius correction parameters, update the pixel radius of the contour pixels to determine the updated pixel radius of the contour pixels.
[0086] Step 402: When the difference between the pixel radius of the pixel whose updated pixel radius is closest to the thread and the pixel radius of the updated pixel radius of the contour pixel is less than the initial pixel radius difference, the contour pixel is taken as the contour pixel whose updated pixel radius is closest to the thread, and the initial pixel radius difference is updated to the pixel radius difference.
[0087] Step 403: When the initial pixel radius difference is not less than the preset ratio of the calibrated pixel radius correction parameter, the contour pixel is used as the pixel of the new thread, and the updated pixel radius of the contour pixel is used as the pixel radius of the new thread.
[0088] When clustering contour pixels in a denoised binary contour image, the pixel radius of the contour pixels can be updated based on the orientation angle and pixel radius of the contour pixels in the denoised binary contour image, as well as the calibrated pixel radius correction parameters. The pixel radius correction parameters are pre-calibrated pixel radius correction parameters. For example... Figure 3-1As shown, for contour pixels with a direction angle θ in [0°, 180°), the correction is applied outward according to the angle ratio (180°-θ) / 180°; for contour pixels with a direction angle θ in [180°, 360°), the correction is applied inward according to the angle ratio (θ-180°) / 180°.
[0089] After determining the orientation angle Theta and pixel radius Rho of the contour pixel, the pixel radius of the contour pixel is updated according to the angle ratio and correction direction corresponding to the angle range to which the contour pixel belongs.
[0090] Specifically, the pixel radius of the contour pixels can be updated using the following formula:
[0091]
[0092] Where Rho_new represents the pixel radius of the updated contour pixel, Rho represents the pixel radius of the (previous) contour pixel, and dr represents the pixel radius correction parameter after calibration.
[0093] After obtaining the updated pixel radius Rho_new of the contour pixel, determine the pixel radius of the thread that is closest to the updated pixel radius of the contour pixel. Then, compare the difference between the pixel radius of the closest thread and the updated pixel radius of the contour pixel with the initial pixel radius difference. If the difference between the pixel radius of the closest thread and the updated pixel radius of the contour pixel is less than the initial pixel radius difference, it means that the pixel radius of the contour pixel is close to the thread. This contour pixel should be classified as the contour pixel that is closest to the thread and assigned to the thread with the closest updated pixel radius, thus realizing the classification of the contour pixel. At the same time, update the initial pixel radius difference to the pixel radius difference.
[0094] If the difference between the updated pixel radius of the contour pixel and the pixel radius of the thread is not less than the initial pixel radius difference, and the initial pixel radius difference is not less than the preset ratio of the calibrated pixel radius correction parameter, it means that there is no cluster of the contour pixel in the existing clusters. In this case, the contour pixel is taken as the pixel of the new thread, and the updated pixel radius of the contour pixel is taken as the pixel radius of the new thread.
[0095] Contour pixels with the same pixel radius are easily grouped together, with each turn of the spiral corresponding to a pixel radius of equal size. The algorithm is implemented using a loop structure, and its pseudocode is shown below:
[0096] Algorithm: Internal Hole Development Thread Profile Clustering
[0097] Input: Binary profile image of the thread I
[0098] Output: Clustered image of the thread profile, including the radius and number of pixels for each type.
[0099]
[0100] The three parts of the loop respectively implement pixel radius correction, pixel radius classification, and pixel radius update classification functions. Finally, all contour pixels are clustered according to pixel radius, obtaining pixel radius and pixel count information for multiple categories. The algorithm involves a pixel radius correction parameter dr that varies with the pixel radius, representing the magnitude of the pixel radius correction. Generally, the denser the spiral pattern in the image captured further inwards, the smaller the correction amount. The actual value of the pixel radius correction parameter can be manually calibrated using simple calculations, or precisely obtained during the minor diameter calibration stage.
[0101] In this embodiment of the invention, the pixel radius of the contour pixels is updated based on the orientation angle and pixel radius of the contour pixels in the binary contour image after contour denoising, and the calibrated pixel radius correction parameters, to determine the updated pixel radius of the contour pixels. When the difference between the pixel radius of the closest thread to the updated pixel radius of the contour pixel and the pixel radius of the updated contour pixel is less than the initial pixel radius difference, the contour pixel is taken as the contour pixel closest to the thread, and the initial pixel radius difference is updated to the pixel radius difference. When the initial pixel radius difference is not less than a preset ratio of the calibrated pixel radius correction parameters, the contour pixel is taken as the pixel of the new thread, and the pixel radius of the contour pixel is taken as the pixel radius of the new thread. This embodiment of the invention improves the clustering effect of the contour pixels by updating the pixel radius of the contour pixels and using the calibrated pixel radius correction parameters to cluster the contour pixels, thereby improving the measurement accuracy of the minor diameter of the internal thread.
[0102] Figure 5 The implementation flow of calibrating pixel radius correction parameters in the internal thread minor diameter measurement method provided by the embodiment of the present invention is shown. For ease of description, only the parts related to the embodiment of the present invention are shown, and are detailed below:
[0103] In one embodiment of the present invention, in order to improve the accuracy of the measurement of the minor diameter of the internal thread, such as... Figure 5 As shown, the calibration pixel radius correction parameters include:
[0104] Step 501: Using the pixel thread image of the standard threaded part, the pixel radius and number of turns of the thread are included in the polynomial fitting to determine the radius-to-turns relationship function; the radius-to-turns relationship function reflects the relationship between the pixel radius and the number of turns of the thread.
[0105] Step 502: Use the derivative of the radius-number relationship function as the calibrated pixel radius correction parameter.
[0106] When obtaining the calibrated pixel radius correction parameters, the pixel thread map of the standard threaded component is obtained through the above steps. Then, based on the pixel thread map of the standard threaded component, a polynomial fitting is performed on the pixel radius and number of turns of the thread to determine the radius-to-turns relationship function, which reflects the relationship between the pixel radius and the number of turns of the thread. Furthermore, the derivative of the radius-to-turns relationship function is calculated, and this derivative is used as the calibrated pixel radius correction parameter.
[0107] In this embodiment of the invention, a polynomial fitting is performed on the pixel thread image of a standard threaded component, including the pixel radius and number of turns of the thread, to determine the radius-to-turns relationship function. This function reflects the relationship between the pixel radius and the number of turns of the thread. The derivative of this function is used as a calibrated pixel radius correction parameter. By using polynomial fitting and differentiation, and taking the derivative of the radius-to-turns relationship function as a calibrated pixel radius correction parameter, this embodiment of the invention can improve the accuracy of minor diameter measurement of internal threads.
[0108] In addition, the pitch type (fine, coarse, standard) can be determined based on the density of the pixel radius set; the presence of thread breakage can be determined by comparing the number of pixels per thread turn with the expected number of pixels; and the thread depth can be calculated by multiplying the total number of thread turns by the pitch.
[0109] This invention also provides an internal thread minor diameter measuring device, as described in the following embodiments. Since the principle behind these devices is similar to that of the internal thread minor diameter measuring method, the implementation of these devices can be found in the implementation of the method, and repeated details will not be elaborated further.
[0110] Figure 6 The functional modules of the internal thread minor diameter measuring device provided in an embodiment of the present invention are shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown, and are described in detail below:
[0111] refer to Figure 6 The various modules included in the internal thread minor diameter measuring device are used to perform... Figure 1 For details of each step in the corresponding embodiment, please refer to [link / reference]. Figure 1 as well as Figure 1The relevant descriptions in the corresponding embodiments will not be repeated here. In this embodiment of the invention, the internal thread minor diameter measuring device includes an imaging module 601, a binarization module 602, a clustering module 603, and a radius determination module 604.
[0112] The imaging module 601 is used to fix the internal thread to be tested at a preset position on the workstation and use an internal hole development mirror set at a preset height directly above the thread hole of the internal thread to be tested to take an image of the internal hole development of the internal thread to be tested.
[0113] The binarization module 602 is used to binarize the captured image of the inner hole development of the internal thread to be tested, and to determine the initial binary profile image of the internal thread to be tested.
[0114] Clustering module 603 is used to cluster the contour pixels of the initial binary contour image of the internal thread to be tested, forming an initial pixel thread map containing threads of different pixel radii.
[0115] The radius determination module 604 is used to determine the actual radius of the internal thread to be tested based on the pixel radius of the thread in the pixel thread diagram sorted by pixel radius size, the pixel radius of the calibrated standard threaded part, and the actual radius.
[0116] In this embodiment of the invention, the imaging module 601 fixes the internal thread to be tested at a preset position on the workstation and uses an internal hole unfolding mirror set at a preset height directly above the threaded hole of the internal thread to be tested to capture the unfolded image of the internal hole of the internal thread to be tested; the binarization module 602 binarizes the captured unfolded image of the internal hole of the internal thread to be tested to determine the initial binary contour image of the internal thread to be tested; the clustering module 603 clusters the contour pixels of the initial binary contour image of the internal thread to be tested to form an initial pixel thread image containing threads of different pixel radius sizes; the radius determination module 604 determines the actual radius of the thread to be tested based on the pixel radius of the thread in the pixel thread image sorted according to pixel radius size, the pixel radius of the calibrated standard thread part, and the actual radius. In this embodiment of the invention, the clustering module 603 clusters the contour pixels of the binary contour image of the internal thread to be measured to form a pixel thread map containing threads of different pixel radii. Then, the radius determination module 604 uses the pixel radius of the thread in the pixel thread map, the pixel radius of the calibrated standard threaded part and the actual radius to measure the minor diameter of the internal thread, thereby improving the accuracy of measuring the minor diameter of the internal thread.
[0117] Figure 7 Another functional module of the internal thread minor diameter measuring device provided in an embodiment of the present invention is shown. For ease of explanation, only the part related to the embodiment of the present invention is shown, and is described in detail below:
[0118] In one embodiment of the present invention, in order to improve the accuracy of the binary profile image of the internal thread, and thus improve the accuracy of the minor diameter measurement of the internal thread, a reference is made. Figure 7 The various modules included in the internal thread minor diameter measuring device are used to perform... Figure 2 For details of each step in the corresponding embodiment, please refer to [link / reference]. Figure 2 as well as Figure 2 The relevant descriptions in the corresponding embodiments will not be repeated here. In this embodiment of the invention, based on the above-described module structure, the internal thread minor diameter measuring device further includes a skeleton extraction module 701.
[0119] The skeleton extraction module 701 is used to refine the initial binary contour image using skeleton extraction to determine the binary contour image.
[0120] Clustering module 603 is specifically used to cluster the contour pixels of the binary contour image of the internal thread to be tested, forming a pixel thread map containing threads of different pixel radii.
[0121] In this embodiment of the invention, the skeleton extraction module 701 refines the initial binary contour image using skeleton extraction to determine the binary contour image. Then, the clustering module 603 clusters the contour pixels of the binary contour image of the internal thread to be measured, forming a pixel thread image containing threads of different pixel radii. The binary contour image obtained by the skeleton extraction module 801 using skeleton extraction to refine the initial binary contour image is more accurate, further improving the accuracy of internal thread minor diameter measurement.
[0122] In one embodiment of the present invention, in order to further improve the accuracy of the binary contour image, and thus further improve the accuracy of the internal thread minor diameter measurement, reference is made to... Figure 8 Based on the above module structure, the internal thread minor diameter measuring device also includes a contour noise reduction module 702.
[0123] The contour denoising module 702 is used to perform contour denoising processing on a binary contour image and determine the binary contour image after contour denoising.
[0124] Clustering module 603 is specifically used to cluster the contour pixels of the binary contour image after noise reduction of the internal thread contour to be tested, forming a pixel thread map containing threads of different pixel radii.
[0125] In this embodiment of the invention, the contour denoising module 702 performs contour denoising processing on the binary contour image to determine the denoised binary contour image. The clustering module 603 clusters the contour pixels of the denoised binary contour image of the internal thread to be measured, forming a pixel thread map containing threads of different pixel radii. The contour denoising module 702 of this embodiment of the invention performs contour denoising processing on the binary contour image, which can further improve the accuracy of the binary contour image, and thus further improve the accuracy of the measurement of the minor diameter of the internal thread.
[0126] Figure 8 The diagram illustrates the structure of the contour noise reduction module 702 in the internal thread minor diameter measuring device provided in an embodiment of the present invention. For ease of explanation, only the parts relevant to the embodiment of the present invention are shown, and are described in detail below:
[0127] In one embodiment of the present invention, in order to improve the accuracy of noise reduction of binary contour images, and thus improve the accuracy of internal thread minor diameter measurement, reference is made to... Figure 8 The contour noise reduction module 702 includes various units for performing... Figure 3 For details of each step in the corresponding embodiment, please refer to [link / reference]. Figure 3 as well as Figure 3 The relevant descriptions in the corresponding embodiments will not be repeated here. In this embodiment of the invention, the contour denoising module 702 includes a matrix convolution kernel determination unit 801, a convolution result determination unit 802, and a first rejection unit 803.
[0128] The matrix convolution kernel determination unit 801 is used to establish a polar coordinate system with the image center pixel of the binary contour image as the origin, determine the neighborhood matrix of the contour pixel, and the convolution kernel corresponding to the orientation angle of the contour pixel.
[0129] The convolution result determination unit 802 is used to determine the actual convolution result of the convolution kernel corresponding to the neighborhood matrix of the contour pixel and the orientation angle of the contour pixel.
[0130] The first rejection unit 803 is used to reject contour pixels as noise when the ratio of the actual convolution result to the convolution result threshold is less than the first preset rejection ratio threshold.
[0131] In this embodiment of the invention, the matrix convolution kernel determination unit 801 establishes a polar coordinate system with the image center pixel of the binary contour image as the origin, determines the neighborhood matrix of the contour pixel, and the convolution kernel corresponding to the orientation angle of the contour pixel; the convolution result determination unit 802 determines the actual convolution result of the neighborhood matrix of the contour pixel and the convolution kernel corresponding to the orientation angle of the contour pixel; the first elimination unit 803 eliminates the contour pixel as noise when the ratio of the actual convolution result to the convolution result threshold is less than a first preset elimination ratio threshold. This invention determines whether a contour pixel is a noise contour pixel by using the orientation angle of the contour pixel, the actual contour orientation matrix, the all-one matrix, and the convolution kernel corresponding to the orientation angle of the contour pixel, thereby improving the accuracy of contour denoising in binary contour images and further improving the accuracy of internal thread minor diameter measurement.
[0132] Figure 9 The diagram illustrates the structure of the clustering module 603 in the internal thread minor diameter measuring device provided in an embodiment of the present invention. For ease of explanation, only the parts relevant to the embodiment of the present invention are shown, and are described in detail below:
[0133] In one embodiment of the present invention, in order to improve the clustering effect of contour pixels and thus improve the measurement accuracy of the minor diameter of the internal thread, a reference is made. Figure 9 The clustering module 603 comprises various units used for execution. Figure 4 For details of each step in the corresponding embodiment, please refer to [link / reference]. Figure 4 as well as Figure 4 The relevant descriptions in the corresponding embodiments will not be repeated here. In this embodiment of the invention, the clustering module 603 includes a pixel radius update unit 901, a contour point clustering unit 902, and a thread classification addition unit 903.
[0134] The pixel radius update unit 901 is used to update the pixel radius of the contour pixels based on the orientation angle and pixel radius of the contour pixels in the binary contour image after contour denoising, as well as the calibrated pixel radius correction parameters, so as to determine the updated pixel radius of the contour pixels.
[0135] The contour point clustering unit 902 is used to identify the contour pixel as the contour pixel whose updated pixel radius is closest to the thread when the difference between the pixel radius of the updated contour pixel and the pixel radius of the updated contour pixel is less than the initial pixel radius difference. At the same time, the initial pixel radius difference is updated to the pixel radius difference.
[0136] A new unit 903 for thread classification is added, which is used to take the contour pixel as the pixel of the new thread and take the updated pixel radius of the contour pixel as the pixel radius of the new thread when the initial pixel radius difference is not less than the preset ratio of the calibrated pixel radius correction parameter.
[0137] In this embodiment of the invention, the pixel radius update unit 901 updates the pixel radius of the contour pixel points according to the orientation angle and pixel radius of the contour pixel points in the binary contour image after contour denoising, as well as the calibrated pixel radius correction parameters, to determine the updated pixel radius of the contour pixel points; the contour point clustering unit 902, when the difference between the pixel radius of the closest thread to the updated pixel radius of the contour pixel point and the pixel radius of the updated pixel radius of the contour pixel point is less than the initial pixel radius difference, regards the contour pixel point as the contour pixel point closest to the thread to the updated pixel radius, and updates the initial pixel radius difference to the pixel radius difference; the thread classification addition unit 903, when the initial pixel radius difference is not less than a preset ratio of the calibrated pixel radius correction parameters, regards the contour pixel point as the pixel point of the new thread, and regards the pixel radius of the contour pixel point as the pixel radius of the new thread. In this embodiment of the invention, the pixel radius update unit 901 updates the pixel radius of the contour pixels, and the contour point clustering unit 902 uses the calibrated pixel radius correction parameters to cluster the contour pixels, which can improve the clustering effect of the contour pixels and thus improve the measurement accuracy of the minor diameter of the internal thread.
[0138] Figure 10 The diagram illustrates the structure of the internal thread minor diameter measuring device according to an embodiment of the present invention for calibrating pixel radius correction parameters. For ease of explanation, only the parts relevant to the embodiment of the present invention are shown, and are described in detail below:
[0139] In one embodiment of the present invention, in order to improve the accuracy of the measurement of the minor diameter of the internal thread, reference is made to... Figure 10 The units included in the calibration pixel radius correction parameters are used to perform... Figure 5 For details of each step in the corresponding embodiment, please refer to [link / reference]. Figure 5 as well as Figure 5 The relevant descriptions in the corresponding embodiments will not be repeated here. In this embodiment of the invention, the calibration pixel radius correction parameters include a function fitting unit 1001 and a pixel radius correction parameter determination unit 1002.
[0140] The function fitting unit 1001 is used to perform polynomial fitting on the pixel thread image of a standard threaded part, which contains the pixel radius and number of turns of the thread, to determine the radius-to-turns relationship function; the radius-to-turns relationship function reflects the relationship between the pixel radius and the number of turns of the thread.
[0141] The pixel radius correction parameter determination unit 1002 is used to take the derivative of the radius circle number relationship function as the calibrated pixel radius correction parameter.
[0142] In this embodiment of the invention, the function fitting unit 1001 uses the pixel thread image of a standard threaded component, which includes the pixel radius and number of turns of the thread, to perform polynomial fitting to determine the radius-to-turns relationship function. This function reflects the relationship between the pixel radius and the number of turns of the thread. The pixel radius correction parameter determination unit 1002 uses the derivative of the radius-to-turns relationship function as the calibrated pixel radius correction parameter. This embodiment of the invention, through polynomial fitting and differentiation, uses the derivative of the radius-to-turns relationship function as the calibrated pixel radius correction parameter, which can improve the accuracy of internal thread minor diameter measurement.
[0143] This invention can measure the minor diameter of each turn of the internal thread, and simultaneously measure the thread depth and determine the pitch type and whether the thread is broken, rather than simply estimating the thread bore diameter. Based on the calibration process of threads of the same specification and specifying image acquisition standards, this invention effectively reduces errors and computational load, enabling rapid visual measurement of the thread minor diameter. The real-time update of the pixel radius during the clustering process of this invention is equivalent to introducing additional spatial information, reducing the alignment requirements of the threaded hole during imaging, exhibiting good robustness, and improving the accuracy of internal thread minor diameter measurement.
[0144] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described method for measuring the minor diameter of internal threads.
[0145] This invention also provides a computer-readable storage medium storing a computer program that performs the above-described method for measuring the minor diameter of internal threads.
[0146] In summary, in this embodiment of the invention, the internal thread to be tested is fixedly positioned at a preset location on the workstation. An internal hole development mirror, positioned at a preset height directly above the threaded hole of the internal thread to be tested, is used to capture the developed image of the internal hole of the internal thread to be tested. The captured developed image of the internal hole of the internal thread to be tested is binarized to determine the initial binary contour image of the internal thread to be tested. The contour pixels of the initial binary contour image of the internal thread to be tested are clustered to form an initial pixel thread image containing threads of different pixel radii. Based on the pixel radii of the threads in the pixel thread image sorted by pixel radius, the pixel radius of the calibrated standard thread component, and the actual radius, the actual radius of the internal thread to be tested is determined. This embodiment of the invention clusters the contour pixels of the binary contour image of the internal thread to be tested to form a pixel thread image containing threads of different pixel radii. Then, based on the pixel radii of the threads in the pixel thread image, and using the pixel radius of the calibrated standard thread component and the actual radius, the minor diameter of the internal thread is measured, improving the accuracy of measuring the minor diameter of the internal thread.
[0147] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can 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, etc.) containing computer-usable program code.
[0148] This 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 block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can 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, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0149] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0150] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0151] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for measuring the minor diameter of an internal thread, characterized in that, include: The internal thread to be tested is fixed at a preset position on the workstation, and the internal hole development mirror set at a preset height directly above the thread hole of the internal thread to be tested is used to take a picture of the internal hole development of the internal thread to be tested. The internal hole development image of the internal thread to be tested is binarized to determine the initial binary profile image of the internal thread to be tested. Cluster the contour pixels of the initial binary contour image of the internal thread to be tested to form an initial pixel thread image containing threads of different pixel radii. The actual radius of the internal thread to be tested is determined based on the pixel radius of the thread in the pixel thread diagram sorted by pixel radius size, the pixel radius of the calibrated standard threaded part, and the actual radius. Specifically, the contour pixels of the initial binary contour image of the internal thread to be tested are clustered to form an initial pixel thread map containing threads of different pixel radii, including: Based on the orientation angle and pixel radius of the contour pixels in the denoising binary contour image, and the calibrated pixel radius correction parameters, the pixel radius of the contour pixels is updated to determine the updated pixel radius of the contour pixels. The calculation method for determining the orientation angle and pixel radius of the contour pixels is as follows: Rho=sqrt((i-m / 2) 2 +(j-n / 2) 2 ); In the formula, Theta represents the orientation angle, Pho represents the pixel radius, m and n are the pixels of the image, and i and j are the coordinates of a certain contour pixel point; When the difference between the pixel radius of the updated pixel radius of the contour pixel and the pixel radius of the updated pixel radius of the contour pixel is less than the initial pixel radius difference, the contour pixel is taken as the contour pixel of the updated pixel radius of the contour pixel that is closest to the thread, and the initial pixel radius difference is updated to the pixel radius difference. When the initial pixel radius difference is not less than the preset ratio of the calibrated pixel radius correction parameter, the contour pixel point is used as the pixel point of the new thread, and the pixel radius updated by the contour pixel point is used as the pixel radius of the new thread. The calculation formula for updating the pixel radius of the contour pixels is as follows: In the formula, Rho_new represents the pixel radius of the updated contour pixel, and dr represents the calibrated pixel radius correction parameter.
2. The method for measuring the minor diameter of internal threads as described in claim 1, characterized in that, Also includes: The initial binary contour image is thinned using skeleton extraction to determine the binary contour image; Clustering is performed on the contour pixels of the initial binary contour image of the internal thread to be tested, forming a pixel thread map containing threads of different pixel radii, including: Cluster the contour pixels of the binary contour image of the internal thread to be tested to form a pixel thread image containing threads of different pixel radii.
3. The method for measuring the minor diameter of internal threads as described in claim 2, characterized in that, Also includes: Perform contour denoising on the binary contour image to determine the denoised binary contour image. Clustering is performed on the contour pixels of the binary contour image of the internal thread under test to form a pixel thread map containing threads of different pixel radii, including: Cluster the contour pixels of the binary contour image after noise reduction of the internal thread contour to be tested to form a pixel thread map containing threads of different pixel radii.
4. The method for measuring the minor diameter of internal threads as described in claim 3, characterized in that, Perform contour denoising on a binary contour image to determine the denoised binary contour image, including: A polar coordinate system is established with the image center pixel of the binary contour image as the origin, and the neighborhood matrix of the contour pixel and the convolution kernel corresponding to the orientation angle of the contour pixel are determined. Determine the actual convolution result of the convolution kernel corresponding to the neighborhood matrix of the contour pixels and the orientation angle of the contour pixels; When the actual convolution result is less than the rejection threshold, the contour pixels are rejected as noise. The rejection threshold is a preset ratio of the convolution result of the convolution kernel corresponding to the orientation angle of the contour pixel and the full-one matrix.
5. The method for measuring the minor diameter of internal threads as described in claim 4, characterized in that, The calibration pixel radius correction parameters include: By using the pixel thread image of a standard threaded component, which contains the pixel radius and number of turns of the thread, a polynomial fitting is performed to determine the radius-to-turns relationship function; the radius-to-turns relationship function reflects the relationship between the pixel radius and the number of turns of the thread. The derivative of the radius-to-circle relationship function is used as the pixel radius correction parameter after calibration.
6. A device for measuring the minor diameter of an internal thread, characterized in that, include: The imaging module is used to fix the internal thread to be tested at a preset position on the workstation and use an internal hole development mirror set at a preset height directly above the thread hole of the internal thread to be tested to take an image of the internal hole development of the internal thread to be tested. The binarization module is used to binarize the captured image of the inner hole development of the internal thread to be tested, and to determine the initial binary contour image of the internal thread to be tested. The clustering module is used to cluster the contour pixels of the initial binary contour image of the internal thread to be tested, forming an initial pixel thread map containing threads of different pixel radii. The radius determination module is used to determine the actual radius of the internal thread to be measured based on the pixel radius of the thread in the pixel thread diagram sorted by pixel radius size, the pixel radius of the calibrated standard threaded part, and the actual radius. Specifically, the clustering module is used for: Based on the orientation angle and pixel radius of the contour pixels in the denoising binary contour image, and the calibrated pixel radius correction parameters, the pixel radius of the contour pixels is updated to determine the updated pixel radius of the contour pixels. The calculation method for determining the orientation angle and pixel radius of the contour pixels is as follows: Rho=sqrt((i-m / 2) 2 +(j-n / 2) 2 ); In the formula, Theta represents the orientation angle, Pho represents the pixel radius, m and n are the pixels of the image, and i and j are the coordinates of a certain contour pixel point; When the difference between the pixel radius of the updated pixel radius of the contour pixel and the pixel radius of the updated pixel radius of the contour pixel is less than the initial pixel radius difference, the contour pixel is taken as the contour pixel of the updated pixel radius of the contour pixel that is closest to the thread, and the initial pixel radius difference is updated to the pixel radius difference. When the initial pixel radius difference is not less than the preset ratio of the calibrated pixel radius correction parameter, the contour pixel point is used as the pixel point of the new thread, and the pixel radius updated by the contour pixel point is used as the pixel radius of the new thread. The calculation formula for updating the pixel radius of the contour pixels is as follows: In the formula, Rho_new represents the pixel radius of the updated contour pixel, and dr represents the calibrated pixel radius correction parameter.
7. The internal thread minor diameter measuring device as described in claim 6, characterized in that, Also includes: The skeleton extraction module is used to refine the initial binary contour image using skeleton extraction, thereby determining the binary contour image. The clustering module is also used to cluster the contour pixels of the binary contour image of the internal thread to be tested, forming a pixel thread map containing threads of different pixel radii.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method for measuring the minor diameter of internal threads according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that performs the minor diameter measurement method for internal threads according to any one of claims 1 to 5.