Method, device and equipment for measuring object in oil and gas well and storage medium
By using monocular image acquisition devices and similar triangle theorems in oil and gas wells, the three-dimensional coordinates and dimension data of target objects in oil and gas wells is solved, and the problem of precision and complex operation of measurement equipment in the prior art is achieved, and an efficient and low-cost measurement process is achieved.
Patent Information
- Application Number
- CN202311089170.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-25
- Publication Date
- 2025-02-25
AI Technical Summary
In the prior art, the equipment for measuring target objects in the oil and gas well is relatively precise and complex in operation, which requires high operating level of the measuring personnel, resulting in low measurement efficiency.
The monocular image acquisition device is used to calculate the dimension data of the target object by acquiring the target image, determining the two-dimensional coordinates of the endpoint of the target object, calculating the three-dimensional coordinates based on the similar triangle theorem, and calculating the dimension data of the target object using the internal reference matrix and coordinate conversion algorithm.
Reduces the requirements for image acquisition devices, simplifies deployment and operation, improves measurement efficiency, and reduces computing power costs.
Smart Images

Figure CN119507887A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of oil and gas field exploration and development, and in particular to a method, device, equipment and storage medium for measuring objects in oil and gas wells. Background Art
[0002] In the process of oil, shale gas and natural gas exploration and production, it is necessary to accurately measure the dimensions of the target objects in the oil and gas wells. For example, the size of the perforation directly affects the oil yield, so it is necessary to measure the size of the perforation in the oil and gas well to determine whether the perforation has been deformed by the underground pressure.
[0003] At present, the equipment for measuring target objects in oil and gas wells is relatively sophisticated and complex to operate, requiring high operating skills of the measurement personnel, and also resulting in low efficiency in measuring target objects in oil and gas wells. Summary of the invention
[0004] The present application provides a method, device, equipment and storage medium for measuring objects in oil and gas wells, which are used to solve the problem that the equipment for measuring target objects in oil and gas wells is relatively sophisticated and complicated to operate, which requires a high level of operation from the measurement personnel and also leads to low efficiency in measuring target objects in oil and gas wells.
[0005] In a first aspect, the present application provides a method for measuring an object in an oil and gas well, comprising:
[0006] Acquire a target image acquired by a monocular image acquisition device; the optical axis of the target acquisition device coincides with the central axis of the oil and gas well;
[0007] Determine the two-dimensional coordinates of multiple endpoints of the target object in the target image;
[0008] According to the similar triangle theorem, the height coordinates of each endpoint in the three-dimensional coordinates are determined based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint;
[0009] Substituting the internal parameter matrix of the monocular image acquisition device and the height coordinates of each endpoint in the three-dimensional coordinates into a preset coordinate conversion algorithm to convert the two-dimensional coordinates of each endpoint into the abscissa and ordinate of the three-dimensional coordinates of each endpoint;
[0010] The size data of the target object is calculated based on the three-dimensional coordinates of each endpoint.
[0011] Optionally, the target object is circular, and the size data of the target object includes a diameter; determining the two-dimensional coordinates of multiple endpoints of the target object in the target image includes: determining the endpoint of the target object with a higher ordinate value in the target image as a high end point, and determining the endpoint of the target object with a lower ordinate value in the target image as a low end point; determining the two-dimensional coordinates of the high end point and the low end point in the target image respectively; calculating the size data of the target object based on the three-dimensional coordinates of each endpoint includes: substituting the three-dimensional coordinates of the high end point in the target image and the three-dimensional coordinates of the low end point in the target image into a distance formula between two points in space, and determining the calculation result of the distance formula between two points in space as the diameter of the target object.
[0012] Optionally, the target object is circular, and the target object endpoint with a higher ordinate value in the target image is determined as a high end point, and the target object endpoint with a lower ordinate value in the target image is determined as a low end point, including: using target detection technology to identify the target object in the target image to obtain a detection frame of the target object; determining the endpoint that intersects with the upper boundary of the detection frame of the target object as the high end point; and determining the endpoint that intersects with the lower boundary of the detection frame of the target object as the low end point.
[0013] Optionally, the method also includes: a step of establishing a coordinate system; the step of establishing a coordinate system includes: determining the optical center of the target acquisition device as the origin of the world coordinate system, and establishing the world coordinate system; the three-dimensional coordinates of each endpoint are the world coordinates of each endpoint in the world coordinate system; determining the intersection of the optical axis of the target acquisition device and the imaging plane as the origin of the image coordinate system, and establishing the image coordinate system on the imaging plane of the target acquisition device; determining the upper left corner of the target image as the origin of the pixel coordinate system, and establishing the pixel coordinate system on the target image; the step of determining the two-dimensional coordinates of multiple endpoints of the target object in the target image includes: determining the pixel coordinates of multiple endpoints of the target object in the pixel coordinate system, and determining the pixel coordinates as the two-dimensional coordinates in the target image.
[0014] Optionally, the method of determining the height coordinates of each endpoint in the three-dimensional coordinates based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint according to the similar triangle theorem includes:
[0015] The distance W between each endpoint and the origin of the image coordinate system in the target image is calculated based on the two-dimensional coordinates of each endpoint; the focal length f of the monocular image acquisition device, the radius R of the oil and gas well, and the distance W between each endpoint and the origin of the image coordinate system are substituted into the height coordinate calculation formula, and the calculation result of the height coordinate calculation formula is determined as the height coordinate in the three-dimensional coordinate of each endpoint; the height coordinate calculation formula is pre-configured based on the similar triangle theorem, and the height coordinate calculation formula is:
[0016]
[0017] Among them, Z is the height coordinate, R is the radius of the oil and gas well, and f is the focal length of the monocular image acquisition device.
[0018] Optionally, the method of converting the two-dimensional coordinates of each endpoint into the abscissa and ordinate in the three-dimensional coordinates of each endpoint based on the intrinsic parameter matrix of the monocular image acquisition device, the height coordinate in the three-dimensional coordinates of each endpoint and a preset coordinate conversion algorithm includes:
[0019] Substitute the intrinsic parameter matrix of the monocular image acquisition device, the height coordinates in the three-dimensional coordinates of each endpoint, and the two-dimensional coordinates of each endpoint into the preset pixel world coordinate conversion model to obtain the pixel world coordinate conversion model to be calculated; the intrinsic parameter matrix of the monocular image acquisition device is a 3*4 matrix; the preset pixel world coordinate conversion model is predetermined based on the mapping relationship between the pixel coordinate system and the image coordinate system, and the mapping relationship between the image coordinate system and the world coordinate system; the pixel world coordinate conversion model to be calculated is split and solved to obtain the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint; the preset pixel world coordinate conversion model is:
[0020]
[0021] Among them, M is the internal parameter matrix of the monocular image acquisition device, u is the horizontal coordinate of each endpoint in the two-dimensional coordinates, v is the vertical coordinate of each endpoint in the two-dimensional coordinates, X is the horizontal coordinate of each endpoint in the three-dimensional coordinates, and Y is the vertical coordinate of each endpoint in the three-dimensional coordinates.
[0022] Optionally, after converting the two-dimensional coordinates of each endpoint into the horizontal and vertical coordinates in the three-dimensional coordinates of each endpoint based on the internal parameter matrix of the monocular image acquisition device, the height coordinates in the three-dimensional coordinates of each endpoint and the preset coordinate conversion algorithm, it also includes: obtaining a preset cylindrical surface space equation; the parameters in the preset cylindrical surface space equation are pre-determined by fitting the cylindrical surface of the oil and gas well in the world coordinate system based on the least squares method; the horizontal and vertical coordinates in the three-dimensional coordinates of each endpoint are substituted into the preset cylindrical surface space equation to calculate the fitted height coordinates of each endpoint; the measurement error is determined based on the fitted height coordinates of each endpoint and the height coordinates in the three-dimensional coordinates of each endpoint; the size data of the target object is calculated according to the three-dimensional coordinates of each endpoint, including: if it is determined that the measurement error is less than the preset error threshold, the size data of the target object is calculated according to the three-dimensional coordinates of each endpoint.
[0023] In a second aspect, the present application provides a device for measuring an object in an oil and gas well, comprising:
[0024] An acquisition module, used to acquire a target image acquired by a monocular image acquisition device; the optical axis of the monocular image acquisition device coincides with the central axis of the oil and gas well;
[0025] A determination module, used to determine the two-dimensional coordinates of multiple endpoints of a target object in a target image; the target object is located on the inner wall of an oil and gas well;
[0026] A height calculation module is used to determine the height coordinates of each endpoint in the three-dimensional coordinates according to the similar triangle theorem based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint;
[0027] A coordinate conversion module, used to substitute the internal parameter matrix of the monocular image acquisition device and the height coordinates in the three-dimensional coordinates of each endpoint into a preset coordinate conversion algorithm to convert the two-dimensional coordinates of each endpoint into the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint;
[0028] The size calculation module is used to calculate the size data of the target object according to the three-dimensional coordinates of each endpoint.
[0029] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory and a transceiver communicatively connected to the processor;
[0030] The memory stores computer-executable instructions; the transceiver is used to send and receive data;
[0031] The processor executes the computer-executable instructions stored in the memory to implement the method for measuring objects in oil and gas wells described in any one of the above aspects.
[0032] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer execution instructions, and when the computer execution instructions are executed by a processor, they are used to implement the method for measuring objects in oil and gas wells described in any of the above aspects.
[0033] In a fifth aspect, the present application provides a computer program product, comprising computer execution instructions, which, when executed by a processor, implement the method for measuring objects in an oil and gas well as described in any of the above aspects.
[0034] The object measurement method, device, equipment and storage medium provided by the present application obtain the target image collected by the monocular image acquisition device; the optical axis of the monocular image acquisition device coincides with the central axis of the oil and gas well; the two-dimensional coordinates of multiple endpoints of the target object in the target image are determined; the target object is located on the inner wall of the oil and gas well; the height coordinates of each endpoint in the three-dimensional coordinates are determined based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint according to the similar triangle theorem; the internal parameter matrix of the monocular image acquisition device and the height coordinates in the three-dimensional coordinates of each endpoint are substituted into the preset coordinate conversion algorithm to convert the two-dimensional coordinates of each endpoint into the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint; the size data of the target object is calculated according to the three-dimensional coordinates of each endpoint. The monocular image acquisition device can be used to measure the object in the oil and gas well, which reduces the requirements for the image acquisition device, reduces the requirements for deploying and operating the monocular image acquisition device, and improves the efficiency of deploying and operating the monocular image acquisition device, thereby improving the efficiency of measuring the target object in the oil and gas well. Moreover, the algorithm used by the monocular image acquisition device requires less computing power than other devices, which greatly reduces the computing power cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0036] Figure 1 A flow chart of a method for measuring an object in an oil and gas well provided in an embodiment of the present application;
[0037] Figure 2 A schematic diagram of an application scenario provided for an embodiment of the present application;
[0038] Figure 3 A schematic diagram of a coordinate system provided for an embodiment of the present application;
[0039] Figure 4 A schematic diagram of object recognition in a target image provided by an embodiment of the present application;
[0040] Figure 5 A schematic diagram of target object mapping provided in an embodiment of the present application;
[0041] Figure 6 A schematic diagram of oil and gas well calibration provided in an embodiment of the present application;
[0042] Figure 7 A schematic diagram of the structure of an object measuring device in an oil and gas well provided in an embodiment of the present application;
[0043] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0044] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0045] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0046] The terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following embodiments, "multiple" means more than two, unless otherwise clearly and specifically defined.
[0047] First, the prior art involved in the present invention is described and analyzed in detail.
[0048] In recent years, the demand for measuring relevant target objects in oil and gas wells has been increasing in the exploration and exploitation of oil, shale gas and natural gas. The relatively accurate dimensional measurement of target objects in oil and gas wells is a prerequisite for the normal operation of equipment and the improvement of production capacity. Taking the perforation of oil and gas wells as an example, the perforation may be deformed after being squeezed by underground pressure. The deformed perforation directly affects the oil yield. At this time, it is necessary to measure the size of the perforation in real time to see if it meets the expected size standard.
[0049] At present, the commonly used distance measurement devices in the field of computer vision are mainly the following: laser radar, millimeter wave radar, structured light camera and ultrasonic sensor, etc. However, laser radar, millimeter wave radar, structured light camera and ultrasonic sensor are relatively precise and complex to operate, requiring high operating skills of the measurement personnel, and also leading to low efficiency in measuring target objects in oil and gas wells.
[0050] The inventor found in the research that the monocular camera has a simple structure, a small size and is easier to install and deploy, and requires less computing power than other equipment, which greatly reduces the computing power cost. Therefore, a monocular camera can be used to measure the size of the target object in the oil and gas well, and by installing the monocular camera on the central axis of the oil and gas well, the optical axis of the monocular camera coincides with the central axis of the oil and gas well, and the problem of inaccurate distance measurement by the monocular camera can be solved by combining the similar triangle theorem and the characteristics of the oil and gas well. Therefore, the present application provides a method for measuring objects in an oil and gas well, obtaining a target image acquired by a monocular image acquisition device; the optical axis of the target acquisition device coincides with the central axis of the oil and gas well; determining the two-dimensional coordinates of multiple endpoints of the target object in the target image; determining the height coordinates of each endpoint in the three-dimensional coordinates according to the similar triangle theorem based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint; substituting the internal parameter matrix of the monocular image acquisition device and the height coordinates of each endpoint in the three-dimensional coordinates into the preset coordinate conversion algorithm to convert the two-dimensional coordinates of each endpoint into the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint; and calculating the size data of the target object according to the three-dimensional coordinates of each endpoint.
[0051] 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, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0052] It should be noted that the method, device, equipment and storage medium for measuring objects in oil and gas wells of the present application can be used in the field of oil and gas field exploration and development, and can also be used in any field other than oil and gas field exploration and development. The application field of the method, device, equipment and storage medium for measuring objects in oil and gas wells of the present application is not limited.
[0053] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0054] Figure 1The flow chart of the method for measuring objects in oil and gas wells provided in the embodiment of the present application, the embodiment of the present application provides a method for measuring objects in oil and gas wells in view of the fact that the equipment for measuring target objects in oil and gas wells is relatively precise and complicated to operate, which requires a high level of operation of the measurement personnel and also leads to the problem of low efficiency in measuring target objects in oil and gas wells. The method in this embodiment is applied to a device for measuring objects in oil and gas wells, and the device for measuring objects in oil and gas wells can be located in an electronic device. Among them, the electronic device can be a digital computer representing various forms. Such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers.
[0055] like Figure 1 As shown, the specific steps of this method are as follows:
[0056] Step S101: Acquire a target image captured by a monocular image acquisition device.
[0057] The optical axis of the monocular image acquisition device coincides with the central axis of the oil and gas well. The target object is located on the inner wall of the oil and gas well.
[0058] In the embodiment of the present application, the monocular image acquisition device may be a monocular camera, specifically, it may be: a control ball in the security field, an audio and video recorder, an intelligent security camera, Ascend AI hardware and other lightweight devices.
[0059] In the present application embodiment, Figure 2 As shown, the camera is placed on the central axis of the oil and gas well and the optical axis of the camera coincides with the central axis of the oil and gas well. Wherein, Oc is the optical center of the camera, O is the center of the target object, O' is the center of the cross section of the oil and gas well, and the radius is R. Oc-O' is the central axis of the oil and gas well.
[0060] Step S102: Determine the two-dimensional coordinates of multiple endpoints of the target object in the target image.
[0061] In the embodiment of the present application, the endpoints of the target object are points on the contour of the target object. By locating the endpoints of the target object, the circumference, area, volume and other dimension data of the target object can be determined.
[0062] Step S103, determining the height coordinate of each endpoint in the three-dimensional coordinate according to the similar triangle theorem based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint.
[0063] It should be understood that the triangle formed by the endpoint of the target object on the inner wall of the oil and gas well, the optical center of the monocular image acquisition device, and the optical axis of the monocular image acquisition device, and the triangle formed by the mapping of the endpoint of the target object on the imaging plane, the optical center of the monocular image acquisition device, and the optical axis of the monocular image acquisition device are similar triangles. Therefore, the height coordinates of each endpoint in the three-dimensional coordinates can be determined based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint.
[0064] Specifically, after determining the two-dimensional coordinates of multiple endpoints of the target object in the target image, the height coordinates can be substituted into a preset coordinate conversion algorithm to calculate the abscissa and ordinate in the three-dimensional coordinates of the endpoints.
[0065] Step S104, substituting the internal parameter matrix of the monocular image acquisition device and the height coordinates of each endpoint in the three-dimensional coordinates into a preset coordinate conversion algorithm to convert the two-dimensional coordinates of each endpoint into the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint.
[0066] The internal parameter matrix of the monocular image acquisition device is predetermined based on the Zhang Zhengyou chessboard calibration method. Specifically, the monocular image acquisition device can be calibrated in advance using the Zhang Zhengyou chessboard calibration method to determine the internal parameter matrix.
[0067] Step S105: Calculate the size data of the target object according to the three-dimensional coordinates of each endpoint.
[0068] In the embodiment of the present application, after determining the three-dimensional coordinates of the endpoints of the target object, the actual contour of the target object in space can be determined, thereby determining the size data of the target object based on the actual contour of the target object in space.
[0069] Among them, the size data of the target object can be the circumference, area, volume, etc. of the target object, and the embodiment of the present application does not make any specific limitation on this.
[0070] The method for measuring objects in oil and gas wells provided in the embodiment of the present application obtains a target image collected by a monocular image acquisition device; the optical axis of the monocular image acquisition device coincides with the central axis of the oil and gas well; the two-dimensional coordinates of multiple endpoints of the target object in the target image are determined; the target object is located on the inner wall of the oil and gas well; the height coordinates of each endpoint in the three-dimensional coordinates are determined based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint according to the similar triangle theorem; the internal parameter matrix of the monocular image acquisition device and the height coordinates in the three-dimensional coordinates of each endpoint are substituted into a preset coordinate conversion algorithm to convert the two-dimensional coordinates of each endpoint into the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint; the size data of the target object is calculated according to the three-dimensional coordinates of each endpoint. The monocular image acquisition device can be used to measure objects in the oil and gas well, which reduces the requirements for the image acquisition device, reduces the requirements for deploying and operating the monocular image acquisition device, and improves the efficiency of deploying and operating the monocular image acquisition device, thereby improving the efficiency of measuring the target object in the oil and gas well. Moreover, the algorithm used by the monocular image acquisition device requires less computing power than other devices, which greatly reduces the computing power cost.
[0071] On the basis of the above embodiments, it is necessary to establish a three-dimensional coordinate system and a two-dimensional coordinate system in order to determine the three-dimensional coordinates of the endpoints and the two-dimensional coordinates of the endpoints.
[0072] Optionally, the three-dimensional coordinate system established may be a world coordinate system, and the two-dimensional coordinate system established may be a pixel coordinate system and an image coordinate system. The steps of establishing the coordinate system include:
[0073] The world coordinate system can be established by: determining the optical center of the target acquisition device as the origin of the world coordinate system, and establishing the world coordinate system; the three-dimensional coordinates of each endpoint are the world coordinates of each endpoint in the world coordinate system.
[0074] The image coordinate system may be established by determining the intersection of the optical axis of the target acquisition device and the imaging plane as the origin of the image coordinate system, and establishing the image coordinate system on the imaging plane of the target acquisition device.
[0075] The pixel coordinate system may be established by determining the upper left corner of the target image as the origin of the pixel coordinate system, and establishing the pixel coordinate system on the target image.
[0076] On this basis, step S102 may specifically include: determining pixel coordinates of multiple endpoints of the target object in a pixel coordinate system, and determining the pixel coordinates as two-dimensional coordinates in the target image.
[0077] Figure 3 A schematic diagram of a coordinate system provided in an embodiment of the present application, such as Figure 3As shown, Oc is the origin of the world coordinate system, Op is the origin of the image coordinate system, and O is the origin of the pixel coordinate system. In the figure, the bold lines are on the imaging plane of the target acquisition device.
[0078] In an embodiment of the present application, a world coordinate system is established on a monocular image acquisition device, so that the camera coordinate system is the world coordinate system. It is only necessary to convert the pixel coordinates of the target image in the pixel coordinate system into image coordinates, and then convert the image coordinates into the world coordinate system. There is no need to convert the camera coordinates into world coordinates, thereby reducing the complexity of the algorithm model.
[0079] The calculation process of the preset coordinate transformation algorithm is:
[0080]
[0081] in, is the transformation matrix from graphics coordinates to pixel coordinates, is the transformation matrix from camera coordinates to image coordinates, s represents the scale factor, is the camera calibration intrinsic matrix, is the homogeneous pixel coordinate of the oil and gas well perforation in the phase plane of the monocular camera, is the homogeneous space coordinate corresponding to the oil and gas well in the camera coordinate system.
[0082] The following is a description of the method for measuring an object in an oil and gas well provided by the above embodiment in conjunction with a specific example. In the embodiment of the present application, the target object is circular, and the size data of the target object includes a diameter. Specifically, the following steps may be included:
[0083] Step S201: Acquire a target image captured by a monocular image acquisition device.
[0084] Step S202: determine the upper and lower endpoints of the target object in the target image.
[0085] Specifically, the endpoint of the target object with a higher ordinate value in the target image may be determined as the high endpoint, and the endpoint of the target object with a lower ordinate value in the target image may be determined as the low endpoint.
[0086] Optionally, a method for determining the high endpoint and the low endpoint of the target object in the target image can be: using target detection technology to identify the target object in the target image to obtain a detection frame of the target object; determining the endpoint that intersects with the upper boundary of the detection frame of the target object as the high endpoint; and determining the endpoint that intersects with the lower boundary of the detection frame of the target object as the low endpoint.
[0087] Figure 4 A schematic diagram of object recognition in a target image provided by an embodiment of the present application, such as Figure 4As shown, after the target object in the target image is identified by the target detection technology, the detection frame of the target object will be displayed in the target image, and the endpoint in the target object contour that intersects with the upper boundary of the detection frame of the target object can be determined as the high end point A' in the target image, and the endpoint that intersects with the lower boundary of the detection frame of the target object can be determined as the low end point B' in the target image.
[0088] like Figure 5 As shown, the pixel coordinates of the high end point A' and the low end point B' in the pixel coordinate system can be calculated in subsequent steps, and the world coordinates of the high end point A of the perforation and the low end point B of the perforation in the world coordinate system can be calculated according to a preset coordinate conversion algorithm.
[0089] Step S203: determine the two-dimensional coordinates of the high end point and the low end point of the target object in the target image.
[0090] It should be understood that images are composed of pixels, and the pixel coordinates are the positions of the pixels in the image. The horizontal coordinate u and the vertical coordinate v of a pixel are the column number and the row number of the pixel in the image array, respectively.
[0091] Specifically, the corresponding pixel coordinates are determined based on the positions of the high end point and the low end point of the target object in the target image, and the corresponding pixel coordinates are determined as its two-dimensional coordinates.
[0092] Step S204: Calculate the distance W between each endpoint in the target image and the origin of the image coordinate system based on the two-dimensional coordinates of each endpoint.
[0093] Specifically, the pixel coordinates of the high end point and the low end point may be converted into image coordinates, and the distance W from the origin of the image coordinate system may be calculated based on the image coordinates.
[0094] Step S205, substitute the focal length f of the monocular image acquisition device, the radius R of the oil and gas well, and the distance W between each endpoint and the origin of the image coordinate system into the height coordinate calculation formula, and determine the calculation result of the height coordinate calculation formula as the height coordinate of each endpoint in the three-dimensional coordinates.
[0095] In the embodiment of the present application, the height coordinate calculation formula is pre-configured based on the similar triangle theorem, and the height coordinate calculation formula is:
[0096]
[0097] Among them, Z is the height coordinate, R is the radius of the oil and gas well, and f is the focal length of the monocular image acquisition device.
[0098] Specifically, Figure 2As shown, since point P is located on the oil and gas well, the distance from point P to the z-axis is the radius R of the oil and gas well, that is, the length of QP is R. And since triangle OcQP and triangle OcOpP' are similar triangles, OpP' / OcOp=QP / OcQ, that is, W / f=R / Z.
[0099] Step S205, substituting the internal parameter matrix of the monocular image acquisition device, the height coordinates in the three-dimensional coordinates of each endpoint, and the two-dimensional coordinates of each endpoint into a preset pixel-world coordinate transformation model to obtain the pixel-world coordinate transformation model to be calculated.
[0100] Among them, the internal parameter matrix of the monocular image acquisition device is a 3*4 matrix; the preset pixel-world coordinate conversion model is predetermined based on the mapping relationship between the pixel coordinate system and the image coordinate system, and the mapping relationship between the image coordinate system and the world coordinate system.
[0101] Specifically, the internal parameter matrix of the monocular image acquisition device is:
[0102]
[0103] Step S207: split and solve the world coordinate transformation model of the pixel to be calculated to obtain the horizontal coordinate and the vertical coordinate in the three-dimensional coordinate of each endpoint.
[0104] The default pixel world coordinate conversion model is:
[0105]
[0106] Among them, M is the internal parameter matrix of the monocular image acquisition device, u is the horizontal coordinate of each endpoint in the two-dimensional coordinates, v is the vertical coordinate of each endpoint in the two-dimensional coordinates, X is the horizontal coordinate of each endpoint in the three-dimensional coordinates, and Y is the vertical coordinate of each endpoint in the three-dimensional coordinates.
[0107] Specifically, after splitting the preset pixel world coordinate transformation model, we can get:
[0108] (u*M[2][0]-M[0][0])*X+(u*M[2][1]-M[0][1])*Y=M[3][0]-u*M[2][3]-(u*M[2][2]-M[0][2])*Z0
[0109] (v*M[2][0]-M[1][0])*X+(v*M[2][1]-M[1][1])*Y=M[0][3]-u*M[2][3]-(u*M[2][2]-M[0][2])*Z0
[0110] The internal parameter matrix of the monocular image acquisition device, the height coordinates of each endpoint in the three-dimensional coordinates, and the two-dimensional coordinates of each endpoint can be substituted into the preset pixel-world coordinate conversion model after splitting to obtain the horizontal and vertical coordinates of each endpoint in the three-dimensional coordinates.
[0111] Step S208, substitute the three-dimensional coordinates of the high end point in the target image and the three-dimensional coordinates of the low end point in the target image into the distance formula between two points in space, and determine the calculation result of the distance formula between two points in space as the diameter of the target object.
[0112] The distance formula between two points in space is:
[0113]
[0114] Specifically, substituting the three-dimensional coordinates of the high end point in the target image and the three-dimensional coordinates of the low end point in the target image into the distance formula between two points in space can calculate the actual distance between the high end point and the low end point of the target object, which is also the diameter of the target object.
[0115] The present application may also verify the calculated result. Optionally, a method for verifying the calculated result may be:
[0116] Step S301, obtaining a preset cylindrical surface space equation.
[0117] The parameters in the preset cylindrical surface space equation are determined in advance by fitting the cylindrical surface of the oil and gas well in the world coordinate system based on the least square method.
[0118] Specifically, the method of fitting and determining the cylindrical surface of the oil and gas well in advance is:
[0119] like Figure 6 As shown, in the world coordinate system, the spatial coordinates of n*m key points are calibrated through actual measurement, and the calibrated key points are fitted by a cylindrical surface in the space based on the least squares.
[0120] The equation of any cylindrical surface in space is:
[0121] (x-x0) 2 +(y-y0) 2 +(z-z0) 2 -[a(x-x0)+b(y-y0)+c(z-z0)] 2 =R 2
[0122] Among them, (x0, y0, z0) is an arbitrary point on the cylinder axis, a, b, c are the cylinder axis vectors, and R is the radius of the cylinder base circle. The distance from any point on the cylinder surface to its axis is the radius R.
[0123] The spatial coordinates of the n*m key points on the inner wall of the calibrated oil and gas well are expressed as the sample matrix X ij . Let the parameter matrix be the vector α, and the true value be the vector Y, that is, the cylindrical surface equation can be expressed as:
[0124]
[0125] That is, P·U=Q. Using the least squares method to estimate U of P·U=Q, we can get
[0126] U=(P T P) -1 P T Q
[0127] So far, we can get the estimated parameter values of the parameter matrix vector α are The cylindrical surface fitting is completed, and the preset cylindrical surface space equation is:
[0128]
[0129] Step S302: Substitute the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint into the preset cylindrical surface space equation to calculate the fitting height coordinate of each endpoint.
[0130] Step S303: determining the measurement error based on the fitted height coordinates of each endpoint and the height coordinates in the three-dimensional coordinates of each endpoint.
[0131] Specifically, the fitted height coordinate and the height coordinate in the three-dimensional coordinate can be substituted into the error calculation formula, and the calculation result of the error calculation formula can be determined as the measurement error. The error calculation formula can be:
[0132]
[0133] Where n represents the number of endpoints, x i represents the fitting height coordinate of the i-th endpoint, y i Represents the height coordinate of the ith endpoint in the three-dimensional coordinates. The smaller E is, the smaller the difference between the fitted height coordinates of each endpoint and the height coordinates in the three-dimensional coordinates of each endpoint is, indicating that the accuracy of the coordinate calculation is higher.
[0134] Step S304: If it is determined that the measurement error is less than the preset error threshold, the size data of the target object is calculated according to the three-dimensional coordinates of each endpoint.
[0135] In an embodiment of the present application, if it is determined that the measurement error is less than a preset error threshold, the size data of the target object can be calculated based on the three-dimensional coordinates of each endpoint; if it is determined that the measurement error is greater than or equal to the preset error threshold, it can be determined that the three-dimensional coordinates of each endpoint are inaccurate, and the size data of the target object calculated based on the three-dimensional coordinates of each endpoint is inaccurate, and the three-dimensional coordinates of each endpoint can be recalculated.
[0136] The method for measuring objects in oil and gas wells provided in the embodiment of the present application determines the measurement error, improves the accuracy of the calculated dimensional data, and can avoid the situation where the calculated dimensional data of the target object is inaccurate, which affects production.
[0137] Figure 7 This is a schematic diagram of the structure of the oil and gas well object measurement device provided in the embodiment of the present application. The oil and gas well object measurement device provided in the embodiment of the present application can execute the processing flow provided in the oil and gas well object measurement method embodiment. Figure 7 As shown, the device 50 for measuring objects in oil and gas wells includes: an acquisition module 501 , a determination module 502 , a height calculation module 503 , a coordinate conversion module 504 and a size calculation module 505 .
[0138] Specifically, the acquisition module 501 is used to acquire a target image acquired by a monocular image acquisition device; the optical axis of the monocular image acquisition device coincides with the central axis of the oil and gas well.
[0139] The determination module 502 is used to determine the two-dimensional coordinates of multiple endpoints of the target object in the target image; the target object is located on the inner wall of the oil and gas well.
[0140] The height calculation module 503 is used to determine the height coordinates of each endpoint in the three-dimensional coordinates according to the similar triangle theorem based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint.
[0141] The coordinate conversion module 504 is used to substitute the internal parameter matrix of the monocular image acquisition device and the height coordinates of each endpoint in the three-dimensional coordinates into a preset coordinate conversion algorithm to convert the two-dimensional coordinates of each endpoint into the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint.
[0142] The size calculation module 505 is used to calculate the size data of the target object according to the three-dimensional coordinates of each endpoint.
[0143] The device provided in the embodiments of the present application can be specifically used to execute the method embodiments provided in the above embodiments, and the specific functions will not be repeated here.
[0144] Optionally, the target object is circular, and the size data of the target object includes a diameter; the determination module 502 is used to: determine the endpoint of the target object with a higher ordinate value in the target image as the high end point, and determine the endpoint of the target object with a lower ordinate value in the target image as the low end point; determine the two-dimensional coordinates of the high end point and the low end point in the target image respectively; the size calculation module 505 is used to: substitute the three-dimensional coordinates of the high end point in the target image and the three-dimensional coordinates of the low end point in the target image into a distance formula between two points in space, and determine the calculation result of the distance formula between two points in space as the diameter of the target object.
[0145] Optionally, the target object is circular, and the determination module 502 is specifically used to: use target detection technology to identify the target object in the target image to obtain a detection frame of the target object; determine the endpoint that intersects with the upper boundary of the detection frame of the target object as the high end point; and determine the endpoint that intersects with the lower boundary of the detection frame of the target object as the low end point.
[0146] Optionally, the object measuring device 50 in the oil and gas well also includes: a coordinate system establishment module; the coordinate system establishment module is used to: determine the optical center of the target acquisition device as the origin of the world coordinate system, and establish the world coordinate system; the three-dimensional coordinates of each endpoint are the world coordinates of each endpoint in the world coordinate system; determine the intersection of the optical axis of the target acquisition device and the imaging plane as the origin of the image coordinate system, and establish the image coordinate system on the imaging plane of the target acquisition device; determine the upper left corner of the target image as the origin of the pixel coordinate system, and establish the pixel coordinate system on the target image; determine the two-dimensional coordinates of multiple endpoints of the target object in the target image, including: determine the pixel coordinates of multiple endpoints of the target object in the pixel coordinate system, and determine the pixel coordinates as the two-dimensional coordinates in the target image.
[0147] Optionally, the height calculation module 503 is specifically used to: calculate the distance W between each endpoint in the target image and the origin of the image coordinate system based on the two-dimensional coordinates of each endpoint; substitute the focal length f of the monocular image acquisition device, the radius R of the oil and gas well, and the distance W between each endpoint and the origin of the image coordinate system into the height coordinate calculation formula, and determine the calculation result of the height coordinate calculation formula as the height coordinate in the three-dimensional coordinate of each endpoint; the height coordinate calculation formula is pre-configured based on the similar triangle theorem, and the height coordinate calculation formula is:
[0148]
[0149] Among them, Z is the height coordinate, R is the radius of the oil and gas well, and f is the focal length of the monocular image acquisition device.
[0150] Optionally, the coordinate conversion module 504 is specifically used to: substitute the intrinsic parameter matrix of the monocular image acquisition device, the height coordinates in the three-dimensional coordinates of each endpoint, and the two-dimensional coordinates of each endpoint into a preset pixel world coordinate conversion model to obtain the pixel world coordinate conversion model to be calculated; the intrinsic parameter matrix of the monocular image acquisition device is a 3*4 matrix; the preset pixel world coordinate conversion model is predetermined based on the mapping relationship between the pixel coordinate system and the image coordinate system, and the mapping relationship between the image coordinate system and the world coordinate system; the pixel world coordinate conversion model to be calculated is split and solved to obtain the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint; the preset pixel world coordinate conversion model is:
[0151]
[0152] Among them, M is the internal parameter matrix of the monocular image acquisition device, u is the horizontal coordinate of each endpoint in the two-dimensional coordinates, v is the vertical coordinate of each endpoint in the two-dimensional coordinates, X is the horizontal coordinate of each endpoint in the three-dimensional coordinates, and Y is the vertical coordinate of each endpoint in the three-dimensional coordinates.
[0153] Optionally, the object measuring device 50 in the oil and gas well also includes: an error detection module; the error detection module is used to: obtain a preset cylindrical surface space equation; the parameters in the preset cylindrical surface space equation are pre-determined by fitting the cylindrical surface of the oil and gas well in the world coordinate system based on the least squares method; the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint are substituted into the preset cylindrical surface space equation to calculate the fitting height coordinate of each endpoint; the measurement error is determined based on the fitting height coordinate of each endpoint and the height coordinate in the three-dimensional coordinates of each endpoint; the size data of the target object is calculated according to the three-dimensional coordinates of each endpoint, including: if it is determined that the measurement error is less than the preset error threshold, the size data of the target object is calculated according to the three-dimensional coordinates of each endpoint.
[0154] The device provided in the embodiment of the present application can be specifically used to execute the above method embodiment, and the specific functions will not be repeated here.
[0155] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 8 As shown, the present application also provides an electronic device 60, including: a processor 601, and a memory 602 and a transceiver 603 that are communicatively connected to the processor 601. The memory 602 stores computer-executable instructions; the transceiver 603 is used to send and receive data; the processor 601 executes the computer-executable instructions stored in the memory 602 to implement the method provided in any embodiment of the present application.
[0156] Specifically, the program may include a program code, and the program code includes a computer-executable instruction. The memory 602 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. Among them, the computer-executable instruction is stored in the memory 602 and is configured to be executed by the processor 601 to implement the method provided in any embodiment of the present application. The relevant description can be understood by referring to the relevant description and effect corresponding to the steps in the accompanying drawings, and no further elaboration is made here.
[0157] In the embodiment of the present application, the memory 602 and the processor 601 are connected via a bus. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0158] An embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method provided by any embodiment of the present application.
[0159] An embodiment of the present application also provides a computer program product, including computer execution instructions, which implement the method provided by any embodiment of the present application when executed by a processor.
[0160] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0161] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0162] In addition, each functional module in each embodiment of the present application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0163] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable full-path trajectory fusion device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0164] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0165] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the application. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.
[0166] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0167] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for measuring objects in oil and gas wells, characterized in that: include: Acquire a target image acquired by a monocular image acquisition device; The optical axis of the monocular image acquisition device coincides with the central axis of the oil and gas well; Determining the two-dimensional coordinates of multiple endpoints of a target object in a target image; the target object is located on the inner wall of an oil and gas well; According to the similar triangle theorem, the height coordinates of each endpoint in the three-dimensional coordinates are determined based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint; Substituting the internal parameter matrix of the monocular image acquisition device and the height coordinates of each endpoint in the three-dimensional coordinates into a preset coordinate conversion algorithm to convert the two-dimensional coordinates of each endpoint into the abscissa and ordinate of the three-dimensional coordinates of each endpoint; The size data of the target object is calculated based on the three-dimensional coordinates of each endpoint.
2. The method according to claim 1, characterized in that: The target object is circular, and the size data of the target object includes a diameter; The step of determining the two-dimensional coordinates of multiple endpoints of the target object in the target image includes: The endpoint of the target object with a higher ordinate value in the target image is determined as the high end point, and the endpoint of the target object with a lower ordinate value in the target image is determined as the low end point; Determine the two-dimensional coordinates of the high end point and the low end point in the target image respectively; The step of calculating the size data of the target object according to the three-dimensional coordinates of each endpoint includes: Substitute the three-dimensional coordinates of the high end point in the target image and the three-dimensional coordinates of the low end point in the target image into the distance formula between two points in space, and determine the calculation result of the distance formula between two points in space as the diameter of the target object.
3. The method according to claim 2, characterized in that The target object is circular, and determining the endpoint of the target object with a higher ordinate value in the target image as the high end point and determining the endpoint of the target object with a lower ordinate value in the target image as the low end point includes: The target object in the target image is identified by using target detection technology to obtain a detection frame of the target object; The endpoint that intersects with the upper boundary of the detection frame of the target object is determined as the high end point; The endpoint that intersects with the lower boundary of the detection box of the target object is determined as the low endpoint.
4. The method according to claim 1, characterized in that: The method further comprises: a step of establishing a coordinate system; the step of establishing a coordinate system comprises: The optical center of the target acquisition device is determined as the origin of the world coordinate system, and the world coordinate system is established; the three-dimensional coordinates of each endpoint are the world coordinates of each endpoint in the world coordinate system; Determine the intersection of the optical axis of the target acquisition device and the imaging plane as the origin of the image coordinate system, and establish the image coordinate system on the imaging plane of the target acquisition device; Determine the upper left corner of the target image as the origin of the pixel coordinate system, and establish the pixel coordinate system on the target image; The step of determining the two-dimensional coordinates of multiple endpoints of the target object in the target image includes: The pixel coordinates of multiple endpoints of the target object in the pixel coordinate system are determined, and the pixel coordinates are determined as two-dimensional coordinates in the target image.
5. The method according to claim 4, characterized in that The method of determining the height coordinates of each endpoint in the three-dimensional coordinates based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint according to the similar triangle theorem includes: Calculate the distance W between each endpoint and the origin of the image coordinate system in the target image based on the two-dimensional coordinates of each endpoint; Substitute the focal length f of the monocular image acquisition device, the radius R of the oil and gas well, and the distance W between each endpoint and the origin of the image coordinate system into the height coordinate calculation formula, and determine the calculation result of the height coordinate calculation formula as the height coordinate of each endpoint in the three-dimensional coordinate; the height coordinate calculation formula is pre-configured based on the similar triangle theorem, and the height coordinate calculation formula is: Among them, Z is the height coordinate, R is the radius of the oil and gas well, and f is the focal length of the monocular image acquisition device.
6. The method according to claim 4, characterized in that The method of converting the two-dimensional coordinates of each endpoint into the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint based on the internal parameter matrix of the monocular image acquisition device, the height coordinate in the three-dimensional coordinates of each endpoint and the preset coordinate conversion algorithm includes: Substituting the intrinsic parameter matrix of the monocular image acquisition device, the height coordinates in the three-dimensional coordinates of each endpoint, and the two-dimensional coordinates of each endpoint into a preset pixel-world coordinate transformation model to obtain the pixel-world coordinate transformation model to be calculated; the intrinsic parameter matrix of the monocular image acquisition device is a 3*4 matrix; the preset pixel-world coordinate transformation model is predetermined based on the mapping relationship between the pixel coordinate system and the image coordinate system, and the mapping relationship between the image coordinate system and the world coordinate system; The pixel world coordinate conversion model to be calculated is split and solved to obtain the horizontal coordinate and the vertical coordinate in the three-dimensional coordinate of each endpoint; the preset pixel world coordinate conversion model is: Among them, M is the internal parameter matrix of the monocular image acquisition device, u is the horizontal coordinate of each endpoint in the two-dimensional coordinates, v is the vertical coordinate of each endpoint in the two-dimensional coordinates, X is the horizontal coordinate of each endpoint in the three-dimensional coordinates, and Y is the vertical coordinate of each endpoint in the three-dimensional coordinates.
7. The method according to claim 4, characterized in that After the two-dimensional coordinates of each endpoint are converted into the horizontal coordinate and the vertical coordinate in the three-dimensional coordinate of each endpoint based on the internal parameter matrix of the monocular image acquisition device, the height coordinate in the three-dimensional coordinate of each endpoint and the preset coordinate conversion algorithm, the method further includes: Obtaining a preset cylindrical surface space equation; the parameters in the preset cylindrical surface space equation are determined in advance by fitting the cylindrical surface of the oil and gas well in the world coordinate system based on the least squares method; Substituting the abscissa and ordinate in the three-dimensional coordinates of each endpoint into a preset cylindrical surface space equation to calculate the fitting height coordinate of each endpoint; Determine the measurement error based on the fitted height coordinates of each endpoint and the height coordinates in the three-dimensional coordinates of each endpoint; The step of calculating the size data of the target object according to the three-dimensional coordinates of each endpoint includes: If it is determined that the measurement error is less than a preset error threshold, the size data of the target object is calculated according to the three-dimensional coordinates of each endpoint.
8. A device for measuring objects in oil and gas wells, characterized in that: include: An acquisition module, used to acquire a target image acquired by a monocular image acquisition device; The optical axis of the monocular image acquisition device coincides with the central axis of the oil and gas well; A determination module, used to determine the two-dimensional coordinates of multiple endpoints of a target object in a target image; the target object is located on the inner wall of an oil and gas well; A height calculation module is used to determine the height coordinates of each endpoint in the three-dimensional coordinates according to the similar triangle theorem based on the focal length of the monocular image acquisition device, the radius of the oil and gas well, and the two-dimensional coordinates of each endpoint; A coordinate conversion module, used to substitute the internal parameter matrix of the monocular image acquisition device and the height coordinates in the three-dimensional coordinates of each endpoint into a preset coordinate conversion algorithm to convert the two-dimensional coordinates of each endpoint into the horizontal coordinate and the vertical coordinate in the three-dimensional coordinates of each endpoint; The size calculation module is used to calculate the size data of the target object according to the three-dimensional coordinates of each endpoint.
9. An electronic device, characterized in that: include: A processor, and a memory and a transceiver communicatively connected to the processor; The memory stores computer-executable instructions; the transceiver is used to send and receive data; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.