Ranging method, device, equipment and medium

By utilizing the positional information of multiple cameras to construct a three-dimensional observation model, the two-dimensional pixel coordinates are converted into three-dimensional spatial coordinates, which solves the problems of high hardware cost and reliance on prior information in traditional ranging methods. This enables accurate target size measurement in scenarios without reference objects and improves robustness in complex environments.

CN121346740AActive Publication Date: 2026-01-16LANJIAN (SUZHOU) TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202511914726.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-01-16
Estimated Expiration
2045-12-18

AI Technical Summary

Technical Problem

Existing target size measurement methods based on image matching suffer from high hardware costs or over-reliance on prior information.

Method used

By using the positions of at least two observation cameras as prior information, a three-dimensional observation model is constructed to convert two-dimensional pixel coordinates into three-dimensional spatial coordinates, avoiding dependence on reference objects, and using multi-camera collaborative work for distance measurement.

Benefits of technology

Accurately measuring target dimensions in architectural scenarios without reference points significantly reduces hardware costs, improves adaptability to confined spaces and measurement robustness in complex environments, and provides reliable dimensional data support for safety hazard identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121346740A_ABST
    Figure CN121346740A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of measurement, and discloses a distance measurement method and device, equipment and a medium. The method comprises the following steps: acquiring at least two observation images containing observation targets; determining an observation included angle of the observation camera based on the observation image; determining a real distance between the observation camera and the end part of the observation target based on the position coordinates of the observation camera, the observation included angle of the observation camera and the end part pixel coordinates of the observation target; and determining the real size of the observation target based on the real distance between the observation camera and the end part of the observation target and the observation included angle of the observation camera. According to the embodiment of the invention, real-time and accurate image distance measurement can be realized with relatively low hardware cost and relatively less prior information.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of measurement, in particular to a ranging method, device, equipment and medium. BACKGROUND

[0002] At present, the target size measurement technology based on image matching has been gradually applied in the field of building safety. The core idea is to collect the building scene image through the camera, and then use the ranging algorithm to deduce the real size of the target object (such as the edge opening) in the image. However, the current target size measurement method based on image matching has the technical problems of high hardware cost or excessive dependence on prior information. SUMMARY

[0003] The purpose of the present application is to provide a ranging method, device, equipment and medium, which can realize real-time and accurate image ranging with relatively low hardware cost and relatively little prior information.

[0004] The present application provides a ranging method, comprising: obtaining at least two observation images containing an observation target; the observation images are respectively photographed by observation cameras located at different positions; determining an observation included angle of the observation cameras based on the observation images; determining a real distance between the observation cameras and the end of the observation target based on the position coordinates of the observation cameras, the observation included angle of the observation cameras and the end pixel coordinates of the observation target; determining a real size of the observation target based on the real distance between the observation cameras and the end of the observation target and the observation included angle of the observation cameras.

[0005] In some embodiments, the determination of the observation included angle of the observation cameras based on the observation images comprises: performing image pixel coordinate extraction on the observation images to obtain end pixel coordinates of the observation target and center pixel coordinates of a center pixel point of the observation images; determining an offset included angle of the observation target relative to the observation center based on the field of view angle of the observation cameras and the offset amount between the end pixel coordinates and the center pixel coordinates; fitting the offset included angle and the real direction angle of the observation images to obtain the observation included angle.

[0006] In some embodiments, the image pixel coordinate extraction on the observation images comprises: identifying the center pixel point, the start pixel point and the end pixel point of the observation target; extracting pixel coordinates of the center pixel point, the start pixel point and the end pixel point in the observation image, to obtain the end pixel coordinates and the center pixel coordinates.

[0007] In some embodiments, the determining the offset angle of the observation target relative to the observation center based on the field of view angle of the observation camera and the offset between the end pixel coordinates and the center pixel coordinates comprises: obtaining a horizontal field of view angle of the observation camera; determining a vertical field of view angle of the observation camera based on the horizontal field of view angle of the observation camera; determining the offset between the end pixel coordinates and the center pixel coordinates based on a difference between the end pixel coordinates and the center pixel coordinates and a resolution of the observation image; determining the offset angle of the observation target relative to the observation center based on the horizontal field of view angle, the vertical field of view angle and the offset between the end pixel coordinates and the center pixel coordinates.

[0008] In some embodiments, the determining the real distance between the observation camera and the end of the observation target based on the position coordinates of the observation camera, the observation angle of the observation camera and the end pixel coordinates of the observation target comprises: mapping the position coordinates of the observation camera and the end pixel coordinates of the observation target to the same coordinate space to obtain the mapping coordinates of the observation camera and the end mapping coordinates of the observation target; determining the real distance between the observation camera and the end of the observation target based on the mapping coordinates of the two observation cameras, the observation angles of the two observation cameras and the end mapping coordinates of the observation target by using a triangulation method.

[0009] In some embodiments, the determining the real size of the observation target based on the real distance between the observation camera and the end of the observation target and the observation angle of the observation camera comprises: determining the end position coordinates of the observation target based on the real distance between the observation camera and the end of the observation target and the observation angle of the observation camera; determining the real size of the observation target based on the end position coordinates of the observation target.

[0010] In some embodiments, the distance measuring method further comprises: When a first observation image and at least a second observation image are acquired, based on an image coordinate mapping relationship between the first observation image and the second observation image and a position coordinate of the observation camera, an end pixel coordinate of the observation target in the second observation image and an observation included angle corresponding to the observation camera are determined; the first observation image is an observation image containing a complete to-be-measured target, and the second observation image is an observation image containing a non-complete to-be-measured target.

[0011] The embodiment of the present application further provides a ranging device, comprising: A first module is configured to acquire at least two observation images containing an observation target; the observation images are respectively obtained by observation cameras located at different positions; A second module is configured to determine an observation included angle of the observation camera based on the observation images; A third module is configured to determine a real distance between the observation camera and an end of the observation target based on a position coordinate of the observation camera, the observation included angle of the observation camera and the end pixel coordinate of the observation target; A fourth module is configured to determine a real size of the observation target based on the real distance between the observation camera and the end of the observation target and the observation included angle of the observation camera.

[0012] The embodiment of the present application further provides an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor implements the ranging method described above when executing the computer program.

[0013] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the ranging method described above.

[0014] The present application has the following beneficial effects: the positions of at least two observation cameras are used as prior information, a three-dimensional observation model is constructed based on the positions of the existing observation cameras, two-dimensional pixel coordinates are converted into three-dimensional space coordinates, the dependence on a reference object in traditional monocular ranging is avoided, the problem of dependence on prior data in traditional monocular ranging is solved, the real size of an observation target can be accurately measured in a building scene without a reference object, compared with a laser radar scheme, the hardware cost is significantly reduced and the adaptability to narrow spaces is improved, the measurement robustness in complex environments is effectively improved by cooperative work of multiple cameras, and reliable size data support is provided for safety hazard identification. BRIEF DESCRIPTION OF DRAWINGS

[0015] Figure 1 An application environment diagram of the ranging method provided by the embodiment of the present application is shown.

[0016] Figure 2This is a flowchart of the ranging method provided in the embodiments of this application.

[0017] Figure 3 This is a flowchart of a method for determining the observation angle of an observation camera, provided in an embodiment of this application.

[0018] Figure 4 This is a flowchart of a method for determining the true distance between the end of an observation camera and an observation target, provided in an embodiment of this application.

[0019] Figure 5 This is a flowchart of a method for determining the true size of an observation target provided in an embodiment of this application.

[0020] Figure 6 This is a schematic diagram of the ranging device provided in the embodiments of this application.

[0021] Figure 7 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0023] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and drawings are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0025] The ranging method provided in this application can be executed by a computer device, which can be a terminal device or a server. Terminal devices include, but are not limited to, mobile phones, computers, smart home appliances, vehicle terminals, and aircraft. The server can be a standalone physical server, a server cluster consisting of multiple physical servers, a distributed system, or a cloud server. Furthermore, the information, data, and signals involved in this application's embodiments are all authorized by the relevant parties or have been fully authorized by all parties, and the collection, use, and processing of related data comply with the relevant laws, regulations, and standards of the relevant countries and regions.

[0026] Figure 1 This diagram illustrates the application environment of the ranging method provided in the embodiments of this application. (See also...) Figure 1 This method is applied to a ranging system. The system includes a terminal 110 and a server 120. The terminal 110 and server 120 are connected via a network. The terminal 110 can be a desktop terminal or a mobile terminal; the mobile terminal can be at least one of a mobile phone, tablet, or laptop. The server 120 can be a standalone server or a server cluster consisting of multiple servers. The terminal 110 sends at least two observation images containing the observed target to the server 120. The server 120 acquires at least two observation images containing the observed target, determines the observation angle of the observation camera based on the observation images, determines the true distance between the observation camera and the end of the observed target based on the position coordinates of the observation camera, the observation angle of the observation camera, and the end pixel coordinates of the observed target, and determines the true size of the observed target based on the true distance between the observation camera and the end of the observed target and the observation angle of the observation camera. The observation images are captured by observation cameras located at different positions.

[0027] It should be understood that Figure 1 The application scenarios shown are merely examples. In practical applications, the ranging method provided in this application embodiment can also be applied to other scenarios. For example, the above ranging method can be directly applied to terminal 110, which is used to acquire at least two observation images containing the observed target, determine the observation angle of the observation camera based on the observation images, determine the true distance between the observation camera and the end of the observed target based on the position coordinates of the observation camera, the observation angle of the observation camera, and the end pixel coordinates of the observed target, and determine the true size of the observed target based on the true distance between the observation camera and the end of the observed target and the observation angle of the observation camera.

[0028] To facilitate understanding of the ranging method provided in the embodiments of this application, the following example uses server 120 as the execution subject to illustrate the application scenario of the ranging method.

[0029] See Figure 2 In one embodiment, a ranging method is provided, which can be executed by either a terminal or a server, including but not limited to steps S201 to S204.

[0030] Step S201: Acquire at least two observation images containing the observed target.

[0031] The observation images were captured by cameras located at different positions. As can be understood, observation images refer to image data containing the observed target, specifically achieved by fixedly installed monitoring cameras capturing images from different angles, ensuring target visibility through multi-view coverage. The observed target can be areas such as floor edges, elevator shaft openings, and pre-drilled pipe openings.

[0032] As examples, before acquiring observation images, observation cameras need to be deployed at predetermined observation points. These cameras then capture images of the target. The executing entity can interact with at least two observation cameras to acquire at least two observation images containing the target.

[0033] In some embodiments, the location coordinates of the observation point can be used as the location coordinates of the observation camera. The location coordinates of the observation point can be determined by Simultaneous Localization and Mapping (SLAM) technology.

[0034] Step S202: Determine the observation angle of the observation camera based on the observed image.

[0035] It can be understood that the observation angle refers to the spatial angle formed between the optical axis of the observation camera and the end of the observed target. Specifically, it can be calculated by pixel coordinate offset and field of view angle, and is used to construct a three-dimensional spatial geometric model to determine the true distance between the end of the observation camera and the end of the observed target.

[0036] As examples, after acquiring at least two observation images containing the observed target, the execution entity may determine the offset angle of the observed target relative to the observation center based on the end pixel coordinates and center pixel coordinates of the observed target in the observation image, and then combine the determined offset angle of the observed target relative to the observation center with the true orientation angle of the observation image to determine the observation angle of the observation camera.

[0037] Step S203: Based on the position coordinates of the observation camera, the observation angle of the observation camera, and the end pixel coordinates of the observation target, determine the true distance between the observation camera and the end of the observation target.

[0038] It can be understood that the true distance between the end of the observation camera and the end of the observation target refers to the straight-line distance between the end of the observation camera and the end of the observation target. Specifically, it can be calculated by combining the triangulation method with the camera position coordinates, which serves as the basic parameter for size derivation.

[0039] As examples, after determining the observation angle of the observation camera, the execution entity can pre-construct a coordinate space, then map the position coordinates of the observation camera and the end pixel coordinates of the observation target into this coordinate space, and then use triangulation to determine the true distance between the end of the observation camera and the end of the observation target based on the mapped position coordinates of the two observation cameras, the observation angle of the two observation cameras, and the mapped end position coordinates of the observation target.

[0040] Step S204: Determine the true size of the target based on the actual distance between the end of the observation camera and the observation angle of the observation camera.

[0041] It can be understood that the true size of the observed target refers to the actual length or width of the observed target in three-dimensional space. Specifically, it can be calculated by the spatial geometric relationship between the actual distance between the observation camera and the end of the observed target and the position coordinates of the end of the observed target, thus eliminating the size error caused by the two-dimensional image projection.

[0042] As examples, after determining the true distance between the observation camera and the end of the observation target, the execution entity can deduce the geometric relationship between one of the observation cameras and the two ends of the observation target based on the true distance between the observation camera and the end of the observation target and the observation angle of the observation camera, thereby determining the end position coordinates of the observation target, and then substituting the end position coordinates of the observation target into the distance calculation formula to calculate the true size of the observation target.

[0043] The ranging method provided in this application first acquires observation images of the target taken by two or more observation cameras at known locations, and extracts the pixel coordinates of the end of the target in the observation images. Based on the offset between the end of the target and the center point of the observation images, and combined with the camera field of view of the observation cameras, the observation angles between at least two observation cameras and the end of the target are calculated. The position coordinates of each observation camera and the observation angles are input into a preset triangulation model to calculate the position coordinates of the end of the target in three-dimensional space, thereby deriving the straight-line distance from the observation camera to the end of the target. Finally, the position coordinates of the end of the target are substituted into the distance calculation formula to calculate the true size of the target. Therefore, by using the positions of at least two observation cameras as prior information and constructing a three-dimensional observation model using the positions of existing observation cameras, two-dimensional pixel coordinates are converted into three-dimensional spatial coordinates. This avoids the dependence on reference objects in traditional monocular ranging and solves the problem of traditional monocular ranging relying on prior data. It can accurately measure the true size of the observed target in architectural scenes without reference objects. Compared with the LiDAR solution, it significantly reduces hardware costs and improves adaptability to confined spaces. The collaborative work of multiple cameras effectively improves the measurement robustness in complex environments and provides reliable size data support for the identification of safety hazards.

[0044] See Figure 3 In one embodiment, the method for determining the observation angle of the observation camera includes, but is not limited to, steps S301 to S303.

[0045] Step S301: Extract the pixel coordinates of the observed image to obtain the end pixel coordinates of the observed target and the center pixel coordinates of the center pixel of the observed image.

[0046] Image pixel coordinate extraction refers to obtaining the position coordinates of the end point and the center point of the target object from the observed image. Specifically, image recognition algorithms can be used to locate the start and end pixels of the target object and extract the corresponding coordinate data for subsequent angle calculations. The center pixel of the observed image refers to the geometric center point in the observed image corresponding to the camera's optical axis. This can be calculated using the image resolution. For example, the center pixel coordinates of an image with a resolution of 1920×1080 are (960, 540). This feature is used to establish a reference point for the image coordinate system, providing a reference for subsequent offset calculations.

[0047] Step S302: Based on the field of view of the observation camera and the offset between the end pixel coordinates and the center pixel coordinates, determine the offset angle of the observation target relative to the observation center.

[0048] As can be understood, the field of view refers to the angle of the camera's field of view, which can be obtained through camera parameters or calibration data. It is used to establish the conversion relationship between pixel offset and actual angular offset. Offset refers to the positional difference between the end pixel coordinates and the center pixel coordinates on the image plane. It can be obtained by calculating the coordinate differences between the two in the horizontal and vertical directions, and is used to quantify the degree of deviation of the target object's position in the camera's field of view.

[0049] Step S303: Fit the offset angle and the true orientation angle of the observed image to obtain the observed angle.

[0050] It is understandable that the true orientation angle refers to the actual orientation angle of the observation camera when it is installed. Specifically, it can be determined by sensor measurement or preset parameters, and is used to correlate the offset angle calculated based on the image with the actual spatial direction.

[0051] Specifically, image processing algorithms are used to identify the end positions of the observed target in the image, extracting the pixel coordinates of its starting and ending pixels, and simultaneously obtaining the pixel coordinates of the image center. Based on the field of view of the observation camera and the pixel coordinate offset, the offset angle of the observed target relative to the center of the camera's field of view is calculated. Further, combined with the camera's true orientation angle, the offset angle of the observed target relative to the observation center is converted into the observation angle in actual space, thus establishing the orientation information of the target object in three-dimensional space. Therefore, by combining pixel coordinate offset and field of view, the spatial angle of the target object can be directly calculated without relying on external reference objects, reducing dependence on prior information. Furthermore, existing binocular ranging methods require simultaneous acquisition by two cameras and are easily affected by occlusion, while this method only requires a single camera image to complete the angle calculation, adapting to scenarios with limited field of view in complex architectural environments.

[0052] In some embodiments, the image pixel coordinate extraction of the observed image includes: identifying the center pixel and the starting and ending pixels of the observed target; extracting the pixel coordinates of the center pixel, the starting pixel, and the ending pixel in the observed image to obtain the end pixel coordinates and the center pixel coordinates.

[0053] It can be understood that the starting pixel refers to the leftmost edge of the observed target along the horizontal direction in the observed image, and the ending pixel refers to the rightmost edge of the observed target along the horizontal direction in the observed image. This can be achieved through edge detection algorithms or target contour recognition algorithms. These two features are used to define the spatial span of the target in the image, providing endpoint data for calculating the true size.

[0054] In one specific embodiment, the pixel coordinates can be coordinate values ​​in a two-dimensional coordinate system with the top-left corner of the image as the origin, which can be directly extracted from an image processing library. This feature quantifies the target location into a numerical form, facilitating the derivation of geometric relationships through mathematical models.

[0055] Specifically, in the image processing stage, the center pixel of the observed image is first located using an image recognition algorithm. This point corresponds to the camera's optical axis. Then, a target detection algorithm identifies the two edges of the observed target, marking them as the start and end pixels, respectively. For example, for a target near an opening, the start pixel corresponds to the boundary between the left edge of the opening and the background, and the end pixel corresponds to the boundary between the right edge and the background. By simultaneously extracting the coordinates of these three key points, the target's position distribution in the image can be accurately described. The end pixel coordinates are composed of the start and end points, while the center pixel coordinates are composed solely of the center point. This coordinate data serves as the basic input for subsequent calculations of the target's offset angle and true size. Therefore, by automatically identifying the end of the observed target and the center point of the observed image, the correlation between the target's geometric features and camera parameters can be directly established without relying on external reference objects or preset distance information. This significantly improves the autonomy and reliability of target size measurement in complex environments. In building scenarios without standard reference objects, it can accurately obtain the endpoint position information of targets near openings, eliminate the ranging error caused by the lack of reference objects, and provide accurate pixel-level coordinate data for subsequent real size calculations, thereby ensuring the accuracy of size measurement results in the process of safety hazard identification.

[0056] In some embodiments, determining the offset angle of the observed target relative to the observation center based on the field of view of the observation camera and the offset between the end pixel coordinates and the center pixel coordinates includes: obtaining the horizontal field of view of the observation camera; determining the vertical field of view of the observation camera based on the horizontal field of view of the observation camera; determining the offset between the end pixel coordinates and the center pixel coordinates based on the difference between the end pixel coordinates and the center pixel coordinates and the resolution of the observed image; and determining the offset angle of the observed target relative to the observation center based on the horizontal field of view, the vertical field of view, and the offset between the end pixel coordinates and the center pixel coordinates.

[0057] Specifically, the horizontal field of view parameter of the observation camera is first obtained, and the vertical field of view is calculated by combining it with the aspect ratio of the camera sensor. For example, when the sensor aspect ratio is 4:3, the vertical field of view is the horizontal field of view multiplied by 3 / 4. Then, by extracting the difference between the ordinate of the pixel coordinates of the end of the observed target in the observation image and the ordinate of the center pixel coordinate of the observation image, and combining this with the height value of the image resolution (e.g., the height value is 1080 pixels when the resolution is 1920×1080), the pixel difference is converted into a normalized offset. Finally, the normalized offset is multiplied by the vertical field of view to obtain the actual vertical offset angle of the end of the observed target relative to the camera's optical axis, thus providing accurate angle input for subsequent ranging calculations. Therefore, by dynamically calculating the vertical field of view using the horizontal field of view and the sensor aspect ratio, it can adapt to different camera parameters and avoid manual calibration errors. Furthermore, existing technologies often calculate offsets based on a fixed ratio assumption between pixel difference and image size, while this solution, by introducing a resolution parameter for normalization, can adapt to image inputs of different resolutions, improving the universality of the offset angle calculation.

[0058] In one specific embodiment, the formula for calculating the vertical field of view of the observation camera is as follows: , in, For vertical field of view, For horizontal field of view, To observe the vertical pixel count of the image, The number of horizontal pixels in the observed image; The formula for calculating the center pixel coordinates of the center pixel in the observed image is: , , in, The horizontal center pixel coordinates, The coordinates of the vertical center pixel; The formula for calculating the offset between the end pixel coordinates and the center pixel coordinates is: , , in, The first observation target The offset between the horizontal end pixel coordinates and the center pixel coordinates of each end. The first observation target The horizontal end pixel coordinates of each end The first observation target The offset between the vertical end pixel coordinates and the center pixel coordinates of each end. The first observation target The vertical end pixel coordinates of each end, where i is a positive integer, i∈[1,2]; The formula for calculating the offset angle between the observed target and the observation center is: , , , in, The first observation target The horizontal offset angle of each end relative to the observation center The first observation target The vertical offset angle of each end relative to the observation center The first observation target The normalized horizontal offset ratio of each end.

[0059] In one specific embodiment, the formula for calculating the observed angle is: , , in, The first observation target The included angle of horizontal observation at each end The first observation target The included angle of vertical observation at each end, This represents the true orientation angle of the observed camera. If the position coordinates of the observed camera include its camera attitude, then... The heading angle can be directly used to observe the camera; conversely, it can be calibrated using a reference object with a known orientation in the observed image.

[0060] See Figure 4 In one embodiment, the method for determining the true distance between the end of the observation camera and the observation target includes, but is not limited to, steps S401 to S402.

[0061] Step S401: Map the position coordinates of the observation camera and the end pixel coordinates of the observation target to the same coordinate space to obtain the mapped coordinates of the observation camera and the end mapped coordinates of the observation target.

[0062] Step S402: Using the triangulation method, based on the mapped coordinates of the two observation cameras, the observation angle between the two observation cameras, and the end mapped coordinates of the observation target, the true distance between the observation camera and the end of the observation target is determined.

[0063] Coordinate mapping can be understood as the process of transforming coordinate systems of different dimensions to a unified reference coordinate system. This can be achieved through projection transformation based on camera calibration parameters or by using a spatial transformation matrix. The aim is to eliminate the dimensional differences between physical space and the image plane, ensuring the consistency of coordinate data in geometric calculations. Triangulation, in particular, can be understood as a technique for calculating unknown distances using the geometric relationships of triangles. It can be achieved through distance calculation based on the law of cosines or by analytical methods of solving for the coordinates of triangle vertices. The goal is to directly derive the distance between the observation camera and the end of the observed target without relying on additional reference objects.

[0064] Specifically, the solution in this application first maps the position coordinates of the observation camera and the end pixel coordinates of the observed target to the same coordinate space, establishing a precise correspondence between three-dimensional physical coordinates and two-dimensional pixel coordinates, thereby eliminating dimensional differences. Based on this, a triangulation method is used to directly calculate the distance between the observation camera and the end of the observed target using the mapped coordinates and the observation angle, based on trigonometric geometry principles. This ensures the accuracy and reliability of the distance calculation, making it particularly suitable for measurement needs under complex conditions in built environments. Thus, it effectively solves the problem of geometric calculation deviations caused by dimensional differences in the coordinate system, significantly improving the accuracy and stability of edge opening size measurement in building scenarios, and providing reliable data support for safety hazard identification.

[0065] As a preferred embodiment, the solution of this application is implemented as follows: In the scenario of measuring the dimensions of an elevator shaft at a construction site, the observation camera can be an industrial-grade camera installed on the scaffolding at the edge of the floor, and its position coordinates are obtained through total station measurement. Coordinate mapping is specifically performed by using the intrinsic and extrinsic parameters obtained from camera calibration, combined with spatial transformation functions in the OpenCV library, to transform the pixel coordinates to the world coordinate system. The triangulation method, based on the mapped coordinates and the included angle between the two observation cameras, determines the true distance by solving the relationship between the side lengths of the triangle, effectively avoiding pixel coordinate distortion caused by obstruction from construction equipment.

[0066] In a specific embodiment, mapping the position coordinates of the observation camera and the end pixel coordinates of the observation target to the same coordinate space can be achieved by establishing a local coordinate system with the observation camera as the origin. The X-axis of the local coordinate system is consistent with the global reference direction, and the Y-axis of the local coordinate system is perpendicular to the X-axis of the local coordinate system. The transformation relationship between global coordinates and local coordinates is: local coordinates of any coordinate point = global coordinates - global coordinates of the observation camera.

[0067] See Figure 5 In one embodiment, the method for determining the true size of the observed target includes, but is not limited to, steps S501 to S502.

[0068] Step S501: Determine the position coordinates of the end of the observation target based on the actual distance between the observation camera and the end of the observation target and the observation angle of the observation camera.

[0069] Step S502: Determine the true size of the observed target based on the end position coordinates of the observed target.

[0070] Specifically, the proposed solution first determines the position coordinates of the end point in three-dimensional space based on the true distance and observation angle between the observation camera and the end point of the observed target. Then, the Euclidean distance between the ends is directly calculated based on these position coordinates, thus obtaining the true size of the observed target. This step-by-step processing method ensures that even with partial image occlusion or perspective distortion, the end point position can be accurately located through spatial geometry, thereby reliably deriving the actual size. Since the true distance between the observation camera and the end point of the observed target provides depth dimension information, and the observation angle reflects the viewing direction information, their coupling allows for precise mapping of the end point pixel coordinates to a three-dimensional coordinate system, eliminating the dependence of traditional monocular ranging on the size of the reference object. Furthermore, the direct analysis of the end point position coordinates skips the pixel ratio conversion step, effectively avoiding size distortion problems caused by changes in camera resolution, field of view, or non-standard viewing angles.

[0071] As a preferred embodiment, the solution of this application is implemented as follows: When measuring the dimensions of an elevator shaft at a construction site, the system first acquires images of the shaft opening taken by two observation cameras, and calculates the actual distance and observation angle between the cameras and the end of the shaft opening. Then, these data are used to determine the coordinate position of the end of the shaft opening in three-dimensional space. Finally, by calculating the distance between the coordinates of the ends, the actual width and depth of the shaft opening are obtained to match the installation requirements of the guardrail. In this embodiment, the observation cameras can specifically adopt industrial-grade CMOS sensor cameras, and their image processing units can implement coordinate mapping calculations based on FPGAs to ensure that dimensional data conforming to safety specifications can still be output even when the edge of the shaft opening is partially obscured by temporary building materials. Thus, even when the edge of the opening is obscured by construction equipment or the image has perspective distortion in the construction scene, the actual dimensions of the opening can still be accurately obtained, ensuring the compliance of the protective measures and effectively reducing the risk of safety accidents.

[0072] In some embodiments, the ranging method further includes: when a first observation image and at least one second observation image are acquired, determining the end pixel coordinates of the observed target in the second observation image and the observation angle of the corresponding observation camera based on the image coordinate mapping relationship between the first observation image and the second observation image and the position coordinates of the observation camera.

[0073] The first observation image is an observation image containing the complete target under test, and the second observation image is an observation image containing an incomplete target under test.

[0074] It can be understood that the image coordinate mapping relationship refers to the geometric transformation model that describes the correspondence between pixel coordinates between different observed images. It can be implemented using a homography matrix or a projection transformation matrix based on feature point matching. Its purpose is to establish a coordinate transformation benchmark between the first and second observed images to ensure that the positional information remains consistent under the difference in viewing angle.

[0075] Specifically, by integrating the image information of the first and second observation images, the end position information in the first observation image is converted to the coordinate system of the second observation image using the image coordinate mapping relationship. The spatial displacement error is calibrated by combining the position coordinates of the observation camera, thereby reconstructing the end pixel coordinates and observation angle even when the target part is missing, ensuring that the ranging process continues in the occluded environment.

[0076] As a preferred embodiment, the solution of this application is implemented as follows: In a construction site scenario, when the first observation camera captures an image containing the complete elevator shaft opening, the second observation camera, due to obstruction by construction equipment, only captures a portion of the shaft opening. By calculating the homography matrix between the first and second observation images and combining it with the GPS coordinates of the two cameras, the end position of the complete shaft opening is mapped to the second image, thereby determining the end pixel coordinates and observation angle of the shaft opening in the partial image. Thus, even when obstructions in the construction scene cause incomplete observation images, the end pixel coordinates and observation angle of the observed target can still be accurately obtained, thereby completing the size measurement, avoiding interruptions in the ranging method, and improving the reliability and applicability of safety hazard identification.

[0077] See Figure 6 This application also provides a ranging device that can implement the above ranging method. The device includes: The first module 601 is used to acquire at least two observation images containing the observation target; the observation images are captured by observation cameras located at different positions. The second module 602 is used to determine the observation angle of the observation camera based on the observed image; The third module 603 is used to determine the true distance between the observation camera and the end of the observation target based on the position coordinates of the observation camera, the observation angle of the observation camera, and the end pixel coordinates of the observation target. The fourth module 604 is used to determine the true size of the observed target based on the true distance between the end of the observation camera and the observation angle of the observation camera.

[0078] The specific implementation of this ranging device is basically the same as the specific implementation of the ranging method described above, and will not be repeated here.

[0079] Figure 7This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application.

[0080] The following reference Figure 7 To describe an electronic device 700 according to such an embodiment of the present disclosure. Figure 7 The electronic device 700 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0081] like Figure 7 As shown, the electronic device 700 is presented in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including storage unit 720 and processing unit 710), a display unit 740, etc.

[0082] The storage unit stores program code, which can be executed by the processing unit 710, causing the processing unit 710 to perform the steps described in the above-described ranging method section of this specification according to various exemplary embodiments of this disclosure.

[0083] Storage unit 720 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 7201 and / or cache memory 7202, and may further include a read-only memory (ROM) 7203.

[0084] The storage unit 720 may also include a program / utility 7204 having a set (at least one) program module 7205, such program module 7205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0085] Bus 730 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0086] Electronic device 700 can also communicate with one or more external devices 700' (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 700, and / or with any device that enables electronic device 700 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 750. Furthermore, electronic device 700 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 760. Network adapter 760 can communicate with other modules of electronic device 700 via bus 730. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0087] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.

[0088] The ranging method, apparatus, device, and medium provided in this application utilize the positions of at least two observation cameras as prior information and construct a three-dimensional observation model using the positions of existing observation cameras. This converts two-dimensional pixel coordinates into three-dimensional spatial coordinates, avoiding the dependence on reference objects in traditional monocular ranging and solving the problem of relying on prior data in traditional monocular ranging. It can accurately measure the true size of the observed target in architectural scenes without reference objects. Compared with lidar solutions, it significantly reduces hardware costs and improves adaptability to confined spaces. The collaborative work of multiple cameras effectively improves the measurement robustness in complex environments and provides reliable size data support for the identification of safety hazards.

[0089] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, or network device, etc.) to execute the methods described above according to the embodiments of this disclosure.

[0090] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0091] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0092] Those skilled in the art will understand that the above modules can be distributed in the device as described in the embodiments, or they can be modified accordingly and placed in one or more devices that are unique to this embodiment. The modules in the above embodiments can be combined into one module, or they can be further divided into multiple sub-modules.

[0093] Exemplary embodiments of this disclosure have been specifically shown and described above. It should be understood that this disclosure is not limited to the detailed structures, arrangements, or implementations described herein; rather, this disclosure is intended to cover various modifications and equivalent arrangements contained within the spirit and scope of the appended claims.

Claims

1. A distance measurement method, characterized in that, include: Acquire at least two observation images containing the observed target; The observation images were captured by observation cameras located at different positions; Based on the observed image, determine the observation angle of the observation camera; Based on the position coordinates of the observation camera, the observation angle of the observation camera, and the end pixel coordinates of the observation target, the true distance between the observation camera and the end of the observation target is determined. The true size of the observed target is determined based on the actual distance between the end of the observation camera and the observation angle of the observation camera.

2. The ranging method according to claim 1, characterized in that, Determining the observation angle of the observation camera based on the observed image includes: The image pixel coordinates are extracted from the observed image to obtain the end pixel coordinates of the observed target and the center pixel coordinates of the center pixel of the observed image; Based on the field of view of the observation camera and the offset between the end pixel coordinates and the center pixel coordinates, the offset angle of the observation target relative to the observation center is determined; The observed angle is obtained by fitting the offset angle and the true orientation angle of the observed image.

3. The ranging method according to claim 2, characterized in that, The step of extracting image pixel coordinates from the observed image includes: Identify the center pixel and the start and end pixels of the observed target; The pixel coordinates of the center pixel, the starting pixel, and the ending pixel in the observed image are extracted to obtain the end pixel coordinates and the center pixel coordinates.

4. The ranging method according to claim 2, characterized in that, Determining the offset angle of the observed target relative to the observation center based on the field of view of the observation camera and the offset between the end pixel coordinates and the center pixel coordinates includes: Obtain the horizontal field of view of the observation camera; Based on the horizontal field of view of the observation camera, determine the vertical field of view of the observation camera; The offset between the end pixel coordinates and the center pixel coordinates is determined based on the difference between the end pixel coordinates and the center pixel coordinates and the resolution of the observed image; Based on the horizontal field of view, the vertical field of view, and the offset between the end pixel coordinates and the center pixel coordinates, the offset angle of the observed target relative to the observation center is determined.

5. The ranging method according to claim 1, characterized in that, Determining the true distance between the observation camera and the end of the observation target based on the position coordinates of the observation camera, the observation angle of the observation camera, and the end pixel coordinates of the observation target includes: The position coordinates of the observation camera and the end pixel coordinates of the observation target are mapped to the same coordinate space to obtain the mapped coordinates of the observation camera and the end mapped coordinates of the observation target. Using triangulation, the true distance between the observation camera and the end of the observation target is determined based on the mapped coordinates of the two observation cameras, the included angle between the two observation cameras, and the mapped coordinates of the end of the observation target.

6. The ranging method according to claim 1, characterized in that, Determining the true size of the observed target based on the actual distance between the end of the observation camera and the end of the observed target and the observation angle of the observation camera includes: Based on the actual distance between the observation camera and the end of the observation target and the observation angle of the observation camera, the position coordinates of the end of the observation target are determined; The true size of the observed target is determined based on the coordinates of its end position.

7. The ranging method according to any one of claims 1 to 6, characterized in that, Also includes: When a first observation image and at least one second observation image are acquired, the end pixel coordinates of the observation target in the second observation image and the observation angle of the corresponding observation camera are determined based on the image coordinate mapping relationship between the first observation image and the second observation image and the position coordinates of the observation camera; the first observation image is an observation image containing the complete target to be measured, and the second observation image is an observation image containing the incomplete target to be measured.

8. A ranging device, characterized in that, include: The first module is used to acquire at least two observation images containing the observed target; The observation images were captured by observation cameras located at different positions; The second module is used to determine the observation angle of the observation camera based on the observed image; The third module is used to determine the true distance between the observation camera and the end of the observation target based on the position coordinates of the observation camera, the observation angle of the observation camera, and the end pixel coordinates of the observation target. The fourth module is used to determine the true size of the observed target based on the true distance between the end of the observation camera and the observation angle of the observation camera.

9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the ranging method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the ranging method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Distance measuring method applying binocular visual parallax error distance-measuring principle

    CN103292710A

  • SLAM device integrating multiple vehicle-mounted sensors and control method of device

    CN105783913A

  • Methods and apparatuses for measuring distance and size by using binocular image pickup device

    CN106643518A

  • Binocular structured light-based accurate confidence depth camera distance measuring device and method

    CN108693538A

  • Image processing method and device, electronic equipment and storage medium

    CN109947886A