Cross-camera spatial distance measuring and calculating method and system, medium and computer equipment
Through the cross-camera stereo matching method, computer vision technology has achieved three-dimensional spatial distance measurement between workers and equipment at power system operation sites, solving the problem of inaccurate distance measurement in traditional methods and improving operation safety.
Patent Information
- Application Number
- CN202510578731.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2025-09-26
AI Technical Summary
In high-risk operation scenarios in the power industry, traditional safety management methods make it difficult to accurately measure the spatial distance between workers and live equipment in real time. This is affected by fatigue and experience differences, resulting in insufficient safety.
The cross-camera stereo matching method is adopted to acquire and process images through multiple cameras, calculate the disparity value using the stereo matching algorithm, and calculate the three-dimensional coordinates in combination with the camera parameters to realize the spatial distance measurement between the operator and the equipment.
It realizes real-time and accurate distance measurement between operators and equipment, improves the safety of on-site operations, and reduces the impact of human errors and environmental interference.
Smart Images

Figure CN120707644A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of power system safety monitoring technology and computer vision technology, and in particular to a method and system, medium, and computer equipment for measuring spatial distance across cameras. Background Art
[0002] In high-risk operation scenarios in the power industry (such as high-voltage live maintenance, high-altitude equipment operation and maintenance, substation inspections, etc.), controlling the spatial distance between operators and live equipment and mechanical devices is the core link in ensuring personal safety.
[0003] Traditional safety management mostly relies on the visual observation of supervisors or handheld rangefinders, which makes it difficult to cover complex working environments (such as overhead wires and underground pipelines) in real time. It is also easily affected by fatigue and experience differences, affecting the safety of on-site workers. Summary of the Invention
[0004] In view of this, the present application provides a method and system, medium, and computer equipment for measuring spatial distance across cameras, which obtains three-dimensional spatial information of personnel and equipment through stereo matching method, can effectively measure the actual distance between personnel and equipment, and thus improve the safety of on-site workers.
[0005] According to one aspect of the present application, a method for measuring spatial distance across cameras is provided, which is applied to a power system operation site, wherein multiple cameras are installed at the power system operation site, and each camera has corresponding camera parameters. The method includes:
[0006] For a power system operation site, two cameras, located at left and right viewing angles, respectively, are used to obtain original operation site images captured by the two cameras, each of which includes an original left view of the operation site captured from the left viewing angle and an original right view of the operation site captured from the right viewing angle.
[0007] Preprocessing the original work site image to obtain a processed work site image, wherein the processed work site image includes a processed work site left view and a processed work site right view;
[0008] Each pixel in the processed left view of the work site is used as a target matching pixel, and each pixel in the processed right view of the work site is used as a candidate pixel. The optimal disparity value of each target matching pixel with respect to the candidate pixel is calculated using a stereo matching algorithm, and a pixel disparity map is obtained based on the optimal disparity value corresponding to each target matching pixel.
[0009] The pixel disparity map and camera parameters are used to calculate the three-dimensional coordinates of each point in the operation scene, and the spatial distance between the operating personnel and the operating equipment in the power system operation site is determined based on the calculated three-dimensional coordinates of each point.
[0010] According to another aspect of the present application, a system for measuring spatial distance across cameras is provided, which is applied to a power system operation site, wherein a plurality of cameras are installed at the power system operation site, and each camera has corresponding camera parameters. The system includes:
[0011] An image acquisition module is configured to acquire, for two cameras located at left and right viewing angles at a power system operation site, original operation site images captured by the two cameras, each including an operator and operation equipment, wherein the original operation site images include an original left view of the operation site captured from the left viewing angle and an original right view of the operation site captured from the right viewing angle;
[0012] An image processing module is used to pre-process the original work site image to obtain a processed work site image, wherein the processed work site image includes a processed work site left view and a processed work site right view;
[0013] A stereo matching module is used to use each pixel in the processed left view of the work site as a target matching pixel and each pixel in the processed right view of the work site as a candidate pixel, calculate the optimal disparity value of each target matching pixel with respect to the candidate pixel through a stereo matching algorithm, and obtain a pixel disparity map based on the optimal disparity value corresponding to each target matching pixel;
[0014] The spatial distance measurement module is used to calculate the three-dimensional coordinates of each point in the operation scene using the pixel disparity map and camera parameters, and determine the spatial distance between the operating personnel and the operating equipment in the power system operation site based on the calculated three-dimensional coordinates of each point.
[0015] According to another aspect of the present application, a medium is provided on which a computer program is stored. When the program is executed by a processor, the above-mentioned method for measuring spatial distance across cameras is implemented.
[0016] According to another aspect of the present application, a computer device is provided, including a medium, a processor, and a computer program stored on the medium and executable on the processor, wherein the processor implements the above-mentioned method for calculating spatial distance across cameras when executing the program.
[0017] With the help of the above technical solution, this application provides a cross-camera spatial distance measurement method and system, medium, and computer equipment, which uses cross-camera stereo matching technology to quickly measure the distance and obtain the three-dimensional spatial position information between the operator and the equipment to improve the safety distance between the operator and the equipment.
[0018] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0020] Figure 1 A schematic diagram of a flow chart of a method for measuring spatial distance across cameras provided in an embodiment of the present application is shown;
[0021] Figure 2 A schematic diagram of a flow chart of a stereo matching algorithm provided in an embodiment of the present application is shown;
[0022] Figure 3 A schematic diagram illustrating a flow chart of another method for calculating spatial distance across cameras provided in an embodiment of the present application is shown;
[0023] Figure 4 A schematic diagram of the architecture of a cross-camera spatial distance measurement system provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0024] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, unless there is a conflict, the embodiments and features in the embodiments of the present application can be combined with each other.
[0025] In this embodiment, a method for calculating spatial distance across cameras is provided, which is applied to a power system operation site. A plurality of cameras are installed in the power system operation site, and the cameras have corresponding camera parameters, such as Figure 1 As shown, the method includes:
[0026] Step 101, for two cameras located at the left and right perspectives in the power system operation site, obtain the original operation site images containing the workers and operation equipment captured by the two cameras respectively, wherein the original operation site images include the original left view of the operation site captured based on the left perspective, and the original right view of the operation site captured based on the right perspective.
[0027] In the above-mentioned embodiments of the present application, it can be applied to actual scenarios of power systems such as substations and infrastructure construction sites. By adapting and optimizing the distance measurement technology, considering that the workers and the operating equipment may be in different positions and postures, the algorithm will be optimized to adapt to the safety distance assessment needs in complex scenarios, and realize accurate control of the safety distance of the operating site. Specifically, in the power system, the operating site is usually equipped with multiple cameras for monitoring. The spatial distance between the workers and the operating equipment can be measured through the stereo matching technology across the cameras. That is, by matching and associating the images captured by multiple cameras, the safety distance between the workers and the operating equipment can be continuously tracked and evaluated, providing real-time safety distance information for the workers, and improving the safety of the workers when working on site.
[0028] Specifically, for example, at the live connection operation site of a 10kV distribution line, the operator needs to operate an insulated boom truck and use an insulated rod to install a parallel trench clamp between the live conductor and the branch line, and must maintain a safe distance of ≥0.7 meters from the live object (conductor). At this time, there are key targets such as live conductors (voltage level 10kV), insulated boom truck mechanical arms (metal material), and operator uniforms (fluorescent reflective strips) at the operation site. Two cameras (or binocular cameras with left and right perspectives) are deployed at the operation site, one in the left and one in the right view. The parameters of the two cameras, for example, support 1280×720 resolution and 120 frames / second synchronous acquisition. Next, the distance (baseline) between the two cameras can be set to 120mm to match the medium-distance accuracy requirements of the power operation scene (the larger the baseline, the higher the long-distance depth measurement accuracy, but the equipment volume needs to be balanced). The two cameras can be fixed 3 meters above the operating table of the insulated boom truck to cover the working area at a 45° downward angle to avoid obstruction by the operating equipment and strictly maintain horizontal alignment (pitch angle error ≤ 0.5°). The calibration plate can be used here to ensure that the optical axis is parallel. When simultaneously capturing the original work site images from the left and right perspectives, the GPIO hard trigger signal or the PTP network synchronization protocol can be used to ensure that the two cameras are exposed at the same time to eliminate the dislocation of dynamic objects (such as the operator's arm) caused by the time difference. At the same time, the acquisition frequency can be set to 30 frames / second to balance real-time performance and data volume.
[0029] Next, the original left view of the work site, for example, clearly shows the worker holding an insulated rod (yellow fluorescent strip) and a safety helmet (red high-visibility marking) in his left hand. In the background, the live wire (silver-white) and the insulated boom truck's robotic arm (metallic gray) are partially obscured (the wire is partially obscured by the robotic arm). The original right view of the work site, for example, was captured at the same time as the original left view of the work site. However, due to the difference in perspective, the obstruction relationship between the live wire and the robotic arm is reversed (the robotic arm partially obscures the wire). The worker's right hand holding a tool kit (black) is visible in the right view, but partially obscured by the insulated rod in the left view.
[0030] Next, the timestamp error of the binocular images (the original left view and the original right view of the work site) can be controlled to ≤1ms through the NTP protocol or hardware time synchronization module to ensure spatial and temporal consistency during subsequent 3D reconstruction. The original work site images can then be compressed using H.265 encoding and transmitted in real time via Gigabit Ethernet to an edge computing terminal (such as NVIDIA Jetson AGX) for subsequent stereo matching.
[0031] Step 102 : pre-processing the original work site image to obtain a processed work site image, wherein the processed work site image includes a processed left view of the work site and a processed right view of the work site.
[0032] Next, the power-frequency electromagnetic field (50 Hz) generated by high-voltage equipment can cause pixel offset or signal noise in the camera sensor, resulting in blurred image edges (e.g., unclear conductor outlines) and local overexposure (e.g., reflective areas on insulators). Stereo matching algorithms rely on pixel-level features (e.g., edges and textures), and this distortion can affect the accuracy of disparity calculations. Furthermore, in outdoor work scenarios, strong light (at noon) can cause highlight blooming (e.g., reflective metal equipment), while weak light (on cloudy days or in tunnels) can cause underexposure noise (e.g., loss of detail in workers' uniforms), disrupting the image's dynamic range consistency. Furthermore, the increased brightness difference between the left and right views of the same target (e.g., the conductor area has a brightness of 200 in the left view and 150 in the right view) can violate the stereo matching assumption of photometric consistency. Furthermore, equipment such as the insulated boom truck's robotic arm and safety rope may partially obstruct live parts, and operator movements (e.g., reaching out) can cause dynamic occlusion, resulting in non-corresponding occluded areas in the left and right views (e.g., the conductor is visible in the left view but obscured in the right view). To this end, the original work site images need to be preprocessed. For example, wavelet transform denoising (preserving edge details) combined with electromagnetic interference model compensation (based on power frequency signal spectrum analysis) can be used to eliminate sensor noise, or local tone mapping (such as bilateral filtering) and multi-exposure fusion (generating HDR images) can be performed on highlight or underexposed areas to balance the brightness difference between the left and right views. The camera internal and external parameters (focal length, baseline, distortion coefficient) can also be calculated using a checkerboard calibration plate, or the left and right views can be converted to coplanar row alignment using the Bouguet algorithm. For the case of occluded areas, neighborhood-based disparity propagation (such as weighted median filtering) or deep learning extrapolation (such as DispNetC prediction) can be used to fill in missing disparity values. By preprocessing the original work site images, image distortion can be eliminated, lighting robustness can be enhanced, and occluded areas can be compensated, thereby improving the input quality of the subsequent stereo matching algorithm.
[0033] Optionally, step 102 pre-processes the original work site image to obtain a processed work site image, specifically including:
[0034] Step 1021 , grayscale the original work site image and then perform denoising and image correction processing to obtain a processed work site image.
[0035] In the above embodiment of the present application, in the pre-processing process, the original work site image may be grayscaled and then subjected to denoising and image correction.
[0036] Regarding grayscale, the weighted average method can be used, and the formula is as follows:
[0037] I gray =0.299×R+0.587×G+0.114×B,
[0038] I gray It is used to represent the original work site image after grayscale output. R, G, and B represent the three basic color channels of the color image: red, green, and blue, respectively. In the above formula, the green channel has the highest weight, which is consistent with the human eye's perception of brightness. At the same time, the contrast of key targets such as wires (silver-white) and insulated tools (yellow) is retained. By converting the three-channel image to a single channel, the amount of calculation can also be reduced.
[0039] Regarding denoising, it is specifically to eliminate electromagnetic interference and sensor noise. At the work site, noise can include the following types:
[0040] 1. Fixed pattern noise (FPN):
[0041] Cause: The camera sensor has inconsistent response between pixels, which appears as horizontal stripes in dark fields.
[0042] Processing: Eliminate it through dark field correction (collect multiple frames of dark images and calculate the average value).
[0043] 2. Random noise (Gaussian / Salt and Pepper):
[0044] Cause: Electromagnetic interference causes random jumps in pixel values, forming burrs on the edges of the wires.
[0045] Processing: Adaptive bilateral filtering (combining spatial distance and grayscale similarity) is used to smooth the noise while preserving the wire edges.
[0046] In particular, other types of noise are also included, such as salt and pepper noise (such as strong interference points on the surface of the wire), which can use the median filtering (3×3) algorithm, Gaussian noise (such as overall blur caused by electromagnetic interference), which can use the bilateral filtering algorithm, and mixed noise (such as low illumination + electromagnetic interference in the tunnel), which can use the wavelet threshold denoising algorithm.
[0047] For image correction, the epipolar correction method can be used to make the matching points lie in the same row, thereby simplifying the matching process.
[0048] In step 103, each pixel in the processed left view of the work site is used as a target matching pixel, and each pixel in the processed right view of the work site is used as a candidate pixel. The optimal disparity value of each target matching pixel with respect to the candidate pixel is calculated using a stereo matching algorithm, and a pixel disparity map is obtained based on the optimal disparity value corresponding to each target matching pixel.
[0049] Next, stereo matching is used to obtain the three-dimensional spatial information of the person and the device, effectively measuring the actual distance between them. This involves computer vision and 3D reconstruction. Stereo matching is based on the pinhole imaging model and triangulation principles. When two cameras (or cameras) capture the same scene from different angles, the corresponding points (i.e., points of the same name) in the left and right views are matched to determine the intersection of the two rays, thereby obtaining the 3D coordinates of that point. By using the stereo matching algorithm to determine the pixel disparity map, we can prepare for subsequent spatial distance measurement.
[0050] Optionally, refer to Figure 2 As shown, the step 103 of "calculating the optimal disparity value of each target matching pixel for each candidate pixel by a stereo matching algorithm" specifically includes:
[0051] Step 1021 : For any target matching pixel, calculate the matching cost of the target matching pixel with respect to the corresponding candidate pixel.
[0052] In step 1022 , for each target matching pixel, the matching costs of adjacent target matching pixels are aggregated to obtain a cost matrix.
[0053] Step 1023 : determining the optimal disparity value of each target matching pixel using a cost matrix, wherein the matching cost is used to characterize the correlation between pixels.
[0054] In the above embodiment of the present application, a matching cost calculation is first performed to measure the correlation between the target matching pixel and the candidate pixel. The matching cost calculation method may include calculating the absolute grayscale difference (AD), the sum of the absolute grayscale difference (SAD), the normalized correlation coefficient (NCC), etc. In computer vision, methods such as mutual information (MI) and census transform (CT) can also be used.
[0055] Since matching cost calculations often only consider local information and are easily affected by noise and weak texture areas, cost aggregation is needed to establish connections between adjacent pixels. Cost aggregation methods can include scan line methods, dynamic programming methods, and path aggregation methods in the SGM algorithm.
[0056] Next, the optimal disparity value of each pixel is determined by the cost matrix after cost aggregation, that is, the disparity corresponding to the minimum cost value of each pixel under all disparities is selected as the optimal disparity value.
[0057] In particular, after obtaining a pixel disparity map based on the optimal disparity value corresponding to each target matching pixel, further optimization can be performed to improve the disparity map's quality. Optimization methods include left-right consistency checking, removing small connected regions, and median filtering. Furthermore, sub-pixel refinement can be used to improve the accuracy of the pixel disparity map.
[0058] Step 104 , using the pixel disparity map and camera parameters, calculate the three-dimensional coordinates of each point in the operation scene, and determine the spatial distance between the operator and the operation equipment in the power system operation site based on the calculated three-dimensional coordinates of each point.
[0059] Then, based on the pixel disparity (optimal disparity value) obtained from stereo matching and camera parameters (such as focal length, optical center position, rotation matrix, translation vector, etc.), the three-dimensional coordinates of each point in the work scene are calculated using the principle of triangulation. In particular, the sparse pixel disparity map can be converted into a dense depth map through interpolation and other methods, thereby obtaining complete three-dimensional spatial information of the workers and work equipment in the scene.
[0060] Optionally, the camera parameters include focal length and principal point coordinates. Regarding step 104, "calculating the three-dimensional coordinates of each point in the work scene using the pixel disparity map and camera parameters" specifically includes:
[0061] Step 1041 , using a triangulation calculation formula, the optimal disparity values in the pixel disparity map, the focal length of the camera, and the principal point coordinates, to calculate the three-dimensional coordinates of each point in the work scene. The triangulation calculation formula is:
[0062]
[0063] (X, Y, Z) are the three-dimensional coordinates of any point in the operation scene, d is the optimal disparity value of the target matching pixel point (u, v) in the pixel disparity map, (f x ,f y ) is the focal length of the camera, (c x ,cy) is the principal point coordinate of the camera, and B is the baseline distance between the two cameras.
[0064] In the above embodiment of the present application, given the baseline distance B of the binocular camera (or two cameras located at the left and right viewing angles respectively), the focal length f, the principal point coordinates (c x ,cy), and the optimal disparity value d of a point in the pixel disparity map, the unit coordinate (X, Y, Z) is calculated as follows:
[0065]
[0066] Where (u, v) is the coordinate of the pixel in the pixel disparity map (with the principal point as the origin), Z is the depth from the target point to the binocular camera (unit: meter), and X and Y are the horizontal and vertical coordinates of the target point in the camera coordinate system (unit: meter).
[0067] In particular, for three-dimensional monitoring of power operation scenes, binocular triangulation can be used to generate three-dimensional coordinates, and parallax calculation and three-dimensional reconstruction algorithms can be optimized for scenes such as weak texture and electromagnetic interference.
[0068] Optionally, in step 104, “determining the spatial distance between the operator and the operating equipment at the power system operation site according to the calculated three-dimensional coordinates of each point” specifically includes:
[0069] Step 1042: Determine a three-dimensional coordinate point cloud based on the calculated three-dimensional coordinates of each point.
[0070] Step 1043: In the three-dimensional coordinate point cloud, a three-dimensional coordinate point set of the operator is identified based on preset operator characteristics, and a three-dimensional coordinate point set of the operating equipment is identified based on preset operating equipment characteristics, wherein the preset operator characteristics include at least one of height and volume, and the preset operating equipment characteristics include at least one of shape, size, and color.
[0071] In step 1044, a representative point of the operator is determined from the set of three-dimensional coordinate points of the operator, and a representative point of the operating equipment is determined from the set of three-dimensional coordinate points of the operating equipment. The spatial distance between the representative point of the operator and the representative point of the operating equipment is calculated using the Euclidean distance calculation formula. The representative point of the operator is determined by the three-dimensional coordinate point of the operator's head or torso, and the representative point of the operating equipment is determined by the center point or edge point of the operating equipment. The Euclidean distance calculation formula is:
[0072]
[0073] (x1, y1, z1) are the three-dimensional coordinates of the operator’s representative point, and (x2, y2, z2) are the three-dimensional coordinates of the operating equipment’s representative point.
[0074] In the above embodiment of the present application, the spatial distance between the operator and the operating equipment is determined based on the calculated three-dimensional coordinates of each point, which can be achieved by the following steps:
[0075] 1. Identify operating personnel and equipment
[0076] 1. Identification of operators:
[0077] In the three-dimensional coordinate point cloud, the three-dimensional coordinate point set of the operator is identified through a preset personnel model (such as height, volume and other features) or through a machine learning algorithm (such as a deep learning model).
[0078] 2. Identification of operating equipment:
[0079] Similarly, in the three-dimensional coordinate point cloud, the three-dimensional coordinate point set of the operating equipment is identified by using the equipment's shape, size, color and other features, or by matching through a preset three-dimensional model of the equipment.
[0080] 2. Calculating spatial distance
[0081] 1. Select representative points:
[0082] For operators, the three-dimensional coordinate points of key parts such as their head and torso can be selected as representative points.
[0083] For operating equipment, the center point, edge point or other representative points of the equipment can be selected as representative points.
[0084] 2. Calculate Euclidean distance:
[0085] Use the Euclidean distance calculation formula to calculate the spatial distance between the representative point of the operator and the representative point of the operating equipment.
[0086] In particular, special cases can also be considered. For example, if there are multiple workers or work equipment in the scene, the spatial distance between each worker and each work equipment needs to be calculated separately and analyzed according to actual needs (such as the closest distance, average distance, etc.). In dynamic scenes, the positions of workers and work equipment may change. Therefore, it is necessary to update the three-dimensional coordinate point cloud in real time and recalculate the spatial distance. For occlusion, if the workers or work equipment are blocked, it may be impossible to accurately identify their three-dimensional coordinate point sets. In this case, sensors (such as lidar, ultrasonic sensors, etc.) can be installed at the work site and combined with sensor information for auxiliary judgment.
[0087] To this end, by integrating the spatial distance calculation function into the monitoring system of the power system operation site, real-time automated safety monitoring and early warning can be achieved.
[0088] Optionally, an alarm is installed at the power system operation site. After "determining the spatial distance between the operator and the operation equipment at the power system operation site based on the calculated three-dimensional coordinates of each point" in step 104, the following steps are specifically included:
[0089] Step 105: When the calculated spatial distance is less than the preset safety distance threshold, an alarm is triggered to sound.
[0090] In the above embodiment of the present application, an alarm is also installed at the power system operation site, and a safety distance threshold is preset. For example, for the operating personnel and the charged object, the safety distance threshold can be set to 0.7 meters. When the calculated spatial distance is less than the preset safety distance threshold, the alarm is immediately triggered to sound. For the alarm part, it can be achieved by adding a relay module, and the PLC signal is converted into an alarm power on-off instruction through the relay module to support the alarm's sound output of 120dB sound pressure level.
[0091] By applying the technical solution of this embodiment, such as Figure 3 As shown in the figure, the algorithm for spatial distance measurement based on cross-camera stereo matching first obtains cross-camera monitoring data (original work site images), then extracts feature key points (extraction of representative points of workers and representative points of work equipment) and matches feature key points (stereo matching). By constructing a new expression structure (spatial distance measurement algorithm based on stereo matching), the acquisition of three-dimensional spatial information is achieved, and after correction, analysis and optimization, the distance between workers and work equipment is quickly measured. Stereo matching is achieved by comparing and matching images of the same scene taken at different locations or at different times. The distance between workers and work equipment is measured by the stereo matching algorithm, which can improve the safety of workers during operation.
[0092] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a spatial distance measurement system across cameras, which is applied to the power system operation site, where multiple cameras are installed in the power system operation site, and the cameras correspond to camera parameters, such as Figure 4 As shown, the system includes:
[0093] An image acquisition module 301 is configured to acquire, for two cameras located at left and right viewing angles, respectively, an original work site image of a power system work site, each of which is captured by the two cameras and includes workers and work equipment. The original work site image includes an original left view of the work site captured from the left viewing angle and an original right view of the work site captured from the right viewing angle.
[0094] An image processing module 302 is configured to pre-process the original work site image to obtain a processed work site image, wherein the processed work site image includes a processed left view of the work site and a processed right view of the work site;
[0095] A stereo matching module 303 is configured to use each pixel in the processed left view of the work site as a target matching pixel and each pixel in the processed right view of the work site as a candidate pixel, calculate the optimal disparity value of each target matching pixel with respect to the candidate pixel using a stereo matching algorithm, and obtain a pixel disparity map based on the optimal disparity value corresponding to each target matching pixel;
[0096] The spatial distance measurement module 304 is used to calculate the three-dimensional coordinates of each point in the operation scene using the pixel disparity map and camera parameters, and determine the spatial distance between the operator and the operating equipment in the power system operation site based on the calculated three-dimensional coordinates of each point.
[0097] It should be noted that for other corresponding descriptions of the functional units involved in the spatial distance measurement system across cameras provided in the embodiment of the present application, please refer to Figures 1 to 2 The corresponding description in the method will not be repeated here.
[0098] Based on the above Figures 1 to 2 The method shown in FIG. 1 is a method for performing the above-mentioned operation. Accordingly, the embodiment of the present application further provides a medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned operation is performed. Figures 1 to 2 The spatial distance measurement method across cameras is shown.
[0099] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0100] Based on the above Figures 1 to 2 The method shown, and Figure 4 In order to achieve the above-mentioned purpose, the embodiment of the virtual system shown in the figure further provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a medium and a processor; the medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figures 1 to 2 The spatial distance measurement method across cameras is shown.
[0101] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a Wi-Fi module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a Wi-Fi interface), etc.
[0102] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0103] The medium may also include an operating system and a network communication module. An operating system is a program that manages and stores the hardware and software resources of a computer device, supporting the execution of information processing programs and other software and / or programs. The network communication module facilitates communication between components within the medium, as well as with other hardware and software within the physical device.
[0104] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware to obtain the original work site images containing workers and work equipment captured by two cameras located in the left and right perspectives, respectively, for pre-processing, and use each pixel in the processed left view of the work site as a target matching pixel, and use each pixel in the processed right view of the work site as a candidate pixel, and calculate the optimal disparity value of each target matching pixel for the candidate pixel through the stereo matching algorithm to obtain a pixel disparity map; use the pixel disparity map and camera parameters to calculate the three-dimensional coordinates of each point in the work scene, and determine the spatial distance between the workers and the work equipment in the power system work site based on the calculated three-dimensional coordinates of each point. Obtaining three-dimensional spatial information of personnel and equipment through the stereo matching method can effectively measure the actual distance between personnel and equipment, thereby improving the safety of on-site workers.
[0105] Those skilled in the art will understand that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily required to implement the present application. Those skilled in the art will understand that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more devices different from the implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple sub-modules.
[0106] The serial numbers of the above application are for descriptive purposes only and do not represent the advantages or disadvantages of the implementation scenarios. The above disclosures are only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any changes that can be made by those skilled in the art should fall within the scope of protection of the present application.
Claims
1. A method for measuring spatial distance across cameras, characterized in that: Applied to a power system operation site, where a plurality of cameras are installed and each camera has corresponding camera parameters, the method includes: For a power system operation site, two cameras, located at left and right viewing angles, respectively, are used to obtain original operation site images captured by the two cameras, each of which includes an original left view of the operation site captured from the left viewing angle and an original right view of the operation site captured from the right viewing angle. Preprocessing the original work site image to obtain a processed work site image, wherein the processed work site image includes a processed work site left view and a processed work site right view; Each pixel in the processed left view of the work site is used as a target matching pixel, and each pixel in the processed right view of the work site is used as a candidate pixel. The optimal disparity value of each target matching pixel with respect to the candidate pixel is calculated using a stereo matching algorithm, and a pixel disparity map is obtained based on the optimal disparity value corresponding to each target matching pixel. The pixel disparity map and camera parameters are used to calculate the three-dimensional coordinates of each point in the operation scene, and the spatial distance between the operating personnel and the operating equipment in the power system operation site is determined based on the calculated three-dimensional coordinates of each point.
2. The method according to claim 1, characterized in that The step of calculating the optimal disparity value of each target matching pixel for each candidate pixel using a stereo matching algorithm includes: For any target matching pixel, calculate the matching cost of the target matching pixel for the corresponding candidate pixel; For each target matching pixel, the matching cost corresponding to each target matching pixel is aggregated to obtain the cost matrix. The optimal disparity value of each target matching pixel is determined by a cost matrix, wherein the matching cost is used to characterize the correlation between pixels.
3. The method according to claim 1, characterized in that The camera parameters include focal length and principal point coordinates. The method of calculating the three-dimensional coordinates of each point in the working scene using the pixel disparity map and camera parameters includes: The three-dimensional coordinates of each point in the working scene are calculated using the triangulation principle calculation formula, the optimal disparity values in the pixel disparity map, the focal length of the camera, and the coordinates of the principal point. The triangulation principle calculation formula is: (X, Y, Z) are the three-dimensional coordinates of any point in the operation scene, d is the optimal disparity value of the target matching pixel point (u, v) in the pixel disparity map, (f x ,f y ) is the focal length of the camera, (c x ,cy) is the principal point coordinate of the camera, and B is the baseline distance between the two cameras.
4. The method according to claim 1, wherein Determining the spatial distance between the operator and the operating equipment at the power system operation site based on the calculated three-dimensional coordinates of each point includes: Determine the three-dimensional coordinate point cloud based on the calculated three-dimensional coordinates of each point; In the three-dimensional coordinate point cloud, a three-dimensional coordinate point set of an operator is identified based on preset operator characteristics, and a three-dimensional coordinate point set of an operating equipment is identified based on preset operating equipment characteristics, wherein the preset operator characteristics include at least one of height and volume, and the preset operating equipment characteristics include at least one of shape, size, and color; Determine the representative point of the operator in the three-dimensional coordinate point set of the operator, and determine the representative point of the operation equipment in the three-dimensional coordinate point set of the operation equipment. Calculate the spatial distance between the representative point of the operator and the representative point of the operation equipment using the Euclidean distance calculation formula. The Euclidean distance calculation formula is: (x1, y1, z1) are the three-dimensional coordinates of the operator’s representative point, and (x2, y2, z2) are the three-dimensional coordinates of the operating equipment’s representative point.
5. The method according to claim 4, characterized in that The worker representative point is determined by the three-dimensional coordinate point of the worker's head or torso, and the work equipment representative point is determined by the center point or edge point of the work equipment.
6. The method according to claim 1, characterized in that An alarm is also installed at the power system operation site. After determining the spatial distance between the operator and the operation equipment at the power system operation site based on the calculated three-dimensional coordinates of each point, the method further includes: When the calculated spatial distance is less than the preset safety distance threshold, the alarm is triggered to sound.
7. The method according to claim 1, characterized in that The preprocessing of the original work site image to obtain a processed work site image includes: The original work site image is grayscaled and then subjected to denoising and image correction processing to obtain the processed work site image.
8. A spatial distance measurement system across cameras, characterized in that: Applied to a power system operation site, where multiple cameras are installed and each camera has corresponding camera parameters, the system includes: An image acquisition module is configured to acquire, for two cameras located at left and right viewing angles at a power system operation site, original operation site images captured by the two cameras, each including an operator and operation equipment, wherein the original operation site images include an original left view of the operation site captured from the left viewing angle and an original right view of the operation site captured from the right viewing angle; An image processing module is used to pre-process the original work site image to obtain a processed work site image, wherein the processed work site image includes a processed work site left view and a processed work site right view; A stereo matching module is used to use each pixel in the processed left view of the work site as a target matching pixel and each pixel in the processed right view of the work site as a candidate pixel, calculate the optimal disparity value of each target matching pixel with respect to the candidate pixel through a stereo matching algorithm, and obtain a pixel disparity map based on the optimal disparity value corresponding to each target matching pixel; The spatial distance measurement module is used to calculate the three-dimensional coordinates of each point in the operation scene using the pixel disparity map and camera parameters, and determine the spatial distance between the operating personnel and the operating equipment in the power system operation site based on the calculated three-dimensional coordinates of each point.
9. A medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for measuring spatial distance across cameras as described in any one of claims 1 to 7 is implemented.
10. A computer device comprising a medium, a processor, and a computer program stored on the medium and executable on the processor, wherein: When the processor executes the computer program, the method for measuring spatial distance across cameras as described in any one of claims 1 to 7 is implemented.