CN112284274A - Method and system for detecting aperture and nest diameter of mechanical connecting hole - Google Patents

Method and system for detecting aperture and nest diameter of mechanical connecting hole Download PDF

Info

Publication number
CN112284274A
CN112284274A CN202011137899.3A CN202011137899A CN112284274A CN 112284274 A CN112284274 A CN 112284274A CN 202011137899 A CN202011137899 A CN 202011137899A CN 112284274 A CN112284274 A CN 112284274A
Authority
CN
China
Prior art keywords
image
connecting hole
aperture
camera
diameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011137899.3A
Other languages
Chinese (zh)
Inventor
程晖
张天阳
黄朕祺
周赜远
赵嘉栋
杨语
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Northwestern Polytechnical University
Original Assignee
Northwestern Polytechnical University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Northwestern Polytechnical University filed Critical Northwestern Polytechnical University
Priority to CN202011137899.3A priority Critical patent/CN112284274A/en
Publication of CN112284274A publication Critical patent/CN112284274A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/08Measuring arrangements characterised by the use of optical techniques for measuring diameters
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/02Measuring arrangements characterised by the use of optical techniques for measuring length, width or thickness

Landscapes

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

Abstract

The invention discloses a method and a system for detecting the aperture and nest diameter of a mechanical connecting hole. The method comprises the following steps: enabling the camera to finish automatic focusing and determining the automatic focusing position of the camera; setting the camera at the automatic focusing position, and acquiring image information of the connecting hole; processing the image information and extracting the boundary of the connecting hole; the lengths of the aperture and dimple diameter are calculated based on the boundary of the connecting hole. The invention carries out digital detection on the connecting hole through the camera to obtain the true value of the aperture nest diameter parameter of the connecting hole, so that the detection precision can reach the pixel point level. In addition, the invention completes the spacing measurement of the connecting hole through the camera without contacting with the connecting hole, thereby avoiding the damage to the workpiece.

Description

Method and system for detecting aperture and nest diameter of mechanical connecting hole
Technical Field
The invention relates to the field of digital intelligent detection, in particular to a method and a system for detecting the aperture and the nest diameter of a mechanical connecting hole.
Background
In the assembly process of complex machinery, the detection quality of the aperture nest diameter of the mechanical connecting hole is an important factor influencing the assembly quality of the complex machinery.
At present, in the manufacturing process, the aperture nest diameter of the connecting hole is usually measured manually, so the detection quality can change along with the difference of the operation level of workers, the detection precision is difficult to guarantee, and the workload of the workers is also large. At present, in manufacturing, a method for detecting the aperture of a connecting hole is a go-no go gauge detection method. Although the go-no go gauge can greatly improve the detection speed when being produced in batches, the go-no go gauge needs to pass through the connecting hole, so the connecting hole can be damaged, and the go gauge is worn after being used for many times, so the detection quality is influenced. Meanwhile, through the detection of the go-no go gauge, whether the aperture meets the tolerance requirement or not can be obtained, the specific numerical value of the aperture cannot be obtained, and the quantitative detection of the aperture cannot be completed. At present, the quality of each dimple is inspected by using a rivet or a bolt, and the method is greatly influenced by the precision of the rivet or the bolt, and the precision of a connecting hole is influenced because the rivet or the bolt needs to be in contact with the connecting hole.
Disclosure of Invention
Based on the above, the invention aims to provide a method and a system for detecting the aperture and the nest diameter of a mechanical connecting hole.
In order to achieve the purpose, the invention provides the following scheme:
a mechanical connection hole aperture and nest diameter detection method comprises the following steps:
enabling the camera to finish automatic focusing and determining the automatic focusing position of the camera;
setting the camera at the automatic focusing position, and acquiring image information of the connecting hole;
processing the image information and extracting the boundary of the connecting hole;
the lengths of the aperture and dimple diameter are calculated based on the boundary of the connecting hole.
Optionally, the enabling the camera to complete automatic focusing and determining an automatic focusing position of the camera specifically includes:
initializing focusing parameters; the focusing parameters include: camera position, camera movement step length and image definition;
moving a camera according to the camera moving step length and updating the position of the camera;
shooting the connecting holes at the positions of the cameras;
calculating the definition of the shot image through a Tenengrad image definition evaluation function;
and determining the corresponding camera position as an automatic focusing position when the definition of the shot image is maximum.
Optionally, the calculation formula of the definition of the shot image is as follows:
Figure BDA0002737331310000021
Figure BDA0002737331310000022
Figure BDA0002737331310000023
Figure BDA0002737331310000024
wherein, I (x, y) represents the gray value of the captured image at (x, y), n is the total number of pixels in the captured image, Q represents the sharpness of the captured image, Gx represents the kernel of the horizontal derivation at a certain pixel point of the image, Gy represents the kernel of the vertical derivation at a certain pixel point of the image, and S (x, y) represents the gradient value of the image at (x, y).
Optionally, the processing the image information to extract the boundary of the connection hole specifically includes:
carrying out binarization processing on the acquired image, and respectively obtaining an aperture image and a pit diameter image by setting different gray threshold values;
and extracting the image boundaries of the aperture image and the nest diameter image after binaryzation by using a Sobel edge detection algorithm.
Optionally, the calculating the lengths of the aperture and the socket diameter based on the boundary of the connection hole specifically includes:
processing the extracted image boundary by using an ellipse recognition algorithm in Opencv to obtain the endpoint coordinate A of the long axis of the aperture of the connecting hole0(x0,y0)、A1(x1,y1) Minor axis end point coordinate B of aperture of connecting hole0(m0,n0)、B1(m1,n1) Coordinates C of long shaft end point of socket diameter of connecting hole0(X0,Y0)、C1(X1,Y1) And coordinates D of end point of minor axis of socket diameter of connecting hole0(M0,N0)、D1(M1,N1);A0The position of the starting point of the long axis of the aperture of the connecting hole on the image (x)0,y0) Is A0Pixel point coordinates on the image; a. the1The position of the end point of the aperture major axis of the connecting hole on the image (x)1,y1) Is A1Pixel point coordinates on the image; b is0The position of the starting point of the minor axis of the aperture of the connecting hole on the image (m)0,n0) Is B0Pixel point coordinates on the image; b is1The position of the end point of the minor axis of the aperture of the connecting hole on the image (m)1,n1) Is B1Pixel point coordinates on the image; c0The position of the long axis starting point of the pit diameter of the connecting hole on the image (X)0,Y0) Is C0Pixel point coordinates on the image; c1The position of the long axis end point of the pit diameter of the connecting hole on the image (X)1,Y1) Is C1Pixel point coordinates on the image; d0The starting point of the minor axis of the pit diameter of the connecting hole is in the imagePosition (M)0,N0) Is D0Pixel point coordinates on the image; d1The position of the minor axis end point of the socket diameter of the connecting hole on the image (M)1,N1) Is D1Pixel point coordinates on the image;
acquiring a transverse calibration result a and a longitudinal calibration result b of the camera; the transverse calibration result a is the real transverse length of a pixel point, and the longitudinal calibration result b is the real longitudinal length of a pixel point;
according to the calibration results a and b of the camera in the transverse and longitudinal directions, the real length A, B of the long and short axes of the aperture of the connecting hole and the real length C, D of the long and short axes of the socket of the connecting hole are calculated, and the calculation formula is as follows:
Figure BDA0002737331310000031
Figure BDA0002737331310000032
Figure BDA0002737331310000033
Figure BDA0002737331310000034
the invention also provides a mechanical connection hole aperture and nest diameter detection system, which comprises:
the position determining module is used for enabling the camera to finish automatic focusing and determining the automatic focusing position of the camera;
the acquisition module is used for setting the camera at the automatic focusing position and acquiring the image information of the connecting hole;
the image processing module is used for processing the image information and extracting the boundary of the connecting hole;
and the length calculation module is used for calculating the lengths of the aperture and the nest diameter based on the boundary of the connecting hole.
Optionally, the position determining module specifically includes:
the initialization unit is used for initializing focusing parameters; the focusing parameters include: camera position, camera movement step length and image definition;
a moving unit for moving the camera by the camera moving step length and updating the camera position;
a shooting unit for shooting the connecting holes at each camera position;
the definition calculating unit is used for calculating the definition of the shot image through a Tenengrad image definition evaluation function;
and the determining unit is used for determining that the corresponding camera position when the definition of the shot image is maximum is an automatic focusing position.
Optionally, the calculation formula of the definition of the shot image is as follows:
Figure BDA0002737331310000041
Figure BDA0002737331310000042
Figure BDA0002737331310000043
Figure BDA0002737331310000044
wherein, I (x, y) represents the gray value of the captured image at (x, y), n is the total number of pixels in the captured image, Q represents the sharpness of the captured image, Gx represents the kernel of the horizontal derivation at a certain pixel point of the image, Gy represents the kernel of the vertical derivation at a certain pixel point of the image, and S (x, y) represents the gradient value of the image at (x, y).
Optionally, the image processing module specifically includes:
the binarization processing unit is used for carrying out binarization processing on the acquired image and respectively obtaining an aperture image and a pit diameter image by setting different gray threshold values;
and the image boundary extraction unit is used for extracting the image boundaries of the aperture image and the nest diameter image after binaryzation by utilizing a Sobel edge detection algorithm.
Optionally, the length calculating module specifically includes:
an identification unit, configured to process the extracted image boundary using an ellipse identification algorithm in Opencv to obtain a connection hole aperture major axis endpoint coordinate a0(x0,y0)、A1(x1,y1) Minor axis end point coordinate B of aperture of connecting hole0(m0,n0)、B1(m1,n1) Coordinates C of long shaft end point of socket diameter of connecting hole0(X0,Y0)、C1(X1,Y1) And coordinates D of end point of minor axis of socket diameter of connecting hole0(M0,N0)、D1(M1,N1);A0The position of the starting point of the long axis of the aperture of the connecting hole on the image (x)0,y0) Is A0Pixel point coordinates on the image; a. the1The position of the end point of the aperture major axis of the connecting hole on the image (x)1,y1) Is A1Pixel point coordinates on the image; b is0The position of the starting point of the minor axis of the aperture of the connecting hole on the image (m)0,n0) Is B0Pixel point coordinates on the image; b is1The position of the end point of the minor axis of the aperture of the connecting hole on the image (m)1,n1) Is B1Pixel point coordinates on the image; c0The position of the long axis starting point of the pit diameter of the connecting hole on the image (X)0,Y0) Is C0Pixel point coordinates on the image; c1The position of the long axis end point of the pit diameter of the connecting hole on the image (X)1,Y1) Is C1Pixel point coordinates on the image; d0The starting point of the minor axis of the socket diameter of the connecting hole is shown in the figurePosition on the image, (M)0,N0) Is D0Pixel point coordinates on the image; d1The position of the minor axis end point of the socket diameter of the connecting hole on the image (M)1,N1) Is D1Pixel point coordinates on the image;
the calibration result acquisition unit is used for acquiring a transverse calibration result a and a longitudinal calibration result b of the camera; the transverse calibration result a is the real transverse length of a pixel point, and the longitudinal calibration result b is the real longitudinal length of a pixel point;
the real length calculating unit is used for calculating the real length A, B of the aperture major axis and the minor axis of the connecting hole and the real length C, D of the aperture major axis and the minor axis of the connecting hole according to the calibration results a and b of the camera in the transverse direction and the longitudinal direction, and the calculation formula is as follows:
Figure BDA0002737331310000051
Figure BDA0002737331310000052
Figure BDA0002737331310000061
Figure BDA0002737331310000062
according to the specific embodiment provided by the invention, the invention discloses the following technical effects:
1) the detection precision is high. The invention carries out digital detection on the connecting hole through the camera to obtain the true value of the aperture nest diameter parameter of the connecting hole, so that the detection precision can reach the pixel point level.
2) The workpiece is not damaged. According to the invention, the camera is used for completing the spacing measurement of the connecting hole, and the connecting hole is not contacted, so that the damage to the workpiece is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is an overall flow chart of a mechanical connection hole aperture and nest diameter detection method provided by the present invention;
FIG. 2 is a flowchart of an auto-focusing method according to the present invention;
FIG. 3 is a flow chart of an image processing method provided by the present invention;
FIG. 4 is a schematic diagram of a camera provided by the present invention;
FIG. 5 is an image of a connection hole at a different location provided by the present invention;
FIG. 6 is a graph showing the variation trend of the image sharpness along with the position of the camera according to the present invention; .
FIG. 7 is an original image provided by the present invention;
FIG. 8 is a binarized aperture image provided by the present invention;
FIG. 9 is a nest diameter image after binarization processing provided by the invention;
FIG. 10 is an aperture image boundary extracted by the Sobel edge detection algorithm provided by the present invention;
FIG. 11 is a dimple diameter image boundary extracted by the Sobel edge detection algorithm provided by the present invention;
FIG. 12 is a schematic diagram of the aperture image recognition result provided by the present invention;
FIG. 13 is a schematic diagram of a dimple diameter image recognition result provided by the present invention;
FIG. 14 is a block diagram of a mechanical linkage hole diameter and socket diameter detection system provided by the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to provide a method and a system for detecting the aperture and the nest diameter of a mechanical connecting hole.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
As shown in fig. 1, a method for detecting the aperture and the nest diameter of a mechanical connection hole comprises the following steps:
step 1: the camera is aligned with the attachment hole as in fig. 4.
Step 2: the auto-focusing function is operated to make the camera complete auto-focusing through the movement of the sliding table of the guide rail, as shown in fig. 2, which is a flow chart of the auto-focusing method. The auto-focusing steps of the camera are as follows:
step 2.1: and initializing focusing parameters. The focusing parameters include: camera position x, camera movement step L, image sharpness Q.
Step 2.2: the camera is moved in steps and the camera position x is updated x + L.
Step 2.3: a photograph was taken and the image sharpness Q was calculated by the Tenengrad image sharpness evaluation function. The Tenengrad image definition evaluation function formula is as follows, wherein I (x, y) represents the gray value of a shot image at the position (x, y), and n is the total number of pixel points in the shot image;
Figure BDA0002737331310000071
Figure BDA0002737331310000072
Figure BDA0002737331310000073
Figure BDA0002737331310000081
step 2.4: and judging whether the image definition Q is a maximum value at the current camera position x. If so, the automatic focusing is completed, otherwise, the step 2.2 is returned to, and the camera is continuously moved. As shown in fig. 5, at x 1000, the image resolution Q4.102061; at x-2000, image sharpness Q-4.604799; at x 3000, the image sharpness Q5.847310; at x 4000, image sharpness Q50.635648; at x 5000, image sharpness Q24.105014; at x 6000, image sharpness Q6.019339; at x 7000, image sharpness Q4.183125; at x 8000, the image sharpness Q2.811283. The degree of image sharpness changes with the change of Q, and it can be seen from fig. 5 that the image is sharper when Q is larger. The trend of Q with x is shown in FIG. 6, where it can be seen that Q has a maximum value. After the automatic focusing is finished, the camera will move to the position where x is 5000.
And step 3: keeping the camera position consistent with the camera position when the automatic focusing is finished, shooting a picture of the connecting hole, and processing the picture through an image processing algorithm to obtain the lengths of the long shaft and the short shaft of the aperture pit diameter of the connecting hole. The image processing algorithm process is shown in fig. 3, and comprises the following steps:
step 3.1: the acquired raw image is processed, and the raw image is shown in fig. 7.
Step 3.2: the acquired image is subjected to binarization processing, and an aperture image and a pit diameter image are respectively obtained by setting different gray level thresholds, wherein the processed aperture image is shown in fig. 8, and the processed pit diameter image is shown in fig. 9.
Step 3.3: the boundary of the binarized image is extracted by using a Sobel edge detection algorithm, the extraction result of the aperture image is shown in figure 10, and the extraction result of the pit diameter image is shown in figure 11.
Step 3.5: processing the extracted image boundary by using an ellipse recognition algorithm in Opencv to obtain the endpoint coordinate A of the long axis of the aperture of the connecting hole0(x0,y0)、A1(x1,y1) And the minor axis end point coordinate B of the aperture of the connecting hole0(m0,n0)、B1(m1,n1) Obtaining coordinates C of the long shaft end point of the socket diameter of the connecting hole0(X0,Y0)、C1(X1,Y1) And the minor axis end point coordinate D of the aperture of the connecting hole0(M0,N0)、D1(M1,N1)。A0The position of the starting point of the long axis of the aperture of the connecting hole on the image (x)0,y0) Is A0Pixel point coordinates on the image; a. the1The position of the end point of the aperture major axis of the connecting hole on the image (x)1,y1) Is A1Pixel point coordinates on the image; b is0The position of the starting point of the minor axis of the aperture of the connecting hole on the image (m)0,n0) Is B0Pixel point coordinates on the image; b is1The position of the end point of the minor axis of the aperture of the connecting hole on the image (m)1,n1) Is B1Pixel point coordinates on the image; c0The position of the long axis starting point of the pit diameter of the connecting hole on the image (X)0,Y0) Is C0Pixel point coordinates on the image; c1The position of the long axis end point of the pit diameter of the connecting hole on the image (X)1,Y1) Is C1Pixel point coordinates on the image; d0The position of the minor axis starting point of the pit diameter of the connecting hole on the image (M)0,N0) Is D0Pixel point coordinates on the image; d1The position of the minor axis end point of the socket diameter of the connecting hole on the image (M)1,N1) Is D1Coordinates of pixel points on the image.
Step 3.6: according to the calibration results a and b of the camera in the transverse direction and the longitudinal direction, the real length A, B of the long axis and the short axis of the aperture of the connecting hole and the real length C, D of the long axis and the short axis of the socket of the connecting hole are calculated. And the calibration results a and b of the camera in the transverse and longitudinal directions are the real transverse and longitudinal lengths of a pixel point. The aperture image recognition result is shown in fig. 12, the dimple image recognition result is shown in fig. 13, and the calculation formula of the true length A, B, C, D is as follows:
Figure BDA0002737331310000091
Figure BDA0002737331310000092
Figure BDA0002737331310000093
Figure BDA0002737331310000094
and 4, step 4: if the use is finished, the equipment is closed; if the use is continued, the step 2 is returned to.
As shown in fig. 14, the present invention also provides a mechanical connection hole aperture and socket aperture detection system, comprising:
a position determining module 1401, configured to enable the camera to complete auto-focus, and determine an auto-focus position of the camera.
The position determining module specifically includes:
the initialization unit is used for initializing focusing parameters; the focusing parameters include: camera position, camera movement step size, and image sharpness.
And the moving unit is used for moving the camera according to the camera moving step length and updating the camera position.
And the shooting unit is used for shooting the connecting hole at each camera position.
The definition calculating unit is used for calculating the definition of the shot image through a Tenengrad image definition evaluation function; the calculation formula of the definition of the shot image is as follows:
Figure BDA0002737331310000101
Figure BDA0002737331310000102
Figure BDA0002737331310000103
Figure BDA0002737331310000104
wherein, I (x, y) represents the gray value of the captured image at (x, y), n is the total number of pixels in the captured image, Q represents the sharpness of the captured image, Gx represents the kernel of the horizontal derivation at a certain pixel point of the image, Gy represents the kernel of the vertical derivation at a certain pixel point of the image, and S (x, y) represents the gradient value of the image at (x, y).
And the determining unit is used for determining that the corresponding camera position when the definition of the shot image is maximum is an automatic focusing position.
The collecting module 1402 is configured to set the camera at the auto-focus position, and collect image information of the connecting hole.
An image processing module 1403, configured to process the image information and extract a boundary of the connection hole.
The image processing module specifically comprises:
the binarization processing unit is used for carrying out binarization processing on the acquired image and respectively obtaining an aperture image and a pit diameter image by setting different gray threshold values;
and the image boundary extraction unit is used for extracting the image boundaries of the aperture image and the nest diameter image after binaryzation by utilizing a Sobel edge detection algorithm.
A length calculation module 1404 for calculating the lengths of the aperture and the dimple diameter based on the boundary of the connection hole.
The length calculation module specifically includes:
an identification unit, configured to process the extracted image boundary using an ellipse identification algorithm in Opencv to obtain a connection hole aperture major axis endpoint coordinate a0(x0,y0)、A1(x1,y1) Minor axis end point coordinate B of aperture of connecting hole0(m0,n0)、B1(m1,n1) Coordinates C of long shaft end point of socket diameter of connecting hole0(X0,Y0)、C1(X1,Y1) And coordinates D of end point of minor axis of socket diameter of connecting hole0(M0,N0)、D1(M1,N1);A0The position of the starting point of the long axis of the aperture of the connecting hole on the image (x)0,y0) Is A0Pixel point coordinates on the image; a. the1The position of the end point of the aperture major axis of the connecting hole on the image (x)1,y1) Is A1Pixel point coordinates on the image; b is0The position of the starting point of the minor axis of the aperture of the connecting hole on the image (m)0,n0) Is B0Pixel point coordinates on the image; b is1The position of the end point of the minor axis of the aperture of the connecting hole on the image (m)1,n1) Is B1Pixel point coordinates on the image; c0The position of the long axis starting point of the pit diameter of the connecting hole on the image (X)0,Y0) Is C0Pixel point coordinates on the image; c1The position of the long axis end point of the pit diameter of the connecting hole on the image (X)1,Y1) Is C1Pixel point coordinates on the image; d0The position of the minor axis starting point of the pit diameter of the connecting hole on the image (M)0,N0) Is D0Pixel point coordinates on the image; d1The position of the minor axis end point of the socket diameter of the connecting hole on the image (M)1,N1) Is D1Coordinates of pixel points on the image.
The calibration result acquisition unit is used for acquiring a transverse calibration result a and a longitudinal calibration result b of the camera; the transverse calibration result a is the real transverse length of a pixel point, and the longitudinal calibration result b is the real longitudinal length of a pixel point;
the real length calculating unit is used for calculating the real length A, B of the aperture major axis and the minor axis of the connecting hole and the real length C, D of the aperture major axis and the minor axis of the connecting hole according to the calibration results a and b of the camera in the transverse direction and the longitudinal direction, and the calculation formula is as follows:
Figure BDA0002737331310000111
Figure BDA0002737331310000112
Figure BDA0002737331310000113
Figure BDA0002737331310000114
the embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.

Claims (10)

1. A mechanical connection hole aperture and nest diameter detection method is characterized by comprising the following steps:
enabling the camera to finish automatic focusing and determining the automatic focusing position of the camera;
setting the camera at the automatic focusing position, and acquiring image information of the connecting hole;
processing the image information and extracting the boundary of the connecting hole;
the lengths of the aperture and dimple diameter are calculated based on the boundary of the connecting hole.
2. The method for detecting the aperture and the nest diameter of the mechanical connection hole according to claim 1, wherein the step of enabling the camera to complete automatic focusing and determining the automatic focusing position of the camera specifically comprises the steps of:
initializing focusing parameters; the focusing parameters include: camera position, camera movement step length and image definition;
moving a camera according to the camera moving step length and updating the position of the camera;
shooting the connecting holes at the positions of the cameras;
calculating the definition of the shot image through a Tenengrad image definition evaluation function;
and determining the corresponding camera position as an automatic focusing position when the definition of the shot image is maximum.
3. The method for detecting the aperture and the nest diameter of the mechanical connection hole according to claim 2, wherein the calculation formula of the definition of the shot image is as follows:
Figure FDA0002737331300000011
Figure FDA0002737331300000012
Figure FDA0002737331300000013
Figure FDA0002737331300000014
wherein, I (x, y) represents the gray value of the captured image at (x, y), n is the total number of pixels in the captured image, Q represents the sharpness of the captured image, Gx represents the kernel of the horizontal derivation at a certain pixel point of the image, Gy represents the kernel of the vertical derivation at a certain pixel point of the image, and S (x, y) represents the gradient value of the image at (x, y).
4. The method for detecting the aperture and the pit diameter of the mechanical connecting hole according to claim 1, wherein the processing the image information to extract the boundary of the connecting hole specifically comprises:
carrying out binarization processing on the acquired image, and respectively obtaining an aperture image and a pit diameter image by setting different gray threshold values;
and extracting the image boundaries of the aperture image and the nest diameter image after binaryzation by using a Sobel edge detection algorithm.
5. The method for detecting the aperture and the nest diameter of the mechanical connecting hole according to claim 4, wherein the step of calculating the lengths of the aperture and the nest diameter based on the boundary of the connecting hole specifically comprises the following steps:
processing the extracted image boundary by using an ellipse recognition algorithm in Opencv to obtain the endpoint coordinate A of the long axis of the aperture of the connecting hole0(x0,y0)、A1(x1,y1) Minor axis end point coordinate B of aperture of connecting hole0(m0,n0)、B1(m1,n1) Coordinates C of long shaft end point of socket diameter of connecting hole0(X0,Y0)、C1(X1,Y1) And connecting hole socket diameter short shaft end point seatMark D0(M0,N0)、D1(M1,N1);A0The position of the starting point of the long axis of the aperture of the connecting hole on the image (x)0,y0) Is A0Pixel point coordinates on the image; a. the1The position of the end point of the aperture major axis of the connecting hole on the image (x)1,y1) Is A1Pixel point coordinates on the image; b is0The position of the starting point of the minor axis of the aperture of the connecting hole on the image (m)0,n0) Is B0Pixel point coordinates on the image; b is1The position of the end point of the minor axis of the aperture of the connecting hole on the image (m)1,n1) Is B1Pixel point coordinates on the image; c0The position of the long axis starting point of the pit diameter of the connecting hole on the image (X)0,Y0) Is C0Pixel point coordinates on the image; c1The position of the long axis end point of the pit diameter of the connecting hole on the image (X)1,Y1) Is C1Pixel point coordinates on the image; d0The position of the minor axis starting point of the pit diameter of the connecting hole on the image (M)0,N0) Is D0Pixel point coordinates on the image; d1The position of the minor axis end point of the socket diameter of the connecting hole on the image (M)1,N1) Is D1Pixel point coordinates on the image;
acquiring a transverse calibration result a and a longitudinal calibration result b of the camera; the transverse calibration result a is the real transverse length of a pixel point, and the longitudinal calibration result b is the real longitudinal length of a pixel point;
according to the calibration results a and b of the camera in the transverse and longitudinal directions, the real length A, B of the long and short axes of the aperture of the connecting hole and the real length C, D of the long and short axes of the socket of the connecting hole are calculated, and the calculation formula is as follows:
Figure FDA0002737331300000021
Figure FDA0002737331300000031
Figure FDA0002737331300000032
Figure FDA0002737331300000033
6. the utility model provides a mechanical connection hole aperture and nest footpath detecting system which characterized in that includes:
the position determining module is used for enabling the camera to finish automatic focusing and determining the automatic focusing position of the camera;
the acquisition module is used for setting the camera at the automatic focusing position and acquiring the image information of the connecting hole;
the image processing module is used for processing the image information and extracting the boundary of the connecting hole;
and the length calculation module is used for calculating the lengths of the aperture and the nest diameter based on the boundary of the connecting hole.
7. The mechanical connection hole aperture and socket diameter detection system of claim 6, wherein the position determination module specifically comprises:
the initialization unit is used for initializing focusing parameters; the focusing parameters include: camera position, camera movement step length and image definition;
a moving unit for moving the camera by the camera moving step length and updating the camera position;
a shooting unit for shooting the connecting holes at each camera position;
the definition calculating unit is used for calculating the definition of the shot image through a Tenengrad image definition evaluation function;
and the determining unit is used for determining that the corresponding camera position when the definition of the shot image is maximum is an automatic focusing position.
8. The mechanical joint hole diameter and nest diameter detection system of claim 7, wherein the computational formula for the sharpness of the captured image is as follows:
Figure FDA0002737331300000034
Figure FDA0002737331300000035
Figure FDA0002737331300000041
Figure FDA0002737331300000042
wherein, I (x, y) represents the gray value of the captured image at (x, y), n is the total number of pixels in the captured image, Q represents the sharpness of the captured image, Gx represents the kernel of the horizontal derivation at a certain pixel point of the image, Gy represents the kernel of the vertical derivation at a certain pixel point of the image, and S (x, y) represents the gradient value of the image at (x, y).
9. The mechanical connection hole aperture and nest diameter detection system of claim 6, wherein the image processing module specifically comprises:
the binarization processing unit is used for carrying out binarization processing on the acquired image and respectively obtaining an aperture image and a pit diameter image by setting different gray threshold values;
and the image boundary extraction unit is used for extracting the image boundaries of the aperture image and the nest diameter image after binaryzation by utilizing a Sobel edge detection algorithm.
10. The system for detecting the aperture and the nest diameter of a mechanical connection hole according to claim 9, wherein the length calculation module specifically comprises:
an identification unit, configured to process the extracted image boundary using an ellipse identification algorithm in Opencv to obtain a connection hole aperture major axis endpoint coordinate a0(x0,y0)、A1(x1,y1) Minor axis end point coordinate B of aperture of connecting hole0(m0,n0)、B1(m1,n1) Coordinates C of long shaft end point of socket diameter of connecting hole0(X0,Y0)、C1(X1,Y1) And coordinates D of end point of minor axis of socket diameter of connecting hole0(M0,N0)、D1(M1,N1);A0The position of the starting point of the long axis of the aperture of the connecting hole on the image (x)0,y0) Is A0Pixel point coordinates on the image; a. the1The position of the end point of the aperture major axis of the connecting hole on the image (x)1,y1) Is A1Pixel point coordinates on the image; b is0The position of the starting point of the minor axis of the aperture of the connecting hole on the image (m)0,n0) Is B0Pixel point coordinates on the image; b is1The position of the end point of the minor axis of the aperture of the connecting hole on the image (m)1,n1) Is B1Pixel point coordinates on the image; c0The position of the long axis starting point of the pit diameter of the connecting hole on the image (X)0,Y0) Is C0Pixel point coordinates on the image; c1The position of the long axis end point of the pit diameter of the connecting hole on the image (X)1,Y1) Is C1Pixel point coordinates on the image; d0The position of the minor axis starting point of the pit diameter of the connecting hole on the image (M)0,N0) Is D0Pixel point coordinates on the image; d1The position of the minor axis end point of the socket diameter of the connecting hole on the image (M)1,N1) Is D1Pixel point coordinates on the image;
the calibration result acquisition unit is used for acquiring a transverse calibration result a and a longitudinal calibration result b of the camera; the transverse calibration result a is the real transverse length of a pixel point, and the longitudinal calibration result b is the real longitudinal length of a pixel point;
the real length calculating unit is used for calculating the real length A, B of the aperture major axis and the minor axis of the connecting hole and the real length C, D of the aperture major axis and the minor axis of the connecting hole according to the calibration results a and b of the camera in the transverse direction and the longitudinal direction, and the calculation formula is as follows:
Figure FDA0002737331300000051
Figure FDA0002737331300000052
Figure FDA0002737331300000053
Figure FDA0002737331300000054
CN202011137899.3A 2020-10-22 2020-10-22 Method and system for detecting aperture and nest diameter of mechanical connecting hole Pending CN112284274A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011137899.3A CN112284274A (en) 2020-10-22 2020-10-22 Method and system for detecting aperture and nest diameter of mechanical connecting hole

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011137899.3A CN112284274A (en) 2020-10-22 2020-10-22 Method and system for detecting aperture and nest diameter of mechanical connecting hole

Publications (1)

Publication Number Publication Date
CN112284274A true CN112284274A (en) 2021-01-29

Family

ID=74423966

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011137899.3A Pending CN112284274A (en) 2020-10-22 2020-10-22 Method and system for detecting aperture and nest diameter of mechanical connecting hole

Country Status (1)

Country Link
CN (1) CN112284274A (en)

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1621775A (en) * 2003-11-24 2005-06-01 株式会社三丰 Systems and methods for rapidly automatically focusing a machine vision inspection system
CN1790095A (en) * 2004-12-17 2006-06-21 鸿富锦精密工业(深圳)有限公司 Automatic image focusing system and method
CN101943839A (en) * 2010-07-06 2011-01-12 浙江大学 Integrated automatic focusing camera device and definition evaluation method
CN102404602A (en) * 2011-09-23 2012-04-04 浙江工业大学 Camera definition detection method based on definition test card
CN102997857A (en) * 2012-11-07 2013-03-27 福群电子(深圳)有限公司 Aperture measurement device and aperture measurement method
CN203422065U (en) * 2013-07-12 2014-02-05 成都曙创科技有限公司 Automatic measurement instrument for wortle bore diameters
CN106247961A (en) * 2016-10-18 2016-12-21 淮阴师范学院 The precision measurement system of a kind of bore inner diameter and method
CN106488122A (en) * 2016-10-14 2017-03-08 北京信息科技大学 A kind of dynamic auto focusing algorithm based on improved sobel method
CN108917594A (en) * 2018-05-29 2018-11-30 广东理工学院 A kind of machine vision device measuring household board size
CN109974609A (en) * 2019-04-28 2019-07-05 西北工业大学 A kind of brill ream quality on-line detecting device and method
CN110345877A (en) * 2019-07-03 2019-10-18 西安交通大学 A kind of tube sheet aperture and method for measuring pitch
CN110425990A (en) * 2019-08-14 2019-11-08 西北工业大学 A kind of hole diameter detection apparatus based on monocular vision camera
CN110906875A (en) * 2019-11-26 2020-03-24 湖北工业大学 Visual processing method for aperture measurement
CN110954024A (en) * 2019-12-23 2020-04-03 芜湖哈特机器人产业技术研究院有限公司 Connecting piece vision measuring device and measuring method thereof

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1621775A (en) * 2003-11-24 2005-06-01 株式会社三丰 Systems and methods for rapidly automatically focusing a machine vision inspection system
CN1790095A (en) * 2004-12-17 2006-06-21 鸿富锦精密工业(深圳)有限公司 Automatic image focusing system and method
CN101943839A (en) * 2010-07-06 2011-01-12 浙江大学 Integrated automatic focusing camera device and definition evaluation method
CN102404602A (en) * 2011-09-23 2012-04-04 浙江工业大学 Camera definition detection method based on definition test card
CN102997857A (en) * 2012-11-07 2013-03-27 福群电子(深圳)有限公司 Aperture measurement device and aperture measurement method
CN203422065U (en) * 2013-07-12 2014-02-05 成都曙创科技有限公司 Automatic measurement instrument for wortle bore diameters
CN106488122A (en) * 2016-10-14 2017-03-08 北京信息科技大学 A kind of dynamic auto focusing algorithm based on improved sobel method
CN106247961A (en) * 2016-10-18 2016-12-21 淮阴师范学院 The precision measurement system of a kind of bore inner diameter and method
CN108917594A (en) * 2018-05-29 2018-11-30 广东理工学院 A kind of machine vision device measuring household board size
CN109974609A (en) * 2019-04-28 2019-07-05 西北工业大学 A kind of brill ream quality on-line detecting device and method
CN110345877A (en) * 2019-07-03 2019-10-18 西安交通大学 A kind of tube sheet aperture and method for measuring pitch
CN110425990A (en) * 2019-08-14 2019-11-08 西北工业大学 A kind of hole diameter detection apparatus based on monocular vision camera
CN110906875A (en) * 2019-11-26 2020-03-24 湖北工业大学 Visual processing method for aperture measurement
CN110954024A (en) * 2019-12-23 2020-04-03 芜湖哈特机器人产业技术研究院有限公司 Connecting piece vision measuring device and measuring method thereof

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
李文龙 等: "基于图像处理技术的轮毂智能检测系统", 《激光杂志》 *
杨帆: "《数字图像处理与分析》", 31 May 2015, 北京航空航天大学出版社 *
武汉大学多核架构与编程技术课程组: "《多核架构与编程技术》", 31 January 2010, 武汉大学出版社 *
郑琪琪 等: "单唇密封圈检测装置自动对焦策略研究", 《机械设计》 *
陈朋 等: "基于二代小波算法的数字全息显微成像自动对焦方法", 《计算机测量与控制》 *

Similar Documents

Publication Publication Date Title
CN109141232B (en) Online detection method for disc castings based on machine vision
CN106709950B (en) Binocular vision-based inspection robot obstacle crossing wire positioning method
CN106824806B (en) The detection method of low module plastic gear based on machine vision
CN109986172B (en) Welding seam positioning method, equipment and system
CN103149087B (en) Follow-up window and digital image-based non-contact real-time strain measurement method
CN113012098B (en) Iron tower angle steel punching defect detection method based on BP neural network
CN115096206B (en) High-precision part size measurement method based on machine vision
CN112132886A (en) Circular hole center rapid positioning and roundness detection method for aviation part
CN110084830B (en) Video moving object detection and tracking method
CN113077437B (en) Workpiece quality detection method and system
CN113822810A (en) Method for positioning workpiece in three-dimensional space based on machine vision
CN115423755A (en) Wafer micromachining structure defect detection method and device, equipment and medium thereof
CN113705564B (en) Pointer type instrument identification reading method
CN104966283A (en) Imaging layered registering method
CN113607058B (en) Straight blade size detection method and system based on machine vision
CN113758439A (en) Method and device for measuring geometric parameters on line in hot ring rolling forming process
CN113375555A (en) Power line clamp measuring method and system based on mobile phone image
CN112284274A (en) Method and system for detecting aperture and nest diameter of mechanical connecting hole
CN116823708A (en) PC component side mold identification and positioning research based on machine vision
CN115294119A (en) Machine vision-based method for detecting stains in inner groove of head of plum-blossom-shaped thread
CN115578594A (en) Edge positioning method and device based on computer vision and related equipment
CN115908275A (en) Hot ring rolling deformation geometric state online measurement method based on deep learning
CN109087278B (en) Condom front and back recognition method based on improved Canny operator
CN108709494B (en) Real-time separation method for background light intensity of white light interference signal
CN110826455A (en) Target identification method and image processing equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210129