Preset bit calibration method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202410624958.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2044-05-20
AI Technical Summary
[0004]本发明提供一种预置位校准方法及装置、电子设备及存储介质,用以解决现有技术中由于截取的图像可能存在特征点不明显、特征点无法识别、以及安装前后倾斜角偏差导致配置位校准结果的准确性偏低的缺陷,能够有效提高配置位校准结果的准确性,提高校准效率
[0013]本发明还提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一种预置位校准方法。
Smart Images

Figure CN121000962B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of photography, and more particularly to a preset position calibration method and apparatus, electronic device and storage medium. Background Technology
[0002] Preset positions store parameters such as the horizontal angle, tilt angle, and lens focal length of the PTZ camera in its current state, using preset position numbers. These parameters can be quickly recalled when needed, and the PTZ camera and camera can be adjusted to that position. When a PTZ camera needs repair or replacement, the installation angle and position may not be consistent before and after reinstallation, therefore, preset position calibration is necessary.
[0003] Currently, the calibration of preset positions often fails to achieve ideal results. For example, preset positions can be adjusted by comparing images captured from two devices. However, in reality, the captured images may have problems such as unclear or unidentifiable feature points, which significantly affect the calibration results. Furthermore, the deviation in the configuration position caused by the tilt angle before and after installation is difficult to calibrate accurately, resulting in low accuracy and efficiency of the calibration results. Summary of the Invention
[0004] This invention provides a preset position calibration method, apparatus, electronic device, and storage medium to address the shortcomings of existing technologies where the accuracy of configuration position calibration results is low due to indistinct or unidentifiable feature points in the captured images, as well as tilt angle deviations before and after installation. This invention can effectively improve the accuracy of configuration position calibration results and increase calibration efficiency.
[0005] This invention provides a preset position calibration method, comprising: determining a target preset position among multiple preset positions in a horizontal plane; wherein the magnification of the target preset position is greater than the magnification of other preset positions; dividing the distribution area covering the multiple preset positions into multiple unit regions according to the target preset position; determining sample preset positions in each unit region of the multiple unit regions according to the magnification of the target preset position, the distribution area, and the magnification of the multiple preset positions; calibrating the sample preset positions according to a first image acquired on the sample preset positions before the device replacement and a second image acquired on the sample preset positions after the device replacement; and calibrating the preset positions according to the fitting curve obtained from the multiple sample preset positions and the calibration results of the sample preset positions.
[0006] According to a preset position calibration method provided by the present invention, a sample preset position is determined in each unit region of a plurality of unit regions based on the magnification of the target preset position, the distribution area, and the magnification of multiple preset positions. The method includes: calculating a first weight for each region preset position based on the magnification of the target preset position and the magnification of preset positions in each region of the target unit region; wherein the target unit region is any one of the plurality of unit regions; calculating a second weight for each region preset position based on a piecewise linear function corresponding to a preset distribution area and the horizontal coordinate of each region preset position; obtaining an evaluation weight for each region preset position based on the first and second weights; and determining the sample preset position of the target unit region based on the evaluation weights of each region preset position; wherein the evaluation weight of the sample preset position of the target unit region is greater than the evaluation weights of the preset positions of other regions in the target unit region.
[0007] According to a preset position calibration method provided by the present invention, the preset position of a sample is calibrated based on a first image acquired on the preset position of the sample before the machine replacement and a second image acquired on the preset position of the sample after the machine replacement. The method includes: determining multiple calibration magnifications based on the magnification of the preset position of the sample; at each calibration magnification, acquiring an image on the preset position of the sample before the machine replacement as the first image and acquiring an image on the preset position of the sample after the machine replacement as the second image; comparing the first image and the second image at each calibration magnification, and calibrating the preset position based on the comparison result.
[0008] According to a preset position calibration method provided by the present invention, multiple calibration magnifications are determined based on the magnification of the sample preset position, including: obtaining a reference magnification based on the magnification of the target preset position; when the magnification of the sample preset position is greater than or equal to the reference magnification, determining multiple calibration magnifications including: wide-angle magnification, medium-focus magnification, and preset position magnification; when the magnification of the sample preset position is less than the reference magnification, determining multiple calibration magnifications including: wide-angle magnification and preset position magnification.
[0009] According to a preset position calibration method provided by the present invention, a distribution area covering multiple preset positions is divided into multiple unit regions based on a target preset position. The method includes: taking the target preset position as the starting point and the distance between the gimbal and the target preset position as the radius, taking the first sector area swept by each preset rotation angle as an initial marking region; dividing the initial marking region into two identical second sector areas, and denoting the second sector areas as secondary marking regions; and taking the regions corresponding to two adjacent secondary marking regions in adjacent initial marking regions as unit regions.
[0010] According to a preset position calibration method provided by the present invention, the preset position is calibrated based on the fitting curves obtained from multiple sample preset positions and the calibration results of the sample preset positions. The method further includes: obtaining an inclination curve function based on the fitting curves obtained from multiple sample preset positions; calculating the preset position offset based on the inclination curve function; and calibrating the preset position based on the calibration results of the sample preset positions and the preset position offset.
[0011] The present invention also provides a preset position calibration device, comprising: a determining module, configured to determine a target preset position among multiple preset positions in a horizontal plane; wherein the magnification of the target preset position is greater than the magnification of other preset positions; a dividing module, configured to divide a distribution area covering multiple preset positions into multiple unit regions according to the target preset position; a processing module, configured to determine a sample preset position in each unit region of the multiple unit regions according to the magnification of the target preset position, the distribution area, and the magnification of the multiple preset positions; a first calibration module, configured to calibrate the sample preset position according to a first image acquired on the sample preset position before the device replacement and a second image acquired on the sample preset position after the device replacement; and a second calibration module, configured to calibrate the preset position according to the fitting curve obtained from the multiple sample preset positions and the calibration result of the sample preset position.
[0012] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement any of the preset bit calibration methods described above.
[0013] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the preset bit calibration methods described above.
[0014] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements any of the preset bit calibration methods described above.
[0015] The preset position calibration method, apparatus, electronic device, and storage medium provided by this invention determine a target preset position among multiple preset positions in a horizontal plane; wherein the magnification of the target preset position is greater than the magnification of other preset positions; based on the target preset position, the distribution area covering multiple preset positions is divided into multiple unit regions; based on the magnification of the target preset position, the distribution area, and the magnification of multiple preset positions, a sample preset position is determined in each unit region of the multiple unit regions; based on a first image acquired on the sample preset position before the device replacement and a second image acquired on the sample preset position after the device replacement, the sample preset position is calibrated; based on the fitting curve obtained from the acquired multiple sample preset positions and the calibration result of the sample preset position, the preset position is calibrated. Through the above process, based on the magnification of multiple preset positions in the horizontal plane, the preset position with the higher magnification weight can be selected as the sample preset position. This ensures that the image captured by the selected sample preset position has high quality, and obvious feature points can be found for comparison. This solves the problem in the prior art that the accuracy of the configuration position calibration results is low due to defects such as unclear feature points, unidentifiable feature points, and tilt angle deviation before and after installation in the cropped image. It can effectively improve the accuracy of the configuration position calibration results and improve calibration efficiency. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1 This is one of the flowcharts illustrating the preset position calibration method provided in this embodiment of the invention;
[0018] Figure 2 This is one of the schematic diagrams illustrating the division of distribution areas in the preset position calibration method provided in this embodiment of the invention;
[0019] Figure 3 This is a schematic diagram of the process of obtaining the unit region in the preset position calibration method provided in the embodiment of the present invention;
[0020] Figure 4 This is the second schematic diagram of the division of distribution areas in the preset position calibration method provided in this embodiment of the invention;
[0021] Figure 5 This is one of the schematic diagrams of a piecewise linear function in the preset position calibration method provided in this embodiment of the invention;
[0022] Figure 6This is the second schematic diagram of the piecewise linear function in the preset position calibration method provided in this embodiment of the invention;
[0023] Figure 7 This is a second schematic flowchart of the preset position calibration method provided in this embodiment of the invention;
[0024] Figure 8 This is a diagram illustrating the fitting curve of the preset position calibration method provided in the embodiments of the present invention;
[0025] Figure 9 This is a schematic diagram of the tilt angle of the preset position calibration method provided in the embodiment of the present invention;
[0026] Figure 10 This is a schematic diagram of obtaining the offset of T based on the tilt angle in the preset position calibration method provided in the embodiment of the present invention;
[0027] Figure 11 This is a schematic diagram illustrating the relationship between T and P in the preset position calibration method provided in this embodiment of the invention;
[0028] Figure 12 This is a schematic diagram of the mathematical parameters in the process of obtaining the tilt curve function calculation formula in the preset position calibration method provided in the embodiment of the present invention;
[0029] Figure 13 This is a schematic diagram of the preset position calibration device provided in an embodiment of the present invention;
[0030] Figure 14 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0032] The following is combined Figures 1-12 The preset position calibration method of the present invention is described.
[0033] Figure 1 This is one of the flowcharts illustrating the preset position calibration method provided by the present invention. For example... Figure 1 As shown, the preset position calibration method of the present invention includes the following steps S110 to S150.
[0034] S110: Determine the target preset position among multiple preset positions in the horizontal plane; wherein the multiplier of the target preset position is greater than the multiplier of the other preset positions.
[0035] The horizontal plane is the plane in which the pan-tilt camera is located horizontally. The target preset position is the preset position with the highest magnification (hereinafter referred to as magnification) among multiple preset positions on the horizontal plane.
[0036] When determining the target preset position, you can first obtain multiple magnifications corresponding to multiple preset positions, determine the maximum magnification among these multiple magnifications, and use the preset position corresponding to the maximum magnification as the target preset position.
[0037] S120: Based on the target preset position, the distribution area covering multiple preset positions is divided into multiple unit areas.
[0038] Multiple unit regions can be the same or different.
[0039] In some embodiments, multiple unit regions are identical. Starting from a target preset position and using the distance to the target preset position as the radius, the first sector swept by each preset rotation angle can be used as an initial marked region.
[0040] The preset angle can be set by the user according to the actual situation. The preset angle satisfies the following conditions: when preset positions are evenly distributed in the horizontal direction from 0 to γ, the preset angle can be divided by θ, and γ is less than or equal to 360°.
[0041] For example, γ is 360°, and the preset angle can be 30°, 60°, 90°, etc. Figure 2 As shown in section a, preset positions are distributed in the horizontal direction within a range of 0 to 360°, with a preset angle of 90°.
[0042] For example, if γ is 240°, the preset angle can be 30°, 40°, 60°, 80°, etc. Figure 2 As shown in section b, preset positions are distributed in the horizontal direction within the range of 0 to 240°, with a preset angle of 80°.
[0043] For example, such as Figure 3 As shown in part a, with the target preset position P1 as the starting point and the distance between the PTZ camera and the target preset position P1 as the radius, the first sector area swept by each 90° rotation is taken as an initial marking area, and four initial marking areas A1, A2, A3 and A4 can be obtained.
[0044] After obtaining multiple initial marked regions, the initial marked regions can be divided into two identical second sector regions, which are denoted as secondary marked regions.
[0045] For example, such as Figure 3As shown in section b, the initial marked region A1 is divided into two identical second sector regions, namely the second sector region A11 and the second sector region A12. Each of the resulting second sector regions is denoted as a sub-marked region. The division methods of the initial marked regions A2, A3, and A4 are the same as those of the initial marked region A1, and can be found in the description of the division of the initial marked region A1 above, which will not be repeated here.
[0046] Finally, the regions corresponding to two adjacent sub-marked regions within the adjacent initial marked regions are taken as unit regions.
[0047] For example, such as Figure 3 As shown in part c, the initial marked region A1 and the initial marked region A2 are adjacent, and the secondary marked region A12 in the initial marked region A1 and the secondary marked region A21 in the initial marked region A2 are adjacent. The regions corresponding to the secondary marked regions A12 and A21 are taken as a unit region B.
[0048] It should be noted that the above-described methods for obtaining multiple unit regions are merely exemplary. In specific implementations, as long as multiple identical unit regions can be divided, the present invention does not limit the method of dividing the distribution area to obtain multiple unit regions.
[0049] For example, see Figure 4 Starting from the target preset position P1, and also using P1 as a marker point, at each preset rotation angle ( Figure 4 After setting the preset angle to 90°, points at preset distances are used as markers, resulting in multiple markers P1, P2, P3, and P4. The preset distance is the distance between the PTZ camera and the preset target position. The area within ±(preset angle / 2) of each marker is defined as a unit area. The ±(preset angle / 2) range of each marker includes: the area scanned by the PTZ camera clockwise (preset angle / 2) from that marker, and the area scanned counterclockwise (preset angle / 2) from that marker.
[0050] In some embodiments, the multiple unit regions can also be different. For example, the initial marking region closer to the target preset position P1 is smaller, and the initial marking region farther away from the target preset position P1 is larger. In this case, the preset angle can be continuously changed. For example, after each scan of the preset angle, the preset angle is updated to the angle obtained by increasing it by a set angle, thereby obtaining multiple initial marking regions of different sizes. Referring to the method of obtaining unit regions based on the initial marking regions described above, multiple unit regions of different sizes can be obtained. Alternatively, multiple preset angles can be preset and sorted, and then the corresponding preset angles can be scanned sequentially according to the above sorting. The area of each preset angle scanned is used as the initial marking region. Finally, referring to the method of obtaining unit regions based on the initial marking regions described above, multiple unit regions of different sizes can be obtained.
[0051] S130: Based on the target preset position's magnification, distribution area, and the magnification of multiple preset positions, determine the sample preset position in each of the multiple unit regions.
[0052] First, the first weight of the preset position in each region can be calculated based on the multiplier of the target preset position and the multiplier of the preset positions in each region of the target unit region; where the target unit region is any one of the multiple unit regions.
[0053] The preset position located in the target cell region is used as the region preset position. For any region preset position, the ratio of the multiplier of the region preset position to the multiplier of the target preset position is obtained, and this ratio is used as the first weight of the region preset position.
[0054] Specifically, the first weight of a preset bit in any region of the target cell can be obtained using the following formula:
[0055] WeightZ = z / z max ;
[0056] Where WeightZ is the first weight of the preset bit in the region, and z is the multiplier of the preset bit in that region. max The multiplier for the target preset position.
[0057] After that, the second weight of each preset position can be calculated based on the piecewise linear function corresponding to the above-mentioned distribution area and the horizontal coordinates of each preset position.
[0058] The second weight of the preset position in each region can be calculated using the following formula:
[0059] WeightP = f(p);
[0060] Where WeightP is the second weight of the preset position in the region, p is the horizontal coordinate of the preset position in the region, and f(p) is the piecewise linear function corresponding to the distribution region.
[0061] It should be noted that the piecewise linear function corresponding to the distribution region is determined according to the type of the distribution region. The type of the distribution region is set in advance by dividing all possible distribution regions.
[0062] The distribution area is the region within the horizontal range of 0 to γ. Depending on the value of γ, the distribution area can be classified into several types. For example, a distribution area within the horizontal range of 0 to 360° is classified as a first-type distribution area; a distribution area within the horizontal range of 0 to γ1 is classified as a second-type distribution area; a distribution area larger than the horizontal range of 0 to γ1 but smaller than the horizontal range of 0 to 360° is classified as a third-type distribution area, and so on.
[0063] Of course, it is understood that the above method of dividing the distribution area is merely an example, intended to illustrate that the distribution area can be divided into different types according to its size. In specific implementation, how to divide the area is determined by those skilled in the art based on the actual situation.
[0064] For the type of distribution area, a piecewise linear function corresponding to each type can be preset to obtain multiple preset piecewise linear functions that correspond one-to-one with multiple types, and a correspondence can be established between multiple types and multiple preset piecewise linear functions.
[0065] To obtain the piecewise linear function corresponding to the distribution region, we can first determine the type of the distribution region, and then determine the piecewise linear function corresponding to the distribution region based on the determined type and the above correspondence.
[0066] The following example illustrates the different types of piecewise linear functions.
[0067] The distribution region is the area ranging from 0 to 360° in the horizontal direction. In this case, the piecewise linear function set for this distribution region is as follows: Figure 5 As shown. Combined with Figure 4 and Figure 5 WeightP takes its maximum value of 1 at positions P1, P2, P3, and P4, and its minimum value of 1 / z at the midpoints of each pair of P1, P2, P3, and P4. max .in, Figure 5 The horizontal coordinate p was converted into an angle (the angle formed by the line segment from point p to the center of the circle, the line segment from P1 to the center of the circle, and the center of the circle).
[0068] The distribution region is the area ranging from 0° to 240° in the horizontal direction. In this case, the piecewise linear function set for this distribution region is as follows: Figure 6 As shown.
[0069] After the above weight calculation is completed, the evaluation weight of each region's preset position is obtained based on the first and second weights of each region's preset position.
[0070] Specifically, the evaluation weight can be calculated using the following formula:
[0071] WeightAll=WeightZ*α+WeightP*β;
[0072] Where WeightAll is the evaluation weight, α and β are proportional coefficients, and α+β=1.
[0073] In some embodiments, α = 0.7 and β = 0.3.
[0074] Finally, based on the evaluation weights of the preset positions in each region, the sample preset positions in the target unit region are determined; wherein, the evaluation weight of the sample preset positions in the target unit region is greater than the evaluation weights of the preset positions in other regions of the target unit region.
[0075] The preset position of the region with the highest evaluation weight in the target unit region is used as the sample preset position of the target unit region. For each unit region in multiple unit regions, the sample preset position of each unit region is determined in the above way, so that multiple sample preset positions corresponding to multiple unit regions can be obtained.
[0076] S140: The sample preset position is calibrated based on the first image acquired at the sample preset position before the machine replacement and the second image acquired at the sample preset position after the machine replacement.
[0077] Specifically, a reference magnification can be obtained first based on the target preset magnification. For example, the reference magnification Z can be calculated as follows: 参考 :
[0078]
[0079] After this, the magnification of the sample preset position can be compared with the aforementioned reference magnification. If the magnification of the sample preset position is greater than or equal to the reference magnification, multiple calibration magnifications are determined, including: wide-angle magnification, medium-focus magnification, and preset position magnification; if the magnification of the sample preset position is less than the reference magnification, multiple calibration magnifications are determined, including: wide-angle magnification and preset position magnification.
[0080] Subsequently, at each calibration magnification, an image was acquired at the sample preset position before the machine was changed as the first image, and an image was acquired at the sample preset position after the machine was changed as the second image.
[0081] For example, multiple calibration magnifications include: wide-angle magnification, medium telephoto magnification, and preset magnification. Before switching cameras, an image is acquired at the preset position of a sample at wide-angle magnification as the first image at wide-angle magnification. This image is then converted to medium telephoto magnification, and the same image is acquired at the preset position of a sample at medium telephoto magnification as the first image at medium telephoto magnification. This image is then converted to the preset position magnification, and the same image is acquired at the preset position of a sample at the preset position as the first image at the preset position magnification. After switching cameras, an image is acquired at the preset position of a sample at wide-angle magnification as the second image at wide-angle magnification. This image is then converted to medium telephoto magnification, and the same image is acquired at the preset position of a sample at the preset position as the second image at the preset position magnification. In this case, there are three first images and three second images, each corresponding to a different calibration magnification.
[0082] For example, multiple calibration magnifications include: wide-angle magnification and preset position magnification. Before switching cameras, an image is acquired at the sample preset position under wide-angle magnification as the first image under wide-angle magnification. This image is then converted to the preset position magnification, and an image is acquired at the sample preset position under the preset position magnification as the first image under the preset position magnification. After switching cameras, an image is acquired at the sample preset position under wide-angle magnification as the second image under wide-angle magnification. This image is then converted to the preset position magnification, and an image is acquired at the sample preset position under the preset position magnification as the second image under the preset position magnification. In this case, there are two first images and two second images, each corresponding to a different calibration magnification.
[0083] The purpose of determining multiple calibration magnifications and acquiring images at different calibration magnifications is that: if the sample preset position magnification is large, a deviation of a few degrees or so in the field of view may cause the sample preset position to deviate from the image, making it impossible to find the sample preset position in the image.
[0084] For example, the field of view of a 38×1 / 1.8" lens is as follows:
[0085] Focus (D) 67.08° 2.27° Horizontal (H) 59° 1.98° Vertical (V) 34.14° 1.12°
[0086] In this situation, the sample preset position may be off-center from the image, making it impossible to find the sample preset position in the image. Therefore, it is necessary to calibrate the image once at the wide-angle magnification, and then zoom to the medium and telephoto (preset position magnification) to reduce the target for calibration, so as to finally achieve the purpose of calibrating the P (left-right displacement) and T (up-down displacement) of the preset position.
[0087] Finally, the first and second images at each calibration magnification are compared, and the preset positions of the samples are calibrated based on the comparison results.
[0088] The calibration process is illustrated below with an example.
[0089] Taking multiple calibration magnifications, including wide-angle magnification, medium-telephoto magnification, and preset position magnification, as an example. First, for wide-angle magnification, the image acquired at the preset position before switching cameras is used as the first image, and the image acquired at the preset position after switching cameras is used as the second image. The first image and the second image are matched to obtain the scaling factor S1, translation amount Tx1, Ty1. The translation amount Tx1, Ty1 are converted into the gimbal angle under the current device: OffsetP1, OffsetT1, and gimbal rotation -OffsetP1, -OffsetT1, completing the first calibration.
[0090] For medium magnification, an image is acquired at a preset position before camera switching as the first image, and an image is acquired at the preset position after camera switching as the second image. The first image and the second image are matched to obtain the scaling factor S2, translation amount Tx2, Ty2. The translation amount Tx2, Ty2 are converted into the gimbal angle under the current device: OffsetP2, OffsetT2, and gimbal rotation -OffsetP2, -OffsetT2, completing the second calibration.
[0091] For the preset magnification, an image is acquired at the preset position of the sample before the device is changed as the first image, and an image is acquired at the preset position of the sample after the device is changed as the second image. The first image and the second image are matched to obtain the scaling factor S3, translation amount Tx3, Ty3. The translation amount Tx3, Ty3 is converted into the gimbal angle under the current device: OffsetP3, OffsetT3, gimbal rotation -OffsetP3, -OffsetT3, to complete the third calibration.
[0092] Finally, the total offset of the gimbal is as follows:
[0093] OffsetP=-(OffsetP1+OffsetP2+OffsetP3);
[0094] OffsetT=-(OffsetT1+OffsetT2+OffsetT3).
[0095] Although the above process only mentions calibrating the sample preset position, it's understandable that, due to the holistic nature of preset position calibration, calibrating the sample preset position also calibrates other preset positions, albeit with lower calibration precision. In this case, the process of calibrating the sample preset position can be used to calibrate all preset positions, achieving the goal of preset position calibration. Furthermore, by selecting the preset position with the higher magnification weight from multiple preset positions in the horizontal plane as the sample preset position, the image captured by the selected sample preset position can be guaranteed to have high quality. This allows for the identification of obvious feature points for comparison, thereby achieving the goal of calibrating all preset positions and improving the accuracy of the calibration results.
[0096] S150: Based on the fitting curves obtained from multiple sample preset positions and the calibration results of the sample preset positions, the preset positions are calibrated.
[0097] like Figure 7 As shown, the process in S150 may include the following steps: S710 to S730.
[0098] S710: Obtain the tilt curve function based on the fitted curves obtained from multiple sampled preset positions.
[0099] Multiple preset positions are collected from all preset positions to obtain multiple sampling preset positions. It should be noted that the sampling preset positions here are no longer limited to preset positions in the horizontal plane, but come from all preset positions set in space.
[0100] Based on P and T from multiple sampled preset positions, a fitted curve of the relationship between P and T is generated with P as the independent variable and T as the dependent variable.
[0101] like Figure 8 As shown, Figure 8 It is based on P and T in multiple sample preset positions, with P (P has been converted to angle, see the introduction above) Figure 5 The curve obtained is a fitted curve with p as the independent variable and T as the dependent variable.
[0102] Specifically, an inclination curve function is obtained that can represent the variation law of the fitted curve, and the unknowns in the inclination curve function are P and T.
[0103] Please see Figure 9 After reinstalling the PTZ camera, there will be an installation tilt angle θ compared to the original position. This will cause the preset P and T values of the replacement data to deviate from the actual scene.
[0104] like Figure 9The dashed line represents the parallel line pointing forward from the gimbal, and the solid line represents the horizontal direction before the device is switched. The angle θ between the dashed and solid lines is the tilt angle. The preset positions at different locations in the vertical direction have offsets in both the P and T directions.
[0105] like Figure 10 One side of the inclination angle θ extends horizontally. A perpendicular line is drawn from the endpoint of the inclination angle θ to the horizontal. A line segment DE, parallel to the horizontal, is drawn through a point D on this perpendicular line. A circle is drawn with line segment DE as its diameter, passing through point D. Starting from point D, at predetermined angles (… Figure 10 (The angle is 30°). Make a point on the arc. Draw a perpendicular line from this point to the horizontal direction. This perpendicular line intersects the two sides of the angle of inclination θ. The line segment between the intersection points (i.e.,...) Figure 10 The length of the line segment in bold varies depending on the location point. The farther the location point is from point D, the longer the corresponding line segment.
[0106] With a predetermined angle P as the horizontal axis, Figure 10 The length T of the line segment between the intersection points of the two sides intersecting at the angle of inclination θ is taken as the vertical axis, resulting in the following: Figure 11 The curve shown.
[0107] Please see Figure 12 Given parts a and b, ∠IEF = θ (angle of inclination), we need to calculate the functional relationship between the longitudinal direction AB and the horizontal direction AM.
[0108] like Figure 12 As shown in parts a and b, Draw a perpendicular line AD from point A to EF. BC is parallel to AD. ABCD forms a rectangle. Let the radius of the circle be r. The radian length corresponding to ∠AOE is... If the radians are equal, then OA = cos∠AOE. OD = r * cos∠AOE, then ED = r - OD = r * cos∠AOE; in △CDE, CD = (r * cos∠AOE) * tanθ; then AB = CD = (r * cos∠AOE) * tanθ, where AB is the T-axis, and ∠AOE (or The radius of the curve (in arcs) is the P-axis.
[0109] From this, we can obtain the tilt curve function: T = (r - rcosP) * tanθ. However, since r and θ are unknown, we can select two preset sampling points and substitute them into T = (r - rcosP) * tanθ to obtain the constants r and θ, thus obtaining the tilt curve function T = (r - rcosP) * tanθ with only T and P as variables.
[0110] S720: Calculate the preset position offset based on the tilt curve function.
[0111] Based on the tilt curve function T = (r - rcosP) * tanθ (where r and θ are constants), the preset position offset T can be obtained by substituting the value of P.
[0112] S730: The preset position is calibrated based on the calibration result of the sample preset position according to the preset position offset.
[0113] The preset position offset is T. Rotating the gimbal by -T will achieve the purpose of calibrating the preset position.
[0114] Finally, the preset lens zoom and focus data can be converted into motor steps for configuration using a magnification table and zoom curve table. During the actual conversion process, the motor position may deviate from the values in the magnification table, requiring an interpolation algorithm to obtain an approximate magnification value. After switching cameras, a focus range can be set based on the approximate magnification value when the preset position is called during the first cruise, triggering automatic focusing to clear the target and saving the parameters.
[0115] Before S110, a coordinate system transformation must be performed after equipment replacement. In this invention, coordinate system transformation can be achieved in the following three ways.
[0116] Method 1: When the hardware supports an electronic compass, maintain a vertical angle of 0°. Use the electronic compass to point north, then rotate the device horizontally to true north (with an error of ±5 to 10°). Capture one image in wide-angle mode, recording this position as S2 and the zero point as S1. After switching devices, maintain a vertical angle of 0° and rotate horizontally to true north. Based on the horizontal range P = [-10°, 10°], compare feature points to determine the accurate position. Update the coordinate system by converting the S2 and S1 positions.
[0117] Method 2: Without an electronic compass, the base has four mounting holes. Utilizing the relatively constant position of the horizontal optical coupler and the gimbal base, first rotate the gimbal to the optical coupler position, capture one image at a wide angle, and save the zero point S1 and the optical coupler position S3 at this point. The gimbal is recognized once for every 90° horizontal rotation, requiring a maximum of four recognitions to find image feature points. The coordinate system is then updated using the S1 and S3 values.
[0118] Method 3: For wall-mounted PTZ (Pan / Tilt / Zoom, omnidirectional (left / right / up / down) pan-tilt movement and lens zoom / zoom control) devices, maintain a vertical 0° angle and rotate horizontally at a wide angle to select a clearly visible feature point, capture one image, and save the current position S2 and zero position S1. During recognition, rotate horizontally 360° to accurately calibrate the feature points by comparison, and update the coordinate system using the values of S1 and S2.
[0119] The preset position calibration method provided by this invention involves determining a target preset position among multiple preset positions in a horizontal plane, wherein the magnification of the target preset position is greater than that of other preset positions; dividing the distribution area covering multiple preset positions into multiple unit regions based on the target preset position; determining sample preset positions in each unit region of the multiple unit regions based on the magnification of the target preset position, the distribution area, and the magnification of the multiple preset positions; calibrating the sample preset positions based on a first image acquired on the sample preset positions before the device replacement and a second image acquired on the sample preset positions after the device replacement; and calibrating the preset positions based on the fitting curves of the acquired multiple sample preset positions and the calibration results of the sample preset positions. Through the above process, based on the magnification of multiple preset positions in the horizontal plane, the preset position with the higher magnification weight can be selected as the sample preset position. This ensures that the image captured by the selected sample preset position has high quality, and obvious feature points can be found for comparison. This solves the problem in the prior art that the accuracy of the configuration position calibration results is low due to defects such as unclear feature points, unidentifiable feature points, and tilt angle deviation before and after installation in the cropped image. It can effectively improve the accuracy of the configuration position calibration results and improve calibration efficiency.
[0120] The preset position calibration device provided by the present invention is described below. The preset position calibration device described below can be referred to in correspondence with the preset position calibration method described above.
[0121] Figure 13 This is a schematic diagram of the preset position calibration device provided by the present invention. Figure 13 As shown, the preset position calibration device 1300 includes:
[0122] The determination module 1301 is used to determine a target preset position among multiple preset positions in a horizontal plane; wherein the multiplier of the target preset position is greater than the multiplier of the other preset positions.
[0123] The partitioning module 1302 is used to divide the distribution area covering multiple preset positions into multiple unit areas according to the target preset position.
[0124] The processing module 1303 is used to determine the sample preset position in each of the multiple unit regions based on the magnification of the target preset position, the distribution area, and the magnification of multiple preset positions.
[0125] The first calibration module 1304 is used to calibrate the sample preset position based on the first image acquired on the sample preset position before the machine replacement and the second image acquired on the sample preset position after the machine replacement.
[0126] The second calibration module 1305 is used to calibrate the preset positions based on the fitting curves of multiple sample preset positions and the calibration results of the sample preset positions.
[0127] The preset position calibration device provided by this invention determines a target preset position from multiple preset positions in a horizontal plane through a determining module; wherein the magnification of the target preset position is greater than that of other preset positions; a dividing module divides the distribution area covering multiple preset positions into multiple unit regions according to the target preset position; a processing module determines sample preset positions in each unit region of the multiple unit regions according to the magnification of the target preset position, the distribution area, and the magnification of the multiple preset positions; a calibration module calibrates the sample preset positions according to a first image acquired on the sample preset positions before the device replacement and a second image acquired on the sample preset positions after the device replacement; and the preset positions are calibrated according to the fitting curves of the acquired multiple sample preset positions and the calibration results of the sample preset positions. The preset position calibration device in this invention can select a preset position with a higher magnification weight as a sample preset position based on the magnification of multiple preset positions in the horizontal plane. This ensures that the image captured by the selected sample preset position has high quality, and obvious feature points can be found for comparison. This solves the problem of low accuracy of configuration position calibration results in the prior art due to defects such as unclear feature points, unidentifiable feature points, and tilt angle deviation before and after installation in the cropped image. It can effectively improve the accuracy of configuration position calibration results and improve calibration efficiency.
[0128] Figure 14 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 14 As shown, the electronic device may include: a processor 1410, a communications interface 1420, a memory 1430, and a communication bus 1440, wherein the processor 1410, the communications interface 1420, and the memory 1430 communicate with each other through the communication bus 1440. The processor 1410 can call logic instructions in the memory 1430 to execute a preset bit calibration method, the method comprising: determining a target preset bit among multiple preset bits in a horizontal plane; wherein the magnification of the target preset bit is greater than the magnification of other preset bits; dividing the distribution area covering the multiple preset bits into multiple unit regions according to the target preset bit; determining sample preset bits in each unit region of the multiple unit regions according to the magnification of the target preset bit, the distribution area, and the magnification of the multiple preset bits; calibrating the sample preset bits according to a first image acquired on the sample preset bits before the replacement and a second image acquired on the sample preset bits after the replacement; and calibrating the preset bits according to the fitting curve of the acquired multiple sample preset bits and the calibration result of the sample preset bits.
[0129] Furthermore, the logical instructions in the aforementioned memory 1430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0130] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the preset position calibration method provided by the above methods. The method includes: determining a target preset position among a plurality of preset positions in a horizontal plane; wherein the magnification of the target preset position is greater than the magnification of other preset positions; dividing the distribution area covering the plurality of preset positions into a plurality of unit regions according to the target preset position; determining a sample preset position in each unit region of the plurality of unit regions according to the magnification of the target preset position, the distribution area, and the magnification of the plurality of preset positions; calibrating the sample preset position according to a first image acquired on the sample preset position before the machine replacement and a second image acquired on the sample preset position after the machine replacement; and calibrating the preset position according to the fitting curve of the plurality of sample preset positions and the calibration result of the sample preset position.
[0131] In another aspect, the present invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the preset position calibration method provided by the methods described above. The method includes: determining a target preset position among a plurality of preset positions in a horizontal plane; wherein the magnification of the target preset position is greater than the magnification of the other preset positions; dividing a distribution area covering the plurality of preset positions into a plurality of unit regions according to the target preset position; determining a sample preset position in each unit region of the plurality of unit regions according to the magnification of the target preset position, the distribution area, and the magnification of the plurality of preset positions; calibrating the sample preset position according to a first image acquired on the sample preset position before the device replacement and a second image acquired on the sample preset position after the device replacement; and calibrating the preset position according to the fitting curve of the plurality of sample preset positions and the calibration result of the sample preset position.
[0132] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0133] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A preset position calibration method, characterized in that, include: A target preset position is determined from multiple preset positions in a horizontal plane; wherein, the target preset position is the preset position with the largest magnification among the multiple preset positions in the horizontal plane; the horizontal plane is the plane in which the pan-tilt camera is located in the horizontal direction; Based on the target preset position, the distribution area covering the multiple preset positions is divided into multiple unit areas; the distribution area is the area in the horizontal direction from 0 to γ, where γ is less than or equal to 360°; Based on the multiplier of the target preset position, the distribution area, and the multipliers of the plurality of preset positions, a sample preset position is determined in each unit region of the plurality of unit regions; The sample preset position is calibrated based on the first image acquired at the sample preset position before the machine replacement and the second image acquired at the sample preset position after the machine replacement. The preset positions are calibrated based on the fitting curves of the multiple sample preset positions and the calibration results of the sample preset positions. The step of determining the sample preset position in each unit region of the plurality of unit regions based on the target preset position magnification, the distribution region, and the magnification of the plurality of preset positions includes: Based on the multiplier of the target preset position and the multiplier of the preset positions of each region in the target unit region, the first weight of each region preset position is calculated; wherein, the target unit region is any one of the plurality of unit regions; The second weight of each preset position is calculated based on the piecewise linear function corresponding to the preset distribution area and the horizontal coordinates of each preset position in the area. The evaluation weight of each preset position in each region is obtained based on the first weight and the second weight of each preset position in each region. The sample preset position of the target unit region is determined according to the evaluation weight of each preset position in the region; wherein the evaluation weight of the sample preset position of the target unit region is greater than the evaluation weight of the preset positions of other regions in the target unit region.
2. The preset position calibration method according to claim 1, characterized in that, The calibration of the sample preset position based on the first image acquired at the sample preset position before the machine replacement and the second image acquired at the sample preset position after the machine replacement includes: Based on the magnification of the preset position of the sample, determine multiple calibration magnifications; At each calibration magnification, an image is acquired at the preset position of the sample before the machine is changed as the first image, and an image is acquired at the preset position of the sample after the machine is changed as the second image; The first and second images at each calibration magnification are compared, and the preset position is calibrated based on the comparison results.
3. The preset position calibration method according to claim 2, characterized in that, The step of determining multiple calibration magnifications based on the magnification of the sample preset position includes: Obtain the reference magnification based on the target preset magnification; When the magnification of the preset position of the sample is greater than or equal to the reference magnification, the plurality of calibration magnifications are determined to include: wide-angle magnification, medium-focus magnification, and preset position magnification; If the magnification of the preset position of the sample is less than the reference magnification, the plurality of calibration magnifications are determined to include: the wide-angle magnification and the preset position magnification.
4. The preset position calibration method according to claim 1, characterized in that, The step of dividing the distribution area covering the multiple preset positions into multiple unit regions according to the target preset positions includes: Taking the target preset position as the starting point and the distance between the gimbal and the target preset position as the radius, the first sector area swept by each preset rotation angle is taken as an initial marking area; The initial marked region is divided into two identical second sector regions, and the second sector regions are denoted as the secondary marked regions; The region corresponding to two adjacent secondary marking regions in the adjacent initial marking regions is taken as the unit region.
5. The preset position calibration method according to any one of claims 1-4, characterized in that, The step of calibrating the preset positions based on the fitting curves of the multiple sample preset positions and the calibration results of the sample preset positions includes: The tilt angle curve function is obtained by fitting curves obtained from multiple sample preset positions. Calculate the preset position offset based on the tilt angle curve function; The preset position is calibrated based on the calibration result of the sample preset position according to the preset position offset.
6. A preset position calibration device, characterized in that, include: The determination module is used to determine a target preset position among multiple preset positions in a horizontal plane; wherein, the target preset position is the preset position with the largest magnification among the multiple preset positions in the horizontal plane; the horizontal plane is the plane in which the pan-tilt camera is located in the horizontal direction; The partitioning module is used to divide the distribution area covering the multiple preset positions into multiple unit areas according to the target preset positions; the distribution area is a region in the horizontal direction from 0 to γ, where γ is less than or equal to 360°; The processing module is used to determine the sample preset position in each unit region of the plurality of unit regions based on the magnification of the target preset position, the distribution area, and the magnification of the plurality of preset positions; The first calibration module is used to calibrate the sample preset position based on the first image acquired on the sample preset position before the machine replacement and the second image acquired on the sample preset position after the machine replacement. The second calibration module is used to calibrate the preset positions based on the fitting curves of the multiple sample preset positions and the calibration results of the sample preset positions. The processing module is specifically configured to: calculate a first weight for each preset position in a region based on the multiplier of the target preset position and the multiplier of each preset position in the target unit region; wherein the target unit region is any one of the plurality of unit regions; calculate a second weight for each preset position in a region based on a preset piecewise linear function corresponding to the distribution region and the horizontal coordinate of each preset position in a region; obtain an evaluation weight for each preset position in a region based on the first weight and the second weight; and determine the sample preset position in the target unit region based on the evaluation weight of each preset position in a region; wherein the evaluation weight of the sample preset position in the target unit region is greater than the evaluation weight of the preset positions in other regions in the target unit region.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the preset bit calibration method as described in any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the preset bit calibration method as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the preset bit calibration method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Parameter determination method and device of preset bit, equipment and medium
CN114500858A
Device and method for locking and tracking human body target
WO2014131252A1