Camera-based transmission line distance measurement method, device and computer equipment
By calibrating the binocular camera and calculating the distance between the top of the construction machinery and the transmission line, the error problem of the binocular camera in long-distance ranging is solved, accurate ranging in complex environments is achieved, and the protection against external damage of the transmission line is improved. work level.
Patent Information
- Application Number
- CN202210790168.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-06
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-07-06
AI Technical Summary
Existing binocular cameras have large errors in measuring the straight-line distance between construction machinery and transmission lines in the early warning of external damage to long-distance transmission lines, and are affected by outdoor lighting, making it difficult to achieve reliable long-distance ranging.
By calibrating the binocular camera, obtain the depth map of each camera and perform binarization processing to determine the vertex position of the construction machinery. Combine the optical center of the binocular camera with the vertex of the construction machinery and the angle between the optical axes to calculate the vertex of the construction machinery. The distance between the transmission line and the transmission line is accurately measured using trigonometric functions.
It achieves the accuracy of distance measurement between construction machinery and transmission lines under long distances and complex lighting conditions, improves the level of prevention of external damage to transmission lines, and ensures the reliability and stability of distance measurement.
Smart Images

Figure CN115014296B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power transmission line monitoring, and in particular to a power transmission line distance measurement method, device and computer equipment based on a camera. Background Art
[0002] Transmission lines are operated outdoors, and construction machinery, over-high trees, illegal buildings, etc. below them may cause external damage to the lines. Among them, the lack of safe distance between construction machinery and transmission wires is the main factor causing external damage to wires due to the large-scale construction machinery, the difficulty of operation, the lack of construction supervision, and the lack of power safety knowledge of operators. Therefore, a method for long-term monitoring of the distance between construction machinery and wires is urgently needed, which is conducive to improving the level of external damage prevention of transmission lines.
[0003] With the continuous development of visual technology, obstacle detection and recognition methods based on machine vision are gradually being used in the work of preventing power transmission lines from breaking. Currently, binocular recognition and ranging systems are basically the most commonly used. Among them, binocular cameras have high accuracy in short-distance ranging, but in the application scenario of long-distance power transmission line prevention and early warning, binocular cameras are limited by the baseline distance of the camera and the influence of outdoor lighting, resulting in large errors in the straight-line distance between the construction machinery and the power transmission line measured by the binocular camera. Summary of the invention
[0004] Based on this, it is necessary to provide a camera-based transmission line ranging method, device and computer equipment that can achieve long-distance reliable ranging in response to the above technical problems.
[0005] In a first aspect, the present application provides a camera-based transmission line distance measurement method, the method comprising:
[0006] After calibrating each binocular camera, the depth map of each binocular camera is obtained based on the parallax relationship.
[0007] Based on a preset binarization threshold, the image depth map corresponding to each binocular camera is binarized to obtain a binarized image, and each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera is traversed from top to bottom in turn, and the construction machinery vertex is determined based on the pixel points corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel points where the pixel value of the first value appears for the first time;
[0008] According to the images taken by the two binocular cameras, the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera is obtained respectively;
[0009] According to the relative distance and angle between the two binocular cameras, the distance between the position of the top of the construction machinery and the transmission line is determined.
[0010] In one embodiment, according to the images captured by the two binocular cameras, the angles between the lines connecting the optical center of each binocular camera and the vertex of the construction machine and the optical axis of the binocular camera are respectively obtained, including:
[0011] Obtain a first relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the first binocular camera and an optical center of the first binocular camera and an optical axis of the first binocular camera;
[0012] Obtain a second relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the second binocular camera and the optical center of the second binocular camera and an optical axis of the second binocular camera;
[0013] According to the relative distance and angle between the two binocular cameras, the distance between the top position of the construction machinery and the transmission line is determined, including:
[0014] The distance between the position of the vertex of the construction machine and the power transmission line is acquired based on the relative distance, the first relative angle, and the second relative angle.
[0015] In one embodiment, obtaining a first relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the first binocular camera and an optical center of the first binocular camera and an optical axis of the first binocular camera includes:
[0016] Obtaining a first straight-line distance between a vertex of the construction machine in a detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera;
[0017] Based on the first straight-line distance and the focal length of the first binocular camera, obtaining a tangent value of a first relative angle;
[0018] The first relative angle is acquired based on the inverse tangent function and the tangent value of the first relative angle.
[0019] In one embodiment, obtaining a first straight-line distance between a vertex of a construction machine in a detection frame corresponding to a first binocular camera and a center of the detection frame corresponding to the first binocular camera includes:
[0020] Obtain a rectangle with the diagonal line of the line connecting the vertices of the construction machine in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera;
[0021] Get the length and width of the rectangle;
[0022] Based on the Pythagorean theorem, a first straight-line distance between a vertex of the construction machinery in a detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera is determined according to the length and width of the rectangle.
[0023] In one embodiment, obtaining the length and width of a rectangle includes:
[0024] Obtain a length ratio relationship formula and a width ratio relationship formula of the rectangle and the detection frame corresponding to the first binocular camera;
[0025] Based on a relationship between a horizontal field of view angle and a length ratio of the first binocular camera, obtaining a first angle value;
[0026] Based on the vertical field of view angle and width ratio relationship of the first binocular camera, obtain a second angle value;
[0027] Obtaining a length value of the rectangle based on a tangent value of the first angle value and a focal length value of the first binocular camera;
[0028] Based on the tangent value of the second angle value and the focal length value of the first binocular camera, a width value of the rectangle is obtained.
[0029] In one embodiment, determining the distance between the position of the top of the construction machine and the power transmission line according to the relative distance and angle between the two binocular cameras includes:
[0030] Based on the relative distance and the angle, a second straight-line distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras is calculated;
[0031] Based on the sine value of the angle and the second straight-line distance, the distance between the position of the construction machinery vertex and the transmission line is obtained.
[0032] In one embodiment, calculating the second straight-line distance between the vertex of the construction machine in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras based on the relative distance and the angle includes:
[0033] The second straight-line distance is obtained based on the relative distance, the angle and a preset relationship; the preset relationship includes a mapping relationship between the relative distance variable, the angle variable and the straight-line distance variable.
[0034] In a second aspect, the present application also provides a camera-based transmission line distance measuring device, the device comprising:
[0035] The first acquisition module is used to calibrate each binocular camera respectively, and then obtain the image depth map of each binocular camera based on the parallax relationship; binarize the image depth map corresponding to each binocular camera based on a preset binarization threshold to obtain a binarized image, and traverse each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera from top to bottom, and determine the construction machinery vertex based on the pixel points corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel point where the pixel value of the first value appears for the first time;
[0036] The second acquisition module is used to respectively acquire the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera according to the images captured by the two binocular cameras;
[0037] The determination module is used to determine the distance between the position of the top of the construction machinery and the transmission line according to the relative distance and angle between the two binocular cameras.
[0038] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the following steps when executing the computer program:
[0039] After calibrating each binocular camera, the depth map of each binocular camera is obtained based on the parallax relationship.
[0040] Based on a preset binarization threshold, the image depth map corresponding to each binocular camera is binarized to obtain a binarized image, and each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera is traversed from top to bottom in turn, and the construction machinery vertex is determined based on the pixel points corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel points where the pixel value of the first value appears for the first time;
[0041] According to the images taken by the two binocular cameras, the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera is obtained respectively;
[0042] According to the relative distance and angle between the two binocular cameras, the distance between the position of the top of the construction machinery and the transmission line is determined.
[0043] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0044] After calibrating each binocular camera, the depth map of each binocular camera is obtained based on the parallax relationship.
[0045] Based on a preset binarization threshold, the image depth map corresponding to each binocular camera is binarized to obtain a binarized image, and each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera is traversed from top to bottom in turn, and the construction machinery vertex is determined based on the pixel points corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel points where the pixel value of the first value appears for the first time;
[0046] According to the images taken by the two binocular cameras, the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera is obtained respectively;
[0047] According to the relative distance and angle between the two binocular cameras, the distance between the position of the top of the construction machinery and the transmission line is determined.
[0048] The above-mentioned camera-based transmission line distance measurement method, device and computer equipment, the construction machinery vertex and the optical center connection line of the two binocular cameras, and the relative distance between the two binocular cameras form a triangle, obtain the relative distance between the two binocular cameras and the angle between the optical center of each binocular camera and the construction machinery vertex and the optical axis of the binocular camera, based on the trigonometric function relationship, the relative distance and angle between the two binocular cameras, determine the distance between the position of the construction machinery vertex and the transmission line, the above-mentioned method calculates a relatively accurate distance between the construction machinery vertex and the transmission line based on the relative angle between the construction machinery vertex and the binocular camera and the precise position coordinates of the binocular camera, does not directly use the binocular camera for distance measurement, and can achieve the purpose of long-term stable operation of the transmission line and the construction machinery to prevent external damage distance measurement. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 FIG. 1 is an application environment diagram of a camera-based transmission line distance measurement method in one embodiment;
[0050] Figure 2 is a schematic diagram of a flow chart of a camera-based transmission line distance measurement method in one embodiment;
[0051] Figure 3 A schematic diagram of the relative positions of a binocular camera and a construction machine in another embodiment;
[0052] Figure 4 A schematic diagram of the parallax relationship between a binocular camera and an object in another embodiment;
[0053] Figure 5 A flowchart of artificial neural network model weight pre-training in another embodiment;
[0054] Figure 6 A schematic diagram of a process for obtaining an angle between a line connecting the optical center of each binocular camera and the vertex of a construction machine and an optical axis of the binocular camera in one embodiment;
[0055] Figure 7 It is a schematic diagram of a process of obtaining a first relative angle in another embodiment;
[0056] Figure 8 It is a schematic diagram of construction machinery imaging in another embodiment;
[0057] Fig. 9 It is a stereoscopic schematic diagram of construction machinery imaging in another embodiment;
[0058] Fig.10A schematic diagram of a process for obtaining a first straight-line distance in another embodiment;
[0059] Fig.11 A schematic diagram of a flow chart for obtaining the length and width of a rectangle in another embodiment;
[0060] Fig.12 A schematic diagram of a flow chart of determining the distance between the position of the top of a construction machine and a power transmission line in another embodiment;
[0061] Fig.13 is a structural block diagram of a camera-based transmission line distance measuring device in one embodiment;
[0062] Fig.14 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0064] The camera-based transmission line distance measurement method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the two binocular cameras 102 on the power transmission line upload the captured images to the server 104. The data storage system can store the image data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 obtains the position of the construction machinery vertex and the angle between the optical center of each binocular camera and the line connecting the construction machinery vertex and the optical axis of the binocular camera based on the images captured by the two binocular cameras; according to the relative distance and angle between the two binocular cameras, the distance between the position of the construction machinery vertex and the power transmission line is determined. The server 104 can be implemented as an independent server or a server cluster consisting of multiple servers.
[0065] In one embodiment, Figure 2 As shown, a camera-based transmission line distance measurement method is provided, and the method is applied to Figure 1 The server in the example is used to illustrate the following steps:
[0066] Step 202, after calibrating each binocular camera respectively, obtain the image depth map of each binocular camera respectively based on the parallax relationship;
[0067] Among them, the binocular camera includes two monocular cameras, and the two monocular cameras are respectively installed on the left and right sides of the binocular camera body. When obtaining the position of the vertex of the construction machinery, the position of the vertex of the construction machinery can be obtained based on the image taken by the monocular camera on the same side of the two binocular cameras.
[0068] Two binocular cameras are installed on the spacer bars respectively. The spacer bars connect the wires together. The two binocular cameras are installed on the two spacer bars to detect the distance between the top of the construction machinery under the transmission line between the two spacer bars and the transmission line. Figure 3 As shown, two binocular cameras are respectively set up on the transmission line. The images taken by the monocular cameras on the same side of the two binocular cameras on the transmission line are obtained, and the image recognition method based on the artificial intelligence algorithm is used to respectively identify the positions of the construction machinery in the detection frames of the two binocular cameras. The image area where the construction machinery body is located is the detection frame corresponding to the binocular cameras, and the image depth map of the area where the construction machinery is located in the detection frames corresponding to the two binocular cameras is obtained based on the parallax relationship of the binocular cameras.
[0069] Among them, the schematic diagram of the parallax relationship between the binocular camera and the object is as follows Figure 4 As shown. P is an object in front of the binocular camera, P L , P R is the point of the object on the camera imaging surface, O L , O R is the optical center of the left and right cameras, F is the focal length of the camera, D is the baseline of the binocular camera, X R , X L is the distance from the imaging point of the object on the image plane to the leftmost end of the image plane, Z is the distance from the object to the binocular camera, and L is the width of the imaging plane.
[0070] According to the proportional relationship:
[0071] From formula (1), we can get:
[0072] After the binocular camera is calibrated, its camera focal length F and binocular camera baseline D are known and fixed, and X can also be calculated. R , X L , the distance from point P to the binocular camera can be obtained by formula (2), and then the depth map of the picture can be obtained.
[0073] Specifically, Figure 5As shown, images taken by two binocular cameras on the transmission line are obtained, and construction machinery is marked in the images. After marking, image preprocessing is performed, and the preprocessed images are input into the neural network model, the weights of the neural network model are initialized, and the loss function is calculated after forward training. When the accuracy reaches the expected level, the final weight is obtained, and the position of the image area where the construction machinery body is located is identified based on the final weight and the target detection algorithm. The image area where the construction machinery body is located is the detection frame corresponding to the binocular camera, and the image depth map of each binocular camera is obtained based on the parallax relationship of the binocular camera.
[0074] Step 204, binarize the image depth map corresponding to each binocular camera based on a preset binarization threshold to obtain a binarized image, traverse each row of pixels of the binarized image corresponding to the detection frame of each binocular camera from top to bottom, and determine the vertices of the construction machinery based on the pixels corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel points where the pixel value of the first value appears for the first time.
[0075] The relative positions of the two binocular cameras on the transmission line and the construction machinery are as follows: Figure 3 As shown, according to the prior knowledge of the position, the vertex of the construction arm of the construction machinery is located near the top of the detection frame in the binocular camera's detection frame. Therefore, when traversing, there is no need to traverse all the image data of the binary image. It is only necessary to traverse each row of pixels of the binary image corresponding to the detection frame of each binocular camera from top to bottom until all the pixels corresponding to the target row in the binary image corresponding to the detection frame are traversed, and then the traversal is stopped.
[0076] The maximum inter-class variance method is used to calculate the binarization threshold. The specific calculation method includes: setting the size of the image depth map to M*N, the initial binarization threshold to T, and the number of pixels in the image depth map whose pixel depth value is less than T is N 0 , whose average grayscale is μ 0 , the number of pixels in the image whose pixel depth value is greater than T is N 1 , whose average grayscale is μ 1 , set N 0 The proportion of the total number of pixels is w 0 , N 1 The proportion of the total number of pixels is w 1 , The total average grayscale is μ, μ=w 0 ×μ 0 +w 1 ×μ 1 , the between-class variance is g, g = w 0 (μ 0 -μ) 2 +w 1(μ 1 -μ) 2 , after simplification, the between-class variance is g = w 0 × 1 (μ 0 -μ 1 ), traverse in the range of [0, 255], and obtain the threshold T that maximizes the inter-class variance g as the preset binarization threshold.
[0077] The depth map of each binocular camera is binarized based on the following formula:
[0078] Among them, F(i, j) is the pixel value after binarization, Gray(i, j) is the original depth value of the depth map of the picture, and Gray th The final threshold for binarization that maximizes the inter-class variance g. The above formula is used to binarize the depth map to obtain a binary image. The pixel points with a binarized pixel value of 1 are defined as the pixels of the construction machinery, and the pixel points with a binarized pixel value of 0 are defined as the pixels of the background image. Among them, the image data of the binary image is a multidimensional array, the rows and columns of the multidimensional array represent the two-dimensional coordinates of the pixels corresponding to the array, and the elements of the multidimensional array are the depth values of the pixels corresponding to the array. From top to bottom, traverse each row of pixels of the binary image corresponding to the detection frame of each binocular camera in turn to obtain the pixel points corresponding to the target row in the binary image corresponding to each detection frame, wherein the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel points where the pixel value of the first value appears for the first time, the first value represents the pixel value of 1, and the target row represents the row corresponding to the pixel point where the pixel value of 1 appears for the first time. If the target row has only one pixel with a pixel value of 1, the pixel is determined to be the construction machine vertex; if the target row has multiple pixel values of 1, the middle point is determined based on the average value of the multiple pixel values of 1 in the target row, and the middle point is determined to be the construction machine vertex. For example, if the target row has 5 pixel values of 1, the middle point is the third pixel with a pixel value of 1, that is, the third pixel with a pixel value of 1 is the construction machine vertex.
[0079] Specifically, taking the construction machinery's boom tilting to the left as an example, the maximum inter-class variance method is used to calculate the binarization threshold, and the image depth map corresponding to each binocular camera is binarized based on the binarization threshold to obtain a binarized image. The pixel points with a binarized pixel value of 1 are defined as the pixels of the construction machinery, and the pixel points with a binarized pixel value of 0 are defined as the pixels of the background image. Each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera is traversed from top to bottom to obtain the pixel points corresponding to the target row in each binarized image corresponding to the detection frame. The target row indicates the row corresponding to the pixel point with a pixel value of 1 that appears for the first time. If the target row has only one pixel point with a pixel value of 1, the pixel point is determined to be the vertex of the construction machinery; if the target row has multiple pixel points with a pixel value of 1, the middle point is determined based on the average value between the multiple pixel points with a pixel value of 1 in the target row, and the middle point is determined to be the vertex of the construction machinery. The construction machinery vertices corresponding to the two binocular cameras obtained by the above-mentioned vertex determination method are the left vertex and the right vertex of the highest part of the boom respectively. The left vertex and the right vertex may not be the same vertex. In this embodiment, the left vertex and the right vertex can be considered to be the same vertex.
[0080] Step 206: According to the images captured by the two binocular cameras, the angles between the lines connecting the optical center of each binocular camera and the vertex of the construction machine and the optical axis of the binocular camera are respectively obtained.
[0081] The optical center of the binocular camera is the optical center of the monocular camera in the binocular camera. Figure 3 As shown in FIG. 1 , the optical axes of the two binocular cameras are approximately parallel to the transmission line. Since the transmission line is approximately parallel to the ground, it can be approximately considered that the optical axes of the two binocular cameras coincide, and the lines connecting the two binocular cameras and the vertices of the construction machinery can form a triangle.
[0082] Specifically, according to the images captured by the monocular cameras on the same side of the two binocular cameras, the angle between the line connecting the optical center of the first binocular camera and the vertex of the construction machinery and the optical axis of the first binocular camera is obtained respectively, and the angle between the line connecting the optical center of the second binocular camera and the vertex of the construction machinery and the optical axis of the second binocular camera is obtained respectively, that is, Figure 3 δ 1 Angle and δ 2 angle.
[0083] Step 208, determining the distance between the position of the top of the construction machine and the transmission line based on the relative distance and angle between the two binocular cameras.
[0084] The relative distance between the two binocular cameras is approximately equal to the length of the transmission line between the two binocular cameras.
[0085] In one embodiment, the binocular camera includes a real-time kinematic (RTK) module and a binocular RGB camera, and the RTK module is used to detect the real-time position coordinates of the binocular camera. The relative distance between the two binocular cameras is equal to the real-time position coordinate difference of the two binocular cameras parallel to the ground.
[0086] The line connecting the vertex of the construction machinery and the optical centers of the two binocular cameras, as well as the relative distance between the two binocular cameras, form a triangle. The angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera are the two angles of the triangle.
[0087] Specifically, Figure 3 As shown, the position coordinates of the two binocular cameras are obtained respectively, and the relative distance between the two binocular cameras is obtained based on the position coordinates of the two binocular cameras, that is, Figure 3 The connecting line A in the middle; respectively obtain the angle between the connecting line between the optical center of the first binocular camera and the vertex of the construction machinery and the optical axis of the first binocular camera, and the angle between the connecting line between the optical center of the second binocular camera and the vertex of the construction machinery and the optical axis of the second binocular camera, that is, respectively obtain Figure 3 δ 1 Angle and δ 2 Angle; based on the trigonometric function relationship, the relative distance between the two binocular cameras, the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera, the distance between the position of the vertex of the construction machinery and the transmission line is determined.
[0088] In the above-mentioned camera-based transmission line ranging method, on the one hand, each row of pixel points of the binary image corresponding to the detection frame of each binocular camera is traversed from top to bottom in turn, and the vertices of the construction machinery are determined based on the pixel points corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel points where the pixel value of the first value appears for the first time; the amount of calculation can be reduced, and the vertex position obtained is accurate. On the other hand, the line connecting the vertex of the construction machinery and the optical centers of the two binocular cameras and the relative distance between the two binocular cameras form a triangle. The relative distance between the two binocular cameras and the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera are obtained. Based on the trigonometric function relationship and the relative distance and angle between the two binocular cameras, the distance between the position of the vertex of the construction machinery and the transmission line is determined. The above method calculates a relatively accurate distance between the vertex of the construction machinery and the transmission line based on the relative angle between the vertex of the construction machinery and the binocular camera and the precise position coordinates of the binocular camera. The binocular camera is not used directly for ranging, and the purpose of preventing external damage of the transmission line and the construction machinery with long-term stable operation can be achieved.
[0089] In one embodiment, Figure 6 As shown, according to the images taken by the two binocular cameras, the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera is obtained respectively, including the following steps:
[0090] Step 602: Obtain a first relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the first binocular camera and the optical center of the first binocular camera and an optical axis of the first binocular camera.
[0091] The optical center of the first binocular camera in this embodiment is the optical center of the right monocular camera in the first binocular camera, and the optical axis of the first binocular camera is the optical axis of the right monocular camera in the first binocular camera.
[0092] Step 604, obtaining a second relative angle between a line connecting the vertices of the construction machine in the detection frame corresponding to the second binocular camera and the optical center of the second binocular camera and the optical axis of the second binocular camera.
[0093] The optical center of the second binocular camera in this embodiment is the optical center of the right monocular camera in the second binocular camera, and the optical axis of the second binocular camera is the optical axis of the right monocular camera in the second binocular camera.
[0094] Step 606, determining the distance between the position of the top of the construction machine and the transmission line according to the relative distance and angle between the two binocular cameras, includes:
[0095] The distance between the position of the construction machine vertex and the transmission line is obtained based on the relative distance, the first relative angle and the second relative angle, wherein the construction machine vertex and the optical center connection line of the two binocular cameras and the relative distance between the two binocular cameras form a triangle, the relative distance between the two binocular cameras is the base of the triangle, and the first relative angle and the second relative angle are two angles of the triangle respectively.
[0096] Specifically, the relative distance, the first relative angle and the second relative angle between the two binocular cameras are obtained, and based on the trigonometric function relationship, the relative distance, the first relative angle and the second relative angle between the two binocular cameras, the distance between the position of the vertex of the construction machinery and the transmission line is determined.
[0097] In one embodiment, a method for acquiring the first relative angle is the same as a method for acquiring the second relative angle, and therefore, only the method for acquiring the first relative angle is described herein.
[0098] In one embodiment, Figure 7 As shown, obtaining a first relative angle between a line connecting a construction machine vertex in a detection frame corresponding to the first binocular camera and an optical center of the first binocular camera and an optical axis of the first binocular camera includes the following steps:
[0099] Step 702: Obtain a first straight-line distance between a vertex of the construction machine in a detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera.
[0100] Among them, the schematic diagram of construction machinery imaging is as follows Figure 8 and Fig. 9 As shown, K represents the vertex of the construction machinery in the detection frame corresponding to the first binocular camera; O′ represents the optical center of the right monocular camera in the first binocular camera; O represents the center of the detection frame corresponding to the first binocular camera; OO′ represents the optical axis, and its length value is equal to the focal length value of the first binocular camera; OK represents the first straight-line distance between the vertex K of the construction machinery in the detection frame corresponding to the first binocular camera and the center O of the detection frame corresponding to the first binocular camera.
[0101] Step 704: Acquire a tangent value of a first relative angle based on the first straight-line distance and the focal length of the first binocular camera.
[0102] The focal length of the first binocular camera is equal to the length of the optical axis OO'. The ratio of the first straight line distance OK to the focal length of the first binocular camera is the tangent value of the first relative angle. The mathematical expression of the tangent value of the first relative angle is:
[0103] Step 706: Obtain the first relative angle based on the inverse tangent function and the tangent value of the first relative angle.
[0104] Among them, the inverse tangent function of the tangent value of the first relative angle is the first relative angle. The mathematical expression of the first relative angle is:
[0105] In this embodiment, based on the focal length value of the first binocular camera and the first straight-line distance between the construction machinery vertex in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera, the first relative angle between the line connecting the construction machinery vertex in the detection frame corresponding to the first binocular camera and the optical center of the first binocular camera and the optical axis of the first binocular camera is obtained. The calculation method is simple, and the distance between the line connecting the construction machinery vertex in the detection frame corresponding to the first binocular camera and the optical center of the first binocular camera obtained based on the traditional binocular ranging principle is not used, and the calculation result is more accurate.
[0106] In one embodiment, Fig.10 As shown, obtaining a first straight-line distance between a vertex of a construction machine in a detection frame corresponding to a first binocular camera and a center of the detection frame corresponding to the first binocular camera comprises the following steps:
[0107] Step 1002: Obtain a rectangle with a diagonal line connecting the vertices of the construction machine in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera.
[0108] in, Figure 8 and Fig. 9 The rectangle OQKR shown represents a rectangle with the line connecting the vertex K of the construction machinery in the detection frame corresponding to the first binocular camera and the center O of the detection frame corresponding to the first binocular camera as the diagonal line; OQ represents the length value of the rectangle OQKR; OR represents the width value of the rectangle OQKR.
[0109] Step 1004, obtaining the length and width of the rectangle.
[0110] Step 1006: Based on the Pythagorean theorem, determine the first straight-line distance between the vertex of the construction machine in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera according to the length value and the width value of the rectangle.
[0111] Among them, the first straight-line distance between the vertex of the construction machinery in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera is the diagonal of the rectangle OQKR, and the first straight-line distance is determined based on the Pythagorean theorem and the length and width values of the rectangle.
[0112] Specifically, the mathematical expression of the first straight-line distance is:
[0113] In this embodiment, a rectangle is constructed with the line connecting the vertices of the construction machinery in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera as the diagonal line. The first straight-line distance between the vertices of the construction machinery in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera is determined based on the Pythagorean theorem and the length and width values of the rectangle. The calculation method is simple.
[0114] In one embodiment, Fig.11 As shown, obtaining the length and width of a rectangle includes the following steps:
[0115] Step 1102, obtaining a length ratio relationship formula and a width ratio relationship formula between the rectangle and the detection frame corresponding to the first binocular camera.
[0116] Among them, Figure 8 As shown, M represents the length value of the detection frame corresponding to the first binocular camera; N represents the width value of the detection frame corresponding to the first binocular camera.
[0117] Specifically, the length ratio relationship between the rectangle and the detection frame corresponding to the first binocular camera is the ratio between the length value of the rectangle and the length value of the detection frame corresponding to the first binocular camera. The mathematical expression of the length ratio relationship is expressed as:
[0118] The width ratio relationship between the rectangle and the detection frame corresponding to the first binocular camera is the ratio between the width value of the rectangle and the width value of the detection frame corresponding to the first binocular camera. The mathematical expression of the width ratio relationship is expressed as:
[0119] Step 1104: Obtain a first angle value based on a proportional relationship between a horizontal field of view angle and a length of the first binocular camera.
[0120] Among them, the horizontal field of view angle of the first binocular camera is a known parameter. Indicates the horizontal field of view of the first binocular camera.
[0121] Specifically, Fig. 9 As shown, the first angle value is determined by multiplying the horizontal field angle of the first binocular camera by the length ratio relationship. The mathematical expression of the first angle value is expressed as: α represents the first angle value.
[0122] Step 1106: Obtain a second angle value based on a proportional relationship between the vertical field of view angle and the width of the first binocular camera.
[0123] The vertical field angle of the first binocular camera is a known parameter, and in this embodiment, γ is used to represent the vertical field angle of the first binocular camera.
[0124] Specifically, Fig. 9 As shown, the second angle value is determined by multiplying the vertical field angle of the first binocular camera by the width ratio relationship. The mathematical expression of the second angle value is expressed as: β represents the second angle value.
[0125] Step 1108: Obtain a length value of the rectangle based on the tangent value of the first angle value and the focal length value of the first binocular camera.
[0126] Specifically, the product of the tangent value of the first angle value and the focal length value of the first binocular camera determines the length value of the rectangle. The mathematical expression of the length value of the rectangle is expressed as: |OQ|=tanα·|OO′|.
[0127] Step 1110: Obtain a width value of the rectangle based on the tangent value of the second angle value and the focal length value of the first binocular camera.
[0128] Specifically, the product of the tangent value of the second angle value and the focal length value of the first binocular camera determines the width value of the rectangle. The mathematical expression of the width value of the rectangle is expressed as: |OR|=tanβ·|OO′|. The mathematical expression of the first straight line distance is:
[0129] In one embodiment, Fig.12As shown, according to the relative distance and angle between the two binocular cameras, determining the distance between the position of the top of the construction machinery and the transmission line includes the following steps:
[0130] Step 1202, based on the relative distance and the angle, calculate the second straight-line distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras.
[0131] Among them, the traditional binocular ranging principle directly measures the distance between the vertex of the construction machinery and the optical center of one of the binocular cameras. This method is affected by the baseline and light of the binocular camera when measuring at a long distance, resulting in a large error in the measured distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras. This step calculates the distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras based on the relative distance and the angle. Compared with the traditional binocular ranging method, it has higher accuracy and is not affected by the baseline and light of the binocular camera.
[0132] Specifically, the line connecting the construction machinery vertex and the optical centers of the two binocular cameras, and the relative distance between the two binocular cameras form a triangle; the relative distance between the two binocular cameras, and the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera are obtained, the relative distance between the two binocular cameras is the base of the triangle, and the angles between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera are respectively the two angles of the triangle. Since a base and two angles of the triangle are known, the second straight-line distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras can be determined based on the trigonometric function relationship, the relative distance between the two binocular cameras, and the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera.
[0133] Step 1204, based on the sine value of the angle and the second straight-line distance, obtain the distance between the position of the construction machinery vertex and the transmission line.
[0134] Specifically, the angle between the line connecting the optical center of one of the binocular cameras and the vertex of the construction machinery and the optical axis of the binocular camera is obtained, as well as the second straight-line distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras, and the distance between the position of the vertex of the construction machinery and the transmission line is obtained based on the product of the sine value of the angle and the second straight-line distance.
[0135] In this embodiment, based on the relative distance between the two binocular cameras and the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera, the second straight-line distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras is determined. Compared with the traditional method of directly obtaining the second straight-line distance based on the binocular ranging principle, the method has higher accuracy and is not affected by the baseline and light of the binocular camera.
[0136] In one embodiment, the second straight-line distance between the vertex of a construction machine in a detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras is calculated based on the relative distance and the angle, including the following steps: obtaining the second straight-line distance based on the relative distance, the angle and a preset relationship; the preset relationship includes a mapping relationship between relative distance variables, angle variables and straight-line distance variables.
[0137] Among them, the second straight-line distance can be the straight-line distance between the vertex of the construction machinery in the detection frame corresponding to the first binocular camera and the optical center of the first binocular camera, or it can be the straight-line distance between the vertex of the construction machinery in the detection frame corresponding to the second binocular camera and the optical center of the second binocular camera.
[0138] Specifically, the preset relationship may be:
[0139]
[0140] In the formula, A represents the relative distance between the two binocular cameras; B represents the straight-line distance between the vertex of the construction machine in the detection frame corresponding to the first binocular camera and the optical center of the first binocular camera; C represents the straight-line distance between the vertex of the construction machine in the detection frame corresponding to the second binocular camera and the optical center of the second binocular camera; δ 1 represents the angle between the optical center of the first binocular camera and the line connecting the vertices of the construction machinery in the detection frame corresponding to the first binocular camera and the optical axis of the first binocular camera; δ 2 The angle between the optical center of the second binocular camera and the line connecting the vertices of the construction machinery in the detection frame corresponding to the second binocular camera and the optical axis of the second binocular camera is shown in Figure 1. B or C can be calculated by the preset relationship to obtain the second straight-line distance.
[0141] The distance between the top position of the construction machinery and the transmission line is expressed by the mathematical expression: E = sinδ 1 B = sinδ 2 ·C, where E represents the distance between the location of the top of the construction machine and the transmission line.
[0142] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0143] Based on the same inventive concept, this embodiment also provides a camera-based transmission line distance measurement device for implementing the camera-based transmission line distance measurement method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations of one or more camera-based transmission line distance measurement device embodiments provided below can refer to the limitations of the camera-based transmission line distance measurement method above, and will not be repeated here.
[0144] In one embodiment, Fig.13 As shown, a camera-based transmission line distance measuring device is provided, comprising: a first acquisition module, a second acquisition module and a determination module, wherein:
[0145] The first acquisition module is used to calibrate each binocular camera respectively, and then obtain the image depth map of each binocular camera based on the parallax relationship; binarize the image depth map corresponding to each binocular camera based on a preset binarization threshold to obtain a binarized image, traverse each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera from top to bottom, and determine the construction machinery vertices based on the pixel points corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel point where the pixel value of the first value appears for the first time.
[0146] The second acquisition module is used to obtain the angle between the optical center of each binocular camera and the line connecting the vertices of the construction machinery and the optical axis of the binocular camera according to the images captured by the two binocular cameras.
[0147] The determination module is used to determine the distance between the position of the top of the construction machinery and the transmission line according to the relative distance and angle between the two binocular cameras.
[0148] In one embodiment, the camera-based transmission line distance measuring device further includes a first relative angle acquisition module and a second relative angle acquisition module, wherein:
[0149] The first relative angle acquisition module is used to obtain a first relative angle between a line connecting a vertex of the construction machinery in a detection frame corresponding to the first binocular camera and the optical center of the first binocular camera and the optical axis of the first binocular camera.
[0150] The second relative angle acquisition module is used to obtain the second relative angle between the vertex of the construction machinery in the detection frame corresponding to the second binocular camera and the optical center connection line of the second binocular camera, and the optical axis of the second binocular camera.
[0151] In one embodiment, the camera-based transmission line distance measuring device further includes: a first straight-line distance acquisition module, a first calculation module and a second calculation module, wherein:
[0152] The first straight-line distance acquisition module is used to acquire the first straight-line distance between the vertex of the construction machinery in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera.
[0153] The first calculation module is used to obtain the tangent value of the first relative angle based on the first straight-line distance and the focal length value of the first binocular camera.
[0154] The second calculation module is used to obtain the first relative angle based on the inverse tangent function and the tangent value of the first relative angle.
[0155] In one embodiment, the camera-based transmission line distance measuring device further includes: a construction module, a third acquisition module, and a third calculation module, wherein:
[0156] A construction module is used to obtain a rectangle with the diagonal line connecting the vertices of the construction machinery in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera.
[0157] The third acquisition module is used to obtain the length and width of the rectangle.
[0158] The third calculation module is used to determine the first straight-line distance between the vertex of the construction machinery in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera based on the Pythagorean theorem and the length and width of the rectangle.
[0159] In one embodiment, the camera-based transmission line distance measuring device further includes: a relational module, a first angle value acquisition module, a second angle value acquisition module, a rectangle length calculation module, and a rectangle width calculation module, wherein:
[0160] The relational expression module is used to obtain a length ratio relational expression and a width ratio relational expression between a rectangle and a detection frame corresponding to the first binocular camera.
[0161] The first angle value acquisition module is used to acquire the first angle value based on the horizontal field angle and length ratio relationship of the first binocular camera.
[0162] The second angle value acquisition module is used to acquire the second angle value based on the vertical field angle and width ratio relationship of the first binocular camera.
[0163] The rectangle length calculation module obtains the length value of the rectangle based on the tangent value of the first angle value and the focal length value of the first binocular camera.
[0164] The rectangle width calculation module is used to obtain the width value of the rectangle based on the tangent value of the second angle value and the focal length value of the first binocular camera.
[0165] In one embodiment, the camera-based transmission line distance measuring device further includes: a second straight-line distance acquisition module and a fourth calculation module, wherein:
[0166] The second straight-line distance acquisition module is used to calculate the second straight-line distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras based on the relative distance and the angle.
[0167] The fourth calculation module is used to obtain the distance between the position of the construction machinery vertex and the transmission line based on the sine value of the angle and the second straight-line distance.
[0168] In one embodiment, the camera-based transmission line distance measuring device also includes: a mapping module for obtaining a second straight-line distance based on a relative distance, an angle and a preset relationship; the preset relationship includes a mapping relationship between relative distance variables, angle variables and straight-line distance variables.
[0169] Each module in the above-mentioned camera-based transmission line distance measuring device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0170] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.14As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a camera-based transmission line ranging method is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0171] Those skilled in the art will understand that Fig.14 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0172] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0173] After calibrating each binocular camera, the depth map of each binocular camera is obtained based on the parallax relationship.
[0174] Based on a preset binarization threshold, the image depth map corresponding to each binocular camera is binarized to obtain a binarized image, and each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera is traversed from top to bottom in turn, and the construction machinery vertex is determined based on the pixel points corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel points where the pixel value of the first value appears for the first time;
[0175] According to the images taken by the two binocular cameras, the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera is obtained respectively;
[0176] According to the relative distance and angle between the two binocular cameras, the distance between the position of the top of the construction machinery and the transmission line is determined.
[0177] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0178] Obtain a first relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the first binocular camera and an optical center of the first binocular camera and an optical axis of the first binocular camera;
[0179] Obtain a second relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the second binocular camera and the optical center of the second binocular camera and an optical axis of the second binocular camera;
[0180] According to the relative distance and angle between the two binocular cameras, the distance between the top position of the construction machinery and the transmission line is determined, including:
[0181] The distance between the position of the vertex of the construction machine and the power transmission line is acquired based on the relative distance, the first relative angle, and the second relative angle.
[0182] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0183] Obtaining a first straight-line distance between a vertex of the construction machine in a detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera;
[0184] Based on the first straight-line distance and the focal length of the first binocular camera, obtaining a tangent value of a first relative angle;
[0185] The first relative angle is acquired based on the inverse tangent function and the tangent value of the first relative angle.
[0186] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0187] Obtain a rectangle with the diagonal line of the line connecting the vertices of the construction machine in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera;
[0188] Get the length and width of the rectangle;
[0189] Based on the Pythagorean theorem, a first straight-line distance between a vertex of the construction machinery in a detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera is determined according to the length and width of the rectangle.
[0190] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0191] Obtain a length ratio relationship formula and a width ratio relationship formula of the rectangle and the detection frame corresponding to the first binocular camera;
[0192] Based on a relationship between a horizontal field of view angle and a length ratio of the first binocular camera, obtaining a first angle value;
[0193] Based on the vertical field of view angle and width ratio relationship of the first binocular camera, obtain a second angle value;
[0194] Obtaining a length value of the rectangle based on a tangent value of the first angle value and a focal length value of the first binocular camera;
[0195] Based on the tangent value of the second angle value and the focal length value of the first binocular camera, a width value of the rectangle is obtained.
[0196] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0197] Based on the relative distance and the angle, a second straight-line distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras is calculated;
[0198] Based on the sine value of the angle and the second straight-line distance, the distance between the position of the construction machinery vertex and the transmission line is obtained.
[0199] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0200] The second straight-line distance is obtained based on the relative distance, the angle and a preset relationship; the preset relationship includes a mapping relationship between the relative distance variable, the angle variable and the straight-line distance variable.
[0201] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0202] After calibrating each binocular camera, the depth map of each binocular camera is obtained based on the parallax relationship.
[0203] Based on a preset binarization threshold, the image depth map corresponding to each binocular camera is binarized to obtain a binarized image, and each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera is traversed from top to bottom in turn, and the construction machinery vertex is determined based on the pixel points corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel points where the pixel value of the first value appears for the first time;
[0204] According to the images taken by the two binocular cameras, the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera is obtained respectively;
[0205] According to the relative distance and angle between the two binocular cameras, the distance between the position of the top of the construction machinery and the transmission line is determined.
[0206] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0207] Obtain a first relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the first binocular camera and an optical center of the first binocular camera and an optical axis of the first binocular camera;
[0208] Obtain a second relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the second binocular camera and the optical center of the second binocular camera and an optical axis of the second binocular camera;
[0209] According to the relative distance and angle between the two binocular cameras, the distance between the top position of the construction machinery and the transmission line is determined, including:
[0210] The distance between the position of the vertex of the construction machine and the power transmission line is acquired based on the relative distance, the first relative angle, and the second relative angle.
[0211] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0212] Obtaining a first straight-line distance between a vertex of the construction machine in a detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera;
[0213] Based on the first straight-line distance and the focal length of the first binocular camera, obtaining a tangent value of a first relative angle;
[0214] The first relative angle is acquired based on the inverse tangent function and the tangent value of the first relative angle.
[0215] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0216] Obtain a rectangle with the diagonal line of the line connecting the vertices of the construction machine in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera;
[0217] Get the length and width of the rectangle;
[0218] Based on the Pythagorean theorem, a first straight-line distance between a vertex of the construction machinery in a detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera is determined according to the length and width of the rectangle.
[0219] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0220] Obtain a length ratio relationship formula and a width ratio relationship formula of the rectangle and the detection frame corresponding to the first binocular camera;
[0221] Based on a relationship between a horizontal field of view angle and a length ratio of the first binocular camera, obtaining a first angle value;
[0222] Based on the vertical field of view angle and width ratio relationship of the first binocular camera, obtain a second angle value;
[0223] Obtaining a length value of the rectangle based on a tangent value of the first angle value and a focal length value of the first binocular camera;
[0224] Based on the tangent value of the second angle value and the focal length value of the first binocular camera, a width value of the rectangle is obtained.
[0225] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0226] Based on the relative distance and the angle, a second straight-line distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras is calculated;
[0227] Based on the sine value of the angle and the second straight-line distance, the distance between the position of the construction machinery vertex and the transmission line is obtained.
[0228] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0229] The second straight-line distance is obtained based on the relative distance, the angle and a preset relationship; the preset relationship includes a mapping relationship between the relative distance variable, the angle variable and the straight-line distance variable.
[0230] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0231] After calibrating each binocular camera, the depth map of each binocular camera is obtained based on the parallax relationship.
[0232] Based on a preset binarization threshold, the image depth map corresponding to each binocular camera is binarized to obtain a binarized image, and each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera is traversed from top to bottom in turn, and the construction machinery vertex is determined based on the pixel points corresponding to the target row in each binarized image; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel points where the pixel value of the first value appears for the first time;
[0233] According to the images taken by the two binocular cameras, the angle between the line connecting the optical center of each binocular camera and the vertex of the construction machinery and the optical axis of the binocular camera is obtained respectively;
[0234] According to the relative distance and angle between the two binocular cameras, the distance between the position of the top of the construction machinery and the transmission line is determined.
[0235] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0236] Obtain a first relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the first binocular camera and an optical center of the first binocular camera and an optical axis of the first binocular camera;
[0237] Obtain a second relative angle between a line connecting a vertex of the construction machine in a detection frame corresponding to the second binocular camera and the optical center of the second binocular camera and an optical axis of the second binocular camera;
[0238] According to the relative distance and angle between the two binocular cameras, the distance between the top position of the construction machinery and the transmission line is determined, including:
[0239] The distance between the position of the vertex of the construction machine and the power transmission line is acquired based on the relative distance, the first relative angle, and the second relative angle.
[0240] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0241] Obtaining a first straight-line distance between a vertex of the construction machine in a detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera;
[0242] Based on the first straight-line distance and the focal length of the first binocular camera, obtaining a tangent value of a first relative angle;
[0243] The first relative angle is acquired based on the inverse tangent function and the tangent value of the first relative angle.
[0244] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0245] Obtain a rectangle with the diagonal line of the line connecting the vertices of the construction machine in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera;
[0246] Get the length and width of the rectangle;
[0247] Based on the Pythagorean theorem, a first straight-line distance between a vertex of the construction machinery in a detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera is determined according to the length and width of the rectangle.
[0248] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0249] Obtain a length ratio relationship formula and a width ratio relationship formula of the rectangle and the detection frame corresponding to the first binocular camera;
[0250] Based on a relationship between a horizontal field of view angle and a length ratio of the first binocular camera, obtaining a first angle value;
[0251] Based on the vertical field of view angle and width ratio relationship of the first binocular camera, obtain a second angle value;
[0252] Obtaining a length value of the rectangle based on a tangent value of the first angle value and a focal length value of the first binocular camera;
[0253] Based on the tangent value of the second angle value and the focal length value of the first binocular camera, a width value of the rectangle is obtained.
[0254] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0255] Based on the relative distance and the angle, a second straight-line distance between the vertex of the construction machinery in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras is calculated;
[0256] Based on the sine value of the angle and the second straight-line distance, the distance between the position of the construction machinery vertex and the transmission line is obtained.
[0257] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0258] The second straight-line distance is obtained based on the relative distance, the angle and a preset relationship; the preset relationship includes a mapping relationship between the relative distance variable, the angle variable and the straight-line distance variable.
[0259] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0260] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0261] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0262] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A camera-based transmission line distance measurement method, It is characterized in that The method comprises: After calibrating the two binocular cameras installed on the transmission line, the depth map of each binocular camera is obtained based on the parallax relationship; the two binocular cameras are respectively installed on the spacer bars, the spacer bars connect the transmission line together, and the two binocular cameras installed on the two spacer bars are used to detect the distance between the top of the construction machinery under the transmission line between the two spacer bars and the transmission line; the optical axes of the two binocular cameras are parallel to the transmission line; Based on a preset binarization threshold, a binarization process is performed on the image depth map corresponding to each binocular camera to obtain a binarized image, and each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera is traversed from top to bottom in turn to determine the pixel points corresponding to the target row in each of the binarized images. If the target row has only one pixel point with a first pixel value, the pixel point with the first pixel value is judged to be the vertex of the construction machinery; if the target row includes multiple pixel points with the first pixel value, the middle point is determined based on the average value between the multiple pixel points with the first pixel value in the target row, and the middle point is judged to be the vertex of the construction machinery; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel point with the first pixel value for the first time; the first value indicates that the pixel value is 1, and the pixel point with the pixel value of 1 in the binarized image is the pixel point of the construction machinery; the image data of the binarized image is a multidimensional array, the rows and columns of the multidimensional array represent the two-dimensional coordinates of the pixel points corresponding to the array, and the elements of the multidimensional array are the depth values of the pixel points corresponding to the array; Obtain a first straight-line distance between the vertex of the construction machinery in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera; obtain a tangent value of a first relative angle based on the first straight-line distance and the focal length of the first binocular camera; obtain the first relative angle based on an inverse tangent function and the tangent value of the first relative angle; the detection frame is the image area where the construction machinery body is located; Acquire a second relative angle between a line connecting the vertex of the construction machine in a detection frame corresponding to the second binocular camera and the optical center of the second binocular camera and an optical axis of the second binocular camera; The distance between the position of the vertex of the construction machinery and the power transmission line is acquired based on the relative distance between the two binocular cameras, the first relative angle and the second relative angle.
2. The camera-based transmission line distance measurement method according to claim 1, It is characterized in that The step of obtaining a first straight-line distance between the vertex of the construction machine in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera includes: Obtain a rectangle with a diagonal line connecting the vertices of the construction machine in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera; Get the length and width of the rectangle. Based on the Pythagorean theorem, a first straight-line distance between the vertex of the construction machine in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera is determined according to the length value and the width value of the rectangle.
3. The camera-based transmission line distance measurement method according to claim 2, It is characterized in that The obtaining of the length and width of the rectangle includes: Obtain a length ratio relationship formula and a width ratio relationship formula between the rectangle and the detection frame corresponding to the first binocular camera; Based on a proportional relationship between the horizontal field of view angle and the length of the first binocular camera, obtaining a first angle value; Based on the vertical field of view angle and width ratio relationship of the first binocular camera, obtaining a second angle value; Acquire a length value of the rectangle based on a tangent value of the first angle value and a focal length value of the first binocular camera; Based on the tangent value of the second angle value and the focal length value of the first binocular camera, a width value of the rectangle is acquired.
4. The camera-based transmission line distance measurement method according to claim 1, It is characterized in that The method of obtaining the distance between the position of the top of the construction machine and the transmission line based on the relative distance between the two binocular cameras, the first relative angle and the second relative angle comprises: Based on the relative distance between the two binocular cameras, the first relative angle, and the second relative angle, calculating a second straight-line distance between the vertex of the construction machine in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras; Based on the sine value of one of the first relative angle and the second relative angle and the second straight-line distance, the distance between the position of the vertex of the construction machinery and the transmission line is obtained.
5. The camera-based transmission line distance measurement method according to claim 4, It is characterized in that The method of calculating the second straight-line distance between the vertex of the construction machine in the detection frame corresponding to one of the binocular cameras and the optical center of one of the binocular cameras based on the relative distance between the two binocular cameras, the first relative angle, and the second relative angle includes: The second straight-line distance is obtained based on the relative distance, the first relative angle, the second relative angle and a preset relationship; the preset relationship includes a mapping relationship between a relative distance variable, an angle variable and a straight-line distance variable.
6. A camera-based transmission line distance measuring device, It is characterized in that The device comprises: The first acquisition module is used to calibrate two binocular cameras installed on the transmission line respectively, and then obtain the image depth map of each binocular camera based on the parallax relationship; the two binocular cameras are respectively installed on the spacer bars, the spacer bars connect the transmission line together, and the two binocular cameras installed on the two spacer bars are used to detect the distance between the top of the construction machinery under the transmission line between the two spacer bars and the transmission line; the optical axes of the two binocular cameras are parallel to the transmission line; based on the preset binarization threshold, the image depth map corresponding to each binocular camera is binarized to obtain a binarized image, and each row of pixel points of the binarized image corresponding to the detection frame of each binocular camera is traversed from top to bottom in turn, and the pixel points corresponding to the target row in each binarized image are determined, and if the target row has only one pixel value If a pixel point has a first value, the pixel point with the first value is judged to be the vertex of the construction machinery; if the target row includes multiple pixel points with the first value, the middle point is determined based on the average value of the multiple pixel points with the first value in the target row, and the middle point is judged to be the vertex of the construction machinery; the detection frame corresponding to the binocular camera is the image area where the construction machinery body is located; the target row includes the pixel point with the first value appearing for the first time; the first value indicates that the pixel value is 1, and the pixel point with the pixel value of 1 in the binary image is the pixel point of the construction machinery; the image data of the binary image is a multidimensional array, the rows and columns of the multidimensional array represent the two-dimensional coordinates of the pixel points corresponding to the array, and the elements of the multidimensional array are the depth values of the pixel points corresponding to the array; The second acquisition module is used to obtain the first straight-line distance between the vertex of the construction machinery in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera; based on the first straight-line distance and the focal length value of the first binocular camera, obtain the tangent value of the first relative angle; based on the inverse tangent function and the tangent value of the first relative angle, obtain the first relative angle; the detection frame is the image area where the construction machinery body is located; obtain the second relative angle between the vertex of the construction machinery in the detection frame corresponding to the second binocular camera and the optical center connection line of the second binocular camera, and the optical axis of the second binocular camera; A determination module is used to obtain the distance between the position of the vertex of the construction machinery and the transmission line based on the relative distance, the first relative angle and the second relative angle.
7. The transmission line distance measuring device according to claim 6, It is characterized in that The device further includes a construction module, a third acquisition module, and a third calculation module, wherein: A construction module, used to obtain a rectangle with a diagonal line connecting a vertex of the construction machinery in the detection frame corresponding to the first binocular camera and a center of the detection frame corresponding to the first binocular camera; The third acquisition module is used to obtain the length and width of the rectangle; The third calculation module is used to determine the first straight-line distance between the vertex of the construction machinery in the detection frame corresponding to the first binocular camera and the center of the detection frame corresponding to the first binocular camera based on the Pythagorean theorem and the length and width of the rectangle.
8. The transmission line distance measuring device according to claim 6, It is characterized in that The device further includes a relational expression module, a first angle value acquisition module, a second angle value acquisition module, a rectangle length calculation module, and a rectangle width calculation module, wherein: A relational expression module, used to obtain a length ratio relational expression and a width ratio relational expression between a rectangle and a detection frame corresponding to the first binocular camera; A first angle value acquisition module, used to acquire a first angle value based on a proportional relationship between a horizontal field of view angle and a length of the first binocular camera; A second angle value acquisition module, used to acquire a second angle value based on a ratio relationship between a vertical field of view angle and a width of the first binocular camera; A rectangle length calculation module, which obtains the length value of the rectangle based on the tangent value of the first angle value and the focal length value of the first binocular camera; The rectangle width calculation module is used to obtain the width value of the rectangle based on the tangent value of the second angle value and the focal length value of the first binocular camera.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
