Digital photogrammetry method, electronic equipment and system
By shooting images at different shooting positions and directions, building digital three-dimensional space and calculating the size scaling ratio, the problems of complex operation, limited applicable scenarios and poor reliability in the prior art are solved, and more convenient and reliable digital photogrammetry is achieved.
Patent Information
- Application Number
- CN202510170979.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-28
- Publication Date
- 2025-06-20
AI Technical Summary
The existing digital photogrammetry methods have problems such as complex operation, limited application scenarios and poor reliability in communication base station surveys.
By obtaining images of different shooting positions and directions, a digital three-dimensional space is constructed, and the size scaling ratio is determined using objects of known sizes, and the distance and height of the target object are calculated.
It reduces the operation complexity of image acquisition, expands the applicability of the measurement scene, and improves the reliability of the measurement.
Smart Images

Figure CN120182480A_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202010131656.2, and the original application date is February 28, 2020. The entire content of the original application is incorporated herein by reference. Technical Field
[0002] This application relates to the field of electronic technology, and in particular, to a digital photogrammetry method, an electronic device, and a system. Background Art
[0003] For the survey work of communication base stations, including but not limited to the measurement of indoor and outdoor equipment dimensions, heights, deployment spacings, etc., is an important prerequisite for the work of communication base station site design, equipment deployment, material sending, risk detection, etc. Traditional survey means are outdoor measurement with a ruler and indoor hand-drawing. Traditional survey means have problems such as large workload, poor reliability, and high danger. For this reason, operators and tower merchants, etc., more often adopt digital photogrammetry methods to complete the survey work for communication base stations.
[0004] Digital photogrammetry is to use a computer to process digital images or digitized images, and use computer vision to replace the stereo measurement and recognition of the human eye to automatically extract geometric and physical information.
[0005] Among them, the measurement scheme based on ground sequence images is often used. Surveyors can use mobile phones or cameras, etc., to take a large number of photos or videos containing control points, and then perform relevant data processing on these photos or videos. It should be noted that before taking photos or videos, surveyors need to deploy multiple targets representing control points according to strict distance relationships and azimuth relationships. The process of deploying targets is complex and unreliable. In addition, deploying multiple targets also requires occupying a certain space, and it is difficult to implement in some narrow spaces, inclined roofs and other scenarios.
[0006] It can be seen that there is an urgent need for a digital photogrammetry method that is convenient to operate, applicable to a wider measurement scenario and reliable. Summary of the Invention
[0007] A digital photogrammetry method, an electronic device, and a system provided by this application can reduce the operation complexity of image acquisition, expand the applicable scenarios of digital photogrammetry, and increase the reliability of measurement.
[0008] To achieve the above object, the embodiments of this application provide the following technical solutions:
[0009] First aspect, a method provided by this application includes: obtaining a first image and a second image, both the first image and the second image including a target object and a first object with a known actual size; wherein, the shooting positions of the first image and the second image are different, and the shooting directions of the first image and the second image are different; constructing a digital three-dimensional space based on the first image and the second image; determining the distance between two endpoints of the target object according to the digital three-dimensional space and the size scaling ratio between the digital three-dimensional space and the real three-dimensional space, wherein the scaling ratio is related to the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object.
[0010] Wherein, the digital three-dimensional space is presented in the form of a three-dimensional point cloud. A three-dimensional point cloud refers to a set of point data on the surface of an object in three-dimensional space, which can reflect the surface contour of the object. The two endpoints of the target object refer to the two endpoints of the distance to be measured. It should be noted that there can be one target object here, and the distance between the two endpoints of the target object can be the height, length, width, etc. of the target object. There can also be two target objects, and the distance between the two endpoints of the target object can be the distance between the two target objects, etc.
[0011] Compared with the prior art where surveyors need to pre-arrange the targets of multiple control points following strict distance relationships and azimuth relationships and take a large number of photos or videos containing the targets, the operation of taking images twice at different shooting positions and in different shooting directions in the embodiments of this application is more convenient. Moreover, using the actual size of the first object to determine the size scaling ratio of the digital three-dimensional space in the embodiments of this application is conducive to improving the reliability of the measurement. Furthermore, since it is also possible to take images at different shooting positions and in different shooting directions in scenarios such as narrow machine rooms and inclined roofs, the measurement method provided by the embodiments of this application can be applied to a wider range of measurement scenarios.
[0012] In a possible implementation manner, the method further includes: determining the sky direction of the digital three-dimensional space according to the ground of the digital three-dimensional space and the photographic center of the first image, or according to the ground of the digital three-dimensional space and the photographic center of the second image; wherein, the ground of the digital three-dimensional space is the plane with the densest distribution of discrete points in the digital three-dimensional space; determining the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, and the sky direction.
[0013] Wherein, the plane with the densest distribution of three-dimensional discrete points is the plane with the largest numerical value of the number of point data in the unit space.
[0014] The above height measurement implementation method enables the embodiments of the present application to be applicable to more measurement scenarios. For example, in some scenarios where the target object may be relatively tall or the bottom end of the target object is blocked, the height of the target object can be calculated based on the captured top end. Additionally, in the solution provided by the embodiments of the present application, it is only necessary to mark the position of the top end in the first image and the second image to complete the measurement of the height of the target object, without the need to mark the position of the bottom end, simplifying the operation of the measurement personnel.
[0015] In a possible implementation manner, before determining the distance between two endpoints of the target object according to the digital three-dimensional space and the scaling ratio of its size to the real three-dimensional space, the method further includes: obtaining the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object; calculating the size S2 of the first object in the digital three-dimensional space according to the position of the first object in the first image and the position of the first object in the second image; and calculating the scaling ratio of the size of the digital three-dimensional space to the size of the real three-dimensional space according to the actual size S1 of the first object and the size S2 of the first object in the digital three-dimensional space.
[0016] Among them, the position of the first object in the first image may be the image point coordinates of the first object in the first image. Similarly, the position of the first object in the second image may be the image point coordinates of the first object in the second image.
[0017] Thus, a method for calculating the scaling ratio is provided based on the actual size S1 of the first object with a known size and the calculated size S2 of the first object in the digital three-dimensional space. Since the actual size of the first object is accurate data, it is beneficial to improve the accuracy of the calculated scaling ratio and enhance the reliability of the measurement.
[0018] In a possible implementation manner, obtaining the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object includes: receiving the input position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object; or identifying the position of the first object in the first image and the position of the first object in the second image, and searching for the actual size S1 of the first object.
[0019] Thus, a method is provided that allows the measurement personnel to manually mark the positions of the two endpoints of the first object and input the actual size of the first object, and a method is also provided for the server to automatically identify the positions of the two endpoints of the first object and search for the actual size of the first object. This enriches the ways to obtain the positions of the two endpoints of the first object and the actual size of the first object.
[0020] In a possible implementation, the first object is a segmented benchmark. The first object includes at least the first black segment, the first white segment, the first colored segment, the second white segment, the second colored segment, the third white segment, and the second black segment arranged in sequence. Among them, the colors of the first colored segment and the second colored segment are a pair of complementary colors. The actual size S1 of the first object is the length between the two endpoints of the first object. One endpoint of the first object is located at the junction of the first black segment and the first white segment, and the other endpoint of the first object is located at the junction of the third white segment and the second black segment. The position of the first object in the first image is the positions of the two endpoints of the first object in the first image. The position of the first object in the second image is the positions of the two endpoints of the first object in the second image.
[0021] Thus, a benchmark with a specific design is provided, which can be used as the first object to facilitate the server to automatically identify the two endpoints of the first object and simplify the operation of the surveyors.
[0022] In a possible implementation, identifying the position of the first object in the first image and the position of the first object in the second image includes: identifying the first colored segment and the second colored segment in the first image, and the first region with a straight-line feature in the first image; identifying the first colored segment and the second colored segment in the second image, and the second region with a straight-line feature in the second image; automatically determining the positions of the two endpoints of the first object in the first image according to the first colored segment and the second colored segment in the first image, the first region with a straight-line feature in the first image, and the positional relationship of each colored segment in the first object; and automatically determining the positions of the two endpoints of the first object in the first image according to the first colored segment and the second colored segment in the second image, the second region with a straight-line feature in the second image, and the positional relationship of each colored segment in the first object. Thus, a method for identifying the two endpoints of the benchmark is provided.
[0023] In a specific implementation, a filter can be used to determine the region with a straight-line feature from the first image and the second image. Specifically, the filter can be the real part of a two-dimensional Gabor function.
[0024] In a possible implementation, the first colored segment is a red segment and the second colored segment is a cyan segment; or the first colored segment is a magenta segment and the second colored segment is a green segment.
[0025] It should be noted that considering that when the shooting light is insufficient, blue and black are not easily distinguishable in the captured image. When the shooting light is too bright, yellow and white are not easily distinguishable. Therefore, neither the first colored segment nor the second colored segment is blue or yellow.
[0026] In a possible implementation, according to the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object, the scaling ratio of the size between the digital three-dimensional space and the real three-dimensional space is calculated, including: calculating the size S2 of the first object in the digital three-dimensional space according to the position of the first object in the first image and the position of the first object in the second image; calculating the scaling ratio of the size between the digital three-dimensional space and the real three-dimensional space according to the actual size S1 of the first object and the size S2 of the first object in the digital three-dimensional space. Thus, a method for specifically calculating the scaling ratio of the size between the digital three-dimensional space and the real three-dimensional space is provided.
[0027] In a possible implementation, according to the digital three-dimensional space and the scaling ratio of the size between the digital three-dimensional space and the real three-dimensional space, the distance between the two endpoints of the target object is determined, including: determining the distance between the two endpoints of the target object according to the digital three-dimensional space, the scaling ratio, the positions of the two endpoints of the target object in the first image, and the positions of the two endpoints of the target object in the second image.
[0028] In a possible implementation, according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, and the sky direction of the digital three-dimensional space, the height of the target object is determined, including: determining the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, the sky direction of the digital three-dimensional space, the position of the top end of the target object in the first image, and the position of the top end of the target object in the second image.
[0029] In a second aspect, a measuring device is provided, including: an acquisition unit configured to acquire a first image and a second image, where both the first image and the second image include a target object and a first object with a known actual size; wherein, the shooting positions of the first image and the second image are different, and the shooting directions of the first image and the second image are different; a construction unit configured to construct a digital three-dimensional space according to the first image and the second image; a determination unit configured to determine the distance between the two endpoints of the target object according to the digital three-dimensional space and the scaling ratio of the size between the digital three-dimensional space and the real three-dimensional space, where the scaling ratio is related to the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object.
[0030] In a possible implementation, the determining unit is further configured to: determine the sky direction of the digital three-dimensional space according to the ground of the digital three-dimensional space and the camera center of the first image, or according to the ground of the digital three-dimensional space and the camera center of the second image; wherein, the ground of the digital three-dimensional space is the plane with the densest distribution of discrete points in the digital three-dimensional space; determine the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, and the sky direction of the digital three-dimensional space.
[0031] In a possible implementation, before the determining unit determines the distance between the two end points of the target object according to the digital three-dimensional space and the scaling ratio of the sizes of the digital three-dimensional space and the real three-dimensional space, the obtaining unit is further configured to obtain the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object; the determining unit is further configured to calculate the size S2 of the first object in the digital three-dimensional space according to the position of the first object in the first image and the position of the first object in the second image; calculate the scaling ratio of the sizes of the digital three-dimensional space and the real three-dimensional space according to the actual size S1 of the first object and the size S2 of the first object in the digital three-dimensional space.
[0032] In a possible implementation, during the process that the obtaining unit obtains the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object, the obtaining unit is specifically configured to: receive the input position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object; or, identify the position of the first object in the first image and the position of the first object in the second image, and search for the actual size S1 of the first object.
[0033] In a possible implementation, the first object is a benchmark with a segmented design, and the first object at least includes a first black segment, a first white segment, a first colored segment, a second white segment, a second colored segment, a third white segment, and a second black segment arranged in sequence; wherein, the colors of the first colored segment and the second colored segment are a pair of complementary colors; the actual size S1 of the first object is the length between the two end points of the first object, one end point of the first object is located at the junction of the first black segment and the first white segment, and the other end point of the first object is located at the junction of the third white segment and the second black segment; the position of the first object in the first image is the positions of the two end points of the first object in the first image; the position of the first object in the second image is the positions of the two end points of the first object in the second image.
[0034] In a possible implementation, during the process of the obtaining unit identifying the positions of the first object in the first image and the positions of the first object in the second image, the obtaining unit is further specifically configured to: identify the first color segment and the second color segment in the first image, and the first region with a linear feature in the first image; identify the first color segment and the second color segment in the second image, and the second region with a linear feature in the second image; automatically determine the positions of the two endpoints of the first object in the first image according to the first color segment and the second color segment in the first image, the first region in the first image, and the positional relationship of each color segment in the first object; and automatically determine the positions of the two endpoints of the first object in the first image according to the first color segment and the second color segment in the second image, the second region in the second image, and the positional relationship of each color segment in the first object.
[0035] In a possible implementation, the first color segment is a red segment and the second color segment is a cyan segment; or the first color segment is a magenta segment and the second color segment is a green segment.
[0036] In a possible implementation, during the process of the determining unit calculating the scaling ratio of the size between the digital three-dimensional space and the real three-dimensional space according to the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object, the determining unit is specifically configured to: calculate the size S2 of the first object in the digital three-dimensional space according to the position of the first object in the first image and the position of the first object in the second image; calculate the scaling ratio of the size between the digital three-dimensional space and the real three-dimensional space according to the actual size S1 of the first object and the size S2 of the first object in the digital three-dimensional space.
[0037] In a possible implementation, during the process of the determining unit determining the distance between the two endpoints of the target object according to the digital three-dimensional space and the scaling ratio of the size between the digital three-dimensional space and the real three-dimensional space, the determining unit is specifically configured to: determine the distance between the two endpoints of the target object according to the digital three-dimensional space, the scaling ratio, the positions of the two endpoints of the target object in the first image, and the positions of the two endpoints of the target object in the second image.
[0038] In an example, it is possible to receive the positions of the two endpoints of the target object in the first image and the positions of the two endpoints of the target object in the second image manually marked by the surveyor, and then calculate the distance between the two endpoints of the target object according to this position information, the digital three-dimensional space, and the scaling ratio.
[0039] It should be noted that the target object here can be one, and the distance between the two endpoints of the target object can be the height, length, width, etc. of the target object. The target object can also be two, and the distance between the two endpoints of the target object can be the distance between the two target objects, etc. For example, this measurement method can be used in the digital survey of telecommunication base stations to obtain information such as equipment dimensions, cable lengths, installation distances, etc. It can also be used in other engineering surveys or daily life, such as measuring the distance between buildings.
[0040] In a possible implementation, in the process of the determination unit determining the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, and the sky direction of the digital three-dimensional space, the determination unit is specifically configured to: determine the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, the sky direction of the digital three-dimensional space, the position of the top end of the target object in the first image, and the position of the top end of the target object in the second image.
[0041] In an example, the position of the top end of the target object in the first image and the position of the top end of the target object in the second image manually marked by the surveyor can be received, and then the height of the target object can be calculated according to this position information, the digital three-dimensional space, the ground and sky directions of the digital three-dimensional space. The measurement method provided by the embodiments of the present application is applicable to the digital survey scenario of telecommunication base stations to obtain the heights of long-distance high towers and various types of equipment on the towers, etc. It can also be applicable to other engineering surveys or daily life, such as measuring the height of buildings.
[0042] In a third aspect, a server is provided, including one or more processors, one or more memories, and one or more communication interfaces. The one or more memories and the one or more communication interfaces are coupled to the one or more processors. The one or more memories are used to store computer program code, and the computer program code includes computer instructions. When the one or more processors read the computer instructions from the one or more memories, the server is caused to execute the method described in the above aspect and any one of its possible implementation manners.
[0043] In a fourth aspect, a chip system is provided, including a processor. When the processor executes instructions, the processor executes the method described in the above aspect and any one of its possible implementation manners.
[0044] In a fifth aspect, a computer storage medium is provided, including computer instructions. When the computer instructions run on the server, the server is caused to execute the method described in the above aspect and any one of its possible implementation manners.
[0045] Sixth aspect: Provide a computer program product, which, when running on a computer, causes the computer to execute the methods described in the above aspects and any possible implementation manners thereof. Description of the Drawings
[0046] Figure 1 Schematic structural diagram of a communication system provided by an embodiment of the present application;
[0047] Figure 2A Schematic diagram of an image acquisition method provided by an embodiment of the present application;
[0048] Figure 2B Schematic diagram of another image acquisition method provided by an embodiment of the present application;
[0049] Figure 2C Schematic diagram of yet another image acquisition method provided by an embodiment of the present application;
[0050] Figure 3 Schematic structural diagram of an electronic device provided by an embodiment of the present application;
[0051] Figure 4 Schematic structural diagram of a server provided by an embodiment of the present application;
[0052] Figure 5A Schematic flowchart of a digital photogrammetry method provided by an embodiment of the present application;
[0053] Figure 5B Schematic diagram of a method for calculating the distance between two endpoints of a target object provided by an embodiment of the present application;
[0054] Figures 6A to 6H Schematic diagrams of user interfaces of some electronic devices provided by an embodiment of the present application;
[0055] Figure 7A Schematic flowchart of another digital photogrammetry method provided by an embodiment of the present application;
[0056] Figure 7B Schematic diagram of a method for calculating the height of a target object provided by an embodiment of the present application;
[0057] Figure 8 Schematic diagram of a benchmark provided by an embodiment of the present application;
[0058] Figure 9 Schematic diagram of a color wheel provided by an embodiment of the application;
[0059] Figure 10 Schematic diagram of another benchmark provided by an embodiment of the present application;
[0060] Figures 11A to 11D Schematic diagram of a method for identifying benchmarks provided by an embodiment of the present application;
[0061] Figure 12 Schematic diagram of the structure of a chip system provided by an embodiment of the present application;
[0062] Figure 13 Schematic diagram of the structure of a device provided by an embodiment of the present application. Detailed implementation manners
[0063] In the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may represent A or B; herein, "and / or" is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone.
[0064] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features.
[0065] In the description of the embodiments of the present application, unless otherwise specified, "a plurality of" means two or more. In the embodiments of the present application, words such as "exemplary" or "for example" are used to represent examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Exactly speaking, using words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.
[0066] As Figure 1 shown, a communication system provided by an embodiment of the present application. The communication system includes a first electronic device 100, a server 200, and a second electronic device 300. In some examples, the second electronic device 300 and the first electronic device 100 may be the same device. In other examples, the first electronic device 100, the server 200, and the second electronic device 300 may be the same device. That is to say, all the steps in the embodiments of the present application are completed by one device, such as a terminal.
[0067] Among them, the first electronic device 100 is a device with a camera and can be used to capture an image of a target to be measured. For example, the first electronic device 100 may be a mobile phone, a tablet computer, a camera, a wearable electronic device, etc. The present application does not make special restrictions on the specific form of the first electronic device 100.
[0068] Specifically, the surveyor can use the first electronic device 100 to capture a first image and a second image at different shooting positions and in different shooting directions. Both the first image and the second image include the target object. The above-mentioned shooting position can be understood as the position where the optical center (or the photography center) of the camera of the first electronic device 100 is located when taking the image. Capturing the first image and the second image in different shooting directions means selecting different photography points around the target object (such as the target object) as the center and taking the first image and the second image, and the two photography points are not on the same straight line as the target object. Under the condition that the shooting distance and the shooting height remain unchanged, different shooting directions can show different side images of the target object. Alternatively, capturing the first image and the second image in different shooting directions can also be understood as the angle formed by the connection lines between the Q point on the target object and the photography centers of the two captured images is not zero and not 180 degrees. Among them, the Q point on the target object can be any point on the target object, for example, any one of the two endpoints of the target object, or the vertex of the target object, etc.
[0069] It should be noted that the first image and the second image captured at different shooting positions and in different shooting directions can form a stereoscopic image pair, so as to subsequently form a digital three-dimensional space and calculate the distance between the two endpoints of the target object and the height of the target object based on the principle of triangulation.
[0070] For example, as Figure 2A shown, the surveyor can carry the first electronic device 100 to capture the first image of the target to be measured 21 at a certain position. When capturing the first image, the camera of the first electronic device 100 is located at the first position P1. Then, the surveyor moves his own position and captures the second image at another position. When capturing the second image, the camera of the first electronic device 100 is located at the second position P2. Among them, the angle α1 is formed by the connection lines between the vertex Q1 point on the target object and the P1 point and the P2 point respectively. Among them, the angle α1 is not zero and not 180 degrees. Figure 2A The measurement method shown can be used in outdoor measurement scenarios. For example, the surveyor can face the target object (such as a house, a tower, etc.), move left and right to achieve two shootings, and the two shooting positions are several meters to dozens of meters apart, and distant target objects can be measured.
[0071] Another example, as Figure 2BAs shown in the figure, the surveyor can hold the first electronic device 100 above the head to capture the first image of the target object 22. When using the first electronic device 100 to capture the first image, the camera of the first electronic device 100 is located at the first position P3. Then, the surveyor places the first electronic device 100 at the waist to capture the second image of the target object. When using the first electronic device 100 to capture the second image, the camera of the first electronic device 100 is located at the second position P4. Among them, the connecting lines between the vertex Q2 point on the target object and the P1 point and the P2 point respectively form an angle α2. Among them, the angle α2 is neither zero nor 180 degrees. Figure 2B The method shown above can be applied to measurements in narrow spaces, such as narrow computer rooms, etc. The distance between the two shooting points is about 0.4 - 1 meter, and target objects within 10 meters can be measured.
[0072] For another example, as Figure 2C shown in the figure, the surveyor can stretch the arm to one side of the body to capture the first image of the target object 22. When using the first electronic device 100 to capture the first image, the camera of the first electronic device 100 is located at the first position P5. Then, the surveyor stretches the arm to the other side of the body to capture the second image of the target object. When using the first electronic device 100 to capture the second image, the camera of the first electronic device 100 is located at the second position P6. Among them, the connecting lines between the vertex Q3 point on the target object and the P1 point and the P2 point respectively form an angle α3. Among them, the angle α3 is neither zero nor 180 degrees. Figure 2C The method shown above can be applied to scenarios where it is inconvenient for the surveyor to move positions, such as on a iron tower or a roof. Then, the surveyor can spread the arms to the left and right respectively to achieve two photos. The distance between the two shooting points is about 1 - 2.5 meters, and target objects within 20 - 50 meters can be measured.
[0073] In some examples, the first electronic device 100 can also receive information of the first object with known dimensions input by the surveyor, such as the information of the two end points of the first object in the first image and the second image, and the actual size of the first object. Among them, both the first image and the second image include the first object.
[0074] Then, the first electronic device 100 sends the captured first image and second image to the server 200. The server 200 constructs a digital three-dimensional space based on the first image and the second image. It should be noted that the ratio of the sizes of the objects in the digital three-dimensional space to the sizes of the objects in the real three-dimensional world is the same, the relative position relationship between the objects in the digital three-dimensional space is the same as the relative position relationship between the objects in the real three-dimensional world, and the ratio of the distances between the objects in the digital three-dimensional space to the distances between the objects in the real three-dimensional world is the same.
[0075] The server 200 can identify the information of the first object with a known size in the first image and the second image, or receive the information of the first object with a known size from the first electronic device 100. The server 200 can obtain the scale ratio between the digital three-dimensional space and the real three-dimensional world according to the actual size of the first object and the size of the first object in the digital three-dimensional space. Thus, the server 200 can calculate the distance between the two endpoints of the target object according to the scale ratio and the digital three-dimensional space. In one implementation, the server 200 can receive the information of the two endpoints of the target object sent by the second electronic device 300, and the server 200 can calculate the distance between the two endpoints according to the information of the two endpoints of the target object and the scale ratio. In another implementation, the server 200 can send the digital three-dimensional space and the scale ratio to the second electronic device 300. The second electronic device 200 can then calculate the distance between the two endpoints of the target object according to the information of the two endpoints of the target object input by the surveyor.
[0076] Among them, the second electronic device 300 is a device with a display screen and an input device, which can display the first image and the second image, and receive the target object information input by the surveyor according to the first image and the second image. For example, the second electronic device 300 can be a mobile phone, a tablet computer, a personal computer (PC), a personal digital assistant (PDA), a netbook, etc. The present application does not impose special restrictions on the specific form of the second electronic device 300. In some examples, the second electronic device 300 can be the same device as the first electronic device 100.
[0077] In some other embodiments of the present application, the server 200 can also determine that the plane with the densest distribution of three-dimensional discrete points in the digital three-dimensional space is the ground, and then determine the height of the ground and the sky direction. Thus, the server 200 can calculate the height of the target object according to the scale ratio, the digital three-dimensional space, the ground height, and the sky direction, that is, the distance from the top of the target object to the ground. In one implementation, the server 200 can receive the top information of the target object sent by the second electronic device 300. The server 200 can calculate the height of the target object according to the top information of the target object, the digital three-dimensional space, the ground height, and the sky direction. In another implementation, the server 200 can send the digital three-dimensional space and related parameters (scale ratio, ground height, and sky direction) to the second electronic device 300. The second electronic device 200 can calculate the height of the target object according to the top information of the target object input by the surveyor and the digital three-dimensional space.
[0078] In summary, in the measurement method provided by the embodiments of the present application, the measurement personnel can use the first electronic device 100 to capture a first image and a second image at two different shooting positions in different shooting directions. Then, a digital three-dimensional space is constructed based on the first image and the second image. Next, according to the actual sizes of the objects with known sizes in the first image and the second image, the scale ratio between the digital three-dimensional space and the real three-dimensional world is obtained. Then, according to the scale ratio and the digital three-dimensional space, the distance between the two endpoints of the target object in the first image and the second image is calculated. The ground in the digital three-dimensional space can also be identified, and the plane with the densest distribution of three-dimensional discrete points is the ground, from which the height of the target object in the first image and the second image can be calculated. Compared with the prior art in which the measurement personnel need to pre-set the targets of multiple control points according to strict distance relationships and azimuth relationships and capture a large number of photos or videos containing the targets, the operation of capturing images at different shooting positions and in different shooting directions in the embodiments of the present application is convenient and highly reliable. Moreover, in the embodiments of the present application, using the actual size of the first object to determine the scale ratio of the size of the digital three-dimensional space is also beneficial to improving the reliability of the measurement. Furthermore, since it is also possible to capture images at different shooting positions and in different shooting directions in scenarios such as narrow computer rooms and sloping roofs, the measurement method provided by the embodiments of the present application can be applied to a wider range of measurement scenarios.
[0079] Please refer to Figure 3 , Figure 3 which shows a schematic structural diagram of the first electronic device 100.
[0080] The first electronic device 100 may include a processor 110, an internal memory 121, a universal serial bus (USB) interface 130, a camera 150, a display screen 160, etc. Optionally, the first electronic device 100 may further include one or more of an external memory interface 120, a charging management module 140, a power management module 141, and a battery 142.
[0081] Among them, the processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a graphics processing unit (GPU), an image signal processor (ISP), a digital signal processor (DSP), a baseband processor, and / or one or more of a neural-network processing unit (NPU). Among them, different processing units may be independent devices or integrated in one or more processors. In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, a general-purpose input / output (GPIO) interface, and / or a universal serial bus (USB) interface, etc. The processor 110 communicates and connects with other devices (such as the internal memory 121, the camera 150, the display screen 160, etc.) through the one or more interfaces.
[0082] The USB interface 130 is an interface that conforms to the USB standard specification. Specifically, it may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the first electronic device 100, and can also be used to transfer data between the first electronic device 100 and peripheral devices.
[0083] In the embodiments of the present application, the first electronic device 100 may send the first image and the second image taken to the server 200 through the USB interface 130, and send the positions of the two endpoints or the top of the target object in the first image marked by the user received, as well as the positions of the two endpoints or the top of the target object in the second image, etc. to the server 200. In some other examples, the first electronic device 100 may also send the positions of the two endpoints of the first object with a known size in the first image marked by the user received, the positions of the two endpoints of the first object with a known size in the second image, and information such as the actual size of the first object to the server 200 through the one or more interfaces.
[0084] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are only illustrative descriptions and do not constitute a structural limitation on the first electronic device 100. In other embodiments of the present application, the first electronic device 100 may also adopt different interface connection methods or a combination of multiple interface connection methods in the above embodiments.
[0085] The first electronic device 100 realizes the display function through the GPU, the display screen 160, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 160 and the application processor. The GPU is used to execute mathematical and geometric calculations and is used for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0086] The first electronic device 100 can realize the shooting function through the ISP, the camera 150, the GPU, the display screen 160, and the application processor, etc.
[0087] The ISP is used to process the data fed back by the camera 150. For example, when taking a photo, the shutter is opened, and the light passes through the lens and is transmitted to the camera photosensitive element. The optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP may be provided in the camera 150.
[0088] The camera 150 is used to capture static images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in standard RGB, YUV, etc. formats. In some embodiments, the first electronic device 100 may include 1 or N cameras 150, where N is a positive integer greater than 1.
[0089] In the embodiments of the present application, the first electronic device 100 can be used to call the camera 150 to take the first image and the second image including the target object at different shooting positions and in different shooting directions. Among them, the different shooting positions are the optical centers of the camera 150.
[0090] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to implement the storage capacity expansion of the first electronic device 100. The internal memory 121 can be used to store computer-executable program codes, and the executable program codes include instructions. The internal memory 121 can include a program storage area and a data storage area. The charging management module 140 is used to receive a charging input from a charger. The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives inputs from the battery 142 and / or the charging management module 140 to supply power to the processor 110, the internal memory 121, the display screen 160, the camera 150, and the wireless communication module, etc.
[0091] It can be understood that the structure schematically shown in the embodiments of the present invention does not constitute a specific limitation on the first electronic device 100. In other embodiments of the present application, the first electronic device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure can be implemented in hardware, software, or a combination of software and hardware.
[0092] Please refer to Figure 4 , Figure 4 FIG. shows a schematic structural diagram of a server 200. The server 200 includes one or more processors 210, one or more external memories 220, and one or more communication interfaces 230. Optionally, the server 200 may further include an input device 240 and an output device 250.
[0093] The processor 210, the external memory 220, the communication interface 230, the input device 240, and the output device 250 are connected by a bus. The processor 210 may include a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), a graphics processing unit (GPU), a neural-network processing unit (NPU), or an integrated circuit for controlling the execution of the program of the solution of the present application, etc.
[0094] Generally, an internal memory can be set in a processor, which can be used to store computer-executable program codes, and the executable program codes include instructions. The internal memory can include a program storage area and a data storage area. Among them, the program storage area can store an operating system and algorithm models required by embodiments of the present application, such as an algorithm model for identifying a first object, an algorithm for constructing a digital three-dimensional space based on a first image and a second image, an algorithm for solving a digital three-dimensional scale scaling ratio according to the actual size of the first object, an algorithm for identifying the plane with the densest three-dimensional discrete point distribution in the digital three-dimensional space, etc. The data storage area can store data created during the use of the server 200 (three-dimensional discrete point clouds of the digital three-dimensional space, the actual size of the first object, parameters of the ground position of the digital three-dimensional space, parameters of the sky direction of the digital three-dimensional space, etc.). In addition, the internal memory can include high-speed random access memory and can also include non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 210 executes various functional applications and data processing of the server 200 by running the instructions stored in the internal memory. In one example, the processor 210 can also include multiple CPUs, and the processor 210 can be a single-CPU processor or a multi-CPU processor. Here, the processor can refer to one or more devices, circuits, or processing cores for processing data (such as computer program instructions).
[0095] The communication interface 230 can be used to communicate with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.
[0096] The output device 250 communicates with the processor 210 and can display information in various ways. For example, the output device can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc.
[0097] The input device 240 communicates with the processor 210 and can receive user input in various ways. For example, the input device can be a mouse, a keyboard, a touch screen device, or a sensing device, etc.
[0098] It should be noted that the structure of the second electronic device 300 can be referred to Figure 3The structural description of the first electronic device 100. It can be understood that the second electronic device 300 may include more or fewer components than the first electronic device 100, or combine certain components, or split certain components, or have a different component arrangement. The embodiments of the present application do not limit this. In some examples, the second electronic device 300 may be the same device as the first electronic device 100.
[0099] To facilitate understanding of the technical solutions provided by the embodiments of the present application, the technical terms involved in the embodiments of the present application will be described first.
[0100] Free network adjustment: Adjustment refers to reasonably allocating the accidental errors of the observed values, pre-correcting the systematic errors of the observed values, and controlling the gross errors of the observed values by using certain observation principles and manual error checking methods. In general adjustment algorithms, the adjustment is based on known starting data, and the control network is fixed on the known data. When there are no necessary starting data in the network, it is called a free network, and the adjustment method without starting data is the free network adjustment.
[0101] Space resection: A method of calculating the elements of exterior orientation of an image by using more than three control points (or connection points) on the image that are not on a straight line according to the collinearity equation.
[0102] Space intersection: A method of determining the object space coordinates (coordinates in a certain tentative three-dimensional coordinate system or ground survey coordinate system) of a point from the interior and exterior orientation elements of the left and right images of a stereo image pair and the measured values of the image coordinates of the homologous image points.
[0103] Shooting position: In this article, the shooting position can be understood as the position where the optical center (or photographic center) of the camera of the first electronic device 100 is located when taking an image.
[0104] Shooting direction: In this article, the first image and the second image are taken in different shooting directions, which means that with the object to be photographed (such as the target object) as the center, different photographic points are selected around the target object to take the first image and the second image, and the two photographic points are not on the same straight line as the target object. Under the conditions of constant shooting distance and shooting height, different shooting directions can show different side images of the target object. Or, taking the first image and the second image in different shooting directions can also be understood as the angle formed by the connection lines between the Q point on the target object and the photographic centers of the two images taken is not zero and not 180 degrees. Among them, the Q point on the target object can be any point on the target object, for example, any one of the two endpoints of the target object, or the vertex of the target object, etc.
[0105] The technical solutions involved in the following embodiments can all be implemented in a communication system as shown in Figure 1 . The technical solutions provided in the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0106] As shown in Figure 5A , it is a flowchart of a digital photogrammetry method provided in an embodiment of the present application, specifically as follows:
[0107] S501. Obtain a first image and a second image. Both the first image and the second image include a target object. Among them, the shooting positions of the first image and the second image are different, and the shooting directions of the first image and the second image are different.
[0108] In some embodiments, a surveyor may carry a first electronic device 100 and capture a first image and a second image of the target object at different shooting positions and in different shooting directions. The meanings of the shooting position and the shooting direction can be referred to the above description and will not be elaborated here. Then, the captured first image and second image are sent to the server 200 through the first electronic device 100, and the server 200 performs subsequent data processing.
[0109] Among them, the first electronic device 100 can be a device that is easy to carry or a device commonly used by surveyors, such as a mobile phone, a tablet computer, a camera, a wearable device with a camera, or a device connected to a camera, etc. In this way, using a dedicated measurement device is avoided during the measurement process, which is beneficial to reducing the measurement cost and facilitating the surveyor to carry.
[0110] Taking the mobile phone as the first electronic device 100 as an example for exemplary illustration.
[0111] The surveyor can open the measurement application in the mobile phone and call the camera to take pictures. During the picture-taking process, the mobile phone can display some guiding information to prompt the surveyor to take the first image and the second image at two different shooting positions and in different shooting directions. For example, the prompt information 601 as shown in Figure 6A , the prompt information 602 as shown in Figure 6B , the prompt information 603 as shown in Figure 6C and the prompt information 604 as shown in Figure 6D . Then, the mobile phone can upload the captured first image and second image to the server 200 for processing.
[0112] Further, in one example, if the angles formed by connecting point Q on the target object to the camera centers of the two captured images are controlled within a range greater than 5 degrees and less than 60 degrees, the measurement error can be reduced to 2% or less. In another example, assume the distance from the camera center P1 of the first captured image to any point Q on the target object is D. Here, point Q on the target object can be any point on the target object, such as either of the two endpoints of the target object, or the vertex of the target object. If the distance between the camera center P2 of the second captured image and P1 is controlled within a range greater than D / 20 and less than D, the measurement error can be reduced to 2% or less.
[0113] S502. Construct a digital three-dimensional space based on the first image and the second image.
[0114] In some embodiments of the present application, the server 200 can first identify the rigid body and invariant ground object regions in the first image and the second image as valid regions, or identify the non-rigid and variable objects in the first image and the second image as invalid regions. Subsequently, perform relevant data processing procedures on the valid regions in the first image and the second image. In this way, on the one hand, since the regions of variable objects in the first image and the second image are excluded, it is beneficial to improve the accuracy of subsequent feature point matching. On the other hand, by excluding the regions of variable objects in the first image and the second image, only the valid regions in the first image and the second image are processed subsequently, significantly reducing the amount of data to be processed subsequently, which is beneficial to improving data processing efficiency.
[0115] In some examples of this embodiment, the sky, water surface, pedestrians, vehicles, etc. in the image can all be considered variable objects. Therefore, the server 200 can use the semantic segmentation method to perform full-element classification on the received first image and second image respectively, identify the variable objects in the first image and the second image, that is, the invalid regions. Then, the server 200 can add a gray mask to the invalid regions in the first image and the second image to mask the invalid regions in the first image and the second image.
[0116] Among them, the semantic segmentation method includes but is not limited to using open-source deep learning training models such as DeepLab-v3, and the embodiments of the present application do not limit this.
[0117] Optionally, the server 200 can also perform color equalization on the images of the invariant ground object regions (i.e., valid regions) already identified in the first image and the second image. In specific implementation, algorithms such as histogram stretching, histogram regularization, and Kama transformation can be performed on the valid regions in the first image and the second image to achieve color equalization.
[0118] Taking the method of histogram stretching as an example, an explanation is given. In one example, the server 200 respectively calculates the grayscale histograms for the images of the valid regions in the first image. Among them, the grayscale histogram is to count the frequencies of all the pixels in the image according to the magnitudes of their grayscale values. Then, the server 200 discards a part of the pixels with larger grayscale values (for example, the number of discarded pixels accounts for 0.5% of the total number of pixels in the image of the valid region), and / or discards a part of the pixels with smaller grayscale values (for example, the number of discarded pixels accounts for 0.5% of the total number of pixels in the valid region), to obtain a truncation threshold. According to the truncation threshold, a linear transformation formula is constructed to perform stretching of the grayscale histogram, so as to achieve color equalization of the images of the valid regions in the first image. Using a similar method, the server 200 can perform color equalization on the images of the valid regions in the second image.
[0119] It should be noted that performing color equalization on the valid regions in the first image and the second image is beneficial to reducing the influence of environmental factors during shooting (such as weather conditions, light conditions, etc.) and factors such as the specifications of the camera used for shooting, and improving the accuracy of subsequent feature point matching and dense matching.
[0120] Furthermore, the server 200 performs feature point matching, free network adjustment, and dense matching on the images of the regions of the ground objects in the first image to obtain a digital three-dimensional space.
[0121] Among them, feature point matching includes feature extraction, feature description, and feature matching. Specifically, the server 200 extracts feature points from the images of the valid regions of the first image and the images of the valid regions of the second image after the above processing, and then describes each feature point respectively. The similarity degrees of each feature point in the image of the valid region of the first image and each feature point in the image of the valid region of the second image are compared. Whether the feature points with similarity degrees higher than threshold A are the same feature points (i.e., homologous feature points) is determined, thus completing feature matching. It can be understood that the server 200 can use any technology known in the relevant technical field to match the feature points in the first image and the second image, and the embodiments of the present application do not make specific limitations in this regard. For example, the server 200 can use feature description operators such as scale-invariant feature transform (SIFT) and speeded up robust features (SURF) for feature description. Another example is that the server 200 can use the least squares method for feature matching.
[0122] The feature points determined to be of the same name in the valid region image of the first image and the valid region of the second image form the connection points of the two images. The server 200 performs gross error rejection and adjustment assignment based on these connection points, that is, free network adjustment. Then, based on the connection points after free network adjustment, spatial resection and intersection calculation are performed to obtain the relative exterior orientation elements of the two images. Based on the relative exterior orientation elements of the two images, a core line image is constructed and dense matching is performed, that is, spatial forward intersection calculation is performed pixel by pixel to obtain a three-dimensional dense point cloud, constituting a digital three-dimensional space. Among them, the three-dimensional point cloud refers to a set of point data on the surface of an object in a three-dimensional space, which can be used to reflect the surface contour of the object. The number of points obtained by this method is large and dense, that is, a dense point cloud.
[0123] It should be noted that the digital three-dimensional space obtained by the embodiments of the present application through free network adjustment and dense matching based on the first image and the second image is inconsistent with the position, size, and direction of the real three-dimensional world. However, the ratio of the sizes of the objects in the digital three-dimensional space to the actual sizes of the objects in the real three-dimensional world is the same; the ratio of the distances between the objects in the digital three-dimensional space to the distances between the objects in the real three-dimensional world is the same.
[0124] In some other embodiments of the present application, when performing feature point matching, the server 200 can also verify whether the first image and the second image taken by the surveyor meet the shooting requirements according to the feature point matching situation. If the first image and the second image do not meet the shooting requirements, relevant prompt information can be displayed through the first electronic device 100 or relevant voice prompts can be played to prompt the surveyor to retake the first image and the second image, or retake the second image.
[0125] For example, if it is detected that no feature points of the same name are extracted in the valid regions of the first image and the second image, or the number of extracted feature points of the same name is less than the threshold B (for example, 10 to 100), the server 200 can prompt the surveyor through the first electronic device 100, "Please retake the first image and the second image to ensure that the two shootings are aligned with the same target."
[0126] For another example, if it is detected that the deviation of the image point positions of the feature points of the same name extracted in the valid regions of the first image and the second image is generally less than the threshold C (for example, 5 to 20 pixels), the server 200 can prompt the surveyor through the first electronic device 100, "Please retake the first image and the second image to ensure shooting at different positions."
[0127] Among them, the following formula can be used to calculate the deviation ΔP of the image point positions of the feature points of the same name (denoted as point P) in the first image and the second image:
[0128]
[0129] Among them, (Px1, Py1) are the pixel coordinates of point P in the first image; (Px2, Py2) are the pixel coordinates of point P in the second image.
[0130] S503. Obtain the actual size S1 of the first object and the position information of the first object in the first image and the second image; calculate the size S2 of the first object in the digital three-dimensional space according to the position information of the first object in the first image and the second image; wherein, the first object is included in both the first image and the second image.
[0131] In some embodiments of the present application, the surveyor can also input, through the first electronic device 100, information about an object with a known size in the first image and the second image, such as the positions of the two endpoints of the object with a known size in the first image, the positions of the two endpoints of the object with a known size in the second image, and the size of the first object in the real space, that is, the actual size S1 of the object. In a specific example, the surveyor can distinguish the first object with a known size from the first image and the second image, mark the two endpoints of the first object in the first image and the second image respectively, and input the size of the first object through the first electronic device 100. In another specific example, the surveyor can also place the first object with a known size within the view range of the camera when taking the first image and the second image. That is to say, when taking the first image and the second image, the first object is also captured in both the first image and the second image. After taking the first image and the second image, the surveyor can mark the two endpoints of the first object in the first image and the second image respectively, and input the actual size of the first object through the first electronic device 100.
[0132] Then, the first electronic device 100 sends the positions of the two endpoints of the first object in the first image (such as the image point coordinates in the first image), the positions of the two endpoints of the first object in the second image (such as the image point coordinates in the second image), and the actual size S1 of the first object to the server 200. The server 200 can first calculate the coordinates of the two endpoints of the first object in the digital three-dimensional space according to the positions of the two endpoints of the first object in the first image and the positions of the two endpoints of the first object in the second image, and then calculate the distance between these two coordinates, which is the size S2 of the first object in the digital three-dimensional space.
[0133] Still taking the mobile phone as an example of the first electronic device 100 for exemplary illustration. The mobile phone can display the first image and the second image simultaneously, or display the first image and the second image successively, so that the surveyor can mark the positions of the two endpoints of the first object with known dimensions on the two images respectively (i.e., a total of four positions). In some examples, when the surveyor marks the position of one endpoint in one of the images, the mobile phone can also draw auxiliary lines in the other image according to the position of the endpoint in this image and the geometric relationship of the stereo image pair to help the surveyor mark the position of the endpoint in the other image.
[0134] For example, due to the small display screen of the mobile phone, the first image and the second image can be displayed successively. As Figure 6E and Figure 6F shown, both the first image and the second image displayed on the mobile phone include an A4 paper with a known length. The length of the A4 paper is 29.7 cm. Then, the surveyor can mark the two endpoints of the long side of the A4 paper in the first image and the second image respectively. As Figure 6E shown, the surveyor can first mark the two endpoints E1 and F1 of the long side of the A4 paper in the first image. Of course, the first image can also be enlarged and then the two endpoints E1 and F1 of the long side of the A4 paper can be marked to make the marking more accurate. Then, switch to the second image. The mobile phone can draw auxiliary lines in the second image according to the two endpoints E1 and F1 that have been marked in the first image and the geometric relationship of the stereo image pair. As Figure 6F shown, the dashed line (1) is the auxiliary line corresponding to the endpoint E1. The surveyor can mark the corresponding endpoint E2 in the second image according to this auxiliary line. The dashed line (2) is the auxiliary line corresponding to the endpoint F1. The surveyor can mark the corresponding endpoint F2 in the second image according to this auxiliary line. Then, the mobile phone calculates the image point coordinates of E1 and F1 in the first image, and the image point coordinates of E2 and F2 in the second image. The mobile phone can also prompt the surveyor to input the value of the actual size S1 of the first object. Then, the mobile phone sends the image point coordinates of E1, F1, E2, and F2, and the value of the actual size S1 to the server 200 for subsequent processing.
[0135] In other embodiments of the present application, the server 200 can also identify the two endpoints of the first object with known dimensions in the first image and the second image, as well as the actual size S1 between the two endpoints of the first object. In some examples, a benchmark with a fixed length and an appearance that is easily recognizable by the server 200 can be designed as the first object. When the surveyor takes the first image and the second image, the benchmark is placed within the shooting range of the first electronic device 100, that is, both the first image and the second image taken include the benchmark.
[0136] Among them, the designed benchmark can be multiple rod-shaped objects with evenly distributed colors. The server 200 can determine the positions of the endpoints of the benchmark by automatically locking a specific color among the rod-shaped objects in the first image and the second image. And the actual size S1 between the two endpoints of the benchmark is known. Among them, the design of the benchmark and the method of identifying the two endpoints of the benchmark will be described in detail below and will not be described here first.
[0137] In some other embodiments of the present application, the server 200 can also first identify the two endpoints of the first object with a known size in the first image and the second image. If the identification fails, the measuring personnel can be prompted through the first electronic device 100 to manually input relevant information of the first object with a known size, such as the positions of the two endpoints of the first object in the first image, the positions of the two endpoints of the first object in the second image, and the actual size S1 of the first object, etc. Or, after the server 200 identifies the two endpoints of the first object with a known size in the first image and the second image, the measuring personnel can also be prompted through the first electronic device 100 to check the information of the identified first object, etc., to ensure the accuracy of the identification result.
[0138] S504. Obtain the scale ratio of the digital three-dimensional space to the real three-dimensional world according to the actual size S1 of the first object and the size S2 of the first object in the digital three-dimensional space.
[0139] In some embodiments of the present application, the server 200 obtains the scale ratio of the digital three-dimensional space to the real space as S1 / S2 according to the size S2 of the first object in the digital three-dimensional space and the actual size S1 of the first object in the real three-dimensional world.
[0140] S505. Determine the distance between the two endpoints of the target object according to the digital three-dimensional space, the scale ratio, the first image, and the second image.
[0141] In an example, the server 200 can receive the positions of the two endpoints of the target object sent by the second electronic device 300, including the image point coordinates of the two endpoints of the target object in the first image and the image point coordinates of the two endpoints of the target object in the second image. Perform spatial resection according to the image point coordinates of the two endpoints of the target object to calculate the coordinates of the two endpoints of the target object in the digital three-dimensional space. As Figure 5B shown, the U point (x3, y3, z3) and the V point (x4, y4, z4) are the coordinates of the two endpoints of the target object calculated by the server 200 in the digital three-dimensional space. The distance between the U point and the V point in the digital three-dimensional space can be calculated according to the coordinates of the U point and the V point in the digital three-dimensional space, and then the actual distance between the two endpoints can be calculated according to the distance between the U point and the V point in the digital three-dimensional space and the scale ratio.
[0142] In another example, the server 200 may also send the calculated digital three-dimensional space and scale ratio to the second electronic device 300. The second electronic device 300 receives the marks of the two endpoints of the target object input by the surveyor, and calculates the distance between the two endpoints of the target object according to the digital three-dimensional space and scale ratio.
[0143] Still taking the mobile phone as an example of the second electronic device 300 for exemplary illustration. The mobile phone can display the first image and the second image simultaneously, or display the first image and the second image successively, so that the surveyor can mark the positions of the two endpoints of the target object (i.e., a total of four positions) on the two images respectively. The specific marking method is the same as the method of marking the two endpoints of the first object in step S503, which will not be elaborated here. For example, as Figure 6G shown, the surveyor marks the two endpoints S1 and R1 of the target object in the first image. As Figure 6H shown, the surveyor marks the two endpoints S2 and R2 of the target object in the second image. Then, the second electronic device 300 sends the image point coordinates of S1, R1, S2, and R2 to the server 200, which is convenient for the server 200 to perform subsequent processing to measure the length of the display. In some examples, the second electronic device 300 may be the same device as the first electronic device 100.
[0144] It should be noted that the target object here may be one, and the distance between the two endpoints of the target object may be the height, length, width, etc. of the target object. The target object may also be two, and the distance between the two endpoints of the target object may be the distance between the two target objects, etc. For example, this measurement method can be used in the digital survey of telecommunication base stations to obtain information such as equipment dimensions, cable lengths, installation distances, etc. It can also be used in other engineering surveys or daily life, such as measuring the building spacing, etc.
[0145] In summary, in the measurement method provided by the embodiments of the present application, the measurement personnel can use the first electronic device 100 to capture the first image and the second image at two different shooting positions in different shooting directions. Then, a digital three-dimensional space is constructed based on the first image and the second image. Further, according to the actual sizes of the first objects with known sizes in the first image and the second image, the scale ratio between the digital three-dimensional space and the real three-dimensional world is obtained. Then, according to the digital three-dimensional space and the scale ratio, the distance between the two endpoints of the target object in the first image and the second image can be calculated. Compared with the prior art in which the measurement personnel need to set up the targets of multiple control points in strict distance relationships and azimuth relationships in advance and capture a large number of photos or videos including the targets, the operation of capturing images at different shooting positions in different shooting directions in the embodiments of the present application is convenient and highly reliable. Moreover, in the embodiments of the present application, using the actual sizes of the first objects to determine the scale ratio of the size of the digital three-dimensional space is also beneficial to improving the reliability of the measurement. Furthermore, since it is also possible to capture images at different shooting positions in different shooting directions in scenarios such as narrow machine rooms and inclined roofs, the measurement method provided by the embodiments of the present application can be applied to a wider range of measurement scenarios.
[0146] Considering that in some scenarios of measuring the height of a target object, it may be impossible for the first electronic device 100 to capture an image including the top and bottom of the target object due to the relatively high target object or the bottom end of the target object being blocked by other objects. For this reason, the embodiments of the present application also provide a digital photogrammetry method, which can identify the plane with the densest three-dimensional discrete points in the digital three-dimensional space based on the digital three-dimensional space obtained in step S502 and the scale ratio obtained in S504, and confirm it as the ground. Further, according to the normal vector of the ground and the shooting positions of the first and second images, the direction of the sky is determined. Then, the server 200 can calculate the distance from the top end of the target object to the ground based on the top end of the target object, the ground position, and the sky direction, which is the height of the target object, so as to expand the usage scenario of the measurement method provided by the embodiments of the present application. In addition, when calculating the height of the target object, it is also possible to complete the measurement of the height of the target object by only marking the position of the top end in the first image and the second image, without marking the position of the bottom end.
[0147] Specifically, as Figure 7A shown, it is a schematic flowchart of another digital image measurement method provided by the embodiments of the present application. This measurement method includes the above steps S501 to S504, and steps S701 to S702, specifically as follows:
[0148] S701. Identify the plane with the densest distribution of discrete points in the second three-dimensional space as the ground, and further determine the sky direction in the digital three-dimensional space.
[0149] Generally, in the real three-dimensional world, the ground is the plane with the most and most complex distributed rigid bodies. Therefore, the areas with the richest textures in the first image and the second image can be considered as the ground. Then, in the digital three-dimensional space constructed based on the first image and the second image, the plane with the densest distribution of three-dimensional discrete points can be considered as the ground. Among them, the plane with the densest distribution of three-dimensional discrete points is the plane with the largest numerical value of the point data within the unit space. After determining the ground in the digital three-dimensional space, the normal vector of the ground is the sky direction or the gravity direction. Further, since the camera centers of the first image or the second image are determined to be above the ground, the sky direction in the digital three-dimensional space can be determined.
[0150] In a specific example, the server 200 can determine the ground and the sky direction in the digital three-dimensional space by the following steps:
[0151] Step a: Determine the midpoint of the photography of the first image and the camera center of the second image in the digital three-dimensional space. The center of the line connecting the camera centers of the two images is set as point O (O x , O y , O z ), and a virtual sphere is constructed with point O as the center of the sphere.
[0152] Step b: Mesh the virtual sphere in terms of longitude and latitude. The longitude is denoted as Lon, and the value range is (-180°, 180°]. The latitude is denoted as Lat, and the value range is (-90°, 90°]. With a sampling interval of 1°, there are 360 * 180 grid points on the virtual sphere. Of course, the sampling interval can also be other degrees, and this application does not limit the number of grid points on the virtual sphere.
[0153] Step c: Starting from the center of the sphere O, draw rays to the grid points on the sphere surface to form 360 * 180 vectors, denoted as representing 360 * 180 directions.
[0154] Step d: Starting from the position of the virtual center of the sphere, arrange n (for example, 10) virtual cylinders with a height of m meters (for example, 0.2 meters) and a radius of r meters (for example, 50 meters) at equal intervals along the direction, denoted as where i is the cylinder label code, and i ∈ {1, 2,..., 10}. It should be noted that the height and radius of the virtual cylinder here are designed according to the size of the real three-dimensional world. Therefore, corresponding to the digital three-dimensional space, it needs to be divided by the size scaling ratio S1 / S2. Of course, the height and radius of the virtual cylinder can also be designed according to the size of the digital three-dimensional space, and then there is no need to divide by the size scaling ratio S1 / S2. This application embodiment does not limit this.
[0155] Step e: Calculate the number of three-dimensional discrete points within the "bounding box" formed by the 360*180*n virtual cylinders formed in Steps d and e, respectively, and record the direction corresponding to the bounding box with the largest number. and the marker code i Mark . Then the sky direction is the opposite direction, and the distance from the ground position to the center O of the virtual sphere is m*i Mark .
[0156] It can be understood that other methods can also be used to determine the ground and sky directions in the digital three-dimensional space, and the embodiments of the present application do not make specific limitations thereto.
[0157] S702: Determine the distance from the top of the target object to the ground as the height of the target object according to the position of the ground, the direction of the sky, the digital three-dimensional space, the first image, and the second image.
[0158] In one example, the server 200 can receive the position of the top of the target object sent by the second electronic device 300, including the image point coordinates of the top of the target object in the first image and the image point coordinates of the top of the target object in the second image. Perform spatial forward intersection according to the image point coordinates of the top of the target object, and calculate the coordinates of the top of the target object in the digital three-dimensional space. As Figure 7B shown, the point T (x1, y1, z1) is the coordinates of the top of the target object calculated by the server 200 in the digital three-dimensional space. The point G (x2, y2, z2) is an arbitrarily selected point on the ground in the digital three-dimensional space. The line connecting the top T of the target object and the point G can be used as the hypotenuse of a triangle (or right trapezoid), and the height H in the vertical direction can be used as a right side to construct a triangle (or right trapezoid). Solve the triangle according to geometric principles, and the length H of the right side obtained is the height of the target object.
[0159] In another example, the server 200 can also send information such as the calculated digital three-dimensional space, size scaling ratio, ground position, sky direction, etc. to the second electronic device 300. The second electronic device 300 receives the mark of the top of the target object input by the surveyor and calculates the height of the target object according to the third three-dimensional space.
[0160] Still taking the mobile phone as an example of the second electronic device 300 for illustrative purposes. The mobile phone can display the first image and the second image simultaneously, or display the first image and the second image successively, so that the surveyor can mark the position of the top of the target object on the two images respectively (i.e., a total of two positions). The specific marking method is the same as the method of marking the two endpoints of the first object in Step S503, and will not be elaborated here. In some examples, the second electronic device 300 can be the same device as the first electronic device 100.
[0161] It can be seen that the measurement method provided by the embodiments of the present application can be applied to the digital survey scenario of telecommunication base stations to obtain the heights of tall towers at a distance and various types of equipment on the towers. It can also be applied to other engineering surveys or daily life, such as measuring the height of a building.
[0162] Next, a method for the server 200 to identify the two endpoints of a reference rod will be described in detail with reference to a reference rod.
[0163] As Figure 8 shown, it is a schematic diagram of a reference rod given by the embodiments of the present application. The reference rod is a rod-shaped object with a four-color segmented design. The four colors include black, white, Color 1, and Color 2. Among them, Color 1 and Color 2 are different, and both Color 1 and Color 2 are not black or white. Color 1 and Color 2 can be selected as a pair of complementary colors from the color wheel. As Figure 9 shown is a schematic diagram of a 24-color wheel. For example, Color 1 and Color 2 can be red and cyan. Color 1 and Color 2 can also be magenta and green. Of course, Color 1 and Color 2 can also be two colors close to complementary colors. Taking Color 1 as red as an example, Color 2 can also be blue-cyan or green-cyan. Since the two colors in complementary colors have a large difference in distinguishability, it is convenient for the server 200 to accurately identify these two colors.
[0164] It should be noted that considering that when the shooting light is insufficient, blue and black are not easily distinguishable in the captured image. When the shooting light is too bright, yellow and white are not easily distinguishable. Therefore, neither Color 1 nor Color 2 is blue or yellow.
[0165] In some examples, the arrangement order of the four-color segments on the reference rod is: black, white, Color 1, white, Color 2, white, and black. In this way, the intersection points of the black segments and the white segments (i.e., Point A and Point B) can be considered as the two endpoints that need to be identified by the server 200. On the reference rod, the distance between these two endpoints is the actual size S1 of the first object. For example, the lengths of the segments of each color between these two endpoints are equal, which is the first length S0, for example, 10 cm. Then, S1 = 5 * S0, and the total length of the reference rod is greater than 5 * S0.
[0166] In one example, the material of the reference rod can be plastic or carbon fiber, with the characteristics of not being easily deformed and not conducting electricity. The diameter of the reference rod can be 1 to 2.5 cm. The reference rod is a straight rod, including but not limited to a cylinder, an elliptical cylinder, a triangular prism, a quadrangular prism, etc. In another example, the reference rod can also be designed to be foldable, that is, the reference rod can be divided into at least two sections, connected by bolts or rubber bands, which is convenient for assembly and disassembly.
[0167] As Figure 10As shown, it is a schematic diagram of another kind of benchmark provided by the embodiment of the present application. Compared with Figure 8 the benchmark shown, Figure 10 at Figure 8 both ends of the benchmark shown (where the length of the black segmented parts at both ends of the benchmark is also S0), a section of white segmented part is respectively added. In this way, the intersection points (i.e., point C and point D) of the black segmented parts and the white segmented parts at both ends of the benchmark can be considered as the two end points that need to be recognized by the server 200. On the benchmark, the distance between these two end points is the actual size S1 of the first object. For example, the lengths of the segmented parts of each color between these two end points are equal, which is the first length S0, for example, 10 cm. Then, S1 = 7 * S0, and the total length of the benchmark is greater than 7 * S0. The specific form of the benchmark in the embodiment of the present application is not limited.
[0168] In some embodiments of the present application, when the surveyor uses the first electronic device 100 to capture the first image and the second image, the benchmark as shown in Figure 8 or the benchmark as shown in Figure 10 can be placed within the view range of the camera. Then, both the first image and the second image include the benchmark.
[0169] Then, the server 200 can respectively adopt a method combining deep learning and morphology for the first image and the second image to determine the approximate positions of the benchmarks in the two images, and then lock the center line of the benchmark according to the linear feature and color feature of the benchmark. Then, according to the center line of the benchmark, the known segmented relationships of each color in the benchmark, and the gray change amount in the image, the two end points of the benchmark are accurately locked, which are the two end points of the first object.
[0170] Next, taking the benchmark as shown in Figure 10 as an example, in combination with Figures 11A to 11D , a method for the server 200 to recognize the two end points of the benchmark is introduced in detail. This method specifically includes:
[0171] Step a: Respectively predict the position ranges of the benchmarks in the first image and the second image, denoted as the first range.
[0172] In a specific implementation manner, the two images can be first subjected to a switching process, that is, each image is respectively cut into small pieces, namely sliced images. Among them, the size of each sliced image can be, for example, 500 * 500 pixels, and a certain overlap degree, for example, 50% overlap degree, can be reserved between the sliced image and its surrounding sliced images. It should be noted that the slicing process is to increase the pixel ratio of the benchmark in the sliced image, which is more helpful for target detection.
[0173] Subsequently, a deep learning method can be adopted to perform object detection on the sliced images of the first image and the sliced images of the second image respectively to obtain the approximate positions of the benchmarks in the first image and the second image. The models used for object detection include but are not limited to Mask R-CNN, etc.
[0174] It should also be noted that before performing object detection, the server 200 can also preprocess the first image and the second image. For example, general optical cameras all have imaging distortion, and first, the internal parameters of the camera need to be used to perform distortion correction on each image. In another example, if the camera of the first electronic device 100 is a fish-eye lens, then a perspective transformation from spherical to central projection also needs to be performed on each image. Among them, distortion correction and perspective transformation are to ensure that the shape of the benchmark in the image is a straight line and will not be distorted due to projection deformation.
[0175] Optionally, morphological opening operations of "erosion first and then dilation" can be further adopted for the images of the benchmarks in the first image and the second image identified by the deep learning method to remove small-area noise points and expand and connect the predicted ranges of the benchmarks to better constrain the positions of the benchmarks in the first image and the second image. Among them, the scale of morphological dilation should be greater than the scale of morphological erosion. For example, the scale of morphological dilation is 30 pixels, and the scale of morphological erosion is 10 pixels.
[0176] For example, as Figure 11A shown, it is an example of the first image or the second image, and this image includes a benchmark. After performing the relevant processing of step a, the approximate position of the benchmark in this image can be obtained, as Figure 11B shown in the white area.
[0177] Step b: Determine the area with linear features from the images within the first range in the first image and the second image as the more accurate position range of the benchmark, denoted as the second range. Among them, the second range is smaller than the first range, and the second range is included within the first range.
[0178] In a specific implementation manner, a filter can be used to determine the area with linear features from the first image and the second image. Among them, the filter can specifically be the real part of a two-dimensional Gabor function, and the formula for constructing the filter is:
[0179]
[0180] Among them, (x, y) is the position in the two-dimensional filter; Gabor λ,σ,γ, θ ,φ(x, y) is the value of the Gabor filter at this position; λ is the wavelength of the sine function, 10 < λ < 20; σ is the standard deviation of the Gaussian function, 3 < σ < 6; γ is the aspect ratio of the Gaussian function in the x and y directions, γ = 1; φ is the initial phase of the sine wave, φ = 0; θ is the direction of the Gabor kernel function. In some examples of this application, some directions of the Gabor kernel function can be selected. For example, 9 directions are selected, such as θ being 0°, 20°, 40°, 60°, 80°, 100°, 120°, 140°, 160°, that is, 9 Gabor filters are respectively constructed.
[0181] After the filter is constructed, the constructed filter is used to process the first image and the second image to extract the straight line features in the images. For example, the size of the Gabor filter window is set to any odd number between 21 and 51. Then, the images in the first range in the first image and the second image are filtered multiple times by sliding the window, and the Gabor eigenvalue of the image at the i-th row and j-th column in the θ direction is obtained, denoted as T Gabor- θ(i, j). The final Gabor eigenvalue is the maximum value after taking the absolute values of the Gabor eigenvalues in multiple directions (such as 9 directions), as shown in the following formula:
[0182]
[0183] After the above calculation, the area where the Gabor eigenvalue is greater than the threshold D (for example, 100) is the area with obvious straight line features, and can be considered as the more accurate position range of the benchmark. For example, as Figure 11C shown, the white area in the image is the area with obvious straight line features determined in step b.
[0184] Furthermore, according to the approximate range of the benchmark determined in step a and the straight line area determined in step b, the overlapping area is further determined as the more accurate position range of the benchmark.
[0185] Step c: Identify the color features of the benchmark from the images in the second range of the first image and the second image, and combine the design of the benchmark to identify the two endpoints of the benchmark.
[0186] First, perform superpixel segmentation on the images within the second range in the first image and the second image, that is, pixels with similar colors and textures in the image form superpixels, which will effectively suppress the imaging noise points of the optical lens and is beneficial to locking the color blocks in the image. Among them, the color block refers to an area with specific color characteristics. Among them, the superpixel segmentation algorithm includes but is not limited to simple linear iterative clustering (SLIC), Mean-shift algorithm, etc. The size of the superpixel is, for example, 50 to 100 pixels.
[0187] Then, convert the image after superpixel segmentation from the RGB space to the HSL (Hue, Saturation, Lightness) space. Through the hue threshold segmentation method, extract two types of color blocks from the images within the second range in the first image and the second image respectively, namely the color blocks corresponding to Color 1 and the color blocks corresponding to Color 2. For example, red color blocks and blue-green color blocks. Among them, the threshold of the hue is related to the colors selected in the benchmark design. Then, calculate the centroids of the two color blocks, and the line connecting the centroids and its extension line are the center lines of the benchmark.
[0188] On the determined center line of the benchmark, find the position with the largest change in gray value within a specific range on both sides of the two determined color blocks, which can be considered as the intersection point of the black color block and the white color block. Among them, the above-mentioned largest change in gray value is close to and slightly less than 255. Since the gray value of black in the image is close to and slightly higher than zero, and the gray value of white in the image is close to and slightly less than 255. Then, the intersection point of the black color block and the white color block is where the gray value changes the most.
[0189] For example, if the benchmark is as Figure 8 shown, on the extension line of one side of the line connecting the centroids of the two color blocks, a position with the largest change in gray value can be determined, such as point A. On the extension line of the other side of the line connecting the centroids of the two color blocks, a position with the largest change in gray value can be determined, such as point B. Optionally, further verification can be performed on the two determined endpoints according to the positional relationship of each color block in the benchmark. For example, the distance between the centroid of the color block where Color 1 is located and the centroid of the color block where Color 2 is located is 2*s0. If the distance from point A to the center of the color block where Color 1 is located is 1.5*s0, or the distance from point A to the center of the color block where Color 2 is located is 2.5*s0, then it is considered that point A is accurately recognized. If the distance from point B to the center of the color block where Color 1 is located is 2.5*s0, or the distance from point B to the center of the color block where Color 2 is located is 1.5*s0, then it is considered that point B is accurately recognized.
[0190] For another example, if the benchmark is as Figure 10For the benchmark shown, on the extension line on one side of the line connecting the centers of gravity of the two colored color patches, two positions with the largest change in gray values can be determined, such as point A and point C. Further, according to the fact that the distance from point C to the center of gravity of the colored color patch is greater than the distance from point A to the center of gravity of the colored color patch, it can be determined that point C is one of the endpoints of the benchmark. Optionally, the accuracy of the recognition of point C can be further determined according to the positional relationship between point A and point C on the benchmark. For example, the distance between the center of gravity of the color patch where color 1 is located and the center of gravity of the color patch where color 2 is located is 2*s0. If the distance between point C and point A is s0, it can be considered that the recognition of point C is correct. On the extension line on the other side of the line connecting the centers of gravity of the two colored color patches, two positions with the largest change in gray values can be determined, such as point B and point D. Similarly, it can be determined that point D is the other endpoint of the benchmark. Optionally, the accuracy of the recognition of point D can be further determined according to the positional relationship between point B and point D. Of course, other methods can also be used to verify the accuracy of point C or point D recognized by the server 200, and the embodiments of the present application do not limit this. Of course, it can also be defined that the distance between point A and point B is the distance between the two endpoints of the benchmark that the server 200 needs to recognize, and the embodiments of the present application do not limit this either.
[0191] Still taking the Figure 10 benchmark shown as an example for illustration. As Figure 11D shown, in the recognized region 1001 in step b, the color patch 1002 corresponding to color 1 and the color patch 1003 corresponding to color 2 are recognized. Then, on the extension line of the line connecting the center of gravity of the color patch 1002 and the center of gravity of the color patch 1003, four endpoints with the largest change in gray values are found, which are point A, point C, point B, and point D respectively. Further, according to the positional relationship of each segment, it can be determined that point C and point D are the two endpoints of the benchmark.
[0192] It can be seen that when the server 200 can recognize the two endpoints of the benchmark as the two endpoints of the first object, there is no need for the surveyor to mark the two endpoints of the first object in the first image and the second image through the first electronic device 100, which can simplify the operation of the surveyor and make the measurement more automated.
[0193] The above embodiments are described by taking as an example constructing a digital three-dimensional space based on a first image and a second image, then determining the scale ratio, ground position, sky direction, etc. between the digital three-dimensional space and the real three-dimensional world, and finally directly calculating the distance between two endpoints of the target object or calculating the height of the target object based on the digital three-dimensional space, scale ratio, ground position, sky direction, etc. Based on the inventive concept of the embodiments of the present application, after constructing a digital three-dimensional space according to the first image and the second image, and determining information such as the scale ratio, ground position, and sky direction between the digital three-dimensional space and the real three-dimensional world, the obtained digital three-dimensional space can also be scaled, translated, rotated, etc., so that the digital three-dimensional space is adjusted to be consistent with the real three-dimensional world. Then, the distance between two endpoints of the target object is calculated based on the adjusted digital three-dimensional space, or the height of the target object is calculated. The embodiments of the present application do not make limitations in this regard.
[0194] The embodiments of the present application also provide a chip system, as Figure 12 shown, the chip system includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 and the interface circuit 1102 can be interconnected through a line. For example, the interface circuit 1102 can be used to receive signals from other devices (such as the memory of the server 200). Again, for example, the interface circuit 1102 can be used to send signals to other devices (such as the processor 1101). Exemplarily, the interface circuit 1102 can read the instructions stored in the memory and send the instructions to the processor 1101. When the instructions are executed by the processor 1101, the server 200 can be made to execute each step executed by the server 200 in the above embodiments. Of course, the chip system can also include other discrete devices, and the embodiments of the present application do not make specific limitations in this regard.
[0195] It can be understood that in order to implement the above functions, the above terminals, etc. include the corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should easily realize that, combining the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described function for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present invention.
[0196] The embodiments of the present application can divide functional modules for the above-mentioned terminals and the like according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. It should be noted that the division of modules in the embodiments of the present invention is illustrative, only a logical function division, and there can be other division methods in actual implementation.
[0197] In the case of dividing each functional module corresponding to each function, Figure 13 FIG. shows another possible structural schematic diagram of the server involved in the above embodiment. The server 200 includes an acquisition unit 1301, a construction unit 1302, and a determination unit 1303.
[0198] Among them, the acquisition unit 1301 is configured to acquire a first image and a second image, both of which include a target object and a first object with a known actual size; wherein, the shooting positions of the first image and the second image are different, and the shooting directions of the first image and the second image are different.
[0199] The construction unit 1302 is configured to construct a digital three-dimensional space according to the first image and the second image.
[0200] The determination unit 1303 is configured to determine the distance between the two endpoints of the target object according to the digital three-dimensional space and the scaling ratio between the size of the digital three-dimensional space and the real three-dimensional space, wherein the scaling ratio is related to the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object.
[0201] Further, the determination unit 1303 is further configured to: determine the plane with the densest distribution of discrete points in the digital three-dimensional space as the ground of the digital three-dimensional space; determine the sky direction of the digital three-dimensional space according to the ground of the digital three-dimensional space and the photographic center of the first image, or according to the ground of the digital three-dimensional space and the photographic center of the second image; determine the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, and the sky direction of the digital three-dimensional space.
[0202] Among them, all relevant contents of each step involved in the above method embodiments can be cited in the function descriptions of the corresponding functional modules, and will not be elaborated here. In the case of adopting an integrated unit, the above-mentioned obtaining unit 1301 can be the communication interface 230 of the server 200. The above-mentioned constructing unit 1302 and determining unit 1303 can be integrated together and can be the processor 210 of the server 200.
[0203] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated here.
[0204] In each embodiment of this application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0205] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this application embodiment, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of this application. The foregoing storage medium includes: various media that can store program codes such as flash memory, mobile hard disk, read-only memory, random access memory, magnetic disk, or optical disc.
[0206] The above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. A digital photogrammetry method, characterized in that, Including: Obtain a first image and a second image, both of which include a target object and a first object with a known actual size; wherein, the shooting positions of the first image and the second image are different, and the shooting directions of the first image and the second image are different; Construct a digital three-dimensional space according to the first image and the second image, and the digital three-dimensional space is presented in the form of a three-dimensional point cloud, and the three-dimensional point cloud is used to reflect the surface contour of the object; Determine the distance between two endpoints of the target object according to the scaling ratio of the size of the digital three-dimensional space to the size of the real three-dimensional space, wherein the scaling ratio is related to the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object.
2. The method according to claim 1, characterized in that, The method further includes: Determine the sky direction of the digital three-dimensional space according to the ground of the digital three-dimensional space and the camera center of the first image, or according to the ground of the digital three-dimensional space and the camera center of the second image; wherein, the ground of the digital three-dimensional space is the plane with the most dense distribution of discrete points in the digital three-dimensional space; Determine the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, and the sky direction of the digital three-dimensional space.
3. The method according to claim 1 or 2, characterized in that, Before determining the distance between two endpoints of the target object according to the scaling ratio of the size of the digital three-dimensional space to the size of the real three-dimensional space, the method further includes: Obtain the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object; Calculate the size S2 of the first object in the digital three-dimensional space according to the position of the first object in the first image and the position of the first object in the second image; Calculate the scaling ratio of the size of the digital three-dimensional space to the size of the real three-dimensional space according to the actual size S1 of the first object and the size S2 of the first object in the digital three-dimensional space.
4. The method according to claim 3, characterized in that, The obtaining the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object includes: Receive the input position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object; Or, identify the position of the first object in the first image and the position of the first object in the second image, and find the actual size S1 of the first object.
5. The method according to claim 4, characterized in that, The first object is a benchmark with a segmented design, and the first object at least includes a first black segment, a first white segment, a first color segment, a second white segment, a second color segment, a third white segment, and a second black segment arranged in sequence; wherein, the colors of the first color segment and the second color segment are a pair of complementary colors; The actual size S1 of the first object is the length between the two endpoints of the first object. One endpoint of the first object is located at the junction of the first black segment and the first white segment, and the other endpoint of the first object is located at the junction of the third white segment and the second black segment; The position of the first object in the first image is the positions of the two endpoints of the first object in the first image; the position of the first object in the second image is the positions of the two endpoints of the first object in the second image.
6. The method according to claim 5, characterized in that, The identifying the position of the first object in the first image and the position of the first object in the second image includes: Identifying the first color segment and the second color segment in the first image, and the first region with a linear feature in the first image; identifying the first color segment and the second color segment in the second image, and the second region with a linear feature in the second image; Automatically determining the positions of the two endpoints of the first object in the first image according to the first color segment and the second color segment in the first image, the first region in the first image, and the positional relationship of each color segment in the first object; and automatically determining the positions of the two endpoints of the first object in the first image according to the first color segment and the second color segment in the second image, the second region in the second image, and the positional relationship of each color segment in the first object.
7. The method according to claim 5 or 6, characterized in that, The first color segment is a red segment, and the second color segment is a cyan segment; Alternatively, the first color segment is a magenta segment, and the second color segment is a green segment.
8. The method according to any one of claims 1-7, characterized in that, Determining the distance between the two endpoints of the target object according to the scaling ratio of the dimensions of the digital three-dimensional space and the real three-dimensional space includes: Determining the distance between the two endpoints of the target object according to the digital three-dimensional space, the scaling ratio, the positions of the two endpoints of the target object in the first image, and the positions of the two endpoints of the target object in the second image.
9. The method according to any one of claims 2-8, characterized in that, The determining the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, and the sky direction of the digital three-dimensional space includes: Determining the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, the sky direction of the digital three-dimensional space, the position of the top end of the target object in the first image, and the position of the top end of the target object in the second image.
10. A measuring device, characterized in that, Includes: An acquisition unit for acquiring a first image and a second image. Both the first image and the second image include a target object and a first object with a known actual size; wherein, the shooting positions of the first image and the second image are different, and the shooting directions of the first image and the second image are different; A construction unit for constructing a digital three-dimensional space based on the first image and the second image, the digital three-dimensional space being presented in the form of a three-dimensional point cloud for reflecting the surface contour of an object; A determination unit for determining the distance between two end points of the target object according to the scaling ratio of the size of the digital three-dimensional space to the size of the real three-dimensional space, wherein the scaling ratio is related to the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object.
11. The measuring device according to claim 10, wherein, The determination unit is further configured to: Determine the sky direction of the digital three-dimensional space according to the ground of the digital three-dimensional space and the camera center of the first image, or according to the ground of the digital three-dimensional space and the camera center of the second image; wherein the ground of the digital three-dimensional space is the plane where the discrete points are most densely distributed in the digital three-dimensional space; Determine the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, and the sky direction of the digital three-dimensional space.
12. The measuring device according to claim 10 or 11, wherein, Before the determination unit determines the distance between the two end points of the target object according to the scaling ratio of the size of the digital three-dimensional space to the size of the real three-dimensional space, The acquisition unit is further configured to acquire the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object; The determination unit is further configured to calculate the size S2 of the first object in the digital three-dimensional space according to the position of the first object in the first image and the position of the first object in the second image; and calculate the scaling ratio of the size of the digital three-dimensional space to the size of the real three-dimensional space according to the actual size S1 of the first object and the size S2 of the first object in the digital three-dimensional space.
13. The measuring device according to claim 12, wherein, During the process of the acquisition unit acquiring the position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object, the acquisition unit is specifically configured to: Receive the input position of the first object in the first image, the position of the first object in the second image, and the actual size S1 of the first object; Or, identify the position of the first object in the first image and the position of the first object in the second image, and search for the actual size S1 of the first object.
14. The measuring device according to claim 13, wherein, The first object is a benchmark with a segmented design, and the first object at least includes a first black segment, a first white segment, a first colored segment, a second white segment, a second colored segment, a third white segment, and a second black segment arranged in sequence; wherein the colors of the first colored segment and the second colored segment are a pair of complementary colors; The actual size S1 of the first object is the length between the two endpoints of the first object. One endpoint of the first object is located at the junction of the first black segment and the first white segment, and the other endpoint of the first object is located at the junction of the third white segment and the second black segment; The position of the first object in the first image is the positions of the two endpoints of the first object in the first image; the position of the first object in the second image is the positions of the two endpoints of the first object in the second image.
15. The measuring device according to claim 14, wherein, During the process that the acquisition unit identifies the position of the first object in the first image and the position of the first object in the second image, the acquisition unit is further specifically configured to: Identify the first color segment and the second color segment in the first image, and the first region with a linear feature in the first image; identify the first color segment and the second color segment in the second image, and the second region with a linear feature in the second image; Automatically determine the positions of the two endpoints of the first object in the first image according to the first color segment and the second color segment in the first image, the first region in the first image, and the positional relationship of each color segment in the first object; And automatically determine the positions of the two endpoints of the first object in the first image according to the first color segment and the second color segment in the second image, the second region in the second image, and the positional relationship of each color segment in the first object.
16. The measuring device according to claim 14 or 15, wherein, The first color segment is a red segment, and the second color segment is a cyan segment; Or, the first color segment is a magenta segment, and the second color segment is a green segment.
17. The measuring device according to any one of claims 10 - 16, wherein, During the process that the determination unit determines the distance between the two endpoints of the target object according to the scaling ratio of the sizes of the digital three-dimensional space and the real three-dimensional space, the determination unit is specifically configured to: Determine the distance between the two endpoints of the target object according to the digital three-dimensional space, the scaling ratio, the positions of the two endpoints of the target object in the first image, and the positions of the two endpoints of the target object in the second image.
18. The measuring device according to any one of claims 11 - 17, wherein, During the process that the determination unit determines the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, and the sky direction of the digital three-dimensional space, the determination unit is specifically configured to: Determine the height of the target object according to the digital three-dimensional space, the scaling ratio, the ground of the digital three-dimensional space, the sky direction of the digital three-dimensional space, the position of the top end of the target object in the first image, and the position of the top end of the target object in the second image.
19. A server, wherein, Comprising one or more processors, one or more memories, and one or more communication interfaces, the one or more memories and the one or more communication interfaces being coupled to the one or more processors, the one or more memories being used to store computer program code, the computer program code including computer instructions, when the one or more processors read the computer instructions from the one or more memories, so that the server executes the digital photogrammetry method according to any one of claims 1-9.
20. A computer storage medium, wherein, Including computer instructions, when the computer instructions run on the server, so that the server executes the digital photogrammetry method according to any one of claims 1-9.