A spatial calibration method and system

By performing planar partition processing and calibration matrix family calculation in geographical areas that do not meet planarity requirements, the problem of large calibration errors in the existing technology is solved, and high-precision spatial calibration of non-planar geographical areas is achieved.

CN112950717BActive Publication Date: 2024-09-17HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911179277.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-26
Publication Date
2024-09-17
Estimated Expiration
2039-11-26

AI Technical Summary

Technical Problem

Existing spatial calibration technology is difficult to achieve accurate calibration in geographical areas that do not meet planarity requirements, resulting in large calibration errors.

Method used

By obtaining the reference image and the spatial measurement data of the geographical area, we perform plane partition processing, calculate the calibration relationship between each partition plane and the image captured by the camera, and form a calibration matrix family to achieve accurate measurement of geographical areas that do not meet the planarity requirements. Space calibration.

Benefits of technology

The accuracy and scope of application of spatial calibration are improved, and accurate conversion from pixel coordinates to geographical coordinates can be achieved in non-planar geographical areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112950717B
    Figure CN112950717B
Patent Text Reader

Abstract

The present application provides a spatial calibration method and system. The method includes: obtaining a reference image taken by a camera and spatial measurement data of a geographic area; performing plane partitioning processing on the geographic area according to the spatial measurement data to obtain multiple partition planes; obtaining a set of marker point matching pairs according to the reference image and spatial measurement data, each marker point matching pair in the set of marker point matching pairs includes the geographic coordinates of a marker point in the geographic area and the pixel coordinates in the image; calculating the calibration relationship between the image taken by the camera and each partition plane according to the set of marker point matching pairs, and obtaining a family of calibration matrices between the image taken by the camera and the geographic area. The above method can improve the accuracy of spatial calibration and expand applicable scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence (AI), and in particular to a spatial calibration method and system. Background Art

[0002] At present, a large number of cameras are deployed in various areas of the city for real-time monitoring. For example, cameras are deployed at urban traffic intersections to monitor traffic information such as vehicle flow and pedestrian flow at the traffic intersections in real time. And with the development of artificial intelligence technology, technologies such as face recognition, license plate recognition, and vehicle model recognition have been widely used in the automated monitoring of traffic intersections, greatly improving the efficiency of traffic supervision and ensuring the safety and order of urban traffic. In order to monitor and analyze the traffic status of traffic intersections, such as monitoring the position of vehicles and pedestrians at traffic intersections, the running speed of vehicles, etc., it is necessary to obtain the actual position of vehicles or pedestrians in the video at the traffic intersection based on the video data captured by the camera. Therefore, it is necessary to perform spatial calibration on the traffic intersection. Spatial calibration is to determine the correspondence between the pixel coordinates of a point in an image and the geographic coordinates of the point in a geographical area, wherein the image is captured by a camera set in a geographical area for capturing the geographical area. In many other video or image applications, it is also necessary to determine the correspondence between the pixel coordinates of a point and the geographic coordinates. The method of determining the correspondence between the pixel coordinates of a point in an image and the geographic coordinates in a geographical area is called spatial calibration technology.

[0003] The existing spatial calibration technical solution requires using a camera to capture an image of a geographical area, determine multiple marker points in the image, obtain the pixel coordinates of each marker point, and then determine the geographical coordinates of the marker point in the image in the geographical area. The calibration relationship between the geographical area and the image captured by the camera is calculated using the obtained geographical coordinates and pixel coordinates of the multiple marker points. When using this spatial calibration technical solution for spatial calibration, it is necessary to ensure that the geographical area is close to a planar distribution. However, in actual application scenarios, the geographical area generally cannot meet the planarity requirements, that is, the surface of the geographical area is not flat. Therefore, using the existing spatial calibration technical solution for spatial calibration will not guarantee the calibration accuracy, resulting in a large calibration error. How to achieve spatial calibration of geographical areas that do not meet the planarity requirements and improve the calibration accuracy is a problem that needs to be solved urgently. Summary of the invention

[0004] The present application provides a spatial calibration method and system, through which the spatial calibration of a geographical area that does not meet the planarity requirements can be achieved, the calibration accuracy can be improved, and the scope of application can be expanded.

[0005] In a first aspect, a spatial calibration method is provided, comprising: a spatial calibration system acquires a reference image, wherein the reference image is captured by a camera set at a fixed position in a geographical area; the spatial calibration system acquires spatial measurement data of the geographical area, wherein the spatial measurement data includes geographical coordinates of multiple points in the geographical area; the spatial calibration system performs plane partitioning processing on the geographical area according to the spatial measurement data to obtain multiple partition planes; the spatial calibration system acquires a set of marker point matching pairs according to the reference image and the spatial measurement data, wherein each marker point matching pair in the set of marker point matching pairs includes geographical coordinates of a marker point in the geographical area and pixel coordinates of the marker point in the reference image; the spatial calibration system calculates a calibration relationship between the image captured by the camera and each partition plane according to the set of marker point matching pairs to obtain a family of calibration matrices between the image captured by the camera and the geographical area.

[0006] In the solution provided by the present application, the spatial calibration system uses spatial measurement data to perform plane partition processing on the geographic area, ensuring that each partition plane meets the requirements of homography transformation, and then obtains a set of landmark point matching pairs and calculates the calibration relationship between the image captured by the camera and each partition plane, thereby obtaining a calibration matrix family between the image captured by the camera and the geographic area. This expands the applicable scenarios and ensures that accurate calibration accuracy can be obtained even when the geographic area as a whole does not meet the planarity requirements.

[0007] In combination with the first aspect, in a possible implementation of the first aspect, the spatial calibration system partitions the reference image according to the marker point matching pairs and the multiple partition planes to obtain multiple image regions, wherein the multiple image regions correspond one-to-one to the multiple partition planes.

[0008] In the solution provided in the present application, after the spatial calibration system partitions the geographical area to obtain multiple partition planes, it can partition the reference image using the matching relationship between the geographical coordinates and pixel coordinates of the marker points in the marker point matching pair to obtain multiple image areas, and there is a one-to-one correspondence between the image areas and the partition planes.

[0009] In combination with the first aspect, in a possible implementation of the first aspect, the spatial calibration system sends the calibration matrix family to a processing device, so that after acquiring the pixel coordinates of the detected target in the image taken by the camera, the processing device determines the image area to which the pixel coordinates of the detected target belong, and selects a calibration matrix corresponding to the image area from the calibration matrix family; determines the geographic coordinates of the detected target in the geographic area according to the calibration matrix and the pixel coordinates of the detected target; or, the spatial calibration system stores the calibration matrix family; when the pixel coordinates of the detected target in the image taken by the camera are acquired, the spatial calibration system determines the image area to which the pixel coordinates of the detected target belong, and selects a calibration matrix corresponding to the image area from the calibration matrix family, and the spatial calibration system determines the geographic coordinates of the detected target in the geographic area according to the calibration matrix and the pixel coordinates of the detected target.

[0010] In the solution provided in the present application, the spatial calibration system can send the obtained calibration matrix family to the processing device, or it can store the calibration matrix family itself. After obtaining the pixel coordinates of the detected target, it can first determine the image area to which it belongs, and then find the corresponding calibration matrix from the calibration matrix family, so that the geographic coordinates of the detected target in the geographic area can be determined, completing the conversion of pixel coordinates to geographic coordinates.

[0011] In combination with the first aspect, in a possible implementation of the first aspect, the spatial calibration system sends the calibration matrix family to a processing device, so that after acquiring the geographic coordinates of the detected target, the processing device determines the partition plane to which the geographic coordinates of the detected target belong, and selects a calibration matrix corresponding to the partition plane from the calibration matrix family; determines the pixel coordinates of the detected target in the image taken by the camera according to the calibration matrix and the geographic coordinates of the detected target; or, the spatial calibration system stores the calibration matrix family; when the geographic coordinates of the detected target are acquired, the spatial calibration system determines the partition plane to which the geographic coordinates of the detected target belong, and selects a calibration matrix corresponding to the partition plane from the calibration matrix family, and the spatial calibration system determines the pixel coordinates of the detected target in the image taken by the camera according to the calibration matrix and the geographic coordinates of the detected target.

[0012] In the solution provided in the present application, the spatial calibration system can send the obtained calibration matrix family to the processing device, or it can store the calibration matrix family itself. After obtaining the geographic coordinates of the detected target, it can first determine the partition plane to which it belongs, and then find the corresponding calibration matrix from the calibration matrix family, so as to determine the pixel coordinates of the detected target in the image taken by the camera, and complete the conversion from geographic coordinates to pixel coordinates.

[0013] In combination with the first aspect, in a possible implementation of the first aspect, the spatial calibration system selects multiple marker point matching pairs in a first partition plane from the marker point matching pair set; calculates a calibration matrix between the image taken by the camera and the first partition plane based on the multiple marker point matching pairs; wherein the first partition plane is any one of the multiple partition planes.

[0014] In the solution provided in the present application, when calculating the calibration relationship, the spatial calibration system selects multiple landmark point matching pairs belonging to the partition plane from the landmark point matching pair set for each partition plane, and then calculates the calibration matrix between the image taken by the camera and the partition plane based on the selected multiple landmark point matching pairs, so that a family of calibration matrices between the image taken by the camera and the geographic area can be finally obtained.

[0015] In combination with the first aspect, in a possible implementation of the first aspect, a spatial calibration system determines a common plane, and the common plane satisfies the central projection theorem with the multiple partition planes; the spatial calibration system calculates a mapping relationship between the common plane and each partition plane; the spatial calibration system selects a target partition plane from the multiple partition planes, and selects multiple marker point matching pairs in the target partition plane from the marker point matching pair set; the spatial calibration system calculates a calibration matrix between the image captured by the camera and the target partition plane; the spatial calibration system calculates a mapping relationship between the target partition plane and each partition plane based on the mapping relationship between the common plane and each partition plane; the spatial calibration system calculates a calibration matrix between the image captured by the camera and each partition plane based on the mapping relationship between the target partition plane and each partition plane and the calibration matrix between the image captured by the camera and the target partition plane.

[0016] In the solution provided in the present application, the spatial calibration system can calculate the mapping relationship between the target partition plane and other partition planes using the common plane, and then calculate the calibration matrix between the target partition plane and the image taken by the camera, so as to indirectly obtain the calibration matrix between other partition planes and the image taken by the camera, thereby obtaining a calibration matrix family. In this way, the partition plane with the highest confidence can be selected as the target partition plane, and then only the calibration matrix between the target partition plane and the image taken by the camera needs to be calculated. Other partition planes can be indirectly obtained using the relationship between them and the target partition plane, which can further improve the calibration accuracy.

[0017] In combination with the first aspect, in a possible implementation of the first aspect, the spatial calibration system determines a matching area in the reference image; the spatial calibration system uses a plane matching algorithm and the spatial measurement data to match the matching area with the geographic area to obtain the set of landmark point matching pairs; or, the spatial calibration system determines a matching area in the geographic area; the spatial calibration system uses a plane matching algorithm and the spatial measurement data to match the matching area with the reference image to obtain the set of landmark point matching pairs.

[0018] In the solution provided in the present application, the spatial calibration system can determine the matching area in the reference image or geographic area, use the plane matching algorithm and spatial measurement data to match the matching area and the geographic area or reference image, obtain a set of landmark point matching pairs, and improve the efficiency of obtaining the set of landmark point matching pairs.

[0019] In combination with the first aspect, in a possible implementation manner of the first aspect, the geographical area is a traffic intersection, and the detected target is a vehicle at the traffic intersection photographed by the camera.

[0020] In combination with the first aspect, in a possible implementation of the first aspect, the vehicle at the traffic intersection photographed by the camera is a suspicious vehicle, and the spatial calibration system sends the geographic coordinates of the suspicious vehicle to the police system.

[0021] In combination with the first aspect, in a possible implementation of the first aspect, the spatial calibration system sends the geographic coordinates of the vehicle to a traffic management system, so that the traffic management system determines the driving trajectory of the vehicle at the traffic intersection based on the geographic coordinates of the vehicle, and further determines the violation of the vehicle based on the driving trajectory. In combination with the first aspect, in a possible implementation of the first aspect, the detected target is a suspicious person; the spatial calibration system sends the geographic coordinates of the suspicious person to a security management system, so that the security management personnel can search for the suspicious person in a timely manner based on the geographic coordinates of the suspicious person.

[0022] In combination with the first aspect, in a possible implementation of the first aspect, the detected target is a dangerous target, and the spatial calibration system sends the geographic coordinates of the dangerous target to a hazard inspection management system so that hazard inspection personnel can arrive at the area in time to conduct hazard inspection based on the geographic coordinates of the dangerous target.

[0023] In a second aspect, a spatial calibration system is provided, comprising: an acquisition unit, for acquiring a reference image, wherein the reference image is captured by a camera set at a fixed position in a geographical area; the acquisition unit, further for acquiring spatial measurement data of the geographical area, wherein the spatial measurement data includes geographical coordinates of multiple points in the geographical area; a plane partitioning processing unit, for performing plane partitioning processing on the geographical area according to the spatial measurement data to obtain multiple partition planes; a landmark matching unit, for performing landmark matching according to the reference image and the spatial measurement data to obtain a landmark matching pair set, wherein each landmark matching pair in the landmark matching pair set includes geographical coordinates of a landmark point in the geographical area and pixel coordinates of the landmark point in the reference image; and a calculation unit, for calculating a calibration relationship between the image captured by the camera and each partition plane according to the landmark matching pair set to obtain a family of calibration matrices between the image captured by the camera and the geographical area.

[0024] In combination with the second aspect, in a possible implementation of the second aspect, the plane partitioning unit is also used to: partition the reference image according to the landmark point matching pairs and the multiple partition planes to obtain multiple image regions, wherein the multiple image regions correspond one-to-one to the multiple partition planes.

[0025] In combination with the second aspect, in a possible implementation of the second aspect, the calculation unit is further used to send the calibration matrix family to the processing device, so that after the processing device obtains the pixel coordinates of the detected target in the image taken by the camera, it determines the image area to which the pixel coordinates of the detected target belong, and selects the calibration matrix corresponding to the image area from the calibration matrix family; determines the geographic coordinates of the detected target in the geographic area according to the calibration matrix and the pixel coordinates of the detected target; or, the calculation unit is further used to store the calibration matrix family; the acquisition unit is further used to acquire the pixel coordinates of the detected target in the image taken by the camera; the calculation unit is further used to determine the image area to which the pixel coordinates of the detected target belong, and selects the calibration matrix corresponding to the image area from the calibration matrix family, and determines the geographic coordinates of the detected target in the geographic area according to the calibration matrix and the pixel coordinates of the detected target.

[0026] In combination with the second aspect, in a possible implementation of the second aspect, the calculation unit is also used to send the calibration matrix family to the processing device, so that after acquiring the geographic coordinates of the detected target, the processing device determines the partition plane to which the geographic coordinates of the detected target belong, and selects the calibration matrix corresponding to the partition plane from the calibration matrix family; determines the pixel coordinates of the detected target in the image taken by the camera according to the calibration matrix and the geographic coordinates of the detected target; or, the calculation unit is also used to store the calibration matrix family; the acquisition unit is also used to acquire the geographic coordinates of the detected target; the calculation unit is also used to determine the partition plane to which the geographic coordinates of the detected target belong, and selects the calibration matrix corresponding to the partition plane from the calibration matrix family, and determines the pixel coordinates of the detected target in the image taken by the camera according to the calibration matrix and the geographic coordinates of the detected target.

[0027] In combination with the second aspect, in a possible implementation of the second aspect, the computing unit is specifically used to: select multiple marker point matching pairs in a first partition plane from the marker point matching pair set; calculate a calibration matrix between the image taken by the camera and the first partition plane based on the multiple marker point matching pairs; wherein the first partition plane is any one of the multiple partition planes.

[0028] In combination with the second aspect, in a possible implementation of the second aspect, the calculation unit is specifically used to: determine a common plane, and the central projection theorem is satisfied between the common plane and the multiple partition planes; calculate the mapping relationship between the common plane and each partition plane; select a target partition plane from the multiple partition planes, and select multiple marker point matching pairs in the target partition plane from the marker point matching pair set; calculate the calibration matrix between the image taken by the camera and the target partition plane; calculate the mapping relationship between the target partition plane and each partition plane based on the mapping relationship between the common common plane and each partition plane; calculate the calibration matrix between the image taken by the camera and each partition plane based on the mapping relationship between the target partition plane and each partition plane and the calibration matrix between the image taken by the camera and the target partition plane.

[0029] In combination with the second aspect, in a possible implementation of the second aspect, the landmark point matching unit is specifically used to: determine a matching area in the reference image; match the matching area with the geographic area using a plane matching algorithm and the spatial measurement data to obtain the landmark point matching pair set; or, determine a matching area in the geographic area; match the matching area with the reference image using a plane matching algorithm and the spatial measurement data to obtain the landmark point matching pair set.

[0030] According to a third aspect, a computing device is provided, comprising a processor and a memory, wherein the memory is used to store program code, and the processor is used to execute the first aspect and a method combined with any one of the implementation modes of the first aspect according to the program code in the memory.

[0031] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the functions of the spatial calibration method provided in the first aspect and in combination with any one of the implementation methods in the first aspect can be implemented.

[0032] In a fifth aspect, a computer program product is provided, which includes instructions. When the computer program product is executed by a computer, the computer can execute the process of the spatial calibration method provided in the above-mentioned first aspect and in combination with any one of the implementation methods in the above-mentioned first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of a system architecture provided for an embodiment of the present application;

[0034] Figure 2 A schematic diagram of the structure of a space calibration system provided in an embodiment of the present application;

[0035] Figure 3 A schematic diagram of a flow chart of a spatial calibration method provided in an embodiment of the present application;

[0036] Figure 4 A schematic diagram of a flow chart of a method for calculating a transformation matrix family provided in an embodiment of the present application;

[0037] Figure 5 A schematic diagram of perspective transformation provided in an embodiment of the present application;

[0038] Figure 6 A flowchart of a traffic violation detection method provided in an embodiment of the present application;

[0039] Figure 7 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] The technical solutions in the embodiments of the present application are clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0041] A geographic area is a specific area in the physical world, such as a traffic intersection, a traffic road, a community entrance, and the like. The present application provides a spatial calibration method, which is executed by a spatial calibration system, and the spatial calibration of a camera can be realized by the spatial calibration method. Spatial calibration specifically comprises: calculating the correspondence between the pixel coordinates of a point in an image corresponding to a geographic area and the geographic coordinates corresponding to the point, and this correspondence is also referred to as a calibration relationship. The image corresponding to the geographic area may be a photograph of the geographic area taken from a fixed angle, or any video frame in a video of the geographic area recorded by a camera set at a fixed position. It should be understood that each calibration relationship obtained according to the spatial calibration method is a correspondence between an image obtained by photographing a geographic area from a fixed angle and the space of the geographic area. When the shooting angle changes, the calibration relationship also changes. According to the calibration relationship obtained by calculation, the pixel coordinates of any target in the geographic area in the image can be converted into the geographic coordinates of the target in the geographic area. For example, in a traffic intersection area, a surveillance camera is installed in the area. The traffic intersection is spatially calibrated using the method provided in the present application, so that the pixel coordinates of traffic targets such as vehicles in the image can be converted into geographic coordinates at the traffic intersection, thereby accurately monitoring the geographic location of the vehicle.

[0042] The pixel coordinates in this application are the coordinates of the pixel points where the target is located in the image, and the pixel coordinates are two-dimensional coordinates.

[0043] The geographic coordinates in this application are three-dimensional coordinate values ​​representing points in a geographic area. It should be noted that in the physical world, the coordinate values ​​corresponding to the same point in different coordinate systems are different. The geographic coordinates of a point in this application can be coordinate values ​​in any coordinate system. For example, the geographic coordinates of a target in this application can be three-dimensional coordinates consisting of the longitude, latitude and altitude corresponding to the target, or three-dimensional coordinates consisting of the X coordinate, Y coordinate and Z coordinate in the natural coordinate system corresponding to the target, or other forms of coordinates. As long as the coordinates can uniquely determine the position of a point in a geographic area, this application does not limit the specific form of coordinates to be used.

[0044] like Figure 1As shown, the spatial calibration system can be deployed in a cloud environment, specifically one or more computing devices in the cloud environment (e.g., a central server). The system can also be deployed in an edge environment, specifically one or more computing devices (edge ​​computing devices) in the edge environment, and the edge computing device can be a server. The cloud environment refers to a cluster of central computing devices owned by a cloud service provider for providing computing, storage, and communication resources; the edge environment refers to a cluster of edge computing devices that are geographically close to the original data acquisition device and are used to provide computing, storage, and communication resources. The original data acquisition device refers to a device for collecting the original data required by the spatial calibration system, including but not limited to cameras, radars, infrared cameras, magnetic induction coils, etc. The original data acquisition device includes a device placed in a fixed position on the traffic road for collecting the original data of the traffic road from its own perspective (e.g., video data, radar data, infrared data, etc.), and also includes a drone that dynamically collects data, a patrol reading vehicle, and a device for manually collecting data (e.g., real-time kinematic (RTK) spatial measurement equipment), etc.

[0045] The spatial calibration system is used to calculate the calibration relationship based on the original data collected by the original data collection device to obtain the corresponding relationship between the image and the geographical area. The units inside the spatial calibration system can be divided into many types, which are not limited by this application. Figure 2 is an exemplary division method, such as Figure 2 As shown, the space calibration system 200 includes an acquisition unit 210, a landmark matching unit 220, a plane partition processing unit 230 and a calculation unit 240. The functions of each functional unit are introduced below.

[0046] The acquisition unit 210 is used to acquire the raw data collected by the raw data acquisition device, which mainly includes video data captured by a camera set at a fixed position in a geographical area, and spatial measurement data collected by a spatial measurement device, and the spatial measurement data includes the geographic coordinates of multiple points in the geographical area. It should be understood that the video data includes multiple video frames, each of which is an image. After acquiring the video data collected by the camera and the spatial measurement data collected by the spatial measurement device, the acquisition unit 210 outputs them to the landmark matching unit 220.

[0047] The landmark matching unit 220 is used to determine the landmark points in the video data or the spatial measurement data. The selected landmark points are clear and easily distinguishable points in the geographical area captured by the camera, that is, the landmark points are easier to identify than other points in the geographical area, such as the right angle points of traffic sign lines, the sharp points of arrows, the corner points of lane lines, the corner points of green belts, the center of circular markers, etc. After the landmark points are determined, the pixel coordinates of the landmark points are obtained in the video data, and the geographical coordinates of the landmark points are obtained in the spatial measurement data.

[0048] Optionally, the landmark matching unit 220 is further used to select a matching area in the video data or the spatial measurement data. The selected registration area can be represented by one or more rectangles, circles, polygons, etc. The selected matching area can contain a part of the area to be eliminated, that is, the required matching area can be flexibly selected. After selecting the matching area, the plane matching algorithm is used to match the matching area and the geographical area or image to obtain a landmark matching pair set, and the landmark matching pair set includes multiple landmark matching pairs.

[0049] Optionally, the spatial calibration system 200 further includes a screening unit 250, which is used to screen the set of landmark point matching pairs obtained by the landmark point matching unit 220, remove abnormal landmark point matching pairs, and retain more accurate and stable landmark point matching pairs.

[0050] The plane partition processing unit 230 is used to perform plane partition processing on the geographical area according to the spatial measurement data to obtain multiple partition planes.

[0051] The calculation unit 240 is used to calculate the calibration relationship between the image captured by the camera and each partition plane according to the set of landmark matching pairs screened by the screening unit 250. Through the calculated calibration relationship, the position of a traffic target such as a vehicle in the image can be converted into a spatial position at the traffic intersection.

[0052] In the present application, the spatial calibration system 200 can be a software system, and the deployment form of the various functional units contained therein on the hardware devices is relatively flexible. For example, the entire system can be deployed in a computing device in one environment, or it can be distributedly deployed in multiple computing devices in the same environment or different environments.

[0053] It should be understood that the commonly used calibration methods currently use homography transformation to calculate the calibration matrix between the geographical area and the image taken by the camera. The premise of homography transformation is to ensure that the geographical area is flat. In actual application scenarios, most geographical areas are not flat. Therefore, calibration using existing calibration methods will produce large calibration errors. Therefore, in order to achieve spatial calibration of geographical areas that do not meet the planarity requirements and to improve the accuracy and applicability of spatial calibration, the present application provides a spatial calibration method and system, which partitions the geographical area so that each partition meets the planarity requirements, and then calculates the spatial calibration relationship between each partition plane and the image. This method improves the calibration accuracy and expands the applicable scenarios.

[0054] See also Figure 3 , Figure 3 A schematic diagram of a flow chart of a spatial calibration method provided in an embodiment of the present application. Figure 3 As shown, the method includes but is not limited to the following steps:

[0055] Before implementing the method provided in the embodiment of the present application, it is necessary to measure the geographic coordinates of multiple measurement points in advance through spatial measurement equipment, such as laser radar, drone vision and other equipment, and use the measured geographic coordinates of the multiple measurement points to perform three-dimensional reconstruction of the geographical area, so as to obtain spatial measurement data of the geographical area, and the spatial measurement data includes the geographic coordinates of multiple points in the geographical area, and the spatial measurement data may specifically include laser radar point cloud data or oblique photography three-dimensional model data, etc. The spatial measurement device can select any position in the geographical area as a measurement point.

[0056] The specific steps of a spatial calibration method provided in an embodiment of the present application are as follows:

[0057] S301: Acquire a reference image captured by a camera set at a fixed position in a geographical area.

[0058] Specifically, the spatial calibration system can obtain a piece of video data taken by a camera set at a fixed position in a geographical area. The video data is composed of video frames at different times, wherein the video frames in the video data are arranged in chronological order, each video frame is an image, and each image records the pictures of multiple measurement points measured by the spatial measurement device. The image selected for calculating the calibration relationship is regarded as a reference image.

[0059] S302: Acquire spatial measurement data of the geographical area.

[0060] Specifically, the spatial calibration system obtains the geographic coordinates of multiple measurement points in a geographic area from laser radar, drone vision and other equipment, and uses the acquired geographic coordinates of the multiple measurement points to perform three-dimensional reconstruction of the geographic area, thereby obtaining spatial measurement data.

[0061] S303: Acquire a set of landmark point matching pairs according to the reference image and the spatial measurement data.

[0062] Specifically, after acquiring the image captured by the camera and the spatial measurement data, the spatial calibration system needs to determine the matching relationship between the image and the spatial measurement data, thereby obtaining a set of marker point matching pairs, each of which represents a coordinate pair consisting of the pixel coordinates of a marker point in the image and its corresponding geographic coordinates in the geographic area. For example, in an algorithm for calculating a spatial calibration relationship, at least four marker point matching pairs are required to calculate the calibration relationship, and in order to improve accuracy, dozens of marker point matching pairs are generally obtained for calculation.

[0063] There are two methods for obtaining a set of landmark matching pairs: 1. Obtaining a set of landmark matching pairs after manual matching; 2. Obtaining a set of landmark matching pairs after automatic matching. The following describes the specific implementation of the above two methods for obtaining a set of landmark matching pairs:

[0064] 1. Obtain a set of landmark point matching pairs after manual matching: First, you need to select landmark points in the image or geographic area. The rule for selecting landmark points is to select points that are clearly distinguishable in the image, such as the corner points of lane lines, the right angle points of traffic sign lines, the center of spherical markers, the corner points of green belts, etc.

[0065] Then, after selecting the marker point, it is necessary to obtain the position coordinates of the marker point. If the marker point is selected in the image, it is necessary to obtain the pixel coordinates of the marker point. Optionally, the pixel coordinates of the marker point can be obtained by manual annotation, corner point detection, short-time Fourier transform edge extraction algorithm, sub-pixel coordinate fitting method, etc.; if the marker point is selected in a geographic area, it is necessary to obtain the geographic coordinates of the marker point, that is, directly read the geographic coordinates of the marker point from the spatial measurement data.

[0066] Furthermore, after obtaining the position coordinates of the marker point, it is necessary to obtain coordinates that match the position coordinates of the marker point, that is, if the pixel coordinates of the marker point are obtained, it is necessary to obtain the geographic coordinates that match the pixel coordinates; if the geographic coordinates of the marker point are obtained, it is necessary to obtain the pixel coordinates that match the geographic coordinates.

[0067] Exemplarily, after obtaining the pixel coordinates of the marker point, the position of the marker point in the geographic area is manually marked, and the geographic coordinates of the position are measured using RTK equipment or directly read from spatial measurement data. The geographic coordinates of the position and the pixel coordinates of the marker point constitute a set of marker point matching pairs. Similarly, after obtaining the geographic coordinates of the marker point, the position of the marker point in the image is determined by corner point detection or manual marking, and the pixel coordinates of the position are obtained. The pixel coordinates of the position and the geographic coordinates of the marker point constitute a set of marker point matching pairs, and multiple marker point matching pairs constitute a marker point matching pair set.

[0068] 2. Obtain a set of landmark point matching pairs after automatic matching: First, a matching area can be determined in the image, and the matching area includes multiple landmark points. The purpose of determining the matching area here is to limit the data processing range of the landmark point matching algorithm to reduce the amount of calculation and eliminate some irrelevant data and unstable data (such as some relatively blurred areas in the image). The selected matching area can be represented by one or more rectangles, circles, polygons, etc. In addition, the selected matching area can contain the eliminated area. The specific selection method of the matching area can be flexibly selected according to the characteristics of the image and spatial measurement data, and this application does not limit this.

[0069] Then, the plane matching algorithm is used to match the matching area and the geographic area to obtain a set of landmark point matching pairs. It should be noted that the plane matching algorithm is only applicable to images and lidar point cloud data, images and oblique photography 3D model data, and is not applicable to images and data measured by RTK equipment. In addition, the automatic matching of images and lidar point cloud data or oblique photography 3D model data belongs to the 2D-3D registration technology in the field of computer vision. This technology has been widely used in the field. The following is a brief explanation of the automatic matching of images and lidar point cloud data as an example.

[0070] The spatial calibration system obtains laser radar point cloud data, which includes the three-dimensional geographic coordinates of multiple points in the geographical area. After obtaining the laser radar point cloud data, the laser radar point cloud data is used to further process the geographical area (i.e., projection processing) to obtain a projection image corresponding to the geographical area. In the projection image, the pixel coordinates of each pixel point are two-dimensional, but each two-dimensional pixel coordinate corresponds to a three-dimensional geographic coordinate. In this way, the three-dimensional geographic coordinates of each point in the geographical area establish a corresponding relationship with the two-dimensional pixel coordinates of the point in the projection image. Then, the spatial calibration system uses a plane matching algorithm to match the image captured by the camera with the obtained projection image, and obtains the corresponding relationship between the pixel coordinates of each pixel point in the image captured by the camera and the pixel coordinates of each pixel point in the projection image. The pixel coordinates of each pixel point in the projection image have a certain corresponding relationship with the three-dimensional geographic coordinates of each point in the geographical area. Therefore, the corresponding relationship between the pixel coordinates of each pixel point in the image captured by the camera and the three-dimensional geographic coordinates of each point in the geographical area can be determined, and multiple matching pairs of marker points can be obtained. At this point, the automatic matching of the image and the laser radar point cloud data is completed.

[0071] It should be noted that in the obtained set of landmark point matching pairs, there may be some abnormal landmark points that have not been eliminated. In order to obtain accurate and stable landmark point matching pairs, ensure the accuracy of the calculated calibration relationship, and ensure the effectiveness of the landmark point matching pairs involved in the calculation, the multiple landmark point matching pairs obtained by matching can be further screened. There are three methods for screening landmark point matching pairs: 1. Screening using the camera projection matrix; 2. Screening using the feature matching algorithm; 3. Selecting a fixed number of landmark point matching pairs within a limited area. It should be understood that in actual applications, the above three methods can be used in combination to screen landmark point matching pairs, that is, the three methods can be screened in any combination, so that the landmark point matching pairs finally screened are landmark point matching pairs that can be effectively used to calculate the spatial calibration relationship. For example: combining method 1 and method 2 for screening, retaining valid landmark point matching pairs when the conditions in method 1 and method 2 are met at the same time; or combining method 1 and method 3 for screening, retaining valid landmark point matching pairs when the conditions in method 1 and method 3 are met at the same time; or combining method 1, method 2 and method 3 for judgment, retaining valid landmark point matching pairs when the conditions in method 1, method 2 and method 3 are met at the same time. This application does not limit this.

[0072] The following describes the specific implementation of the above three methods for screening landmark point matching pairs:

[0073] 1. Screening using the camera projection matrix: After obtaining multiple marker point matching pairs, calculate the transformation relationship between the three-dimensional geographic coordinates of the marker points and the two-dimensional pixel coordinates of the image captured by the camera. The transformation relationship can be represented by a matrix (i.e., the camera projection matrix). Then, for each marker point matching pair, use the projection matrix to calculate the pixel coordinates of the marker points, and compare the calculated pixel coordinates with the actual pixel coordinates of the marker point, i.e., the pixel coordinates of the marker point in the image captured by the camera. If the difference between the two pixel coordinates is less than a preset threshold, the marker point matching pair is considered to be reliable and can be used to calculate the spatial calibration relationship and should be retained; otherwise, the marker point matching pair is discarded. Among them, the preset threshold can be set as needed, and this application does not limit this.

[0074] 2. Screening using feature matching algorithms: After obtaining multiple landmark point matching pairs, further processing is performed using feature matching algorithms in the field of computer vision. For example, the correctMatches algorithm in the open source computer vision library (OpenCV) toolkit is used to screen the multiple landmark point matching pairs obtained, eliminate abnormal landmark point matching pairs, and retain reliable landmark point matching pairs.

[0075] 3. Select a fixed number of landmark matching pairs in a limited area: After obtaining multiple landmark matching pairs, first determine the area to be selected (i.e., the limited area) in the image or geographic area, and then select a fixed number of landmark matching pairs in the limited area. The specific number of landmark matching pairs selected can be flexibly set. In addition, the specific selection criteria can be random selection, selection in a fixed order, scoring selection, etc., which is not limited in this application.

[0076] In addition, the validity of the obtained multiple landmark point matching pairs needs to be judged. That is, it is judged whether the obtained landmark point matching pairs are distributed in a straight line. If they are distributed in a straight line, they will not meet the validity and cannot be used to calculate the calibration relationship; if they are not distributed in a straight line, they meet the validity and can be used to calculate the calibration relationship.

[0077] When making a validity judgment, a straight line fitting is performed on the obtained geographic coordinates or pixel coordinates of the marker point matching pair. For example, the pixel coordinates of all marker points are fitted to obtain a fitting straight line, and then the distance from the pixel coordinates of all marker points to the fitting straight line is traversed and calculated. Since the pixel coordinates of all marker points are known, the distance from the pixel coordinates of each marker point to the fitting straight line can be calculated according to the point-to-straight line distance formula in Euclidean geometry. Next, it is determined whether the distance from each pixel coordinate to the straight line is less than the first threshold, and finally it is determined whether the number of pixel coordinates that meet the distance less than the first threshold is greater than the second threshold. If it is greater than the second threshold, it means that the pixel coordinates of all marker points are distributed on a straight line, which does not meet the conditions for calculating the calibration relationship, and it is necessary to re-acquire multiple marker point matching pairs; otherwise, it can be considered that the pixel coordinates of all marker points are not distributed on a straight line, which meets the conditions for calculating the calibration relationship and can be used to calculate the calibration relationship.

[0078] It should be understood that since the calibration relationship we finally calculated is the calibration relationship between two planes, and a straight line cannot determine a plane, if the final landmark point matching pair is distributed in a straight line, then the calculated calibration relationship is inaccurate. In other words, the calculated transformation matrix is ​​not unique, but a random transformation matrix that meets the conditions. Therefore, in order to improve the accuracy of spatial calibration and ensure that the calculated transformation matrix is ​​unique, the obtained landmark point matching pair cannot be distributed in a straight line.

[0079] S304: Performing plane partitioning processing on the geographical area according to the spatial measurement data to obtain a plurality of partition planes.

[0080] Specifically, after the geographical area is subjected to plane partitioning processing, a plurality of partition planes are obtained, and each partition plane is marked with a different geographical area code value.

[0081] There are two methods for plane partitioning of geographic areas: 1. Obtaining the partition plane after manual partitioning; 2. Obtaining the partition plane after automatic partitioning. The following describes the specific implementation of the above two partitioning methods:

[0082] 1. Obtain the partition plane after artificial partitioning: directly observe the distribution of altitude data in the spatial measurement data, or intuitively display the distribution of altitude data in the spatial measurement data through computer visualization technology.

[0083] Then, based on the observation results, the geographical area is partitioned into planes. For example, the geographical area with an altitude of 100 to 105 meters is divided into one partition plane, and the geographical area with an altitude of 105 to 110 meters is divided into another partition plane.

[0084] After the geographic area is divided into different partition planes, the different partition planes are marked with different geographic area code values. For example, the geographic area is divided into four partition planes according to the altitude, which can be marked with partition plane 1, partition plane 2, partition plane 3, and partition plane 4.

[0085] 2. Obtain the partition plane after automatic partitioning: Use the point cloud segmentation algorithm to process the spatial measurement data, divide the geographical area into multiple partition planes, and mark each partition plane with a different geographical area code value, where the point cloud segmentation algorithm can be a Euclidean distance segmentation algorithm, a regional growing segmentation algorithm, a segmenterlight segmentation algorithm, etc. This application does not limit the specific algorithm to be used.

[0086] After the geographical area is divided into a plurality of partition planes, it is also necessary to perform partition processing on the reference image, so as to obtain a plurality of image regions, and the obtained plurality of image regions correspond one to one to the plurality of partition planes.

[0087] Specifically, multiple marker point matching pairs are selected from the marker point matching pair set obtained in S303, and the geographic coordinates of the selected marker point matching pairs are determined, so that the geographic area code value corresponding to the geographic coordinates of the marker point can be determined, that is, to which partition plane the geographic coordinates of the marker point belong, and the geographic area code value corresponding to the geographic coordinates of the marker point is the geographic area code value corresponding to the partition plane.

[0088] Further, the pixel coordinates of the selected marker point matching pair are determined, and an image region coding value is given to the pixel coordinates of each marker point, wherein the image region coding values ​​corresponding to the pixel coordinates of the marker points having the same geographic region coding value are the same. Exemplarily, it is assumed that there are five marker points, namely marker point 1, marker point 2, marker point 3, marker point 4 and marker point 5, wherein marker point 1 and marker point 2 belong to the same partition plane, and the geographic region coding values ​​corresponding to the geographic coordinates of marker point 1 and marker point 2 are partition plane 1; marker point 3 and marker point 4 belong to the same partition plane, and the geographic region coding values ​​corresponding to the geographic coordinates of marker point 3 and marker point 4 are partition plane 2; marker point 5 belongs to a partition plane, and the geographic region coding value corresponding to the geographic coordinates of marker point 5 is partition plane 3. Then, the image region coding values ​​corresponding to the pixel coordinates of marker point 1 and marker point 2 are the same, which can be image region 1; the image region coding values ​​corresponding to the pixel coordinates of marker point 3 and marker point 4 are the same, which can be image region 2; the image region coding value corresponding to the pixel coordinates of marker point 5 can be image region 3.

[0089] After obtaining the image area coding values ​​corresponding to the pixel coordinates of multiple marker points, for other pixel points in the image taken by the camera except the marker points, the distance between the pixel coordinates of each pixel point and the pixel coordinates of multiple marker points is traversed and calculated, the pixel coordinates of the marker point closest to the pixel coordinates of a pixel point are determined, and the image area coding values ​​corresponding to the pixel coordinates of the closest marker point are assigned to the pixel point. For other pixel points, the distances are calculated and assigned in the same way.

[0090] Finally, the pixel coordinates of all pixels in the image will correspond to an image area coding value. The pixel coordinates of pixels with the same image area coding value constitute an image area. The entire image will be divided into different image areas, and each image area corresponds to a partition plane.

[0091] S305: Calculate the calibration relationship between the image captured by the camera and each partition plane according to the set of landmark point matching pairs.

[0092] Specifically, the spatial calibration system can establish a calibration relationship between the image from each camera perspective and the geographic area in the physical world based on the acquired multiple valid landmark point matching pairs.

[0093] It should be understood that since the geographical area and the image are planarly partitioned, the calibration relationship between the image and the geographical area finally calculated is not just a calibration matrix, but a family of calibration matrices, that is, different partition planes correspond to different calibration matrices.

[0094] It should be noted that the method for calculating the calibration matrix family can be any of the following:

[0095] 1. First, according to the plane partitioning result obtained in S304, the geographical area is divided into different partition planes, and the image corresponding to the geographical area is divided into different image areas. Since the landmark matching pair set is obtained in S303, multiple landmark matching pairs can be selected from the landmark matching pair set for each partition plane or image area, and then the calibration relationship between each partition plane and the image is calculated based on the selected multiple landmark matching pairs to complete the spatial calibration. It is worth noting that a variety of methods can be used to establish a calibration relationship between the image under each camera's viewing angle and the physical world. For example, the homography transformation matrix H that converts pixel coordinates into geographic coordinates can be calculated based on the homography transformation principle. The homography transformation formula is (m, n, h) = H*(s, k), (m, n, h) is the geographic coordinates of the marker point, and (s, k) is the pixel coordinates of the marker point. The pixel coordinates of at least four marker points in each different image area in the image under the shooting angle of each camera obtained in the above step S303 and their corresponding geographic coordinates can be used to calculate an H matrix corresponding to the image area. Different image areas have different corresponding H matrices. In addition, the calibration matrix family corresponding to the image taken by each camera is also different.

[0096] It should also be understood that the algorithm for calculating the homography transformation is a basic content in the field of computer vision and has been widely integrated into software such as OpenCV and matrix laboratory (MATLAB), and can be directly used to calculate the homography transformation. For the sake of brevity, it will not be repeated here.

[0097] It is easy to understand that after obtaining the calibration matrix family corresponding to the image taken by each camera, the pixel coordinates of the target in the image taken by each camera can be converted according to the calibration matrix family and the image partitioning results (i.e., different image regions) to obtain the geographic coordinates corresponding to the target. For example, first determine which image region the pixel coordinates of the target belong to, and then use the calibration matrix corresponding to the image region to convert and obtain the geographic coordinates corresponding to the target. However, it should be noted that different image regions have their own corresponding H matrices, and the corresponding H matrices should be used for conversion to obtain the geographic coordinates corresponding to the target.

[0098] 2. If Figure 4 As shown, in order to further improve the accuracy of the calculated calibration matrix family and improve the calibration precision, the calibration matrix family can be calculated using the conversion relationship between different partition planes. Another method for calculating the calibration matrix family includes:

[0099] S401: Obtain the geographic coordinates of the camera.

[0100] Specifically, the geographic coordinates of the camera may be directly acquired from the spatial measurement data obtained in S302 above.

[0101] S402: Determine a common plane.

[0102] Specifically, the planes based on homography transformation need to satisfy the central projection theorem. After the geographical area is divided into multiple partition planes, the plane transformation matrix cannot be directly calculated between different partition planes. At this time, a common plane can be selected. The common plane satisfies the central projection theorem with all partition planes. The plane transformation matrix between different partition planes can be indirectly calculated through the common plane. That is, the common plane acts as a bridge to connect different partition planes.

[0103] It should be noted that the common plane is a concept introduced only for the convenience of subsequent calculations, and the common plane may not exist in the actual geographical area.

[0104] Furthermore, a common horizontal plane in the geographical area may be selected as the common plane Z0, and the height of the common horizontal plane may be the lowest point, the highest point, the average point, etc. in the geographical area, which is not limited in the present application.

[0105] S403: Calculate a mapping relationship between the common plane and the multiple partition planes according to the geographic coordinates of the camera.

[0106] Specifically, the transformation matrix between each partition plane and the public plane can be calculated based on the geographic coordinates of the marker point in each partition plane and the geographic coordinates of the marker point projected on the public plane, combined with the geographic coordinates of the camera.

[0107] For example, Figure 5As shown, a spatial coordinate system is constructed with the space of the geographic area, in which x and y represent the first dimension and the second dimension on the plane respectively, and h is the third dimension formed by the height perpendicular to the horizontal plane. The public plane Z0 is a horizontal plane, and there is a marker point P on the partition plane Z1, whose three-dimensional coordinates are (x1, y1, h1). Since the imaging model of the camera is pinhole imaging, the pinhole imaging is based on the perspective principle, mapping the three-dimensional space to the two-dimensional space, and the projection ray passes through the same projection center. Therefore, the marker point P is projected on the public plane Z0 as the marker point Q, whose three-dimensional coordinates are (x2, y2, 0), the intersection point of the marker point P perpendicular to the public plane Z0 is A, and its three-dimensional coordinates are (x1, y1, 0), the three-dimensional coordinates of the camera M are (x3, y3, h2), and the intersection point of the camera M perpendicular to the public plane Z0 is N, and its three-dimensional coordinates are (x3, y3, 0). In order to obtain the first and second dimensional coordinates (x2, y2) of point Q, after obtaining the above data, the geographic coordinates of point Q can be calculated. Specifically, the (x2, y2) of point Q can be derived based on basic geometric mathematical principles, such as the principle of similar triangles. Figure 5 As shown, since triangle PQA and triangle MQN are similar triangles, and PA = h1, MN = h2, QA = (x1, y1)-(x2, y2), QN = (x3, y3)-(x2, y2), according to the principle of similarity, PA / MN = QA / QN, that is: h1 / h2 = (x1, y1)-(x2, y2) / (x3, y3)-(x2, y2), thus we can obtain: h1 / h2 = (x1-x2) / (x3-x2), h1 / h2 = (y1-y2) / (y3-y2).

[0108] Therefore, x2 can be calculated using the following formula 1:

[0109] x2=(h2*x1-h1*x3) / (h2-h1) Formula 1

[0110] y2 can be calculated using the following formula 2:

[0111] y2=(h2*y1-h1*y3) / (h2-h1) Formula 2

[0112] By using the above principle, the three-dimensional coordinates of the marker points projected on the common plane Z0 by other marker points on the partition plane Z1 can be calculated, so that the homography transformation matrix between the partition plane Z1 and the common plane Z0 can be further calculated, for example, the homography transformation matrix can be calculated by using the findHomography algorithm in the OpenCV toolkit. Similarly, using similar principles, the homography transformation matrix between other partition planes and the common plane Z0 can be calculated, which will not be repeated here for the sake of brevity.

[0113] S404: Select a target partition plane from multiple partition planes.

[0114] Specifically, since cameras can generally only collect data from part of a geographic area, there may be some geographic areas that are not captured by the camera, or the quality of data collected by the camera is not equal, that is, some data quality is ideal, and some data quality is not good enough. Therefore, it is necessary to select a target partition plane to ensure that the data collected by the camera on the target partition plane has the highest confidence (that is, the quality of the collected data) in the entire geographic area.

[0115] The method for selecting the target partition plane can be to select the partition plane that is closest to the camera, because the closer the distance to the camera, the clearer the image taken by the camera and the more accurate the calculated calibration relationship; or to select the partition plane with the largest number of valid marker points, because the more valid marker points, the more accurate the calculated calibration relationship; or to comprehensively consider the above two factors and select the partition plane that is closer to the camera and contains a larger number of valid marker points. This application does not limit the specific selection method.

[0116] S405: Calculate the calibration relationship between the image captured by the camera and the target partition plane.

[0117] Specifically, according to the multiple partition planes obtained in S304 above, the target partition plane among the multiple partition planes is determined, and according to the set of landmark point matching pairs obtained in S303 above, multiple landmark point matching pairs in the target partition plane are selected from the set of landmark point matching pairs, and then the findHomography algorithm in the OpenCV toolkit is used to calculate the homography transformation matrix H1 between the image taken by the camera and the target partition plane.

[0118] S406: Calculate a mapping relationship between the target partition plane and each partition plane according to a mapping relationship between the common plane and each partition plane.

[0119] Specifically, since the mapping relationship between the common plane and multiple partition planes has been calculated in S403, the mapping relationship between the target partition plane and the common plane has been obtained, and the mapping relationship between other partition planes and the common plane has also been obtained. Therefore, the common plane can be used as a bridge for conversion to obtain the mapping relationship between the target partition plane and other partition planes.

[0120] Exemplarily, the transformation matrix between the target partition plane and the common plane is H2, and the transformation matrix between partition plane 1 and the common plane is H3, then the transformation matrix between the target partition plane and partition plane 1 is H4=H2*INV(H3), where INV(H3) represents the inverse matrix of H3.

[0121] S407: Calculate the calibration relationship between the image captured by the camera and each partition plane.

[0122] Specifically, since the mapping relationship between the target partition plane and multiple partition planes has been calculated in S406, in addition, the calibration relationship between the image taken by the camera and the target partition plane has been calculated in S405, and the homography transformation matrix is ​​reversible, therefore, after conversion, the calibration relationship between the image taken by the camera and each partition plane can be indirectly calculated.

[0123] Exemplarily, the homography transformation matrix between the image captured by the camera and the target partition plane is H1, the transformation matrix between the target partition plane and the common plane is H2, and the transformation matrix between partition plane 1 and the common plane is H3. Then, the transformation matrix H between the image captured by the camera and partition plane 1 can be calculated by the following formula 3:

[0124] H=H1*H2*INV(H3) Formula 3

[0125] Among them, INV(H3) represents the inverse matrix of H3. It can be seen that through the above formula 3, the homography transformation matrix between each partition plane and the image taken by the camera can be calculated, and finally a transformation matrix family is obtained, and different partition planes correspond to different transformation matrices.

[0126] After spatial calibration of the geographical area, the calibration relationship between the image captured by the camera and the geographical area is obtained. The spatial calibration system can store the calibration relationship. After obtaining the pixel coordinates of the detected target in the image captured by the camera, the image area to which the detected target belongs is determined, and the corresponding calibration relationship is obtained. According to the calibration relationship and the pixel coordinates of the detected target, the geographical coordinates of the detected target in the geographical area are determined. When the spatial calibration system determines the geographical coordinates of the detected target in the geographical area according to the calibration relationship and the pixel coordinates of the detected target, the detected target can have different meanings according to different application scenarios. For example, in the application scenario of determining the violation of the vehicle at the traffic intersection, the detected target is the vehicle at the target traffic intersection; in the application scenario of determining the driving position of the suspicious vehicle, the detected target is the suspicious vehicle on the traffic road; when determining the suspicious person in a certain area (such as inside a residential area), the detected target is the suspicious person in the area; when determining the dangerous situation in a certain area (such as a factory), the detected target is the dangerous target in the area (such as a faulty machine, a burning object, etc.).

[0127] Or the spatial calibration system can send the calculated spatial calibration relationship to the processing device, so that after obtaining the pixel coordinates of the detected target in the image captured by the camera, the processing device determines the image area to which the pixel coordinates of the detected target belong, and determines the geographical coordinates of the detected target in the said geographical area according to the corresponding calibration relationship and the pixel coordinates of the detected target. The processing device can be different according to the application scenario of the calibration relationship. For example, the processing device can be a device for determining the geographical coordinates of a vehicle in a traffic management system, or a device for determining the geographical coordinates of a suspicious vehicle in a police system, or a device for determining the geographical coordinates of a suspicious person in a security management system, or a device for determining the geographical coordinates of a dangerous target in a hazard inspection management system.

[0128] In short, the spatial calibration relationship obtained by the spatial calibration system in the present application can be applied to a variety of scenarios, and the executor of the spatial calibration relationship of the present application can be the spatial calibration system itself or other processing devices or systems that receive the spatial calibration relationship sent by the spatial calibration system, which is not limited by the present application.

[0129] The following uses the example of the spatial calibration system itself using the calculated spatial calibration relationship to determine the illegal vehicles at the traffic intersection to specifically introduce the application of the spatial calibration relationship: at the traffic intersection, after calculating the calibration relationship between the camera and a geographical area, the spatial calibration system can store the calibration relationship. In the subsequent time, the spatial calibration system can analyze the video data captured by the camera and use the obtained spatial calibration relationship to locate the vehicle at the traffic intersection, obtain the geographical coordinates of the vehicle at the traffic intersection, and further determine the positional relationship between the vehicle and the traffic sign line to determine the vehicle's violation. Figure 6 As shown:

[0130] S601: Perform spatial calibration on the road traffic scene and store the spatial calibration relationship.

[0131] Specifically, using the above Figure 3 and Figure 4 The method performs spatial calibration on the traffic road scene, establishes calibration relationships between points in the image under each camera perspective and points in the geographical area in the physical world, and stores the spatial calibration relationship in a spatial calibration system, where the spatial calibration relationship is a transformation matrix family including multiple transformation matrices.

[0132] S602: Process the data captured by the camera, and identify and locate all vehicles therein.

[0133] Specifically, when a violation judgment is required, the spatial calibration system uses a target detection algorithm to perform target detection on the video data and identify all vehicles in the video data, for example, using a trained neural network model such as SSD or RCNN to detect vehicles in the video data. It should be understood that the neural network model needs to be trained in advance, and the annotations of the training images in the training set used should include the type of target to be identified (such as motor vehicles, non-motor vehicles, etc.), so that the neural network model learns the characteristics of each type of target in the training set. After target detection, the partition plane to which the vehicle belongs in the geographical area can be determined, and the pixel coordinates of all vehicles in the image can be obtained.

[0134] S603: Track all vehicles to obtain motion trajectory sequences of all vehicles in the image.

[0135] Specifically, target tracking refers to tracking targets in two images at adjacent moments to determine the same target in the two adjacent images. The target's motion trajectory in the image can be obtained from the pixel coordinates of the target at the current moment and the pixel coordinates of the historical moment. Therefore, by recording the pixel coordinates of all vehicles in each image, the motion trajectory of all vehicles in the image can be obtained.

[0136] S604: Calculate the movement trajectory of the vehicle in the geographical area, and complete the vehicle violation detection according to the movement trajectory of the vehicle in the geographical area.

[0137] Specifically, the motion trajectory sequence of the vehicle in the image obtained in S703 is actually composed of a series (multiple) of pixel coordinates. For each pixel coordinate in the motion trajectory sequence, the calibration relationship matrix family calculated in the above S305 and S401-S406 is used, for example: the homography transformation matrix family. First, determine the image area to which each pixel coordinate belongs, and then use the corresponding homography transformation matrix to calculate the corresponding geographic coordinates of the pixel coordinates of each point, that is, H and the pixel coordinates (s, k) are known. According to the homography transformation formula (m, n, h) = H*(s, k), the geographic coordinates (m, n, h) can be calculated to complete the coordinate conversion.

[0138] After all pixel coordinates are converted into geographic coordinates, the motion trajectory sequence of the vehicle in the geographic area in the physical world is obtained. The spatial calibration system can send the obtained motion trajectory sequence of the vehicle in the geographic area in the physical world to the traffic management system. The traffic management system can set specific detection areas for different types of violations. For example, for violations of running a red light, a detection area can be set before and after the stop line of each lane, and the motion trajectory of each vehicle in the geographic area obtained from the spatial calibration system can be recorded and analyzed. If the signal light state of the current lane is red, and the vehicle trajectory passes through the two set detection areas in sequence, the vehicle is considered to have run a red light; for violations of driving on the line, a lane line area where driving on the line is prohibited is set, and the motion trajectory of each vehicle is recorded and analyzed. If the vehicle trajectory passes through this area, it is considered that the vehicle is driving on the line; for violations of not driving in the specified lane, two detection areas can be set in two lanes. If the vehicle trajectory passes through the two set detection areas in sequence, it is considered that the vehicle is not driving in the specified lane and is judged as a violation.

[0139] It can be seen that through Figure 3 The method shown performs spatial calibration on the road traffic scene and establishes a calibration relationship between the image and the geographic area, thereby accurately locating the vehicle and tracking the vehicle target. The vehicle trajectory analysis can be used to complete vehicle violation detection.

[0140] As another example, for the scenario of identifying dangerous targets: when there are dangerous targets in the images captured by the surveillance camera, the pixel coordinates (s, k) of the dangerous target in the image can be determined in the image, and the image area to which the pixel coordinates belong can be further determined, so as to select the calibration relationship matrix corresponding to the image area, such as the homography transformation matrix H, and calculate (m, n, h) = H*(s, k) to obtain the geographical coordinates of the dangerous target in the geographical area, and then send the geographical coordinates of the dangerous target to the danger investigation management system. Danger investigation personnel can arrive at the area in time for danger investigation based on the geographical coordinates of the dangerous target.

[0141] The method of the embodiment of the present application is described in detail above. In order to facilitate better implementation of the above scheme of the embodiment of the present application, correspondingly, related equipment for cooperating in implementing the above scheme is also provided below.

[0142] like Figure 2 As shown, the present application also provides a space calibration system, which is used to execute the above space calibration method. The present application does not limit the division of functional units in the space calibration system, and the various units in the space calibration system can be increased, reduced or merged as needed. Figure 2 An exemplary division of a functional unit is provided:

[0143] The space calibration system 200 includes an acquisition unit 210 , a landmark matching unit 220 , a plane partition processing unit 230 , and a calculation unit 240 .

[0144] Specifically, the acquisition unit 210 is used to execute the aforementioned steps S301-S302, and optionally execute the optional method in the aforementioned steps to acquire at least one image taken by the camera and the spatial measurement data of the geographical area.

[0145] The landmark matching unit 220 is used to execute the aforementioned step S303 to obtain a landmark matching pair set according to the reference image and the spatial measurement data.

[0146] The plane partitioning unit 230 is used to execute the aforementioned step S304, and optionally execute the optional method in the aforementioned step, to perform plane partitioning processing on the geographical area and the image corresponding to the geographical area, and obtain multiple partition planes and image areas.

[0147] The calculation unit 240 is used to execute the aforementioned step S305, and optionally execute the optional method in the aforementioned step to calculate the calibration relationship between the image captured by the camera and each partition plane to obtain a calibration matrix family.

[0148] The above three units can transmit data to each other through a communication path. It should be understood that each unit included in the space calibration system 200 can be a software unit, a hardware unit, or partly a software unit and partly a hardware unit.

[0149] See also Figure 7 , Figure 7 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. Figure 7 As shown, the computing device 700 includes: a processor 710, a communication interface 720 and a memory 730, and the processor 710, the communication interface 720 and the memory 730 are interconnected via an internal bus 740. It should be understood that the computing device 700 can be a computing device in a cloud environment, or a computing device in an edge environment.

[0150] The processor 710 may be composed of one or more general-purpose processors, such as a central processing unit (CPU), or a combination of a CPU and a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0151] The bus 740 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus 740 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0152] The memory 730 may include a volatile memory, such as a random access memory (RAM); the memory 730 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 730 may also include a combination of the above types.

[0153] It should be noted that the memory 730 of the computing device 700 stores codes corresponding to the various units of the spatial calibration system 200, and the processor 710 executes these codes to implement the functions of the various units of the spatial calibration system 200, that is, executes the methods S301-S305.

[0154] The descriptions of the processes corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process, please refer to the relevant descriptions of other processes.

[0155] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., an SSD), etc.

Claims

1. A spatial calibration method, characterized in that: include: Acquire a reference image, where the reference image is captured by a camera located at a fixed position in a geographic area; Acquire spatial measurement data of the geographic area, the spatial measurement data comprising geographic coordinates of a plurality of points in the geographic area; Performing plane partitioning processing on the geographic area according to the spatial measurement data to obtain a plurality of partition planes; Acquire a set of marker point matching pairs according to the reference image and the spatial measurement data, each marker point matching pair in the set of marker point matching pairs comprising a geographic coordinate of a marker point in the geographic area and a pixel coordinate of the marker point in the reference image; Determine a common plane, wherein the common plane satisfies the central projection theorem with the plurality of partition planes; Calculating a mapping relationship between the common plane and each partition plane; Select a target partition plane from the multiple partition planes, and select multiple marker point matching pairs in the target partition plane from the marker point matching pair set; Calculating a calibration matrix between the image captured by the camera and the target partition plane; Calculating a mapping relationship between the target partition plane and each partition plane according to a mapping relationship between the common plane and each partition plane; According to the mapping relationship between the target partition plane and each partition plane and the calibration matrix between the image captured by the camera and the target partition plane, a calibration matrix family between the image captured by the camera and each partition plane is calculated.

2. The method according to claim 1, characterized in that After performing plane partitioning processing on the geographic area according to the spatial measurement data, the method further includes: The reference image is partitioned according to the marker point matching pairs and the multiple partition planes to obtain multiple image regions, wherein the multiple image regions correspond one-to-one to the multiple partition planes.

3. The method according to claim 2, characterized in that The method further comprises: Sending the calibration matrix family to a processing device, so that the processing device, after acquiring the pixel coordinates of the detected target in the image captured by the camera, determines the image region to which the pixel coordinates of the detected target belong, and selects a calibration matrix corresponding to the image region from the calibration matrix family; Determining the geographical coordinates of the detected object in the geographical area according to the calibration matrix and the pixel coordinates of the detected object; or, storing the calibration matrix family; After the pixel coordinates of the detected target in the image taken by the camera are obtained, the image area to which the pixel coordinates of the detected target belong is determined, and a calibration matrix corresponding to the image area is selected from the calibration matrix family, and the geographic coordinates of the detected target in the geographic area are determined based on the calibration matrix and the pixel coordinates of the detected target.

4. The method according to claim 1 or 2, characterized in that: The method further comprises: Sending the calibration matrix family to a processing device, so that after acquiring the geographic coordinates of the detected target, the processing device determines the partition plane to which the geographic coordinates of the detected target belong, and selects a calibration matrix corresponding to the partition plane from the calibration matrix family; Determining pixel coordinates of the detected target in the image captured by the camera according to the calibration matrix and the geographic coordinates of the detected target; or, storing the calibration matrix family; After the geographic coordinates of the detected target are obtained, the partition plane to which the geographic coordinates of the detected target belong is determined, and a calibration matrix corresponding to the partition plane is selected from the calibration matrix family. Based on the calibration matrix and the geographic coordinates of the detected target, the pixel coordinates of the detected target in the image taken by the camera are determined.

5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Selecting a plurality of matching pairs of landmark points in a first partition plane from the set of matching pairs of landmark points; Calculate a calibration matrix between the image captured by the camera and the first partition plane according to the multiple marker point matching pairs; The first partition plane is any partition plane among the multiple partition planes.

6. The method according to any one of claims 1 to 3, characterized in that: The step of acquiring a set of matching pairs of landmark points according to the reference image and the spatial measurement data comprises: determining a matching region in the reference image; Using a plane matching algorithm and the spatial measurement data to match the matching area and the geographic area to obtain the set of landmark point matching pairs; or, determining a matching area in the geographic area; The matching area and the reference image are matched using a plane matching algorithm and the spatial measurement data to obtain the set of matching pairs of landmark points.

7. A spatial calibration system, characterized in that: include: An acquisition unit, used for acquiring a reference image, wherein the reference image is captured by a camera set at a fixed position in a geographical area; The acquisition unit is further used to acquire spatial measurement data of the geographical area, wherein the spatial measurement data includes geographical coordinates of a plurality of points in the geographical area; A plane partition processing unit, used for performing plane partition processing on the geographical area according to the spatial measurement data to obtain a plurality of partition planes; a marker point matching unit, configured to perform marker point matching according to the reference image and the spatial measurement data, and obtain a marker point matching pair set, wherein each marker point matching pair in the marker point matching pair set includes a geographic coordinate of a marker point in the geographic area and a pixel coordinate of the marker point in the reference image; A calculation unit, used for determining a common plane, wherein the common plane satisfies the central projection theorem with the plurality of partition planes; Calculating a mapping relationship between the common plane and each partition plane; Select a target partition plane from the multiple partition planes, and select multiple marker point matching pairs in the target partition plane from the marker point matching pair set; Calculating a calibration matrix between the image captured by the camera and the target partition plane; Calculating a mapping relationship between the target partition plane and each partition plane according to a mapping relationship between the common plane and each partition plane; According to the mapping relationship between the target partition plane and each partition plane and the calibration matrix between the image captured by the camera and the target partition plane, the calibration matrix between the image captured by the camera and each partition plane is calculated.

8. The spatial calibration system according to claim 7, characterized in that: The plane partition processing unit is further used for: The reference image is partitioned according to the marker point matching pairs and the multiple partition planes to obtain multiple image regions, wherein the multiple image regions correspond one-to-one to the multiple partition planes.

9. The spatial calibration system according to claim 8, characterized in that: The calculation unit is further used to send the calibration matrix family to the processing device, so that the processing device determines the image area to which the pixel coordinates of the detected target belong after obtaining the pixel coordinates of the detected target in the image captured by the camera, and selects a calibration matrix corresponding to the image area from the calibration matrix family; Determining the geographical coordinates of the detected object in the geographical area according to the calibration matrix and the pixel coordinates of the detected object; or, The computing unit is further used to store the calibration matrix family; The acquisition unit is further used to acquire the pixel coordinates of the detected target in the image captured by the camera; The calculation unit is also used to determine the image area to which the pixel coordinates of the detected target belong, and select a calibration matrix corresponding to the image area from the calibration matrix family, and determine the geographical coordinates of the detected target in the geographical area based on the calibration matrix and the pixel coordinates of the detected target.

10. The spatial calibration system according to claim 7 or 8, characterized in that: The calculation unit is further used to send the calibration matrix family to the processing device, so that the processing device determines the partition plane to which the geographical coordinates of the detected target belong after acquiring the geographical coordinates of the detected target, and selects the calibration matrix corresponding to the partition plane from the calibration matrix family; Determining pixel coordinates of the detected target in the image captured by the camera according to the calibration matrix and the geographic coordinates of the detected target; or, The computing unit is further used to store the calibration matrix family; The acquisition unit is further used to acquire the geographic coordinates of the detected target; The calculation unit is also used to determine the partition plane to which the geographic coordinates of the detected target belong, and select a calibration matrix corresponding to the partition plane from the calibration matrix family, and determine the pixel coordinates of the detected target in the image taken by the camera based on the calibration matrix and the geographic coordinates of the detected target.

11. The spatial calibration system according to any one of claims 7 to 9, characterized in that: The computing unit is further specifically used for: Selecting a plurality of matching pairs of landmark points in a first partition plane from the set of matching pairs of landmark points; Calculate a calibration matrix between the image captured by the camera and the first partition plane according to the multiple marker point matching pairs; The first partition plane is any partition plane among the multiple partition planes.

12. The spatial calibration system according to any one of claims 7 to 9, characterized in that: The landmark matching unit is specifically used for: determining a matching region in the reference image; Using a plane matching algorithm and the spatial measurement data to match the matching area and the geographic area, to obtain the set of landmark point matching pairs; Or, determining a matching area in the geographic area; The matching area and the reference image are matched using a plane matching algorithm and the spatial measurement data to obtain the set of matching pairs of landmark points.

13. A computing device, characterized in that: The computing device includes a memory and a processor, and the processor executes computer instructions stored in the memory, so that the computing device performs the method according to any one of claims 1 to 6.

14. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the function of the method according to any one of claims 1 to 6 is realized.