A calibration device and a calibration method for machine vision detection
By designing a foldable U-shaped aluminum alloy calibration device and infrared lamp, and combining convolutional neural networks and iterative calculation algorithms, the problems of large size and low accuracy of calibration devices in machine vision inspection were solved, realizing a portable and efficient calibration process.
Patent Information
- Application Number
- CN202411067705.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-06
AI Technical Summary
Existing machine vision inspection and calibration devices suffer from problems such as excessive size when shooting from a distance, difficulty in clearly capturing scales, large calibration errors at night, and cumbersome and inefficient calibration processes.
A foldable calibration device was designed, which adopts a U-shaped aluminum alloy profile structure and is equipped with infrared lamps. Combining convolutional neural networks and iterative calculation algorithms, it can realize the rapid identification and accurate positioning of calibration corner points and construct a transformation matrix from pixel coordinates to world coordinates.
It achieves portability and efficient calibration of the calibration device, improves calibration accuracy and efficiency under low light and long distance conditions, and achieves sub-pixel level positioning accuracy.
Smart Images

Figure CN118657840B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine vision detection calibration, and in particular to a calibration device and a calibration method for machine vision detection. Background Art
[0002] As an emerging inspection method in recent years, machine vision inspection has shown an increasingly broad application prospect in the inspection fields of engineering structures with its advantages of non-contact, high precision, convenience, speed, strong scalability and high intelligence.
[0003] When using machine vision technology for detection or monitoring, one or more target points in the image must be calibrated to obtain the conversion relationship between the pixel displacement in the calibration plane and the actual displacement. Therefore, it is necessary to develop a dedicated calibration device and calibration method to improve the calibration efficiency and accuracy.
[0004] The patent application with the announcement number CN213748177U, entitled "A special calibration ruler", provides a special calibration ruler, including a horizontal ruler and a vertical ruler perpendicular to the horizontal ruler. The plane formed by the horizontal ruler and the vertical ruler is set as a calibration plane. A base is also provided. The base is provided with a horizontal adjustment component that can adjust the level of the horizontal ruler. The horizontal ruler and the vertical ruler are fixed on the base. The special calibration ruler can calibrate each target point of the test object separately to obtain the calibration parameters of each target point, so that the pixel displacement and actual displacement of each target point can be obtained by analyzing the collected image, which solves the problem that the target point cannot be calibrated separately in the prior art. However, the dedicated calibration ruler still has the following problems: when the shooting distance is far, in order to ensure that the calibration ruler occupies enough pixels in the image, the size of the calibration ruler is required to be large enough, which makes the calibration ruler too large and inconvenient to transport and carry; when the shooting distance is far, the scale grid of the calibration ruler is difficult to be clearly photographed, resulting in a large calibration error or even failure to complete the calibration; when shooting at night, the calibration ruler itself cannot emit light and can only be illuminated by an infrared fill light, but often due to poor clarity, the calibration cannot be completed; when calibrating, it is necessary to manually select the intersection of three reference line segments on the image, which introduces errors, and the calibration process is cumbersome and inefficient. Summary of the invention
[0005] The object of the present invention is to provide a calibration device and a calibration method for machine vision detection to solve at least one of the above-mentioned technical problems existing in the prior art.
[0006] In a first aspect, in order to solve the above technical problems, the present invention provides a calibration device for machine vision inspection, comprising a horizontal ruler, a vertical ruler and a support rod;
[0007] One end of the horizontal ruler is hinged to one end of the vertical ruler, a first calibration angle point is arranged at the hinge, and a second calibration angle point and a third calibration angle point are arranged at the other end of the vertical ruler and the horizontal ruler respectively; an opening is arranged in the middle of the horizontal ruler;
[0008] One end of the support rod is hinged to the middle part of the vertical ruler; the other end of the support rod can be temporarily fixed to the opening when the horizontal ruler and the vertical ruler are unfolded into a vertical state.
[0009] Through the above device, the horizontal ruler and the vertical ruler can be folded for easy storage and transportation. When performing calibration shooting, the horizontal ruler and the vertical ruler are unfolded into a vertical state, so that a calibration right triangle is formed by three calibration corner points for calibration shooting.
[0010] In a feasible implementation, the horizontal ruler and the vertical ruler are both U-shaped aluminum alloy profiles; this not only reduces the weight of the calibration device, but also utilizes the U-shaped structure for easy interlocking. By controlling the cross-sectional dimensions of the horizontal ruler and the vertical ruler, the technical effect of inserting the horizontal ruler as a whole into the vertical ruler, or inserting the vertical ruler as a whole into the horizontal ruler can be achieved, thereby further reducing the volume of the calibration device when folded and stored.
[0011] In a feasible implementation, infrared lights are provided at the three calibration corner points for identifying the calibration corner points; this facilitates identification of the calibration corner points of the calibration device under adverse conditions such as insufficient lighting and long distance, thereby improving calibration efficiency and accuracy.
[0012] In a feasible implementation manner, the infrared lamp is mounted on the calibration device by means of hand-tightened screws to facilitate flexible replacement.
[0013] In a feasible implementation, the infrared lamp includes infrared lamp beads, batteries, driving circuits and power management circuits, etc.; the driving circuit is electrically connected to the infrared lamp beads and the power management circuit, respectively, for controlling the infrared lamp bead switch; the power management circuit is also electrically connected to the battery for providing a stable power supply for the infrared lamp.
[0014] Preferably, the battery is a rechargeable lithium battery.
[0015] In a feasible implementation manner, the infrared lamp is circular, so that a circular light spot appears in the calibration image captured by the calibration camera, so as to facilitate calibration calculation.
[0016] In a feasible implementation manner, the level ruler is further provided with a base, which is used to enable the calibration device to stand upright at the calibration target point when the level ruler and the vertical ruler are opened to a vertical state, so as to facilitate the calibration camera to take pictures.
[0017] In a second aspect, based on the same inventive concept, the present application also provides a calibration method using the above calibration device, comprising the following steps:
[0018] Step 1, unfold the calibration device so that the horizontal ruler and the vertical ruler are perpendicular to each other, and place it at the calibration target point; use a calibration camera, such as a camera of a machine vision displacement monitor, to capture a calibration image; the calibration image contains three calibration corner points of the calibration device;
[0019] Step 2: Based on the calibration image, use a convolutional neural network, such as the YOLO algorithm, to identify the pixel position rectangles of the three calibration corner points in the calibration image, so as to quickly and accurately locate the approximate positions of the three calibration corner points at the pixel level. Since the YOLO algorithm has a large memory requirement (about 1G), it is necessary to run the algorithm on a mobile phone or server.
[0020] Step 3: Based on the pixel position rectangle of the calibration corner points, the center coordinates P1, P2 and P3 of the three calibration corner points are calculated by fusing the centroid method with the Gaussian distribution method, so that the precise coordinates of the calibration corner points in the calibration image can be obtained;
[0021] Step 4, connect the center coordinates P1, P2 and P3, obtain the calibration line segments P1P2, P1P3 and P2P3, and determine the calibration plane;
[0022] Step 5, respectively calculate the pixel lengths L1, L2 and L3 of P1P2, P1P3 and P2P3 in the calibration image;
[0023] Step 6: Based on the actual center distances L1r, L2r and L3r between the three calibration corner points of the calibration device, the conversion relationship between the pixel length and the actual center distance is calculated, and a calibration matrix, that is, a conversion matrix from pixel coordinates to world coordinates, is constructed;
[0024] Step 7: photograph the detection image, obtain the pixel displacement of the target to be detected, and calculate the actual displacement of the target to be detected through the calibration matrix.
[0025] In a feasible implementation, before capturing the calibration image in step 1, the step further includes turning on the infrared light of the calibration device, so that the clarity of the calibration corner points in the calibration image can be improved under unfavorable conditions such as insufficient lighting and long distance.
[0026] In a feasible implementation, in step 1, when shooting the calibration image, the exposure parameters of the calibration camera are adjusted so that the background of the calibration image is black, so as to improve the contrast and enhance the subsequent recognition effect.
[0027] In a feasible implementation manner, the step 3 specifically includes:
[0028] Step 31: preprocess the calibration image, including noise reduction, enhancement, etc.
[0029] Step 32: Based on the pixel position rectangle of the calibrated corner point, the initial center coordinates of the calibrated corner point are located by the centroid method as the reference point for iterative calculation;
[0030] Step 33: Calculate the center coordinates of the calibrated corner points through an iterative calculation formula until the iteration termination condition is reached. The specific iterative calculation formula can be:
[0031] ;
[0032] in, Indicates The center coordinates calculated by the iteration;
[0033] Indicates The center coordinates calculated by the iteration;
[0034] Indicates the variable step size of the quadratic polynomial, which is used to control the number of iterations. The closer the center coordinate is to the center, the smaller the value is;
[0035] represents the gradient, which is the difference in center coordinates calculated in two iterations;
[0036] Step 34: Calculate the difference between any two generations of center coordinates through the decision tree algorithm, and select the two generations of center coordinates whose difference does not exceed the preset threshold as candidate center coordinates; calculate the mean of the center coordinates of all generations through the Gaussian distribution method, and also use it as the candidate center coordinates; average all the candidate center coordinates to obtain the final center coordinates P1, P2 and P3, so that the sub-pixel level accuracy of the percentile can be achieved;
[0037] Through the above process, by using preprocessing, the noise tolerance can be improved and the noise interference in the calibration image can be effectively filtered out; by using iterative calculation and decision tree algorithm, the positioning accuracy of the calibration corner points can be significantly improved and the error can be reduced; at the same time, the computational complexity of this scheme is low, which is conducive to the fast and efficient calculation of the center coordinates.
[0038] Preferably, the iteration termination condition is that the gradient value is less than 0.3.
[0039] Preferably, the preset threshold is 0.5.
[0040] In a feasible implementation manner, the calibration matrix The specific expression of can be:
[0041] ;
[0042] Among them, the matrix elements Represents the three-dimensional conversion factor, which is a floating point number.
[0043] Preferably, the conversion matrix from world coordinates to pixel coordinates can also be obtained through the above calibration matrix and inverse matrix operation.
[0044] In a feasible implementation, in step 6, a calibration matrix is constructed. The specific methods include:
[0045] Step 61: Based on the six endpoints of the calibration line segments P1P2, P1P3 and P2P3, construct a calibration line segment endpoint coordinate matrix And its plane equation, the specific formula can be:
[0046] ;
[0047] ;
[0048] in, , and They represent the constants of the plane equation respectively; , and Respectively represent the three-dimensional coordinates in the calibration image;
[0049] Through fitting calculation, we can get , and 3 specific values of ;
[0050] Step 62: Based on , and 3 specific values of to construct the actual world coordinate matrix , the specific formula can be:
[0051] ;
[0052] in, , and Respectively represent the three-dimensional coordinates in the world coordinate system;
[0053] Step 63: Based on the intrinsic parameter matrix K of the calibration camera and the coordinate matrix of the endpoints of the calibration line segment And the actual world coordinate matrix ,Through the camera calibration function, such as the calibrateCamera function of OpenCV, the external parameter matrix of the calibration camera is calculated, including the rotation matrix R and the translation vector T; after combining the rotation matrix R and the translation vector T, the calibration matrix is obtained by multiplying the internal parameter matrix K ; The specific formula can be:
[0054] ;
[0055] ;
[0056] in, Indicates the x-focal length of the calibration camera; Indicates the y-focal length of the calibration camera; Indicates the x-coordinate of the center point of the calibration image; Indicates the y-coordinate of the center point of the calibration image; Represents matrix multiplication operation; It represents the combination of rotation matrix R and translation vector T. The specific formula can be:
[0057] ;
[0058] in, Indicates tiling in the horizontal direction.
[0059] By adopting the above technical solution, the present invention has the following beneficial effects:
[0060] The present invention provides a calibration device and a calibration method for machine vision detection, which adopt a foldable structure and are easy to carry and transport. By using infrared light, the clarity of calibration corner point recognition under unfavorable conditions such as insufficient light and long distance is improved. This scheme can accurately and quickly calculate the center coordinates of the calibration corner points, and can also use three calibration line segments to construct a conversion matrix from pixel coordinates to world coordinates, so as to quickly and accurately obtain the calibration results. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0062] Figure 1 A structural diagram of a calibration device for machine vision inspection in an unfolded state provided by an embodiment of the present invention;
[0063] Figure 2 for Figure 1 Another angle view of
[0064] Figure 3 for Figure 1 Another angle view of
[0065] Figure 4 A structural diagram of a calibration device for machine vision inspection in a closed state provided by an embodiment of the present invention;
[0066] Figure 5 A flow chart of a calibration method for machine vision detection provided by an embodiment of the present invention;
[0067] Figure 6 A diagram illustrating pixel length in a calibration image provided by an embodiment of the present invention;
[0068] Figure 7 An illustration of the actual center distance of the calibration device provided in an embodiment of the present invention;
[0069] Reference numerals:
[0070] 1-Level ruler; 2-Vertical ruler; 3-Support rod; 4-Cylindrical pin; 7-Infrared lamp; 10-Hand screw. DETAILED DESCRIPTION
[0071] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0072] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0073] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0074] The present invention is further explained below in conjunction with specific implementation modes.
[0075] It should also be noted that the following specific embodiments or specific implementations are a series of optimized settings listed in the present invention to further explain the specific content of the invention, and these settings can be used in combination or in association with each other.
[0076] Embodiment 1:
[0077] like Figure 1-3 As shown, this embodiment provides a calibration device for machine vision inspection, including a horizontal ruler 1, a vertical ruler 2 and a support rod 3;
[0078] One end of the horizontal ruler 1 is hinged to one end of the vertical ruler 2, a first calibration angle point is arranged at the hinge, and a second calibration angle point and a third calibration angle point are arranged at the other end of the vertical ruler 2 and the horizontal ruler 1 respectively; an opening is arranged in the middle of the horizontal ruler 1;
[0079] One end of the support rod 3 is hinged to the middle of the vertical ruler 2 through a cylindrical pin 4; the other end of the support rod 3 can be temporarily fixed to the opening when the horizontal ruler 1 and the vertical ruler 2 are unfolded into a vertical state.
[0080] Through the above device, the horizontal ruler 1 and the vertical ruler 2 can be folded for easy storage and transportation. When performing calibration photography, the horizontal ruler 1 and the vertical ruler 2 are unfolded into a vertical state, so that a calibration right triangle is formed by three calibration corner points for calibration photography.
[0081] Furthermore, the horizontal ruler 1 and the vertical ruler 2 are both U-shaped aluminum alloy profiles; this not only reduces the weight of the calibration device, but also makes use of the U-shaped structure to facilitate interlocking. By controlling the cross-sectional dimensions of the horizontal ruler 1 and the vertical ruler 2, the vertical ruler 2 can be inserted as a whole into the horizontal ruler 1, thereby further reducing the volume of the calibration device when folded and stored. Figure 4 shown.
[0082] Furthermore, infrared lamps 7 are provided at the three calibration corner points for identifying the calibration corner points; this facilitates identification of the calibration corner points of the calibration device under unfavorable conditions such as insufficient lighting and long distance, thereby improving calibration efficiency and accuracy.
[0083] Furthermore, the infrared lamp 7 is mounted on the calibration device by means of a hand-tightened screw 10 for easy and flexible replacement.
[0084] Furthermore, the infrared lamp 7 includes infrared lamp beads, batteries, driving circuits and power management circuits, etc.; the driving circuit is electrically connected to the infrared lamp beads and the power management circuit respectively, and is used to control the infrared lamp bead switch; the power management circuit is also electrically connected to the battery, and is used to provide a stable power supply for the infrared lamp 7.
[0085] Preferably, the battery is a rechargeable lithium battery.
[0086] Furthermore, the infrared lamp 7 is circular, so that a circular light spot appears in the calibration image captured by the calibration camera, so as to facilitate calibration calculation.
[0087] In other embodiments, the level ruler 1 is further provided with a base, which is used to make the calibration device stand upright at the calibration target point when the level ruler 1 and the vertical ruler 2 are opened to a vertical state, so as to facilitate the calibration camera to take pictures.
[0088] Embodiment 2:
[0089] like Figure 5 As shown, this embodiment provides a calibration method using the above calibration device, comprising the following steps:
[0090] Step 1, unfold the calibration device so that the horizontal ruler and the vertical ruler are perpendicular to each other, and place it at the calibration target point; use the camera of the machine vision displacement monitor to take a calibration image; the calibration image contains three calibration corner points of the calibration device;
[0091] Step 2: Based on the calibration image, the pixel position rectangles of the three calibration corner points in the calibration image are identified by the YOLO algorithm; so as to quickly and accurately locate the approximate positions of the three calibration corner points at the pixel level. Since the YOLO algorithm has a large memory requirement (about 1G), it is necessary to run the algorithm on a mobile phone or server; the YOLO algorithm belongs to the prior art and can transform the target detection problem into a regression problem. Given an input image, the target rectangle and its classification category can be directly regressed at multiple positions of the image;
[0092] Step 3: Based on the pixel position rectangle of the calibration corner points, the center coordinates P1, P2 and P3 of the three calibration corner points are calculated by fusing the centroid method with the Gaussian distribution method, so that the precise coordinates of the calibration corner points in the calibration image can be obtained;
[0093] Step 4: Connect the center coordinates P1, P2 and P3 to obtain the calibration line segments P1P2, P1P3 and P2P3, and determine the calibration plane;
[0094] Step 5: Calculate the pixel lengths L1, L2 and L3 of P1P2, P1P3 and P2P3 in the calibration image respectively, as Figure 6 As shown;
[0095] Step 6: Based on the actual center distances L1r, L2r and L3r between the three calibration corner points of the calibration device, Figure 7 As shown, the conversion relationship between the pixel length and the actual center distance is calculated, and a calibration matrix, that is, a conversion matrix from pixel coordinates to world coordinates, is constructed and stored in the machine vision displacement monitor;
[0096] Step 7: photograph the detection image, obtain the pixel displacement of the target to be detected, and calculate the actual displacement of the target to be detected through the calibration matrix.
[0097] Furthermore, before capturing the calibration image in step 1, the step also includes turning on the infrared light of the calibration device, so that the clarity of the calibration corner points in the calibration image can be improved under unfavorable conditions such as insufficient lighting and long distance.
[0098] Furthermore, in the step 1, when shooting the calibration image, the exposure parameters of the calibration camera are adjusted so that the background of the calibration image is black, so as to improve the contrast and enhance the subsequent recognition effect.
[0099] Furthermore, the step 3 specifically includes:
[0100] Step 31: preprocess the calibration image, including noise reduction, enhancement, etc.
[0101] Step 32: Based on the pixel position rectangle of the calibrated corner point, the initial center coordinates of the calibrated corner point are located by the centroid method as the reference point for iterative calculation;
[0102] Step 33: Calculate the center coordinates of the calibrated corner points through an iterative calculation formula until the iteration termination condition is reached. The specific iterative calculation formula can be:
[0103] ;
[0104] in, Indicates The center coordinates calculated by the iteration;
[0105] Indicates The center coordinates calculated by the iteration;
[0106] Indicates the variable step size of the quadratic polynomial, which is used to control the number of iterations. The closer the center coordinate is to the center, the smaller the value is;
[0107] represents the gradient, which is the difference in center coordinates calculated in two iterations;
[0108] Step 34, using a decision tree algorithm, calculate the difference between any two generations of center coordinates, and select the two generations of center coordinates whose difference does not exceed a preset threshold as candidate center coordinates; using a Gaussian distribution method, calculate the mean of the center coordinates of all generations, which is also used as the candidate center coordinates; average all the candidate center coordinates to obtain the final center coordinates P1, P2 and P3, so that the sub-pixel level accuracy of the percentile can be achieved; the Gaussian distribution, also known as the normal distribution or the bell curve, is one of the most common probability distributions in statistics;
[0109] Through the above process, by using preprocessing, the noise tolerance can be improved and the noise interference in the calibration image can be effectively filtered out; by using iterative calculation and decision tree algorithm, the positioning accuracy of the calibration corner points can be significantly improved and the error can be reduced; at the same time, the computational complexity of this scheme is low, which is conducive to the fast and efficient calculation of the center coordinates.
[0110] Preferably, the iteration termination condition is that the gradient value is less than 0.3.
[0111] Preferably, the preset threshold is 0.5.
[0112] Furthermore, the calibration matrix The specific expression of can be:
[0113] ;
[0114] Among them, the matrix elements Represents the three-dimensional conversion factor, which is a floating point number.
[0115] Preferably, the conversion matrix from world coordinates to pixel coordinates can also be obtained through the above calibration matrix and inverse matrix operation.
[0116] Furthermore, in step 6, a calibration matrix is constructed The specific methods include:
[0117] Step 61: Based on the six endpoints of the calibration line segments P1P2, P1P3 and P2P3, construct a calibration line segment endpoint coordinate matrix And its plane equation, the specific formula can be:
[0118] ;
[0119] ;
[0120] in, , and They represent the constants of the plane equation respectively; , and Respectively represent the three-dimensional coordinates in the calibration image;
[0121] Through fitting calculation, we can get , and 3 specific values of ;
[0122] Step 62: Based on , and 3 specific values of to construct the actual world coordinate matrix , the specific formula can be:
[0123] ;
[0124] in, , and Respectively represent the three-dimensional coordinates in the world coordinate system;
[0125] Step 63: Based on the intrinsic parameter matrix K of the calibration camera and the coordinate matrix of the endpoints of the calibration line segment And the actual world coordinate matrix ,Through the calibrateCamera function of OpenCV, the external parameter matrix of the calibration camera is calculated, including the rotation matrix R and the translation vector T; after combining the rotation matrix R and the translation vector T, the calibration matrix is obtained by multiplying the internal parameter matrix K ; The specific formula can be:
[0126] ;
[0127] ;
[0128] in, Indicates the x-focal length of the calibration camera; Indicates the y-focal length of the calibration camera; Indicates the x-coordinate of the center point of the calibration image; Indicates the y-coordinate of the center point of the calibration image; Represents matrix multiplication operation; It represents the combination of rotation matrix R and translation vector T. The specific formula can be:
[0129] ;
[0130] in, Indicates tiling in the horizontal direction.
[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A calibration method using a calibration device for machine vision detection, characterized in that: The calibration device comprises: a horizontal ruler, a vertical ruler and a support rod; One end of the horizontal ruler is hinged to one end of the vertical ruler, a first calibration angle point is arranged at the hinge, and a second calibration angle point and a third calibration angle point are arranged at the other end of the vertical ruler and the horizontal ruler respectively; an opening is arranged in the middle of the horizontal ruler; One end of the support rod is hinged to the middle of the vertical ruler; the other end of the support rod can be temporarily fixed to the opening when the horizontal ruler and the vertical ruler are unfolded into a vertical state; The horizontal ruler and the vertical ruler are both U-shaped aluminum alloy profiles; Infrared lamps are arranged at the three calibrated corner points for identifying the calibrated corner points; the infrared lamps include infrared lamp beads, batteries, drive circuits and power management circuits; the drive circuits are electrically connected to the infrared lamp beads and the power management circuits respectively for controlling the infrared lamp bead switches; the power management circuits are also electrically connected to the batteries for providing stable power for the infrared lamps; the infrared lamps are round; The calibration method comprises the following steps: Step 1, unfold the calibration device so that the horizontal ruler and the vertical ruler are perpendicular to each other, and place it at the calibration target point; use the calibration camera to capture a calibration image; the calibration image contains three calibration corner points of the calibration device; Step 2: Based on the calibration image, a convolutional neural network is used to identify the pixel position rectangles of the three calibration corner points in the calibration image. Step 3: Based on the pixel position rectangle of the calibrated corner points, the center coordinates P1, P2 and P3 of the three calibrated corner points are calculated by fusing the centroid method with the Gaussian distribution method. Step 4: Connect the center coordinates P1, P2 and P3 to obtain the calibration line segments P1P2, P1P3 and P2P3, and determine the calibration plane; Step 5, respectively calculate the pixel lengths L1, L2 and L3 of P1P2, P1P3 and P2P3 in the calibration image; Step 6: Based on the actual center distances L1r, L2r and L3r between the three calibration corner points of the calibration device, the conversion relationship between the pixel length and the actual center distance is calculated to construct a calibration matrix; Step 7: photograph the detection image, obtain the pixel displacement of the target to be detected, and calculate the actual displacement of the target to be detected through the calibration matrix.
2. The calibration method according to claim 1, characterized in that: The step 1 also includes turning on the infrared light of the calibration device before capturing the calibration image.
3. The calibration method according to claim 1, characterized in that: The step 3 specifically includes: Step 31, preprocessing the calibration image, including noise reduction and enhancement; Step 32: Based on the pixel position rectangle of the calibrated corner point, the initial center coordinates of the calibrated corner point are located by the centroid method as the reference point for iterative calculation; Step 33: Calculate the center coordinates of the calibrated corner points through an iterative calculation formula until the iterative termination condition is reached. The specific iterative calculation formula is: ; in, Indicates The center coordinates calculated by the iteration; Indicates The center coordinates calculated by the iteration; Represents a quadratic polynomial with variable step size, used to control the number of iterations; represents the gradient, which is the difference in center coordinates calculated in two iterations; Step 34: Calculate the difference between any two generations of center coordinates through the decision tree algorithm, and select the two generations of center coordinates whose difference does not exceed the preset threshold as the alternative center coordinates; calculate the mean of the center coordinates of all generations through the Gaussian distribution method, and also use it as the alternative center coordinates; calculate the mean of all the alternative center coordinates to obtain the final center coordinates P1, P2 and P3.
4. The calibration method according to claim 3, characterized in that: The iteration termination condition is that the gradient value is less than 0.
3.
5. The calibration method according to claim 3, characterized in that: The preset threshold is 0.5.
