Camera preset position calibration method and device, equipment and medium

CN122621802APending Publication Date: 2026-08-21PIPECHINA SOUTH CHINA CO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610970694.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-01
Publication Date
2026-08-21

AI Technical Summary

Technical Problem

现有技术中,通常采用人工的方式实现摄像头的预置位校准,效率较低,因此,提高对摄像头的预置位进行校准的效率,至关重要

Benefits of technology

当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器能够执行本发明实施例所提供的任意一种摄像头的预置位校准方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122621802A_ABST
    Figure CN122621802A_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a camera preset position calibration method, device, equipment and medium. The method comprises: obtaining a target reference image, target pixel equivalent and current detection trigger data of a target camera; determining a target detection state according to the current detection trigger data and a preset detection trigger strategy, and obtaining a current detection image when the target detection state is a detection start state; determining a current angle offset value and current image quality data according to the current detection image, the target reference image and the target pixel equivalent; determining a current calibration state according to the current angle offset value and the current image quality data, and determining a current angle compensation value according to the current angle offset value when the current calibration state is a preset position calibration trigger state; determining a current preset position calibration strategy according to the current angle compensation value, and calibrating the target preset position according to the current preset position calibration strategy. The efficiency of calibrating the preset position of the camera is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of camera calibration technology, and in particular to a method, apparatus, device and medium for calibrating a camera's preset position. Background Technology

[0002] Pan-tilt cameras are core equipment for security monitoring of long-distance pipelines. By pre-setting horizontal rotation angles, vertical tilt angles, electronic zoom magnification, and precise focusing parameters, they establish preset positions, enabling one-click, rapid, and accurate location of key monitoring points along the pipeline. Currently, camera preset position calibration is typically performed manually, which is inefficient. Therefore, improving the efficiency of camera preset position calibration is crucial. Summary of the Invention

[0003] This invention provides a method, apparatus, device, and medium for calibrating the preset position of a camera, so as to improve the efficiency of calibrating the preset position of a camera.

[0004] According to one aspect of the present invention, a preset position calibration method for a camera is provided, comprising: Acquire the target reference image, target pixel equivalent, and current detection trigger data of the target camera; Based on the current detection trigger data and the preset detection trigger strategy, the target detection state of the target camera is determined, and when the target detection state is the detection start state, the current detection image is acquired; Based on the current detected image, the target reference image, and the target pixel equivalent, determine the current angle offset value and the current image quality data; Based on the current angle offset value and the current image quality data, the current calibration state is determined, and when the current calibration state is the preset position calibration trigger state, the current angle compensation value is determined based on the current angle offset value. Based on the current angle compensation value, a current preset position calibration strategy is determined, and the target preset position of the target camera is calibrated according to the current preset position calibration strategy.

[0005] According to another aspect of the present invention, a preset position calibration device for a camera is provided, comprising: The data acquisition module is used to acquire the target reference image, target pixel equivalent, and current detection trigger data of the target camera from the target camera. The current detection image acquisition module is used to determine the target detection state of the target camera based on the current detection trigger data and the preset detection trigger strategy, and to acquire the current detection image when the target detection state is the detection start state; The current image quality data determination module is used to determine the current angle offset value and the current image quality data based on the current detected image, the target reference image, and the target pixel equivalent. The current angle compensation value determination module is used to determine the current calibration state based on the current angle offset value and the current image quality data, and when the current calibration state is a preset position calibration trigger state, to determine the current angle compensation value based on the current angle offset value; The calibration module is used to determine the current preset position calibration strategy based on the current angle compensation value, and to calibrate the target preset position of the target camera according to the current preset position calibration strategy.

[0006] According to another aspect of the present invention, an electronic device is provided, comprising: One or more processors; Memory, used to store one or more programs; When one or more programs are executed by one or more processors, the one or more processors are able to execute any of the preset position calibration methods for cameras provided in the embodiments of the present invention.

[0007] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute and implement any of the preset position calibration methods for cameras provided in the embodiments of the present invention.

[0008] This invention provides a preset position calibration scheme for a camera. The scheme involves acquiring a target reference image, target pixel equivalent, and current detection trigger data of the target camera; determining the target detection state of the target camera based on the current detection trigger data and a preset detection trigger strategy; and acquiring the current detection image when the target detection state is in the detection initiation state. Based on the current detection image, target reference image, and target pixel equivalent, the scheme determines the current angle offset value and current image quality data; determining the current calibration state based on the current angle offset value and current image quality data; and determining the current angle compensation value when the current calibration state is the preset position calibration trigger state. Based on the current angle compensation value, the scheme determines the current preset position calibration strategy and calibrates the target preset position of the target camera according to the current preset position calibration strategy. This scheme automates the calibration of the target preset position of the target camera, improving the efficiency of target preset position calibration, thus improving the efficiency of preset position calibration for the camera.

[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 This is a flowchart of a preset position calibration method for a camera provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart of a preset position calibration method for a camera provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the structure of a camera preset position calibration device provided in Embodiment 4 of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device that implements a preset position calibration method for a camera, as provided in Embodiment 5 of the present invention. Detailed Implementation

[0012] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0013] Example 1 Figure 1 This is a flowchart of a camera preset position calibration method provided in Embodiment 1 of the present invention. This embodiment can be applied to the detection and calibration of the preset position of a camera. The method can be executed by a camera preset position calibration device, which can be implemented in software and / or hardware and can be configured in an electronic device that carries the preset position calibration function of the camera.

[0014] See Figure 1 The preset position calibration method for the camera shown includes: S110: Obtain the target reference image, target pixel equivalent, and current detection trigger data of the target camera.

[0015] The target camera refers to the pan-tilt camera that requires preset position calibration. The target reference image refers to the reference image corresponding to the target camera.

[0016] For example, during the calibration phase, the target camera is moved to a preset standard position; an initial calibration board image is acquired by the target camera at the preset standard position; target calibration board images are selected from the initial calibration board images; for any pixel coordinate point, the average pixel value of the pixel corresponding to that pixel coordinate point in each target calibration board image is determined; and the target reference image is determined based on the average pixel value of each pixel coordinate point.

[0017] Here, "preset standard preset position" refers to the pre-set standard preset position of the target camera. "Initial calibration board image" refers to the calibration board image captured by the target camera at the preset standard preset position. "Target calibration board image" refers to the valid calibration board image selected from the initial calibration board image. "Pixel coordinate point" refers to the pixel position in the target calibration board image. "Pixel mean" refers to the average pixel value corresponding to the same pixel coordinate point in each target calibration board image.

[0018] For example, for any initial calibration board image, the average grayscale value of the initial calibration board image is determined; it is then determined whether the average grayscale value is within a preset valid grayscale value range; if so, the initial calibration board image is used as the target calibration board image; otherwise, the initial calibration board image is deleted. This embodiment of the invention does not limit the setting of the preset valid grayscale value range, which can be set by a technician based on experience or needs. For example, the preset valid grayscale value range is [50, 205]. The average grayscale value refers to the average value of the pixel grayscale values ​​corresponding to the initial calibration board image.

[0019] Here, the target pixel equivalent refers to the pixel equivalent corresponding to the target reference image. For example, during the calibration phase, the target camera is moved to a preset standard position, and an initial calibration board image is acquired through this target camera, along with the initial horizontal and vertical angles. Based on preset horizontal and vertical angle changes, the target camera is moved to the corresponding angle, and a reference calibration board image is acquired through this target camera. The pixel displacement is determined based on the coordinates of the center region of the calibration board in the initial and reference calibration board images. Finally, the target pixel equivalent is determined based on the pixel displacement, the preset horizontal angle change, and the preset vertical angle change.

[0020] For example, the mean of the coordinates of all interior corner points on the calibration board in the initial calibration board image is extracted as the coordinates of the central region of the calibration board in the initial calibration board image; the mean of the coordinates of all interior corner points on the calibration board in the reference calibration board image is extracted as the coordinates of the central region of the calibration board in the reference calibration board image.

[0021] The initial calibration board image refers to the calibration board image captured by the target camera at a preset standard position. The initial horizontal angle refers to the actual horizontal angle when the target camera is moved to the preset standard position. The initial vertical angle refers to the actual vertical angle when the target camera is moved to the preset standard position. The preset horizontal angle change refers to the pre-set change in horizontal angle. The preset vertical angle change refers to the pre-set change in vertical angle. The reference calibration board image refers to the calibration board image captured by the target camera after it has been moved to the corresponding angle based on the preset horizontal and vertical angle changes. Pixel displacement refers to the change in position of the same calibration board center area between the initial and reference calibration board images.

[0022] For example, pixel displacement includes horizontal pixel displacement and vertical pixel displacement; target pixel equivalent includes target horizontal pixel equivalent and target vertical pixel equivalent. Horizontal pixel displacement refers to the change in position in the horizontal direction. Vertical displacement refers to the change in position in the vertical direction. Target horizontal pixel equivalent refers to the pixel equivalent in the horizontal direction. Target vertical pixel equivalent refers to the pixel equivalent in the vertical direction.

[0023] For example, the ratio between the preset horizontal angle change and the horizontal pixel displacement is used as the target horizontal pixel equivalent; the ratio between the preset vertical angle change and the vertical pixel displacement is used as the target vertical pixel equivalent; and a current pixel equivalent including the target horizontal pixel equivalent and the target vertical pixel equivalent is generated.

[0024] The current detection trigger data refers to the data associated with triggering the preset position detection of the target camera. For example, the current detection trigger data includes periodic detection data and conditional trigger data. Periodic detection data refers to the data required to trigger automatic inspection. Conditional trigger data refers to the data required to trigger detection when certain conditions are met.

[0025] S120. Based on the current detection trigger data and the preset detection trigger strategy, determine the target detection state of the target camera, and when the target detection state is the detection start state, acquire the current detection image.

[0026] The preset detection trigger strategy refers to a pre-set strategy used to determine the target detection status of the target camera. Exemplary preset detection trigger strategies include a preset periodic trigger strategy and a preset conditional trigger strategy. The preset periodic trigger strategy is a pre-set strategy used to determine whether automatic inspection is satisfied. The preset conditional trigger strategy is a pre-set strategy used to determine whether a conditional trigger is satisfied.

[0027] The target detection state indicates whether preset position detection of the target camera is initiated. For example, the target detection state can be either a detection initiated state or a detection disabled state. A detection initiated state indicates that preset position detection of the target camera is triggered. A detection disabled state indicates that preset position detection of the target camera is prohibited.

[0028] For example, periodic detection data includes the time interval between the previous detection and the previous detection. Conditional trigger data may include at least one of the following: preset bit offset prediction data, ambient light intensity unit change range, device restart status, and first recovery after a long network interruption.

[0029] Continuing from the previous example, if the time interval between the previous detection and the previous detection meets the preset periodic detection time, then detection is triggered (i.e., the target detection state is in the detection start state); if the preset position offset prediction data is greater than the preset offset threshold, then detection is triggered; if the unit change amplitude of the ambient light intensity is greater than the preset change amplitude threshold, then detection is triggered; if the device restart status is restart complete, then detection is triggered; if the network interruption duration exceeds the preset interruption duration threshold and then resumes for the first time, then detection is triggered.

[0030] This invention does not impose any limitations on the preset period detection duration, preset offset threshold, preset change range threshold, and preset interruption duration threshold. These can be set by technicians based on experience or needs, or determined through extensive experimentation. For example, the preset period detection duration can be 24 hours, the preset offset threshold can be 0.1 degrees, the preset change range threshold can be 30%, and the preset interruption duration threshold can be 5 minutes.

[0031] Here, the current detection image refers to the real-time calibration board image captured by the target camera after detection is triggered. For example, if the target detection state is in the detection start state, the target camera is controlled to move to a preset standard position, and the current preset position of the target camera is taken as the target preset position; the real-time detection image captured by the moved target camera is the current detection image.

[0032] S130. Determine the current angle offset value and current image quality data based on the current detected image, the target reference image, and the target pixel equivalent.

[0033] Here, the current angle offset value refers to the angle offset data corresponding to the currently detected image. The current image quality data refers to the data that can be used to quantify the quality of the currently detected image.

[0034] S140. Determine the current calibration state based on the current angle offset value and the current image quality data. When the current calibration state is the preset position calibration trigger state, determine the current angle compensation value based on the current angle offset value.

[0035] The current calibration status indicates whether the target preset position of the target camera is being calibrated. The current calibration status can be either preset position calibration non-triggered or preset position calibration triggered. Preset position calibration triggered indicates that calibration of the target preset position has been initiated. Preset position calibration non-triggered indicates that calibration of the target preset position is not required.

[0036] The current angle compensation value refers to the angle compensation value corresponding to the current detected image.

[0037] S150. Based on the current angle compensation value, determine the current preset position calibration strategy, and calibrate the target preset position of the target camera according to the current preset position calibration strategy.

[0038] The current preset position calibration strategy refers to the strategy for calibrating the target preset position. The target preset position refers to the current preset position of the target camera that needs to be calibrated.

[0039] This invention provides a preset position calibration scheme for a camera. The scheme involves acquiring a target reference image, target pixel equivalent, and current detection trigger data of the target camera; determining the target detection state of the target camera based on the current detection trigger data and a preset detection trigger strategy; and acquiring the current detection image when the target detection state is in the detection initiation state. Based on the current detection image, target reference image, and target pixel equivalent, the scheme determines the current angle offset value and current image quality data; determining the current calibration state based on the current angle offset value and current image quality data; and determining the current angle compensation value when the current calibration state is the preset position calibration trigger state. Based on the current angle compensation value, the scheme determines the current preset position calibration strategy and calibrates the target preset position of the target camera according to the current preset position calibration strategy. This scheme automates the calibration of the target preset position of the target camera, improving the efficiency of target preset position calibration, thus improving the efficiency of preset position calibration for the camera.

[0040] Based on the above technical solution, the method further includes: determining the target processing abnormal data of the target preset position, and determining the target abnormal processing method according to the target processing abnormal data and the preset abnormal processing strategy.

[0041] Here, target processing anomalous data refers to anomalous data associated with the detection and calibration of the target preset position. For example, target processing anomalous data includes at least one of the following: detection image acquisition anomalous data, detection image quality anomalous data, angle offset anomalous data, and calibration anomalous data.

[0042] Among them, the preset exception handling strategy refers to the pre-set strategy used to handle exceptions. The target exception handling method refers to the exception handling method determined based on the target exception data.

[0043] For example, the preset anomaly handling strategy includes multiple anomaly handling strategies of different levels. For instance, if the detected image anomaly data is due to network fluctuations or a single failed acquisition, a Level 3 mild anomaly handling strategy is adopted, with the corresponding target anomaly handling method being automatic retry repair and only logging. If the detected image quality anomaly data is due to continuous detected image quality deviation, and / or the detected angle offset anomaly data is due to a small deviation exceeding the standard for the angle offset corresponding to the detected image, a Level 2 moderate anomaly handling strategy is adopted, with the corresponding target anomaly handling method being marking the location, pushing an early warning, and reviewing the issue after 24 hours. If the calibration anomaly data is due to at least one of five consecutive calibration failures, mechanical failure, or equipment disconnection, a Level 1 severe anomaly handling strategy is adopted, with the corresponding target anomaly handling method being terminating the task, pushing an emergency alarm, and immediate manual intervention.

[0044] Understandably, by targeting abnormal data and pre-defined abnormal handling strategies, the target abnormal handling method is determined, thereby enabling the monitoring and abnormal handling of the detection and calibration of preset positions, and improving the accuracy of handling abnormal situations that occur during the detection and calibration of preset positions.

[0045] Example 2 Figure 2 This is a flowchart of a camera preset position calibration method provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment further refines the operation of "determining the current angle offset value and current image quality data based on the current detection image, the target reference image, and the target pixel equivalent" into "extracting the current detection feature point from the current detection image and extracting the current reference feature point from the target reference image; determining the target feature point combination under the corresponding candidate feature point category based on the current detection feature point and the current reference feature point; determining the current reference center coordinates under the corresponding candidate feature point category in the target reference image based on the target feature point combination; determining the current detection center coordinates under the corresponding candidate feature point category in the current detection image based on the current reference center coordinates and the current detection center coordinates; determining the current category coordinate difference under the corresponding candidate feature point category based on the current reference center coordinates and the current detection center coordinates; determining the current center coordinate difference based on the current category coordinate difference under each candidate feature point category; determining the current angle offset value based on the current center coordinate difference and the target pixel equivalent; and determining the current image quality data based on the current detection image and the target reference image," thereby improving the mechanism for determining the current angle offset value and the current image quality data. It should be noted that for parts not described in detail in the embodiments of the present invention, please refer to the descriptions in other embodiments.

[0046] See Figure 2 The method for determining the preset position of the camera shown includes: S210: Obtain the target reference image, target pixel equivalent, and current detection trigger data of the target camera.

[0047] S220. Based on the current detection trigger data and the preset detection trigger strategy, determine the target detection state of the target camera, and when the target detection state is the detection start state, acquire the current detection image.

[0048] S230. Extract the currently detected feature points from the current detected image and extract the current reference feature points from the target reference image.

[0049] Here, the currently detected feature points refer to the feature points in the current detection image used for determining the combination of target feature points. For example, the currently detected feature points include robust feature points and high-speed feature points in the current detection image.

[0050] Here, the current reference feature points refer to the feature points in the target reference image used for determining the combination of target feature points. The current reference feature points include robust feature points and high-speed feature points in the target reference image.

[0051] S240. Based on the current detected feature points and the current reference feature points, determine the target feature point combination under the corresponding candidate feature point category, and based on the target feature point combination, determine the current reference center coordinates under the corresponding candidate feature point category in the target reference image, and determine the current detection center coordinates under the corresponding candidate feature point category in the current detected image.

[0052] The candidate feature point categories include robustness category and high-speed feature category. For example, the current detected feature point under the robustness category is a robust feature point extracted from the current detected image, and the current benchmark feature point is a robust feature point extracted from the target benchmark image; the current detected feature point under the high-speed feature category is a high-speed feature point extracted from the current detected image, and the current benchmark feature point is a high-speed feature point extracted from the target benchmark image.

[0053] Here, "target feature point combination" refers to the feature point combination selected from the candidate feature point combinations. "Current reference center coordinates" refers to the coordinates of the center point in the target reference image determined based on the target feature point combination under the candidate feature point category. "Current detection center coordinates" refers to the coordinates of the center point in the current detection image determined based on the target feature point combination under the candidate feature point category.

[0054] In an optional embodiment, determining the target feature point combination under the corresponding candidate feature point category based on the current detected feature point and the current reference feature point includes: for any candidate feature point category, determining the candidate feature point combination based on the current detected feature point and the current reference feature point under the candidate feature point category, and determining the deviation value corresponding to the candidate feature point combination; and determining the target feature point combination under the candidate feature point category from the candidate feature point combinations based on the deviation value and a preset deviation value threshold.

[0055] Here, a candidate feature point combination refers to a combination of currently detected feature points and current baseline feature points belonging to the same candidate feature point category. The deviation value refers to the distance difference between the currently detected feature point and the current baseline feature point in the candidate feature point combination. That is, the deviation value can be understood as the reprojection error, which is the difference in Euclidean distance between the predicted position of the current baseline feature point in the candidate feature point combination and the actual matching point position in the current detection image after projecting it through the transformation matrix.

[0056] The present invention does not impose any limitation on the size of the preset deviation threshold. It can be set by technicians based on experience or needs, or determined through repeated experiments. For example, the preset deviation threshold can be 5.

[0057] For example, for any combination of candidate feature points under the candidate feature point category, if the deviation value of the candidate feature point combination is less than or equal to a preset deviation value threshold, then the candidate feature point combination is used as the target feature point combination under the candidate feature point category; if the deviation value of the candidate feature point combination is greater than the preset deviation value threshold, then the candidate feature point combination is prohibited from being used as the target feature point combination under the candidate feature point category.

[0058] Understandably, by determining the candidate feature point combination under any candidate feature point category, and based on the deviation value corresponding to each candidate feature point combination and the preset deviation value threshold, the target feature point combination under that candidate feature point category is determined, thereby improving the accuracy of the determined target feature point combination.

[0059] In an optional embodiment, determining a candidate feature point combination based on the current detected feature point and the current reference feature point under the candidate feature point category includes: for any current detected feature point under the candidate feature point category, determining a first current reference feature point and a second current reference feature point corresponding to the current detected feature point; generating an initial feature point combination including the current detected feature point and the first current reference feature point, and generating a reference feature point combination including the current detected feature point and the second current reference feature point; determining a distance ratio based on a first distance corresponding to the initial feature point combination and a second distance corresponding to the reference feature point combination; and determining whether the initial feature point combination is a candidate feature point combination under the candidate feature point category based on the distance ratio.

[0060] The first current reference feature point refers to the current reference feature point that is closest to the current detected feature point. The second current reference feature point refers to the current reference feature point that is the second closest to the current detected feature point.

[0061] The initial feature point combination refers to the combination of the currently detected feature point and the first current reference feature point. The reference feature point combination refers to the combination of the currently detected feature point and the second current reference feature point.

[0062] Here, the first distance refers to the nearest neighbor distance corresponding to the initial combination of feature points. The second distance refers to the second nearest neighbor distance corresponding to the reference combination of feature points. The distance ratio is the ratio between the first distance and the second distance.

[0063] For example, for any candidate feature point category, the current detection descriptor corresponding to the current detected feature point under the candidate feature point category is determined, and the current reference descriptor corresponding to the current reference feature point under the candidate feature point category is determined; for any current detected feature point under the candidate feature point category, based on the current detection descriptor of the current detected feature point and each current reference descriptor under the candidate feature point category, the feature point distance between the current detected feature point and each current reference feature point is determined, and based on the feature point distance, the first current reference feature point and the second current reference feature point corresponding to the current detected feature point are determined.

[0064] Here, the current detection descriptor refers to the feature descriptor corresponding to the current detected feature point within the candidate feature point category. The current benchmark descriptor refers to the feature descriptor corresponding to the current benchmark feature point within the candidate feature point category. For example, if the candidate feature point category is a robust category, then both the current detection descriptor and the current benchmark descriptor within that category are high-dimensional feature descriptors; if the candidate feature point category is a high-speed feature category, then both the current detection descriptor and the current benchmark descriptor within that category are low-dimensional feature descriptors. The feature point distance can be used to quantify the similarity between the current detected feature point and any current benchmark feature point. For example, the current benchmark feature point corresponding to the smallest feature point distance is taken as the first current benchmark feature point corresponding to the current detected feature point; the current benchmark feature point corresponding to the second smallest feature point distance is taken as the second current benchmark feature point corresponding to the current detected feature point.

[0065] It is understandable that by determining an initial feature point combination and a reference feature point combination that include the same currently detected feature point under any candidate feature point category, and based on the distance ratio between the first distance corresponding to the initial feature point combination and the second distance corresponding to the reference feature point combination, it is determined whether the aforementioned initial feature point combination can be used as a candidate feature point combination under that candidate feature point category, thereby improving the accuracy of the determined candidate feature point combination.

[0066] In one optional embodiment, determining whether an initial feature point combination is a candidate feature point combination under the candidate feature point category based on the distance ratio includes: if the distance ratio is less than a preset distance ratio threshold, then the corresponding initial feature point combination is used as a candidate feature point combination under the candidate feature point category; if the distance ratio is greater than or equal to the preset distance ratio threshold, then the corresponding initial feature point combination is prohibited from being used as a candidate feature point combination under the candidate feature point category.

[0067] The embodiments of the present invention do not impose any limitation on the size of the preset distance ratio threshold. It can be set by technicians based on experience or needs, or determined repeatedly through a large number of experiments. For example, the preset distance ratio threshold can be 0.7.

[0068] For example, if the distance ratio is greater than or equal to a preset distance ratio threshold, the corresponding initial feature point combination and reference feature point combination are deleted.

[0069] Understandably, comparing the distance ratio with a preset distance ratio threshold and determining whether the initial feature point combination associated with the distance ratio can be used as a candidate feature point combination based on the comparison result improves the accuracy of the determined candidate feature point combination.

[0070] S250. Based on the current reference center coordinates and the current detection center coordinates, determine the current category coordinate difference under the corresponding candidate feature point category, and determine the current center coordinate difference based on the current category coordinate difference under each candidate feature point category.

[0071] The current category coordinate difference refers to the difference in center point coordinates determined based on the current reference center coordinates and the current detection center coordinates under any candidate feature point category. For example, the current category coordinate difference includes the current horizontal coordinate difference and the current vertical coordinate difference under any candidate feature point category. The current horizontal coordinate difference refers to the difference in center point coordinates under any candidate feature point category in the horizontal direction. The current vertical coordinate difference refers to the difference in center point coordinates under any candidate feature point category in the vertical direction.

[0072] The current center coordinate difference refers to the difference in the center point coordinates of the current detected image.

[0073] For example, the current light intensity is obtained, and the current intensity range is determined based on the current light intensity and the preset candidate intensity range; the candidate category weight corresponding to the current intensity range is used as the current category weight; and the current center coordinate difference is determined based on the current category weight and the current category coordinate difference.

[0074] Here, "current illumination intensity" refers to the ambient illumination intensity corresponding to the currently detected image. "Candidate intensity interval" refers to a pre-defined interval of different illumination intensities. Each candidate intensity interval has a corresponding candidate category weight. "Current intensity interval" refers to the candidate intensity interval in which the current illumination intensity falls. Candidate category weights include the weights corresponding to robustness categories and high-speed feature categories. "Current feature point weight" refers to the candidate category weight corresponding to the current intensity interval.

[0075] For example, if the candidate strength range is less than 200 lux or greater than 3000 lux, the weight of the corresponding robustness category is 70%, and the weight of the high-speed feature category is 30%; if the candidate strength range is [200 lux, 3000 lux], the weight of the corresponding robustness category is 40%, and the weight of the high-speed feature category is 60%.

[0076] For example, based on the current category weight, the current horizontal coordinate differences are weighted and summed to obtain the current horizontal center difference; based on the current category weight, the current vertical coordinate differences are weighted and summed to obtain the current vertical center difference; a current center coordinate difference including the current horizontal center difference and the current vertical center difference is generated. Here, the current horizontal center difference refers to the weighted and fused center point coordinate difference in the horizontal direction. The current vertical center difference refers to the weighted and fused center point coordinate difference in the vertical direction.

[0077] S260. Determine the current angle offset value based on the current center coordinate difference and the target pixel equivalent, and determine the current image quality data based on the current detected image and the target reference image.

[0078] For example, the current horizontal angle offset value is determined based on the current horizontal center difference and the target horizontal pixel equivalent; the current vertical angle offset value is determined based on the current vertical center difference and the target vertical pixel equivalent; a current angle offset value including the current horizontal angle offset value and the current vertical angle offset value is generated. Here, the current horizontal angle offset value refers to the actual physical offset angle of the target camera corresponding to the current detected image in the horizontal direction. The current vertical angle offset value refers to the actual physical offset angle of the target camera corresponding to the current detected image in the vertical direction.

[0079] For example, based on a preset quality data determination strategy, the current image quality data is determined according to the current detected image and the target reference image. The current image data includes structural similarity index, peak signal-to-noise ratio, and mean absolute error. The preset quality data determination strategy refers to a pre-set strategy used to determine the current image quality data.

[0080] S270. Determine the current calibration state based on the current angle offset value and the current image quality data. When the current calibration state is the preset position calibration trigger state, determine the current angle compensation value based on the current angle offset value.

[0081] For example, if the structural similarity index corresponding to the current detected image is greater than or equal to a preset index threshold, the peak signal-to-noise ratio is greater than or equal to a preset signal-to-noise ratio threshold, and the mean absolute error is less than or equal to a preset error threshold, then the image quality of the current detected image is determined to be normal; if the image quality of the current detected image is normal, then the current calibration state is determined based on the current angle offset value.

[0082] In this embodiment of the invention, the preset exponent threshold, preset signal-to-noise ratio threshold, and preset error threshold are not limited in any way. They can be set by technicians based on experience or needs, or determined repeatedly through numerous experiments. For example, the preset exponent threshold can be 0.85, the preset signal-to-noise ratio threshold can be 30dB, and the preset error threshold can be 5.

[0083] For example, if the absolute value of the current horizontal angle offset is less than or equal to a preset horizontal offset threshold, and the absolute value of the current vertical angle offset is less than or equal to a preset vertical offset threshold, then the current calibration state is determined to be a preset position calibration triggered state; otherwise, the current calibration state is determined to be a preset position calibration non-triggered state.

[0084] In this embodiment of the invention, the size of the preset horizontal offset threshold and the preset vertical offset threshold are not limited in any way. They can be set by technicians based on experience or needs, or determined repeatedly through a large number of experiments. For example, the preset horizontal offset threshold can be 0.05 degrees, and the preset vertical offset threshold can be 0.05 degrees.

[0085] S280. Based on the current angle compensation value, determine the current preset position calibration strategy, and calibrate the target preset position of the target camera according to the current preset position calibration strategy.

[0086] This invention provides a preset position calibration scheme for a camera. By refining the operation of determining the current angle offset value and current image quality data based on the current detected image, the target reference image, and the target pixel equivalent, the scheme further refines the steps into: extracting the current detected feature points from the current detected image and extracting the current reference feature points from the target reference image; determining the target feature point combination under the corresponding candidate feature point category based on the current detected feature points and the current reference feature points; determining the current reference center coordinates under the corresponding candidate feature point category in the target reference image based on the target feature point combination; determining the current detection center coordinates under the corresponding candidate feature point category in the current detected image based on the current reference center coordinates and the current detection center coordinates; determining the current category coordinate difference under the corresponding candidate feature point category based on the current reference center coordinates and the current detection center coordinates; determining the current center coordinate difference based on the current category coordinate difference under each candidate feature point category; determining the current angle offset value based on the current center coordinate difference and the target pixel equivalent; and determining the current image quality data based on the current detected image and the target reference image. This improves the mechanism for determining the current angle offset value and the current image quality data. The above scheme improves the accuracy of the determined current angle offset value by determining the current angle offset value based on the current detected feature point and the current reference feature point under different candidate feature point categories.

[0087] Example 3 This invention provides an optional example based on the above embodiments. It should be noted that for parts not described in detail in this invention's embodiments, please refer to the descriptions in other embodiments.

[0088] This invention relates to the field of pipeline security monitoring technology, specifically to an automatic inspection and calibration method and system for preset positions of PTZ cameras at key monitoring points (valve chambers, pipeline welds, leak monitoring points, and key equipment areas of stations) in long-distance pipelines such as oil and natural gas. It is applicable to complex outdoor environments with extreme temperature and humidity, strong vibration, multiple electromagnetic interferences, and drastic changes in lighting, enabling all-weather, high-reliability security monitoring of key areas of long-distance pipelines.

[0089] Pan-tilt cameras are core equipment for security monitoring of long-distance pipelines. By presetting horizontal rotation angles, vertical pitch angles, electronic zoom magnification, and precise focusing parameters, they create preset positions, enabling one-click, rapid, and accurate location of key monitoring points on the pipeline. This requires high repeatability, short preset position recall response time, and a large preset position storage capacity (e.g., 150 preset positions) to ensure the real-time performance and accuracy of pipeline monitoring. Oil and gas long-distance pipelines are deployed across multiple regions, and monitoring cameras are often installed in open areas such as outdoor poles, valve chamber tops, and station edges. The operating environment is complex and harsh, and preset positions are susceptible to angle and zoom shifts due to the combined effects of mechanical, environmental, equipment, and external interference.

[0090] For example, wear on the gears inside the gimbal camera due to long-term meshing, increased bearing clearance, loosening and aging of the transmission belt, and mechanical jamming caused by uneven gimbal load directly lead to angle positioning deviations; torque attenuation caused by long-term operation of the stepper motor, accumulation of encoder counting pulse deviations, and unstable power supply caused by aging capacitors on the drive board cause positioning parameter drift; insecurely fixed equipment mounting base, vibration from surrounding pumps / compressors, and equipment shaking caused by strong winds in the field continuously impact the gimbal's mechanical structure, leading to the accumulation of micro-offsets in the preset position; thermal expansion and contraction of metal parts caused by extreme high and low temperatures, corrosion and jamming of mechanical parts caused by high humidity and salt spray environments, and slight lens deformation caused by large day-night temperature differences affect angle and focusing accuracy; initial installation calibration errors, electromagnetic interference from surrounding high-voltage equipment, minor deviations in monitoring software algorithms, and command execution errors caused by network transmission delays, although small in individual cases, can easily accumulate with other factors over long-term operation, leading to significant deviations.

[0091] For example, if preset position offsets are not detected and corrected in a timely manner, it will directly lead to blind spots or blurred images in critical areas of the pipeline, making it impossible to effectively identify safety hazards such as leaks, third-party construction damage, and equipment malfunctions, significantly increasing the risk of pipeline safety accidents. Traditional manual calibration methods have many drawbacks: low calibration efficiency, requiring on-site operation by maintenance personnel, with full preset position calibration for a single camera taking more than 2 hours, making it unsuitable for large-scale operation and maintenance of long-distance pipelines with multiple monitoring points; poor calibration accuracy, relying on manual visual judgment, resulting in large positioning errors that cannot meet the industry's high-precision requirements; insufficient real-time performance, with long manual calibration cycles, making it difficult to cope with sudden offset problems; and poor adaptability, unable to operate in harsh outdoor environments such as extreme temperature and humidity, and strong vibrations.

[0092] For example, traditional manual calibration is no longer sufficient to meet the requirements of continuous, real-time, high-precision, and large-scale operation and maintenance for oil and gas pipeline security monitoring. Therefore, there is an urgent need to develop a technical solution that can achieve automatic detection, accurate quantification, intelligent calibration, and full unmanned operation of preset position offset, so as to solve the industry pain point of preset position offset of pipeline monitoring cameras in complex outdoor environments.

[0093] This invention addresses the operational characteristics of pipeline monitoring cameras and the demands of complex outdoor environments by providing an automatic method and system for checking and calibrating camera preset positions, thus resolving the problem of preset position offset. Specifically, it enables high-precision automatic checking of preset position offset with minimal detection error and accurate identification of minute offsets; it achieves precise quantification and intelligent calibration of offset amounts, resulting in minimal preset position offset after calibration, meeting core industry performance indicators; it automates the entire inspection and calibration process, replacing manual operation, improving maintenance efficiency, and reducing labor costs; it adapts to complex outdoor environments, possesses strong anti-interference capabilities, and enables continuous 24 / 7 monitoring and automatic calibration; it establishes equipment operation and calibration data archives, enabling full-process data traceability and providing data support for the entire lifecycle maintenance of the equipment. Ultimately, this improves the overall reliability and stability of the pipeline monitoring system, ensuring effective security monitoring of long-distance oil and gas pipelines.

[0094] This invention addresses the industry pain points of camera preset position misalignment, low accuracy and efficiency of manual calibration, and lack of adaptive compensation in complex outdoor monitoring scenarios of long-distance pipelines. It innovatively proposes a core technical solution that uses a benchmark image library as the sole judgment benchmark, integrates intelligent image comparison, accurate pixel-angle conversion, and PID (proportional-integral-derivative) closed-loop iterative calibration, and constructs an integrated system for automated inspection and calibration triggered by dual modes, thus comprehensively solving many defects of traditional technologies.

[0095] The overall technical architecture of this invention is divided into three main parts: automatic inspection, automatic calibration, and hardware / software integration system. The core innovative principle is as follows: by constructing a standardized dedicated benchmark image library, combined with ORB (Oriented Fast and Rotated BRIEF) and SIFT (Scale-invariant feature transform) feature matching and sub-pixel positioning technology, high-precision automatic detection of preset position offset is achieved; through a dual judgment mechanism of multi-dimensional image similarity index and calibration object angle offset, the accuracy of offset recognition is ensured; by optimizing the PID closed-loop control algorithm, it is adapted to complex scenarios such as outdoor vibration and temperature change, achieving accurate iterative calibration of offset; and with the support of a dual-mode triggering mechanism, full-process data archiving, and anomaly alarm mechanism, no manual intervention is required throughout the process.

[0096] For example, both the inspection and calibration processes support both timed triggering and conditional triggering modes, which can adapt to the operation and maintenance needs of different monitoring points and different environmental conditions. The system adopts a three-layer integrated architecture of terminal acquisition layer - core processing layer - execution control layer. Relying on the collaboration of three core software modules and standardized hardware equipment, it realizes unmanned closed-loop management of the entire process of preset position offset detection, judgment, calibration and data traceability.

[0097] For example, the technical solution provided by the embodiments of the present invention has lower detection error and smaller offset after calibration compared with the traditional manual calibration solution. The calibration time of a single device is greatly shortened, and it has strong anti-interference ability in outdoor environment. At the same time, it can realize full life cycle data traceability, effectively improve the stability, accuracy and intelligent operation and maintenance level of pipeline security monitoring, and is suitable for large-scale monitoring and operation and maintenance scenarios of oil and gas long-distance pipelines and various municipal pipe networks.

[0098] This invention provides a method and system for automatic inspection and calibration of camera preset positions in complex outdoor environments of long-distance pipelines. Its core lies in building a fully unmanned closed-loop control system that integrates precise perception, intelligent decision-making, adaptive execution, and long-term optimization.

[0099] For example, the target camera is continuously powered on and preheated for at least 30 minutes; during the preheating period, the system reads the device status code every 5 seconds to confirm there are no abnormalities such as mechanical overload, sensor communication errors, or power supply undervoltage before continuing. The ambient temperature is controlled at [ , Relative humidity [40%, 60%]. Confirm that there is no strong direct light shining on the calibration plate, no wind and dust, and no equipment vibration; confirm that the checkerboard calibration plate (10×14 grids, grid spacing 20mm) is firmly fixed, the surface is clean, and the calibration plate occupies more than 60% of the target camera preview screen and is located in the center of the image area.

[0100] For example, fully manual fixed parameters are sent through the target camera control interface, such as fixed exposure time of 1 / 50 second, fixed gain of 1dB, locked resolution of 1920×1080, manually locked white balance at 6500K color temperature, autofocus off, wide dynamic range off, and noise reduction off. After sending, each parameter is read back to confirm that it has taken effect.

[0101] For example, the system reads the fixed coordinates (horizontal angle, vertical angle, zoom magnification, focus value) of the target camera's original preset position, and drives the gimbal at a low speed (e.g., Move the camera to the preset standard position. Once in position, force it to remain stationary for 2 seconds without performing any operations. After the stationary period, read the initial horizontal and vertical angles of the target camera and compare them with the expected horizontal and vertical angles corresponding to the preset standard position to confirm the deviation. .

[0102] For example, the target camera is triggered to capture a single frame of the initial calibration board image. After acquisition, the average grayscale value of each initial calibration board image is calculated: for any initial calibration board image, if the average grayscale value of the initial calibration board image is within [50, 205], it is determined to be the target calibration board image; if it is below 50 (underexposed) or above 205 (overexposed), it is discarded and a new image is immediately captured. The acquisition is repeated at 10-second intervals, and after accumulating 10 frames of target calibration board images, the pixel values ​​at the same position in the 10 frames of target calibration board images are averaged to synthesize a target reference image with mean-denoised image.

[0103] For example, confirm that all interior corner points (9 columns × 13 rows = 117 points) of the checkerboard calibration board in the target reference image can be completely identified. If the number of identified points is less than 100, re-acquire the image. Save the target reference image according to the naming rules of target camera number, preset position number, acquisition time, temperature, and humidity, store it in an encrypted folder, calculate and record the checksum of the folder to prevent tampering, and write the storage path and checksum into the database. Re-determine a new target reference image for the target camera every month, and retain the old target reference image as a historical version. The target camera number can be used to uniquely identify the target camera. The preset position number can be used to uniquely identify the preset standard position corresponding to the target camera. The acquisition time refers to the time when the target reference image is determined.

[0104] For example, the initial horizontal and initial vertical angles can be read using a high-precision angle measuring instrument. Target horizontal pixel equivalent = preset horizontal angle change. Horizontal pixel displacement; Target vertical pixel equivalent = Preset vertical angle change Vertical pixel displacement. To further improve the accuracy of the target pixel equivalent, the measurement can be repeated three times and the average value taken, with the standard deviation of the three measurements not exceeding 0.00005 degrees / pixel. The target pixel equivalent is bound to the target reference image and stored in the corresponding preset standard position record in the database. Each preset standard position is stored independently, and reuse across preset positions is prohibited.

[0105] For example, the scheduled automatic inspection mode: the system background timer has a default 24-hour cycle, which can be modified by maintenance personnel to 1 hour, 6 hours, 12 hours, or 7 days via the interface; the execution window can be preferentially set to 02:00-04:00 AM. Conditional trigger mode: the timer is immediately interrupted and detection is forced when any of the following conditions are met: the system predicts a preset position offset exceeding 0.1 degrees; the ambient light intensity changes by more than 30% within 1 second; the camera or monitoring system restarts completely; or the network is restored for the first time after a prolonged interruption of more than 5 minutes. After any trigger starts, the system first drives the target camera to accurately reset to the preset standard position, then forces it to remain stationary for 2 seconds. After confirming that the actual angle of the target camera deviates from the expected angle by no more than 0.01 degrees, it then acquires the real-time detection image, i.e., the current detection image.

[0106] For example, standardization preprocessing is performed on the target reference image and the current detection image respectively: conversion to grayscale, Gaussian filtering for noise reduction, adaptive histogram equalization to enhance contrast, and lens distortion correction. Robust feature point extraction: stable feature points (such as calibration board edges, corners, etc.) that are invariant to scale changes, illumination changes, and rotation transformations are detected across the entire image, and a high-dimensional feature descriptor (128-dimensional) is generated for each feature point. High-speed feature point extraction: corner-type feature points are quickly detected across the entire image, and a low-dimensional feature descriptor (32-dimensional) is generated for each feature point.

[0107] For example, when reading ambient light sensor data: when the illuminance is below 200 lux or above 3000 lux, robust feature points are prioritized (70% weight); when the illuminance is within the normal range (200–3000 lux), high-speed feature points are prioritized (60% weight). The two sets of feature points are merged, and feature points located within the checkerboard calibration plate area are retained preferentially.

[0108] For example, the matchers are initialized separately for robust feature points and high-speed feature points, and feature matching is performed. For each feature point, two matching results are returned: the nearest neighbor and the second nearest neighbor. The distance ratio between the nearest neighbor and the second nearest neighbor is calculated, and only matching pairs with a distance ratio less than 0.7 are retained. Fuzzy matches are eliminated, thus determining the candidate feature point combinations under any candidate feature point category.

[0109] For example, the feature point coordinates on the reference image side and the feature point coordinates on the real-time image side of the retained matching pairs are collected separately. Random sampling consistency iteration is performed, and matching pairs with a deviation from the model exceeding 5.0 pixels are judged as mismatches and discarded. High-confidence inliers are retained, that is, the deviation value corresponding to the candidate feature point combination is determined. Based on the deviation value and the preset deviation value threshold, the target feature point combination under the candidate feature point category is determined from the candidate feature point combinations.

[0110] For example, count the number of interior points that are ultimately retained (i.e., the number of target feature point combinations under any candidate feature point category): if there are more than 10, continue; if there are less than 10, trigger image anomaly fault tolerance retry - extend the target camera to 5 seconds, enhance the preprocessing intensity, and then re-acquire and re-match, with a maximum of 2 retries.

[0111] For example, based on the retained high-confidence target feature point combinations, sub-pixel-level fine localization is performed on the checkerboard corner points in the central region of the calibration board, obtaining the current reference center coordinates of the target reference image and the current detection center coordinates of the current detection image under each candidate feature point category. The current horizontal coordinate difference and the current vertical coordinate difference under the corresponding candidate feature point category are then determined.

[0112] For example, the current horizontal angle offset value = current horizontal center difference × target horizontal pixel equivalent; the current vertical angle offset value = current vertical center difference × target vertical pixel equivalent. The calculation result is rounded to 0.001 degrees.

[0113] For example, three image quality metrics are calculated simultaneously: Structural Similarity Index (SSIM), Peak Signal-to-Noise Ratio (PSNR), and Mean Absolute Error (MAE). Multiple mean filtering is performed: five independent detections are repeated consecutively (with a 2-second interval between each), resulting in five sets of angle offset values. The maximum and minimum values ​​are removed, and the arithmetic mean of the remaining three sets is taken as the final angle offset value and recorded.

[0114] For example, the joint judgment decision is as follows: Condition A: SSIM ≥ 0.85, PSNR ≥ 30dB, and MAE ≤ 5; Condition B: |Horizontal angle offset| ≤ 0.05 degrees, and |Vertical angle offset| ≤ 0.05 degrees; If both conditions A and B are met, the judgment is qualified and the log is recorded; if condition A is met but condition B is not met, the offset is judged to be excessive, and calibration is triggered. If SSIM < 0.7 in a single detection, it is judged as an abnormal image quality, not directly judged as device offset; the system automatically extends the gimbal's static state to 5 seconds, enhances preprocessing, and retryes, with a maximum of 2 retries.

[0115] For example, real-time sensor data is read: ambient temperature (T), ambient humidity, vibration frequency (f), and vibration amplitude (A). The PID parameter model is automatically selected according to the following rules: the operating condition is standard ambient temperature; triggering conditions include... ≤T≤ f < 5Hz; proportional, integral, and derivative coefficients are all default values; the reason for adjustment is that they are reference parameters and no adjustment is needed. Operating condition is low temperature; trigger condition is T < The proportional coefficient is multiplied by 1.1 (default value) to enhance response; the integral coefficient is multiplied by 0.9 (default value) to prevent integral saturation; the derivative coefficient is multiplied by 1.2 (default value) to resist backlash disturbances. The reason for this adjustment is that lubricating grease becomes more viscous at low temperatures, increasing mechanical resistance, requiring enhanced correction force and suppression of sudden static friction changes. The operating condition is high temperature; the trigger condition is T> The proportional coefficient is multiplied by 1.1 (default value) to compensate for rigidity; the integral coefficient is multiplied by 1.1 (default value) to compensate for torque attenuation; the derivative coefficient is multiplied by 0.9 (default value) to prevent amplification of thermal noise. The reason for this adjustment is that thermal expansion of metal at high temperatures leads to increased transmission clearance and decreased motor torque. The operating condition is strong vibration; the triggering condition is f≥20Hz or A≥0.05mm; the proportional coefficient is multiplied by 0.9 (default value) to reduce sensitivity; the integral coefficient is multiplied by 0.8 (default value) to prevent integral saturation; the derivative coefficient is multiplied by 1.3 (default value) for strong damping suppression. The reason for this adjustment is that under high-frequency vibration, the integral accumulation rate needs to be significantly reduced to enhance damping resistance to external excitation. The operating condition is strong wind disturbance; the trigger condition is 5≤f<20Hz; the proportional coefficient is the default value multiplied by 0.95 to mitigate the response; the integral coefficient is the default value multiplied by 0.9 to prevent periodic accumulation; the derivative coefficient is the default value multiplied by 1.2 to resist swaying disturbances; the reason for the adjustment is that low-to-medium frequency periodic wind disturbances require reducing overreaction and suppressing swaying. Sensor data is reread before each iteration, and parameter switching uses a smooth transition.

[0116] For example, segmented speed regulation closed-loop iterative calibration. Total compensation angle offset (i.e., current angle compensation value) = The compensation direction is opposite to the detection offset. For example, the current preset calibration strategy includes a segmented speed adjustment execution strategy, a convergence determination strategy, and a three-dimensional calibration strategy integrating angle, zoom, and focus. The segmented speed adjustment execution strategy may include: when the current angle compensation value is less than or equal to 0.1 degrees, maintaining a constant speed throughout the entire process... Execute at low speed; or, if the current angle compensation value is greater than 0.1 degrees, first... Quickly approach the desired angle -0.15 degrees, then switch to the remaining settings. Low-speed fine-tuning; after each adjustment, the gimbal is forced to remain still for 5 seconds; after the stillness period, the process for determining the current angle offset value is automatically invoked for re-checking, obtaining the residual offset and three image quality indicators. The convergence judgment strategy is as follows: if the residual offset is less than or equal to 0.05 degrees and all three indicators meet the standards, the calibration is successful, the parameters are fixed, and the iteration exits; if the standards are not met, the current angle compensation value is recalculated based on the residual offset, the PID parameters are fine-tuned, and the process returns to the step of calculating the total compensated angle offset; the iteration count is 5 times, and if the standards are met within 5 iterations, the process ends normally; if the standards are not met for 5 consecutive iterations, the calibration is terminated, and a level 1 emergency alarm is pushed.

[0117] For example, the three-dimensional calibration strategy integrating angle, zoom, and focus specifically includes: angle compensation: driving the target camera to perform the calibration based on the calculated current angle compensation value; zoom compensation: comparing the pixel area of ​​the calibration board in the target reference image and the current detection image, decreasing the zoom magnification if the area is larger, and increasing the zoom magnification if the area is smaller, and calculating the specific correction amount by substituting the zoom motor characteristic curve; focus compensation: comparing the sharpness evaluation value of the calibration board area in the target reference image and the current detection image, mapping the difference to the focus value correction direction and step size; before all current angle compensation values ​​are executed, they are compared with hardware parameter thresholds (horizontal 0~360 degrees, vertical -30 degrees~90 degrees, zoom and focus not exceeding the device's nominal range). If any limit is exceeded, calibration is terminated and an alarm is triggered.

[0118] For example, a dual-mode calibration and inspection linkage and a three-level anomaly handling system are implemented. Calibration and inspection are fully linked: detection of offset → triggering calibration → re-verification after calibration → archiving of qualified results / iteration of unqualified results. Calibration synchronization supports both timed triggering and conditional triggering modes. Three levels of anomaly handling are as follows: Level 3 (Mild): Network fluctuations, single acquisition failure → automatic retry and repair, log only; Level 2 (Moderate): Continuous image quality deviation, slight offset exceeding limits → marking the location, sending an alert, 24-hour review; Level 1 (Severe): 5 consecutive calibration failures, mechanical failure, equipment disconnection → terminating the task, sending an emergency alarm, immediate manual intervention. After all anomaly handling is completed, an anomaly handling log is automatically generated and included in the equipment's full lifecycle file.

[0119] For example, the system provided in this embodiment of the invention includes a three-layer architecture deployment: terminal acquisition layer: PTZ (Pan-Tilt-Zoom) control, image acquisition, and status monitoring, polling the device status every 100ms; core processing layer: benchmark library management, image preprocessing, dual algorithm matching, offset quantization, and comprehensive judgment; execution control layer: PID iterative calibration and data archiving.

[0120] For example, the technical solution provided by the embodiments of the present invention realizes multi-level access control, namely three levels: super administrator, operation and maintenance administrator, and ordinary viewer, with dedicated personnel and accounts, and operation traceability; data encryption and anti-tampering, namely core data is encrypted and stored, and cannot be modified without authorization, and all operations are logged; dual backup, namely local daily incremental backup + cloud monthly full off-site backup, and all data is retained for ≥3 years; integrity verification, namely automatic MD5 verification before each call to the target reference image, and blocking the operation and alarm if inconsistent.

[0121] The technical solution provided by this invention is designed for the complex outdoor monitoring environment of long-distance oil and gas pipelines. Through standardized, automated, and high-precision inspection and calibration technology, it solves many of the shortcomings of traditional manual calibration. The system has strong overall practicality, stability, and anti-interference ability.

[0122] For example, the technical solution provided by the embodiments of the present invention improves calibration accuracy and anti-interference capability. Specifically, it adopts sub-pixel-level positioning technology and feature point matching algorithm to achieve accurate detection of offset with low detection error. Combined with PID closed-loop control iterative calibration, the actual angle offset of the preset position after calibration is small, meeting the high-precision requirements of pipeline monitoring. The algorithm and PID parameters are optimized for outdoor strong vibration, extreme temperature and humidity, drastic changes in light, electromagnetic interference and other scenarios, effectively resisting multiple interferences and adapting to various complex outdoor environments.

[0123] For example, the technical solution provided by the embodiments of the present invention realizes full-process automation, reduces costs and improves efficiency. That is, it realizes unmanned operation of the entire process of preset position from offset checking, judgment, quantification to calibration and report generation, replacing the traditional manual on-site calibration method. The calibration time of a single camera for all preset positions is shortened, which greatly improves the operation and maintenance efficiency. At the same time, it reduces the number of outdoor on-site inspections by operation and maintenance personnel, reduces labor costs and on-site operation safety risks, and is suitable for large-scale operation and maintenance of long-distance pipelines with multiple monitoring points.

[0124] For example, the technical solution provided by the embodiments of the present invention realizes dual-mode triggering and has strong scenario adaptability. That is, both inspection and calibration support timed triggering and conditional triggering modes. Maintenance personnel can customize the triggering cycle according to the importance of the monitoring point and the complexity of the environment. It can flexibly adapt to different types of pipeline monitoring points such as valve chambers, pipeline welds, leakage monitoring points, and key equipment areas of stations. At the same time, it can be directly adapted to similar pipeline monitoring scenarios such as urban water supply and drainage and gas pipeline networks, and has good scenario adaptability and system scalability.

[0125] For example, the technical solution provided by the embodiments of the present invention achieves adaptive compensation and improves stability. That is, in conjunction with the monthly update mechanism of the reference image library, it effectively eliminates the cumulative errors in the long-term operation of the environment and equipment, and ensures the long-term stability of the monitoring system and calibration accuracy.

[0126] For example, the technical solution provided by the embodiments of the present invention realizes full-process data traceability and improves the standardization of operation and maintenance management. That is, it establishes a full life-cycle data archive for equipment, records the full process data of inspection and calibration in real time (offset, compensation value, number of iterations, environmental parameters, calibration results, etc.), automatically generates standardized calibration reports, and supports quick data query, export, and printing, realizing full-process data traceability of equipment operation and maintenance. At the same time, the system has fault alarm and anomaly marking functions, realizes intelligent operation and maintenance management of pipeline monitoring cameras, and improves the overall standardization level of operation and maintenance management.

[0127] Example 4 Figure 3This is a schematic diagram of a camera preset position calibration device provided in Embodiment 4 of the present invention. This embodiment can be applied to the detection and calibration of the preset position of a camera. The method can be executed by the camera preset position calibration device, which can be implemented in software and / or hardware and can be configured in an electronic device that carries the preset position calibration function of the camera.

[0128] like Figure 3 As shown, the device includes: a data acquisition module 310, a current detection image acquisition module 320, a current image quality data determination module 330, a current angle compensation value determination module 340, and a calibration module 350. Among them, The data acquisition module 310 is used to acquire the target reference image, target pixel equivalent, and current detection trigger data of the target camera from the target camera. The current detection image acquisition module 320 is used to determine the target detection state of the target camera based on the current detection trigger data and the preset detection trigger strategy, and to acquire the current detection image when the target detection state is the detection start state; The current image quality data determination module 330 is used to determine the current angle offset value and the current image quality data based on the current detected image, the target reference image and the target pixel equivalent. The current angle compensation value determination module 340 is used to determine the current calibration state based on the current angle offset value and the current image quality data, and when the current calibration state is a preset position calibration trigger state, to determine the current angle compensation value based on the current angle offset value. The calibration module 350 is used to determine the current preset position calibration strategy based on the current angle compensation value, and to calibrate the target preset position of the target camera according to the current preset position calibration strategy.

[0129] This invention provides a preset position calibration scheme for a camera. The scheme involves acquiring a target reference image, target pixel equivalent, and current detection trigger data of the target camera; determining the target detection state of the target camera based on the current detection trigger data and a preset detection trigger strategy; and acquiring the current detection image when the target detection state is in the detection initiation state. Based on the current detection image, target reference image, and target pixel equivalent, the scheme determines the current angle offset value and current image quality data; determining the current calibration state based on the current angle offset value and current image quality data; and determining the current angle compensation value when the current calibration state is the preset position calibration trigger state. Based on the current angle compensation value, the scheme determines the current preset position calibration strategy and calibrates the target preset position of the target camera according to the current preset position calibration strategy. This scheme automates the calibration of the target preset position of the target camera, improving the efficiency of target preset position calibration, thus improving the efficiency of preset position calibration for the camera.

[0130] Optionally, the current image quality data determination module 330 includes: The feature point extraction unit is used to extract currently detected feature points from the current detection image and to extract current reference feature points from the target reference image; The center coordinate determination unit is used to determine the target feature point combination under the corresponding candidate feature point category based on the current detected feature point and the current reference feature point, and to determine the current reference center coordinates under the corresponding candidate feature point category in the target reference image based on the target feature point combination, and to determine the current detection center coordinates under the corresponding candidate feature point category in the current detected image. The center coordinate difference determination unit is used to determine the current category coordinate difference under the corresponding candidate feature point category based on the current reference center coordinates and the current detection center coordinates, and to determine the current center coordinate difference based on the current category coordinate difference under each candidate feature point category; The image quality data determination unit is used to determine the current angle offset value based on the current center coordinate difference and the target pixel equivalent, and to determine the current image quality data based on the current detected image and the target reference image.

[0131] Optionally, the center coordinate determination unit includes: The deviation value determination subunit is used to determine a combination of candidate feature points for any candidate feature point category based on the current detected feature point and the current benchmark feature point under that candidate feature point category, and to determine the deviation value corresponding to the combination of candidate feature points. The target feature point combination determination subunit is used to determine the target feature point combination under the candidate feature point category from the candidate feature point combinations based on the deviation value and the preset deviation value threshold.

[0132] Optionally, the deviation value determining subunit includes: The second current benchmark feature point determination unit is used to determine the first current benchmark feature point and the second current benchmark feature point corresponding to any current detected feature point under the candidate feature point category. A reference feature point combination generation unit is used to generate an initial feature point combination including the currently detected feature point and the first current reference feature point, and to generate a reference feature point combination including the currently detected feature point and the second current reference feature point; The distance ratio determination unit is used to determine the distance ratio based on the first distance corresponding to the initial feature point combination and the second distance corresponding to the reference feature point combination. The candidate feature point combination determination unit is used to determine whether the initial feature point combination is a candidate feature point combination under the candidate feature point category based on the distance ratio.

[0133] Optionally, the candidate feature point combination determines the unit, specifically for: If the distance ratio is less than a preset distance ratio threshold, then the corresponding initial feature point combination is used as the candidate feature point combination under that candidate feature point category; If the distance ratio is greater than or equal to a preset distance ratio threshold, then the corresponding initial feature point combination is prohibited from being used as the candidate feature point combination under that candidate feature point category.

[0134] Optionally, the device further includes: The target anomaly handling method determination module is used to determine the target processing anomaly data of the target preset position, and determine the target anomaly handling method based on the target processing anomaly data and the preset anomaly handling strategy.

[0135] The camera preset position calibration device provided in this embodiment of the invention can execute the camera preset position calibration method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the preset position calibration method of each camera.

[0136] In the technical solution of this invention, the collection, storage, use, processing, transmission, provision and disclosure of target reference images, target pixel equivalents and current detection trigger data, etc., all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0137] Example 5 Figure 4 This is a schematic diagram of an electronic device for implementing a preset position calibration method for a camera, as provided in Embodiment 5 of the present invention. Electronic device 410 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0138] like Figure 4 As shown, the electronic device 410 includes at least one processor 411 and a memory, such as a read-only memory (ROM) 412 or a random access memory (RAM) 413, communicatively connected to the at least one processor 411. The memory stores computer programs executable by the at least one processor. The processor 411 can perform various appropriate actions and processes based on the computer program stored in the ROM 412 or loaded from storage unit 418 into the RAM 413. The RAM 413 may also store various programs and data required for the operation of the electronic device 410. The processor 411, ROM 412, and RAM 413 are interconnected via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0139] Multiple components in electronic device 410 are connected to I / O interface 415, including: input unit 416, such as keyboard, mouse, etc.; output unit 417, such as various types of displays, speakers, etc.; storage unit 418, such as disk, optical disk, etc.; and communication unit 419, such as network card, modem, wireless transceiver, etc. Communication unit 419 allows electronic device 410 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0140] Processor 411 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 411 performs the various methods and processes described above, such as the preset position calibration method for a camera.

[0141] In some embodiments, the camera preset position calibration method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 410 via ROM 412 and / or communication unit 419. When the computer program is loaded into RAM 413 and executed by processor 411, one or more steps of the camera preset position calibration method described above may be performed. Alternatively, in other embodiments, processor 411 may be configured to perform the camera preset position calibration method by any other suitable means (e.g., by means of firmware).

[0142] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0143] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0144] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0145] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0146] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0147] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0148] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0149] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for calibrating a preset position of a camera, characterized in that, include: Acquire the target reference image, target pixel equivalent, and current detection trigger data of the target camera; Based on the current detection trigger data and the preset detection trigger strategy, the target detection state of the target camera is determined, and when the target detection state is the detection start state, the current detection image is acquired; Based on the current detected image, the target reference image, and the target pixel equivalent, determine the current angle offset value and the current image quality data; Based on the current angle offset value and the current image quality data, the current calibration state is determined, and when the current calibration state is the preset position calibration trigger state, the current angle compensation value is determined based on the current angle offset value. Based on the current angle compensation value, a current preset position calibration strategy is determined, and the target preset position of the target camera is calibrated according to the current preset position calibration strategy.

2. The method according to claim 1, characterized in that, The step of determining the current angle offset value and current image quality data based on the current detected image, the target reference image, and the target pixel equivalent includes: Extract the currently detected feature points from the currently detected image, and extract the current reference feature points from the target reference image; Based on the current detected feature points and the current reference feature points, determine the target feature point combination under the corresponding candidate feature point category, and based on the target feature point combination, determine the current reference center coordinates under the corresponding candidate feature point category in the target reference image, and determine the current detection center coordinates under the corresponding candidate feature point category in the current detected image; Based on the current reference center coordinates and the current detection center coordinates, determine the current category coordinate difference under the corresponding candidate feature point category, and determine the current center coordinate difference based on the current category coordinate difference under each candidate feature point category; Based on the current center coordinate difference and the target pixel equivalent, the current angle offset value is determined, and based on the current detected image and the target reference image, the current image quality data is determined.

3. The method according to claim 2, characterized in that, The step of determining the target feature point combination under the corresponding candidate feature point category based on the current detected feature point and the current benchmark feature point includes: For any candidate feature point category, a combination of candidate feature points is determined based on the current detected feature point and the current benchmark feature point under that candidate feature point category, and the deviation value corresponding to the combination of candidate feature points is determined. Based on the deviation value and the preset deviation value threshold, the target feature point combination under the candidate feature point category is determined from the candidate feature point combination.

4. The method according to claim 3, characterized in that, The step of determining a candidate feature point combination based on the currently detected feature point and the current baseline feature point under the candidate feature point category includes: For any currently detected feature point under the candidate feature point category, determine the first current benchmark feature point and the second current benchmark feature point corresponding to the current detected feature point; Generate an initial feature point combination including the currently detected feature point and the first current reference feature point, and generate a reference feature point combination including the currently detected feature point and the second current reference feature point; The distance ratio is determined based on the first distance corresponding to the initial feature point combination and the second distance corresponding to the reference feature point combination; Based on the distance ratio, determine whether the initial feature point combination is a candidate feature point combination under the candidate feature point category.

5. The method according to claim 4, characterized in that, The step of determining whether the initial feature point combination is a candidate feature point combination under the candidate feature point category based on the distance ratio includes: If the distance ratio is less than a preset distance ratio threshold, then the corresponding initial feature point combination is used as the candidate feature point combination under that candidate feature point category; If the distance ratio is greater than or equal to a preset distance ratio threshold, then the corresponding initial feature point combination is prohibited from being used as the candidate feature point combination under that candidate feature point category.

6. The method according to claim 1, characterized in that, The method further includes: Determine the target processing anomaly data of the target preset position, and determine the target anomaly processing method based on the target processing anomaly data and the preset anomaly processing strategy.

7. A preset position calibration device for a camera, characterized in that, include: The data acquisition module is used to acquire the target reference image, target pixel equivalent, and current detection trigger data of the target camera from the target camera. The current detection image acquisition module is used to determine the target detection state of the target camera based on the current detection trigger data and the preset detection trigger strategy, and to acquire the current detection image when the target detection state is the detection start state; The current image quality data determination module is used to determine the current angle offset value and the current image quality data based on the current detected image, the target reference image, and the target pixel equivalent. The current angle compensation value determination module is used to determine the current calibration state based on the current angle offset value and the current image quality data, and when the current calibration state is a preset position calibration trigger state, to determine the current angle compensation value based on the current angle offset value; The calibration module is used to determine the current preset position calibration strategy based on the current angle compensation value, and to calibrate the target preset position of the target camera according to the current preset position calibration strategy.

8. The apparatus according to claim 7, characterized in that, The current image quality data determination module includes: The feature point extraction unit is used to extract currently detected feature points from the current detection image and to extract current reference feature points from the target reference image; The center coordinate determination unit is used to determine the target feature point combination under the corresponding candidate feature point category based on the current detected feature point and the current reference feature point, and to determine the current reference center coordinates under the corresponding candidate feature point category in the target reference image based on the target feature point combination, and to determine the current detection center coordinates under the corresponding candidate feature point category in the current detected image. The center coordinate difference determination unit is used to determine the current category coordinate difference under the corresponding candidate feature point category based on the current reference center coordinates and the current detection center coordinates, and to determine the current center coordinate difference based on the current category coordinate difference under each candidate feature point category. The image quality data determination unit is used to determine the current angle offset value based on the current center coordinate difference and the target pixel equivalent, and to determine the current image quality data based on the current detected image and the target reference image.

9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement a camera preset position calibration method as described in any one of claims 1-6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements a preset position calibration method for a camera as described in any one of claims 1-6.