A camera automatic calibration method and device for field flow measurement
By setting the calibration object in the field flow measurement scenario and automatically calibrating using the object detection model, the problems of low efficiency and low accuracy in the field scenario are solved, and the camera is quickly and accurately calibrated, ensuring the calibration results Accuracy and system reliability are adapted to complex environments.
Patent Information
- Application Number
- CN202411306569.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-09-19
AI Technical Summary
Traditional camera calibration methods are cumbersome in field flow measurement scenarios, easy to introduce errors, low efficiency, and difficult to adapt to complex environments, resulting in low calibration accuracy and poor robustness.
Using a camera automatic calibration method, by setting the calibration objects on both sides of the river to be tested, using the target detection model to obtain the image coordinates and reference coordinates of the calibration objects, calculate the reprojection transformation matrix and distortion parameters, automatically perform the camera calibration, and in the error When the threshold is exceeded, the rotation and translation adjustments are performed until the accurate calibration is achieved.
It realizes fast and accurate calibration of the camera, ensures the accuracy of calibration results and the reliability of the system, improves the adaptability and flexibility of field flow measurement technology, supports online calibration, and improves the accuracy and application range of flow measurement data.
Smart Images

Figure CN118823140B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of flow velocity measurement, and in particular to a camera automatic calibration method and device for field flow measurement. Background Art
[0002] Camera calibration is a basic technology in the field of computer vision and robotics. It establishes a mapping relationship between the three-dimensional world and the two-dimensional image by calculating the camera's internal parameters (such as focal length, optical center, distortion coefficient, etc.) and external parameters (such as the camera's position and posture in the world coordinate system). This mapping relationship is crucial for subsequent image processing, target tracking and other tasks, and directly affects the accuracy and reliability of related applications.
[0003] Traditional camera calibration methods mainly include calibration based on calibration blocks and self-calibration algorithms. Although the calibration method based on calibration blocks has high accuracy, it relies on specific calibration objects and equipment, and the calibration process is cumbersome and time-consuming. Although the self-calibration algorithm is more flexible, the calibration process is complicated, nonlinear methods are used for calibration, and the robustness is poor and the accuracy is not high. Therefore, these methods are often difficult to apply in complex scenarios such as field flow measurement.
[0004] With the rapid development of computer vision and robotics, the demand for camera calibration algorithms is also increasing. Especially in application scenarios such as field flow measurement, an algorithm that can quickly, accurately and adaptively complete camera calibration is needed to overcome the limitations of traditional methods, adapt to complex and changing environmental conditions, and improve the overall performance and reliability of the flow measurement system. Summary of the invention
[0005] In view of this, the present invention provides a method and device for automatic calibration of a camera for field flow measurement, which is used to solve the problems that the traditional camera calibration process in the current field flow measurement scenario is cumbersome manual operation, easy to introduce errors, low efficiency and difficult to adapt to complex environments.
[0006] In order to solve the above technical problems, in a first aspect, the present invention provides a camera automatic calibration method for field flow measurement, the method comprising:
[0007] Select two points on both sides of the river channel to be measured along the flow direction of the river channel to be measured, and set a calibration object at each point;
[0008] Acquire a plurality of distance parameters between the four calibration objects, and convert the actual position information of each calibration object into a reference coordinate system according to the plurality of distance parameters to obtain the reference coordinates of each calibration object;
[0009] Acquire a calibration image captured by a camera, and acquire image coordinates of each calibration object in the calibration image;
[0010] Calibrate the camera according to the reference coordinates and image coordinates of the calibration object to obtain a reprojection transformation matrix and distortion parameters;
[0011] Calculating the world coordinates of each calibration object according to the reprojection transformation matrix, and calculating the reprojection error value of the camera according to the world coordinates and reference coordinates of each calibration object;
[0012] When the reprojection error value of the camera is less than a preset threshold, the reprojection transformation matrix and the distortion parameters are used as final calibration information.
[0013] Optionally, the method further includes:
[0014] When the reprojection error value of the camera is greater than or equal to the preset threshold, controlling the camera to rotate and / or translate to retake a new calibration image;
[0015] Recalibrate the camera using the image coordinates of the calibration object in the new calibration image and the reference coordinates until the reprojection error value of the camera after calibration is less than the preset threshold;
[0016] The reprojection transformation matrix and distortion parameters obtained from the last calibration are used as the final calibration information.
[0017] Optionally, the four calibration objects include a first calibration object, a second calibration object, a third calibration object and a fourth calibration object arranged in sequence in a counterclockwise direction, and the multiple distance parameters include: a first distance parameter between the center of the first calibration object and the center of the second calibration object, a second distance parameter between the center of the first calibration object and the center of the third calibration object, a third distance parameter between the center of the first calibration object and the center of the fourth calibration object, a fourth distance parameter between the center of the second calibration object and the center of the third calibration object, and a fifth distance parameter between the center of the second calibration object and the center of the fourth calibration object.
[0018] Optionally, the step of acquiring the image coordinates of each calibration object in the calibration image includes:
[0019] Detecting each calibration object in the calibration image based on a pre-trained target detection model to obtain a candidate target frame;
[0020] A non-maximum suppression method is used to remove redundant frames in the candidate target frame to obtain a target detection frame corresponding to each of the calibration objects;
[0021] The center point coordinates of each target detection frame are used as the image coordinates of the calibration object.
[0022] Optionally, the four points are arranged in a rectangular shape.
[0023] In a second aspect, the present invention further provides a camera automatic calibration device for field flow measurement, the device comprising:
[0024] A calibration object deployment module is used to select two points on both sides of the river channel to be measured along the flow direction of the river channel to be measured, and set a calibration object at each point;
[0025] A reference coordinate acquisition module, used to acquire a plurality of distance parameters between the four calibration objects, and convert the actual position information of each calibration object into a reference coordinate system according to the plurality of distance parameters to obtain the reference coordinates of each calibration object;
[0026] An image coordinate acquisition module, used to acquire a calibration image taken by a camera, and to acquire the image coordinates of each calibration object in the calibration image;
[0027] A calibration module, used to calibrate the camera according to the reference coordinates and image coordinates of the calibration object to obtain a reprojection transformation matrix and distortion parameters;
[0028] An error calculation module, used to calculate the world coordinates of each calibration object according to the reprojection transformation matrix, and calculate the reprojection error value of the camera according to the world coordinates and reference coordinates of each calibration object;
[0029] A determination module is used to use the reprojection transformation matrix and the distortion parameters as final calibration information when the reprojection error value of the camera is less than a preset threshold.
[0030] Optionally, the device further comprises:
[0031] A reshooting module, configured to control the camera to rotate and / or translate to reshoot a new calibration image when the reprojection error value of the camera is greater than or equal to the preset threshold;
[0032] A recalibration module, configured to recalibrate the camera using the image coordinates of the calibration object in the new calibration image and the reference coordinates, until the reprojection error value of the camera after calibration is less than the preset threshold;
[0033] The re-determination module is used to use the re-projection transformation matrix and distortion parameters obtained by the last calibration as the final calibration information.
[0034] Optionally, the four calibration objects include a first calibration object, a second calibration object, a third calibration object and a fourth calibration object arranged in sequence in a counterclockwise direction, and the multiple distance parameters include: a first distance parameter between the center of the first calibration object and the center of the second calibration object, a second distance parameter between the center of the first calibration object and the center of the third calibration object, a third distance parameter between the center of the first calibration object and the center of the fourth calibration object, a fourth distance parameter between the center of the second calibration object and the center of the third calibration object, and a fifth distance parameter between the center of the second calibration object and the center of the fourth calibration object.
[0035] Optionally, the image coordinate acquisition module includes:
[0036] A detection unit, configured to detect each calibration object in the calibration image based on a pre-trained target detection model to obtain a candidate target frame;
[0037] A removal unit, configured to remove redundant frames from the candidate target frame by adopting a non-maximum suppression method to obtain a target detection frame corresponding to each of the calibration objects;
[0038] The acquisition unit is used to use the center point coordinates of each target detection frame as the image coordinates of the calibration object.
[0039] Optionally, the four points are arranged in a rectangular shape.
[0040] The beneficial effects of the above technical solution of the present invention are as follows:
[0041] In the present invention, by integrating advanced target detection models, calibration objects in the river are automatically identified, and the internal and external parameters of the camera are calculated based on the world coordinates and image coordinates of the calibration objects, so as to achieve fast and accurate calibration of the camera; and, by using the reprojection transformation matrix obtained by calibration to recalculate the world coordinates of each calibration object, and comparing them with the original reference coordinates, it can be determined whether the camera calibration is accurate, and then determine whether recalibration is needed, thereby ensuring the accuracy of the calibration result. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is a flow chart of a method for automatic calibration of a camera for outdoor flow measurement in the first embodiment of the present invention;
[0043] Figure 2 Schematic diagram of the arrangement of the calibration objects provided in the first embodiment of the present invention
[0044] Figure 3 The figure is a schematic diagram of the structure of a camera automatic calibration device for outdoor flow measurement in the second embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0046] Camera calibration is a basic technology in the field of computer vision and robotics. It establishes a mapping relationship between the three-dimensional world and the two-dimensional image by calculating the camera's internal parameters (such as focal length, optical center, distortion coefficient, etc.) and external parameters (such as the camera's position and posture in the world coordinate system). This mapping relationship is crucial for subsequent image processing, target tracking and other tasks, and directly affects the accuracy and reliability of related applications.
[0047] Traditional camera calibration methods mainly include calibration based on calibration blocks and self-calibration algorithms. Although the calibration method based on calibration blocks has high accuracy, it relies on specific calibration objects and equipment, and the calibration process is cumbersome and time-consuming. Although the self-calibration algorithm is more flexible, the calibration process is complicated, nonlinear methods are used for calibration, and the robustness is poor and the accuracy is not high. Therefore, these methods are often difficult to apply in complex scenarios such as field flow measurement.
[0048] With the rapid development of computer vision and robotics, the demand for camera calibration algorithms is also increasing. Especially in application scenarios such as field flow measurement, an algorithm that can quickly, accurately, and adaptively complete camera calibration is needed. This algorithm should be able to overcome the limitations of traditional methods, adapt to complex and changing environmental conditions, and improve the overall performance and reliability of the flow measurement system.
[0049] Therefore, this application proposes a method and device for automatic identification of calibration objects in a river velocity measurement scenario, which is efficient, reliable and suitable for complex outdoor environments. It can solve the many challenges faced by traditional flow measurement methods when applied in the field, especially for visual flow measurement systems such as drones and edge devices.
[0050] See also Figure 1 , Figure 1 A schematic flow chart of a method for automatic calibration of a camera for outdoor flow measurement provided in the first embodiment of the present invention, the method comprising the following steps:
[0051] Step 11: Select two points on both sides of the river channel to be measured along the flow direction of the river channel to be measured, and set a calibration object at each point.
[0052] Please refer to Figure 2 , Figure 2 This is a schematic diagram of the arrangement of the calibration objects provided in the first embodiment of the present invention. Figure 2 As shown, in this embodiment, four-point marking is adopted. Specifically, two points are selected on both sides of the river channel to be measured, and the two points on each side of the river channel to be measured are arranged at intervals along the flow direction of the river channel to be measured, and then calibration objects are placed at each point, wherein it is necessary to ensure that the four calibration objects fall within the shooting range of the camera. In specific implementation, the calibration objects can be arranged by cross-section casting to obtain a flat plane, and the top surfaces of the calibration objects at the four points are marked with red spray paint, for example, marked as X-1, X-2, X-3, and X-4 respectively.
[0053] In some embodiments, the four points are optionally arranged in a rectangular shape, that is, the four markers are arranged in a rectangular shape. Of course, in the specific implementation process, the four points can also be arranged in a shape close to a rectangle.
[0054] Step 12: Acquire a plurality of distance parameters between the four calibration objects, and convert the actual position information of each calibration object into a reference coordinate system according to the plurality of distance parameters to obtain the reference coordinates of each calibration object.
[0055] In this embodiment, multiple distance parameters between the four calibration objects can be obtained through actual measurement or the like, and then, based on the obtained multiple distance parameters of the calibration objects, the actual position information of the calibration objects is converted into a reference coordinate system, which can be any world coordinate system, thereby obtaining the coordinates of each calibration object in the reference coordinate system.
[0056] like Figure 2 As shown, in some embodiments, the four calibration objects include a first calibration object X-1, a second calibration object X-2, a third calibration object X-3, and a fourth calibration object X-4 arranged in a counterclockwise direction, wherein the first calibration object X-1 and the second calibration object X-2 are located on the left side of the river channel to be measured, and the third calibration object X-3 and the fourth calibration object X-4 are located on the right side of the river channel to be measured. Then the above-mentioned multiple distance parameters include: a first distance parameter D1 between the center of the first calibration object X-1 and the center of the second calibration object X-2, a second distance parameter D2 between the center of the first calibration object X-1 and the center of the third calibration object X-3, a third distance parameter D3 between the center of the first calibration object X-1 and the center of the fourth calibration object X-4, a fourth distance parameter D4 between the center of the second calibration object X-2 and the center of the third calibration object X-3, and a fifth distance parameter D5 between the center of the second calibration object X-2 and the center of the fourth calibration object X-4.
[0057] In some embodiments, optionally, each distance parameter may be accurate to centimeters, and the recording format may be: “X1-X2400cm”.
[0058] Step 13: Obtain a calibration image taken by a camera, and obtain the image coordinates of each calibration object in the calibration image.
[0059] In this embodiment, after the camera and the calibration object are deployed, the camera is used to shoot the detection area of the river to be measured to obtain a calibration image. Of course, video recording can also be performed to obtain multiple calibration images. Among them, the calibration image needs to include each calibration object.
[0060] After obtaining the calibration image, the target detection model can be used based on deep learning technology to automatically identify the calibration objects in the calibration image and output the image coordinates of each calibration object.
[0061] Step 14: Calibrate the camera according to the reference coordinates and image coordinates of the calibration object to obtain a reprojection transformation matrix and distortion parameters.
[0062] After obtaining the reference coordinates (i.e., world coordinates) and image coordinates of the calibration object, the camera can be calibrated according to the reference coordinates and image coordinates corresponding to each calibration object, thereby obtaining the camera's reprojection transformation matrix and distortion parameters.
[0063] Step 15: Calculate the world coordinates of each calibration object according to the reprojection transformation matrix, and calculate the reprojection error value of the camera according to the world coordinates and reference coordinates of each calibration object.
[0064] Since a single camera calibration may not be accurate enough, especially in complex environments such as field flow measurement, errors are more likely to occur. Therefore, the reprojection transformation matrix obtained after calibration and the image coordinates of the calibration object can be used to calculate the world coordinates of each calibration object. Then, the world coordinates calculated using the reprojection transformation matrix are compared with the reference coordinates actually measured, for example, by making a difference to obtain the distance difference. The difference is the reprojection error value of this camera calibration, and the reprojection error value can be used to determine whether the camera calibration is accurate.
[0065] Step 16: When the reprojection error value of the camera is less than a preset threshold, the reprojection transformation matrix and the distortion parameters are used as final calibration information.
[0066] In this embodiment, if the reprojection error value of this camera calibration is less than the preset threshold, it indicates that the error of this camera calibration meets the requirements, that is, the reprojection transformation matrix and distortion parameters obtained by the camera calibration are accurate, and can be output as the final calibration information for use in subsequent river flow velocity measurements.
[0067] Through the above steps, the automatic calibration of the camera in the field flow measurement scene is finally realized.
[0068] The automatic camera calibration method for field flow measurement provided by the embodiment of the present invention automatically identifies calibration objects in the river by integrating an advanced target detection model, and calculates the internal and external parameters of the camera based on the world coordinates and image coordinates of the calibration objects, thereby realizing fast and accurate calibration of the camera; and, by using the reprojection transformation matrix obtained by calibration to recalculate the world coordinates of each calibration object, and comparing them with the original reference coordinates, it can be determined whether the camera calibration is accurate, and then determine whether recalibration is needed, thereby ensuring the accuracy of the calibration result.
[0069] The following example illustrates the above-mentioned automatic camera calibration method for field flow measurement.
[0070] In one optional specific implementation manner, the method further comprises:
[0071] When the reprojection error value of the camera is greater than or equal to the preset threshold, controlling the camera to rotate and / or translate, and reshooting a new calibration image;
[0072] Recalibrate the camera using the image coordinates of the calibration object in the new calibration image and the reference coordinates until the reprojection error value of the camera after calibration is less than the preset threshold;
[0073] The reprojection transformation matrix and distortion parameters obtained from the last calibration are used as the final calibration information.
[0074] That is to say, if the reprojection error value of this camera calibration is greater than or equal to the preset threshold, it indicates that the error of this camera calibration does not meet the requirements, that is, the reprojection transformation matrix and distortion parameters obtained by the camera calibration are not accurate enough. In this case, the camera can be manipulated to rotate, translate, and so on, that is, switch the shooting angle, shooting range, and so on, and then repeat steps 13-15 until the reprojection error obtained by the camera calibration is less than the preset threshold, that is, reshoot to obtain a new calibration image, and then use the image coordinates of the calibration object in the new calibration image and the reference coordinates to recalibrate the camera until the reprojection error value after the camera calibration is less than the preset threshold, and finally, the reprojection transformation matrix and distortion parameters obtained by the last calibration are used as the final calibration information.
[0075] In another optional implementation, the step of acquiring the image coordinates of each calibration object in the calibration image includes:
[0076] Detecting each calibration object in the calibration image based on a pre-trained target detection model to obtain a candidate target frame;
[0077] A non-maximum suppression method is used to remove redundant frames in the candidate target frame to obtain a target detection frame corresponding to each of the calibration objects;
[0078] The center point coordinates of each target detection frame are used as the image coordinates of the calibration object.
[0079] In this embodiment, it is necessary to accurately detect each calibration object in the calibration image. Optionally, in order to improve the detection efficiency and accuracy, the calibration image can be preprocessed first. Exemplarily, the preprocessing includes using Gaussian filtering to denoise the calibration image, perform contrast enhancement, and the like. Then, a pre-trained classification model is used to identify the four calibration styles in the calibration image. That is, the target detection model is used to perform target detection of the calibration object on the preprocessed calibration image to obtain multiple candidate target frames; then, the non-maximum suppression method (Non-Maximum Suppression, NMS) is used to remove redundant frames in the candidate target frames, retain the optimal detection results, and finally obtain the target detection results, that is, four target detection frames. Finally, the center point of each target detection frame is calculated, and the center points of the four target detection frames are used as the image coordinates of the corresponding four calibration objects.
[0080] In this embodiment, the target detection model may be pre-trained, and specifically may be a target detection model trained based on PPDet (Predicting pooling Detection, a detection method based on prediction pool).
[0081] The main effects of this application are as follows:
[0082] (1) Improve calibration efficiency: Traditional camera calibration methods often require manual intervention, and the calibration process is cumbersome and time-consuming. The automatic calibration method of the present invention aims to reduce manual operations through algorithm automation processing, significantly improve calibration efficiency, and enable camera calibration to be completed quickly in field flow measurement tasks, shortening task preparation time.
[0083] (2) Ensure calibration accuracy: The field environment is complex and changeable. Traditional calibration methods may be affected by environmental factors, resulting in inaccurate calibration results. The automatic calibration method of the present invention can more accurately calculate the internal and external parameters of the camera through optimization algorithms and strict verification processes, ensuring the accuracy and reliability of the calibration results, thereby improving the accuracy of flow measurement data.
[0084] (3) Improved adaptability and flexibility: Traditional calibration methods usually rely on specific calibration objects or equipment, which are often difficult to obtain or deploy in the field. The automatic calibration method of the present invention does not require specific calibration objects, which greatly improves the adaptability and flexibility of the system, enabling it to perform effective camera calibration in various complex field environments.
[0085] (4) Support online calibration: During field flow measurement, environmental conditions may change, resulting in the need to adjust camera parameters. The automatic calibration system of the present invention supports online calibration function, which can adjust camera parameters in real time to adapt to environmental changes, ensuring the continuous accuracy and reliability of flow measurement data.
[0086] (5) Improving the applicability of field flow measurement technology: By achieving rapid and accurate calibration of the camera, it provides solid technical support for the visual flow measurement system carried by drones and deployed on edge devices, which helps to improve the efficiency and accuracy of field flow measurement and further expand its application in hydrological monitoring, disaster warning, environmental protection and other fields.
[0087] See also Figure 3 , Figure 3 3 is a schematic diagram of a camera automatic calibration device for field flow measurement provided by the second embodiment of the present invention. The device 30 includes:
[0088] The calibration object deployment module 31 is used to select two points on both sides of the river channel to be measured along the flow direction of the river channel to be measured, and set a calibration object at each point;
[0089] A reference coordinate acquisition module 32 is used to acquire a plurality of distance parameters between the four calibration objects, and convert the actual position information of each calibration object into a reference coordinate system according to the plurality of distance parameters to obtain the reference coordinate of each calibration object;
[0090] An image coordinate acquisition module 33 is used to acquire a calibration image taken by a camera, and to acquire the image coordinates of each calibration object in the calibration image;
[0091] A calibration module 34, configured to calibrate the camera according to the reference coordinates and image coordinates of the calibration object to obtain a reprojection transformation matrix and distortion parameters;
[0092] An error calculation module 35, used to calculate the world coordinates of each calibration object according to the reprojection transformation matrix, and calculate the reprojection error value of the camera according to the world coordinates and reference coordinates of each calibration object;
[0093] The determination module 36 is used to use the reprojection transformation matrix and the distortion parameters as final calibration information when the reprojection error value of the camera is less than a preset threshold.
[0094] Optionally, the device further comprises:
[0095] A reshooting module, configured to control the camera to rotate and / or translate to reshoot a new calibration image when the reprojection error value of the camera is greater than or equal to the preset threshold;
[0096] A recalibration module, configured to recalibrate the camera using the image coordinates of the calibration object in the new calibration image and the reference coordinates, until the reprojection error value of the camera after calibration is less than the preset threshold;
[0097] The re-determination module is used to use the re-projection transformation matrix and distortion parameters obtained by the last calibration as the final calibration information.
[0098] Optionally, the four calibration objects include a first calibration object, a second calibration object, a third calibration object and a fourth calibration object arranged in sequence in a counterclockwise direction, and the multiple distance parameters include: a first distance parameter between the center of the first calibration object and the center of the second calibration object, a second distance parameter between the center of the first calibration object and the center of the third calibration object, a third distance parameter between the center of the first calibration object and the center of the fourth calibration object, a fourth distance parameter between the center of the second calibration object and the center of the third calibration object, and a fifth distance parameter between the center of the second calibration object and the center of the fourth calibration object.
[0099] Optionally, the image coordinate acquisition module includes:
[0100] A detection unit, configured to detect each calibration object in the calibration image based on a pre-trained target detection model to obtain a candidate target frame;
[0101] A removal unit, configured to remove redundant frames from the candidate target frame by adopting a non-maximum suppression method to obtain a target detection frame corresponding to each of the calibration objects;
[0102] The acquisition unit is used to use the center point coordinates of each target detection frame as the image coordinates of the calibration object.
[0103] Optionally, the four points are arranged in a rectangular shape.
[0104] In the embodiment of the present invention, by integrating an advanced target detection model, the calibration objects in the river are automatically identified, and the internal and external parameters of the camera are calculated based on the world coordinates and image coordinates of the calibration objects, so as to realize fast and accurate calibration of the camera; and, by using the reprojection transformation matrix obtained by calibration to recalculate the world coordinates of each calibration object, and comparing it with the original reference coordinates, it can be known whether the camera calibration is accurate, and then determine whether recalibration is needed, thereby ensuring the accuracy of the calibration result.
[0105] The embodiment of the present invention is a product embodiment corresponding to the above-mentioned method embodiment 1, so it will not be described in detail here. Please refer to the above-mentioned embodiment 1 for details.
[0106] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A camera automatic calibration method for field flow measurement, characterized in that: include: Select two points on both sides of the river channel to be measured along the flow direction of the river channel to be measured, and set a calibration object at each point; Acquire a plurality of distance parameters between the four calibration objects, and convert the actual position information of each calibration object into a reference coordinate system according to the plurality of distance parameters to obtain the reference coordinates of each calibration object; Acquire a calibration image captured by a camera, and acquire image coordinates of each calibration object in the calibration image; Calibrate the camera according to the reference coordinates and image coordinates of the calibration object to obtain a reprojection transformation matrix and distortion parameters; Calculating the world coordinates of each calibration object according to the reprojection transformation matrix, and calculating the reprojection error value of the camera according to the world coordinates and reference coordinates of each calibration object; When the reprojection error value of the camera is less than a preset threshold, using the reprojection transformation matrix and the distortion parameters as final calibration information; in The method further comprises: When the reprojection error value of the camera is greater than or equal to the preset threshold, controlling the camera to rotate and / or translate to retake a new calibration image; Recalibrate the camera using the image coordinates of the calibration object in the new calibration image and the reference coordinates until the reprojection error value of the camera after calibration is less than the preset threshold; The reprojection transformation matrix and distortion parameters obtained from the last calibration are used as the final calibration information.
2. The method according to claim 1, characterized in that The four calibration objects include a first calibration object, a second calibration object, a third calibration object and a fourth calibration object arranged in sequence in a counterclockwise direction, and the multiple distance parameters include: a first distance parameter between the center of the first calibration object and the center of the second calibration object, a second distance parameter between the center of the first calibration object and the center of the third calibration object, a third distance parameter between the center of the first calibration object and the center of the fourth calibration object, a fourth distance parameter between the center of the second calibration object and the center of the third calibration object, and a fifth distance parameter between the center of the second calibration object and the center of the fourth calibration object.
3. The method according to claim 1, characterized in that The step of obtaining the image coordinates of each calibration object in the calibration image comprises: Detecting each calibration object in the calibration image based on a pre-trained target detection model to obtain a candidate target frame; A non-maximum suppression method is used to remove redundant frames in the candidate target frame to obtain a target detection frame corresponding to each of the calibration objects; The center point coordinates of each target detection frame are used as the image coordinates of the calibration object.
4. The method according to claim 1, characterized in that: The four points are arranged in a rectangular shape.
5. A camera automatic calibration device for field flow measurement, characterized in that: include: A calibration object deployment module is used to select two points on both sides of the river channel to be measured along the flow direction of the river channel to be measured, and set a calibration object at each point; A reference coordinate acquisition module, used to acquire a plurality of distance parameters between the four calibration objects, and convert the actual position information of each calibration object into a reference coordinate system according to the plurality of distance parameters to obtain the reference coordinates of each calibration object; An image coordinate acquisition module, used to acquire a calibration image taken by a camera, and to acquire the image coordinates of each calibration object in the calibration image; A calibration module, used to calibrate the camera according to the reference coordinates and image coordinates of the calibration object to obtain a reprojection transformation matrix and distortion parameters; An error calculation module, used to calculate the world coordinates of each calibration object according to the reprojection transformation matrix, and calculate the reprojection error value of the camera according to the world coordinates and reference coordinates of each calibration object; A determination module, configured to use the reprojection transformation matrix and the distortion parameters as final calibration information when the reprojection error value of the camera is less than a preset threshold; The device also includes: A reshooting module, configured to control the camera to rotate and / or translate to reshoot a new calibration image when the reprojection error value of the camera is greater than or equal to the preset threshold; A recalibration module, configured to recalibrate the camera using the image coordinates of the calibration object in the new calibration image and the reference coordinates, until the reprojection error value of the camera after calibration is less than the preset threshold; The re-determination module is used to use the re-projection transformation matrix and distortion parameters obtained by the last calibration as the final calibration information.
6. The device according to claim 5, characterized in that The four calibration objects include a first calibration object, a second calibration object, a third calibration object and a fourth calibration object arranged in sequence in a counterclockwise direction, and the multiple distance parameters include: a first distance parameter between the center of the first calibration object and the center of the second calibration object, a second distance parameter between the center of the first calibration object and the center of the third calibration object, a third distance parameter between the center of the first calibration object and the center of the fourth calibration object, a fourth distance parameter between the center of the second calibration object and the center of the third calibration object, and a fifth distance parameter between the center of the second calibration object and the center of the fourth calibration object.
7. The device according to claim 5, characterized in that The image coordinate acquisition module comprises: A detection unit, configured to detect each calibration object in the calibration image based on a pre-trained target detection model to obtain a candidate target frame; A removal unit, configured to remove redundant frames from the candidate target frame by adopting a non-maximum suppression method to obtain a target detection frame corresponding to each of the calibration objects; The acquisition unit is used to use the center point coordinates of each target detection frame as the image coordinates of the calibration object.
8. The device according to claim 5, characterized in that The four points are arranged in a rectangular shape.
