Target measurement method and device, electronic equipment and storage medium
By calculating the correction factor during the target alignment process and adjusting the pan-tilt rotation angle using the device parameters and pixel coordinate differences, the problem of increased hardware costs for the laser emitting device is solved, achieving higher measurement accuracy and reducing costs.
Patent Information
- Application Number
- CN202510637063.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-10-03
AI Technical Summary
In the existing technology, an additional laser emitting device is required during the target centering process, which increases hardware costs and results in poor measurement results in some scenarios.
By acquiring the captured images, determining the device parameters and pixel coordinate differences, calculating the correction factors, using the correction factors to determine the pan-tilt rotation angle, and controlling the pan-tilt to adjust, the use of laser ranging devices is avoided.
It improves measurement accuracy, reduces errors caused by lens distortion, projection deformation or environmental factors, and reduces hardware costs.
Smart Images

Figure CN120740429A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of pan-tilt platform technology, and in particular to a target measurement method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of technology, precise gimbal control is becoming increasingly necessary in scenarios like motion tracking and target positioning. In some practical applications, the camera must automatically align itself with the target object. This means that when the target object deviates from the center of the frame, the system must calculate the gimbal rotation angle to bring the target back to the center of the frame. This process is also known as target centering.
[0003] Related technologies have proposed using laser ranging to determine the pan / tilt rotation angle required for target centering by measuring the distance between the camera and the target object. However, this approach requires the addition of a laser transmitter, and in some scenarios, the laser may not align with the target, resulting in poor measurement results. Summary of the Invention
[0004] In view of this, the present application provides a target measurement method, device, electronic device and storage medium, the main purpose of which is to solve the problem of requiring an additional laser emitting device to determine the pan-tilt rotation angle during target alignment, so as to reduce hardware costs.
[0005] In a first aspect, the present application provides a target measurement method, including: acquiring a captured image, the captured image containing a captured target; determining device parameters and pixel coordinate differences, and using the device parameters and pixel coordinate differences to calculate a correction factor, wherein the device parameters are determined by a shooting device that captures the captured image, and the pixel coordinate difference is determined based on the captured image; using the correction factor to determine a target rotation angle, and controlling the gimbal to adjust based on the target rotation angle.
[0006] Optionally, the device parameters include a focus step and a magnification corresponding to the captured image, and the pixel coordinate difference is a coordinate difference of the captured target relative to a reference point.
[0007] Optionally, the pixel coordinate difference includes a horizontal dimension difference and a vertical dimension difference; determining the device parameters and the pixel coordinate difference, and using the device parameters and the pixel coordinate difference to calculate the correction factor, including: calculating the horizontal physical offset based on the horizontal dimension difference and the magnification; calculating the first intermediate variable parameter based on the horizontal physical offset and the focusing step, the first intermediate variable parameter is used to correct the influence of the vertical dimension on the horizontal dimension; calculating the first correction factor based on the first intermediate variable parameter, the first correction factor being the correction factor for the horizontal dimension.
[0008] Optionally, the pixel coordinate difference includes a horizontal dimension difference and a vertical dimension difference; determining the device parameters and the pixel coordinate difference, and using the device parameters and the pixel coordinate difference to calculate the correction factor, also includes: calculating the vertical physical offset based on the vertical dimension difference and the magnification; calculating a second intermediate variable parameter based on the vertical physical offset and the focusing step, the second intermediate variable parameter is used to correct the influence of the horizontal dimension on the vertical dimension; calculating a second correction factor based on the second intermediate variable parameter, the second correction factor being the correction factor for the vertical dimension.
[0009] Optionally, a correction factor is used to determine the target rotation angle, and the gimbal is controlled to adjust based on the target rotation angle, including: calculating the initial rotation angle required to center the shooting target according to a trigonometric function relationship; correcting the initial rotation angle using the correction factor to obtain the target rotation angle, and controlling the gimbal to adjust based on the target rotation angle.
[0010] Optionally, after correcting the initial rotation angle using the correction factor to obtain the target rotation angle and controlling the gimbal to adjust based on the target rotation angle, the method further includes: determining the distance to the shooting target based on the target rotation angle under preset conditions.
[0011] Optionally, under preset conditions, the distance to the shooting target is determined based on the target rotation angle, including: calculating the actual physical offset based on the pixel coordinate difference and the magnification, the actual physical offset including the horizontal physical offset or the vertical physical offset; and calculating the distance to the shooting target using a trigonometric function relationship based on the target rotation angle and the actual physical offset.
[0012] In a second aspect, the present application provides a target measurement device, comprising:
[0013] An acquisition unit is configured to acquire a captured image, wherein the captured image includes a captured object;
[0014] a calculation unit configured to determine device parameters and pixel coordinate differences, and calculate a correction factor using the device parameters and the pixel coordinate differences, wherein the device parameters are determined by a photographing device that photographs the image, and the pixel coordinate differences are determined based on the photographed image;
[0015] The processing unit is configured to determine a target rotation angle using a correction factor and control the gimbal to adjust based on the target rotation angle.
[0016] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the target measurement method described in the first aspect.
[0017] In a fourth aspect, the present application provides an electronic device comprising a memory storing a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the target measurement method described in the first aspect when executing the computer program.
[0018] In a fifth aspect, the present application provides a computer program product having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the target measurement method described in the first aspect is implemented.
[0019] Based on the above technical solution, the present application provides a target measurement method, device, electronic device and storage medium, which first obtains a captured image containing a captured target, and then determines the device parameters and pixel coordinate differences, and uses the device parameters and pixel coordinate differences to calculate the correction factor. Finally, the correction factor is used to determine the target rotation angle, and the gimbal is controlled to adjust based on the target rotation angle. Compared with related technologies, the present application calculates the correction factor only through the basic parameters of the image and the device without the need to introduce methods such as laser ranging. Compared with the method of converting through trigonometric functions, the measurement accuracy is improved, the errors caused by lens distortion, projection deformation or environmental factors are reduced, and the hardware cost is also reduced.
[0020] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0023] Figure 1 A schematic diagram of a target measurement method according to an embodiment of the present application is shown;
[0024] Figure 2 A schematic diagram of a flow chart of another target measurement method provided in an embodiment of the present application is shown;
[0025] Figure 3 A schematic structural diagram of a target measurement device provided in an embodiment of the present application is shown;
[0026] Figure 4 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0027] In order to more clearly understand the above-mentioned objectives, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.
[0028] A target measurement method proposed in this embodiment is applied to a target measurement device or electronic device. The device or electronic device can be installed or integrated into some target measurement and shooting products or systems, such as a system consisting of a shooting device and a pan-tilt head, wherein the shooting device is used to shoot the target, and the pan-tilt head is used to adjust the orientation of the shooting device. For example, before shooting the target, or when and after the target moves, the target measurement device can calculate the angle of the pan-tilt head adjustment so that the target is located in the center of the picture, and can execute any of the target measurement methods mentioned below during operation.
[0029] In order to solve the problem of needing to add an additional laser emitting device to determine the pan-tilt rotation angle during the target alignment process, the hardware cost can be reduced. This embodiment proposes a target measurement method, such as Figure 1 As shown, the method includes:
[0030] S101, acquiring a captured image.
[0031] A captured image is an image captured by a camera, containing the object being photographed. The position of the object in the captured image is not fixed. Generally, to facilitate observation, the camera's orientation can be adjusted using a gimbal to position the object in the exact center of the image. This process is also called centering.
[0032] S102, determining the device parameters and the pixel coordinate difference, and calculating the correction factor using the device parameters and the pixel coordinate difference.
[0033] Device parameters are parameters that can be directly or indirectly obtained from the device itself or while it is operating. Pixel coordinate differences are derived from the target's position in the captured image. The device parameters and pixel coordinate differences are then used to calculate correction factors, which are used to adjust the gimbal's rotation angle.
[0034] S103, determining a target rotation angle using the correction factor, and controlling the pan / tilt head to adjust based on the target rotation angle.
[0035] The target rotation angle is obtained by applying a correction factor, and the gimbal adjusts the camera's orientation based on the target rotation angle. During routine operation, the system also calculates an initial rotation angle. Based on this initial rotation angle, the system adjusts the gimbal's orientation to position the target in the center of the image—this is the target centering process mentioned above. However, in actual imaging, projection distortion can cause the relationship between the target's position on the imaging plane and its actual physical position to deviate from a simple linear relationship. For example, when the target object is at different depths or angles, its projection on the imaging plane may be stretched, compressed, or distorted. Barrel distortion or pincushion distortion of the lens can cause different degrees of stretching or compression at different positions in the image, resulting in a nonlinear relationship between the target's position and angle. Therefore, by introducing a correction factor to eliminate this error, adjustments are made based on the final calculated target rotation angle, resulting in a more realistic centering effect.
[0036] In this embodiment, a captured image containing the target is first acquired. The device parameters and pixel coordinate differences are then determined, and correction factors are calculated using these differences. Finally, the correction factors are used to determine the target's rotation angle, and the gimbal is controlled to adjust based on the target's rotation angle. Compared to related technologies, this embodiment calculates the correction factors solely based on the image and basic device parameters, without requiring methods such as laser ranging. This improves measurement accuracy compared to methods using trigonometric conversion, reduces errors caused by lens distortion, projection deformation, or environmental factors, and reduces hardware costs.
[0037] From another perspective, conventional algorithms for calculating the centering angle typically use simple trigonometric transformations to determine the angle. However, during the shooting process, factors such as lens factors, focal length, magnification parameters, environmental influences, and the interaction between horizontal and vertical in three-dimensional space can all lead to errors in the rotation angle derived from simple trigonometric transformations. Therefore, this embodiment introduces a correction factor to reduce errors caused by these factors, thereby improving measurement accuracy.
[0038] To facilitate subsequent explanation and understanding, the geometric relationship, light propagation characteristics, and nonlinear deviations in the imaging system are introduced here for explanation:
[0039] The relationship between the lens and the imaging plane:
[0040] In an imaging system, a lens focuses light from an object onto an imaging plane to form an image. The focal length of the lens, the distance from the object to the lens, and the distance from the imaging plane to the lens are related by a specific geometric relationship, which follows the Gaussian lens imaging formula.
[0041] The correspondence between object points and image points: Light emanating from a point on an object, after being refracted by a lens, corresponds to a specific point on the imaging plane. This correspondence is not a simple linear mapping but depends on factors such as the lens's optical properties, the object's position, and the angle. For example, in a wide-angle lens, the farther the object point is from the optical axis, the greater the deviation between its image position and the ideal linear projection position.
[0042] The propagation characteristics of light include:
[0043] Rectilinear propagation: In a homogeneous medium, light propagates in a straight line. This is one of the fundamental assumptions of geometric optics and the basis for analyzing imaging systems. During the imaging process, light rays emanating from various points on an object follow the law of rectilinear propagation both before and after reaching the lens.
[0044] Refraction and Convergence: When light passes through a lens, it refracts due to the lens's lens action. Light rays refract at different angles at different locations, causing them to converge at different points on the imaging plane. Lens parameters such as the refractive index and radius of curvature determine the angle of refraction and convergence characteristics of light. For example, a convex lens causes light rays parallel to the optical axis to converge at a single point, forming a focal point.
[0045] Changes in propagation direction: The direction of light propagation can change depending on the relative position of the object and the lens, as well as the lens's optical properties. For obliquely incident light, its landing point on the imaging plane can deviate from the center, and the degree of deviation depends on factors such as the light's angle of incidence and lens aberrations.
[0046] Nonlinear deviation
[0047] Cause: In actual imaging systems, factors such as lens aberrations and distortion, as well as the complexities of light propagation, can cause the image position of objects on the imaging plane to deviate from the ideal linear projection position. This deviation is known as nonlinearity. For example, barrel distortion causes objects at the edge of the image to appear to bend outward, while pincushion distortion causes objects at the edge of the image to bend inward. These are both manifestations of nonlinearity.
[0048] Influencing factors: Lens quality, focal length, aperture, object distance, and angle all influence the degree of nonlinearity. Generally speaking, wide-angle lenses are more likely to produce larger nonlinearities, while telephoto lenses have relatively smaller nonlinearities. Furthermore, the closer the object is to the lens, the more pronounced the nonlinearity may be.
[0049] Impact on imaging: Nonlinear deviations can cause image distortion, affecting image quality and accuracy. In applications requiring precise measurement and positioning, such as aerial photogrammetry and machine vision inspection, nonlinear deviations must be corrected to ensure the reliability of measurement results.
[0050] Optionally, the device parameters include a focus step and a magnification corresponding to the captured image, and the pixel coordinate difference is a coordinate difference of the captured target relative to a reference point.
[0051] In this embodiment, the device parameters include the focus step length and magnification corresponding to the captured image. The focus step length reflects the number of steps or distance that a capturing device (e.g., a camera) moves during the focusing process to achieve a clear image of the target and is related to geometric parameters such as the focal length of the lens. To a certain extent, this step length is related to the distance between the target object and the imaging device. Generally speaking, the farther the target object is from the capturing device, the larger the focus step length may be required to achieve a clear image, so it can be roughly considered a metric related to object distance. The magnification represents the degree to which the capturing device magnifies the target object. The higher the magnification, the larger the target object appears on the imaging plane, and the more pixels an object of the same actual physical size occupies on the imaging plane. Both parameters can generally be obtained from the device, for example, through internal camera parameters. If the camera supports autofocus and has an open underlying control interface (e.g., SDK, API, etc.), they can be obtained through direct reading from the camera SDK or experimental calibration. The acquisition method is not limited here.
[0052] The pixel coordinate difference is the coordinate difference of the captured target relative to the reference point. The reference point is a reference point selected within the captured image. This selection criteria is not unique; for example, the lower left corner or the center of the image can be used as the reference point. A rectangular coordinate system is established with the reference point as the origin. The pixel coordinate difference represents the coordinate of the captured target in the current rectangular coordinate system (i.e., the coordinate difference between the captured target and the reference point). To calculate the correction factor to eliminate at least one of the effects of lens factors, focal length, magnification parameters, environmental influences, and the interaction between horizontal and vertical in three-dimensional space, it is considered to use the device's own parameters to eliminate these errors and improve centering accuracy.
[0053] Optionally, the pixel coordinate difference includes a horizontal dimension difference and a vertical dimension difference. In this case, the above-mentioned determination of the device parameters and the pixel coordinate difference, and calculation of the correction factor using the device parameters and the pixel coordinate difference (i.e., step S102) may include: calculating a horizontal physical offset based on the horizontal dimension difference and the magnification; calculating a first intermediate variable parameter based on the horizontal physical offset and the focus step size, the first intermediate variable parameter being used to correct the influence of the vertical dimension on the horizontal dimension; and calculating a first correction factor based on the first intermediate variable parameter, the first correction factor being a correction factor for the horizontal dimension.
[0054] In the exemplary solution proposed in this embodiment, the pixel coordinate difference is processed separately from the horizontal and vertical dimensions. In this embodiment, the processing process of the horizontal dimension is specifically described:
[0055] First, calculate the horizontal physical offset based on the horizontal dimension difference and the magnification:
[0056]
[0057] In Formula 1, real_delta_x is the horizontal physical offset, delta_x is the horizontal dimension difference, and magnification is the magnification factor. The magnification factor affects the size of the target image on the imaging plane and is related to the degree of light convergence. The higher the magnification, the greater the degree of light convergence on the imaging plane, and the more pixels the target occupies on the imaging plane. Furthermore, when calculating the first intermediate variable parameter based on the horizontal physical offset and focus step size, it is also necessary to determine the intermediate parameters a and e. The process for determining the intermediate parameters a and e is as follows:
[0058]
[0059] In Formula 2, e is an intermediate parameter related to the target's actual horizontal displacement and equivalent distance. From the perspective of light propagation, the intermediate parameter e is an angle calculated using the inverse cosine function. Its physical meaning is the inverse function of the cosine of the angle between the light ray and the optical axis. It reflects the angle by which the light ray deviates from the optical axis. In other words, the magnitude of this angle depends on the target's actual position and the light's propagation path in the imaging system. This angle can be considered an intermediate value under an ideal geometric model.
[0060] focus_param is the focus step size. In the actual imaging process, light propagation follows specific physical laws. Light originates from the target object, refracts through the lens, and forms an image on the imaging plane. The focus step size, focus_param, reflects the adjustments made by the imaging device to achieve a clear image of the target. It is closely related to the light propagation path through the lens and the focusing effect. When the target object is farther from the imaging device, light must travel a longer distance to focus on the imaging plane, which typically requires a larger focus step size to achieve a clear image.
[0061]
[0062] In Formula 3, the intermediate parameter a is a normalized representation of the object's horizontal displacement and the system characteristic parameters. It represents the ratio of the actual horizontal displacement to the equivalent distance, reflects the relative size of the horizontal displacement, and embodies the degree of horizontal position offset of the target relative to the camera.
[0063] Furthermore, in actual imaging, due to factors such as lens distortion and projection deformation, the position and angle relationship of the target will show nonlinear changes, that is, nonlinear deviation. In order to capture this nonlinear deviation, the first intermediate variable parameters c1 and c3 are calculated as follows:
[0064]
[0065] c3=sin -1 a(Formula 5)
[0066] The two variables c1 and c3 are obtained by processing different intermediate parameters a and e using the inverse sine function. Their function is to perform a nonlinear transformation on a to capture nonlinear deviations caused by factors such as projection distortion. In actual imaging, projection distortion can cause nonlinear changes in the relationship between the target's position and angle, including the influence of the vertical dimension on the horizontal dimension. The inverse sine function can incorporate this nonlinear relationship into the calculation of the correction factor. In actual imaging, nonlinear deviations may occur due to factors such as lens aberrations and distortion. The inverse sine functions c1 and c3 are used to model these nonlinear relationships. The graphical characteristics of the inverse sine function can effectively fit nonlinear deviations in imaging.
[0067] Specifically, here we explain the principle of nonlinear transformation of a by c1 and c3. First, from formula 4, we can see that a is scaled to meet the domain requirements of the inverse sine function. Then, based on the properties of the inverse sine function, nonlinear features are introduced. As a result, the relationship between c1 and a is no longer linear. When a changes within different value ranges, the rate of change of c1 will be different, so that the nonlinear deviation caused by projection deformation can be captured. For example, when a is close to 1 or -1, the slope of the inverse sine function changes greatly, which can more sensitively reflect the nonlinear changes in these boundary cases. The angle value adjusted in this way can more accurately reflect the complex relationship between the actual position and angle of the imaging point in the horizontal direction.
[0068] Similarly, utilizing the nonlinear characteristics of the inverse sine function, we directly process a to obtain c3. a is the ratio of the actual horizontal displacement to the equivalent distance, reflecting the relative horizontal position of the target. Using the inverse sine function to map a to the range [-π / 2, π / 2] creates a nonlinear relationship between c3 and a, and to some extent reflects the deviation angle of the imaging point from the optical axis.
[0069] Capturing nonlinear deviations at different scales: Compared to C1, C3 does not scale a. It more directly reflects the nonlinear relationship between a and the inverse sine function. In projective deformation, displacements and angles of varying scales can lead to varying degrees of nonlinear deviations. C3 and C1 apply nonlinear transformations to a from different perspectives, enabling a more comprehensive capture of these nonlinear deviations at different scales.
[0070] Finally, based on the first intermediate variable parameter, the first correction factor is calculated as follows:
[0071]
[0072] In formula 6, factor 1 is the first correction factor, that is, the correction factor of the horizontal dimension. Factor 1 is based on the comprehensive consideration of light propagation characteristics and nonlinear deviation. Among them, a in the numerator represents the relative displacement in the horizontal direction, c3 3 Related to the cube of the angle obtained by directly taking the inverse sine of a, sin e calculates the sine of the angle e, which is related to the change in the propagation direction of light in the medium. During the imaging process, light follows propagation laws such as the law of refraction and refracts when passing through the lens. (Here, it is used to calculate the correction factor in combination with other intermediate variables. It is related to the sine of the angle of the light deviation from the optical axis to consider the influence of the component perpendicular to the horizontal direction on the angle calculation.) 2 e is the square of sin e, which is related to the square of the sine of the angle of deviation of the light; c1 in the denominator is the value obtained by taking the arc sine after scaling, cos 3 e is the cube of the cosine of the angle e, which appears in the denominator of factor1, indicating that the cosine of the light propagation direction has an impact on the final angle-related value, which is consistent with the characteristic that the angle change during light propagation affects the imaging position.
[0073] Specifically, sin e represents the sine of the angle between the light and the optical axis, reflecting the horizontal projection component of the light. In an imaging system, this component directly affects the horizontal imaging position of the target. cos e represents the projection component of the light in the direction perpendicular to the optical axis and is closely related to the depth of field and focusing effect of the lens. 2 The use of e is based on the inverse square law in optics, that is, the light intensity is inversely proportional to the square of the distance. In nonlinear correction, this factor is used to compensate for the imaging deviation caused by light attenuation in the edge area. 3 The use of e is to more accurately simulate the distortion characteristics of the lens. In wide-angle lenses, edge distortion is usually associated with high powers of cos e.
[0074] By comprehensively considering horizontal displacement, equivalent distance, nonlinear relationships caused by projection distortion, and the influence of vertical components (and thereby correcting the initial angle calculated by simple trigonometric functions), the accuracy of horizontal centering angle calculation is improved. Specifically, if factor1 is greater than 1, the initially calculated angle is increased; if factor1 is less than 1, the angle is decreased. In this way, factor1 can adjust the angle based on the actual imaging situation to compensate for errors caused by factors such as projection distortion, making the final calculated horizontal rotation angle more consistent with actual conditions. The combination of factor1s, through comprehensive consideration and ingenious modeling of the imaging system's geometric relationships, light propagation characteristics, and nonlinear deviations, can accurately describe the various complex factors in the imaging process, effectively reflecting the various characteristics of actual imaging when calculating horizontal angle-related values.
[0075] Optionally, the pixel coordinate difference includes a horizontal dimension difference and a vertical dimension difference. In some embodiments, the above-mentioned determination of device parameters and pixel coordinate differences, and calculation of the correction factor using the device parameters and pixel coordinate differences (i.e., step S102) may further include: calculating a vertical physical offset based on the vertical dimension difference and the magnification; calculating a second intermediate variable parameter based on the vertical physical offset and the focus step size, the second intermediate variable parameter being used to correct the influence of the horizontal dimension on the vertical dimension; and calculating a second correction factor based on the second intermediate variable parameter, the second correction factor being a correction factor for the vertical dimension.
[0076] In this embodiment, the calculation process in the vertical direction is similar to that in the horizontal direction. Here are the specific calculation steps. First, the vertical physical offset is calculated based on the vertical dimension difference and the magnification:
[0077]
[0078] In Formula 7, real_delta_y is the horizontal physical offset, and delta_y is the vertical dimension difference. When calculating the second intermediate variable parameter based on the vertical physical offset and the focus step, it is also necessary to determine the intermediate parameters f and b. The process of determining the intermediate parameters f and b is as follows:
[0079]
[0080] In Formula 8, f is an intermediate parameter, an angle calculated based on the actual vertical displacement and the equivalent distance. It reflects the vertical angle between the light ray and the optical axis and is related to the vertical light propagation path and the target position. This angle can be considered an intermediate angle under an ideal geometric model.
[0081]
[0082] In Formula 9, the intermediate parameter b represents the ratio of the actual vertical displacement to the equivalent distance, reflecting the relative size of the vertical displacement and the degree of vertical position offset of the target relative to the camera.
[0083] Furthermore, the second intermediate variable parameters d1 and d3 are calculated as follows:
[0084]
[0085] d3=sin -1 b(Formula 11)
[0086] The two variables d1 and d3 are obtained by processing different intermediate parameters f and b through the inverse sine function. Their function is to perform a nonlinear transformation on b to capture the nonlinear deviation caused by factors such as projection deformation. Specifically, d1 takes the inverse sine after scaling b, which can capture the nonlinear deviation in the vertical direction at a specific scale; d3 directly takes the inverse sine of b, which more directly reflects the nonlinear relationship between the target position and the inverse sine function in the vertical direction. In actual imaging, projection deformation may cause the position and angle relationship of the target to show nonlinear changes, including the influence of the horizontal dimension on the vertical dimension. This nonlinear relationship can be introduced into the calculation of the correction factor through the inverse sine function. The way d1 and d3 introduce nonlinear relationships is similar to that of c1 and c3 above, and will not be repeated here. Finally, based on the second intermediate variable parameter, the second correction factor is calculated, and the process is as follows:
[0087]
[0088] In formula 12, sin_f is the sine value of angle f, which is used to calculate the correction factor in the vertical direction. For f, take sin 2 f and cos 3 The reason for f is the same as taking sin of e in the horizontal direction 2 e and cos 3 The reason for e is the same and will not be repeated here. Factor 2 is the second correction factor, or the correction factor for the vertical dimension. Factor 2 improves the accuracy of the vertical centering angle calculation by comprehensively considering vertical displacement, equivalent distance, nonlinear relationships caused by projection deformation, and the influence of horizontal components (thus correcting the initial angle calculated by simple trigonometric functions).
[0089] Optionally, the above-mentioned use of the correction factor to determine the target rotation angle and controlling the gimbal to adjust based on the target rotation angle (i.e., step S103) may include: calculating the initial rotation angle required to center the shooting target according to a trigonometric function relationship; correcting the initial rotation angle using the correction factor to obtain the target rotation angle, and controlling the gimbal to adjust based on the target rotation angle.
[0090] In this embodiment, the initial rotation angle is the rotation angle determined according to a simple trigonometric relationship, and then the initial rotation angle is corrected by the factors 1 and 2 obtained by the above calculation to obtain the target rotation angle, and the gimbal is controlled to adjust the shooting device based on the target rotation angle.
[0091] It should be noted that the above scheme is not limited to calculations in radians or degrees; the radians or degrees can be unified before calculation as needed. Correcting the initial rotation angle can specifically involve dividing the initial rotation angle into two components, horizontal and vertical, and then correcting each component using factor1 and factor2. The correction process involves multiplying factor1 by the horizontal rotation angle component and then combining the two corrected components to obtain the target rotation angle. Alternatively, factor1 and factor2 can be combined before correcting the initial rotation angle, and the specific method can be selected based on actual circumstances.
[0092] Optionally, after correcting the initial rotation angle using the correction factor to obtain the target rotation angle and controlling the gimbal to adjust based on the target rotation angle (i.e., step S103), the method further includes: determining the distance to the target based on the target rotation angle under predetermined conditions. Determining the distance to the target based on the target rotation angle under predetermined conditions includes: calculating an actual physical offset based on pixel coordinate differences and a magnification factor, the actual physical offset including a horizontal physical offset or a vertical physical offset; and calculating the distance to the target using a trigonometric function relationship based on the target rotation angle and the actual physical offset.
[0093] In this embodiment, the preset condition refers to the connection line between the preset shooting device and the target and the horizontal / vertical direction line of the imaging plane forming a right triangle. It should be noted here that in actual applications, if the right triangle situation is not satisfied, the posture angle correction process can be performed first to meet the preset geometric conditions. That is, in actual situations, the connection line between the shooting device and the target and the horizontal / vertical direction line of the imaging plane do not satisfy the right triangle situation. The posture angle can be corrected to compensate for the angle error, which can also meet the preset conditions. When parameters such as the horizontal and vertical centering angles (the two components of the target rotation angle), the magnification, and the pixel coordinate difference are known, the true distance between the shooting device and the target object can also be inferred, thereby achieving a more accurate distance result without using a laser ranging device. The specific calculation process includes:
[0094] Calculate the actual physical offset. The actual physical offset can be either the horizontal physical offset delta_x or the vertical physical offset delta_y. Here, the horizontal physical offset delta_x is used for illustration.
[0095] Assuming the horizontal component of the target's rotation angle is θ, based on trigonometric relationships, the true distance m is calculated as follows within a right triangle (assuming the line connecting the camera to the target and the horizontal / vertical lines of the imaging plane form a right triangle):
[0096]
[0097] It is important to ensure that the horizontal component of the input target rotation angle θ is within a reasonable range to avoid calculation errors. In the actual application of the above calculation process, methods such as taking the average value can be considered to improve the accuracy of the results.
[0098] Furthermore, if the actual situation is not a right triangle, that is, when the shooting device has a pitch angle or a roll angle, the imaging plane and the target plane are no longer strictly parallel, and attitude angle correction processing needs to be introduced. Specifically, corrected_delta_x=delta_x*cos(pitch)-delta_y*sin(roll), and / or corrected_delta_y=delta_x*sin(pitch)+delta_y*cos(roll), where corrected_delta_x(y) is the corrected physical offset, pitch is the pitch angle, and roll is the roll angle. After the attitude angle correction processing, even if the actual situation does not strictly form a right triangle, the error caused by the above processing can be compensated, so that it can be regarded as meeting the preset conditions. In addition, when the shooting device has a pitch angle or a roll angle, the error can also be eliminated by introducing a rotation matrix for coordinate transformation.
[0099] Furthermore, Figure 2 The following is a flow chart of another target measurement method provided by an embodiment of the present application. This embodiment differs from the above embodiment in that after obtaining the first correction factor and the second correction factor, the initial rotation angle is not split into two dimensions, horizontal and vertical, for separate processing. Instead, the correction factors are combined to correct the initial rotation angle as a whole. The specific steps include:
[0100] Step 1: Get the captured image.
[0101] The captured image includes the captured object.
[0102] Step 2: Determine the focus step size, magnification, and pixel coordinate difference.
[0103] Focus step size and magnification can be obtained from the camera itself and the captured image. Pixel coordinate difference refers to the difference between the coordinates of the captured object and the reference point in the captured image. The specific methods for obtaining and calculating these parameters have been described above and will not be repeated here.
[0104] Step 3: Calculate the first intermediate variable parameter and the second intermediate variable parameter respectively.
[0105] Step 4: Calculate the first correction factor and the second correction factor respectively.
[0106] Based on the focus step size, magnification, and pixel coordinate differences (horizontal and vertical dimension differences), the first and second intermediate variable parameters are calculated. These first and second intermediate variable parameters incorporate nonlinear characteristics to correct for the effects of the vertical dimension on the horizontal dimension, as well as for errors caused by lens distortion, environmental factors, and other factors. The first and second correction factors are then calculated.
[0107] Step 5: Calculate the initial rotation angle.
[0108] The initial rotation angle, that is, the rotation angle determined according to a simple trigonometric relationship, can be determined directly by the system through calculation.
[0109] Step 6: After fusing the first correction factor and the second correction factor, correct the initial rotation angle to obtain the target rotation angle.
[0110] Correcting the initial rotation angle can specifically involve dividing the initial rotation angle into two components, horizontal and vertical, and then correcting each component using a first correction factor, factor1, and a second correction factor, factor2. The correction process involves multiplying factor1 by the horizontal rotation angle component and then combining the two corrected components to obtain the target rotation angle. Alternatively, factor1 and factor2 can be combined to correct the initial rotation angle. In this embodiment, the initial rotation angle is corrected primarily by combining factor1 and factor2, thereby omitting the calculation process of splitting the initial rotation angle into its components, thereby improving system processing efficiency.
[0111] At the same time, in the practical application of the overall solution, some relevant technologies can also be adopted to improve the convenience of the actual application process, including but not limited to:
[0112] Introducing deep learning-related technologies: such as convolutional neural networks (CNNs), which extract image features more accurately. Model training is combined with target measurement tasks to automatically learn the features and positional relationships of targets in images, further improving measurement accuracy and adaptability to complex scenarios. For example, leveraging the powerful feature extraction capabilities of CNNs, targets can be accurately identified in complex environments such as those with varying lighting and occlusion, optimizing the measurement process. Integrating temporal context information into the measurement process, referencing the idea of using temporal context for target detection and combining it with the motion continuity of targets in video sequences, improves measurement accuracy and stability. This is particularly true for the measurement of moving targets, as it better captures their dynamic changes and reduces measurement errors.
[0113] Expanding Application Scenarios: Exploring applications in dynamic scenarios, researching measurement methods when both the target and the camera are in motion, addressing scenarios such as drone tracking of moving targets and vehicle-mounted surveillance, and transcending the current limitations of focusing on static or relatively static target measurement. For multi-target measurement scenarios, developing technologies capable of simultaneously measuring the rotation angles and distances of multiple targets will address interference between targets and broaden the technology's application, such as in group target monitoring.
[0114] Optimize the correction factor calculation model: Consider more subtle factors in the imaging process, such as the propagation characteristics of light in complex media and higher-order aberrations of the lens, so that the correction factor can more comprehensively and accurately compensate for errors and raise the upper limit of measurement accuracy. Research more efficient attitude angle correction algorithms to improve the correction accuracy and real-time performance when the camera attitude changes rapidly, ensure the reliability of measurement results, and adapt to measurement needs such as those during rapid maneuvering of drones.
[0115] In actual optical systems, the errors caused by fisheye lenses or atmospheric refraction can be reduced by introducing optical transfer functions (OTFs) or polynomial distortion models.
[0116] In the above embodiment, without the need to introduce laser ranging or other methods, the correction factor is calculated only through the basic parameters of the image and the device. This improves the measurement accuracy compared to the method of converting through trigonometric functions, reduces errors caused by lens distortion, projection deformation or environmental factors, and also reduces hardware costs. On the other hand, when calculating the centering angle, conventional algorithms are usually based on simple trigonometric function transformations to determine the centering angle. However, during the shooting process, lens factors, focal length, magnification parameters, environmental influences, and the mutual influence of horizontal and vertical in three-dimensional stereo may cause errors in the rotation angle obtained by simple trigonometric transformation. Therefore, by utilizing the nonlinear characteristics of the inverse sine function, a correction factor is introduced to process the initial rotation angle, thereby reducing the errors caused by the above factors and improving the measurement accuracy.
[0117] Further, as Figure 1 or Figure 2 The specific implementation of the method shown in this embodiment provides a target measurement device, such as Figure 3 As shown, the device includes: an acquisition unit 301, a calculation unit 302 and a processing unit 303.
[0118] An acquisition unit 301 is configured to acquire a captured image, wherein the captured image includes a captured object;
[0119] a calculation unit 302 configured to determine device parameters and pixel coordinate differences, and calculate a correction factor using the device parameters and the pixel coordinate differences, wherein the device parameters are determined by a photographic device that photographs the image, and the pixel coordinate differences are determined based on the photographic image;
[0120] The processing unit 303 is configured to determine the target rotation angle using the correction factor and control the gimbal to adjust based on the target rotation angle.
[0121] In a specific application scenario, the calculation unit 302 is specifically configured to calculate the horizontal physical offset based on the horizontal dimension difference and the magnification; calculate the first intermediate variable parameter based on the horizontal physical offset and the focusing step, and the first intermediate variable parameter is used to correct the influence of the vertical dimension on the horizontal dimension; calculate the first correction factor based on the first intermediate variable parameter, and the first correction factor is the correction factor of the horizontal dimension.
[0122] In a specific application scenario, the calculation unit 302 is further configured to calculate the vertical physical offset based on the vertical dimension difference and the magnification; calculate the second intermediate variable parameter based on the vertical physical offset and the focusing step, and the second intermediate variable parameter is used to correct the influence of the horizontal dimension on the vertical dimension; calculate the second correction factor based on the second intermediate variable parameter, and the second correction factor is the correction factor of the vertical dimension.
[0123] In a specific application scenario, the processing unit 303 is further configured to calculate the initial rotation angle required to center the shooting target based on a trigonometric function relationship; use a correction factor to correct the initial rotation angle to obtain a target rotation angle, and control the gimbal to adjust based on the target rotation angle.
[0124] In a specific application scenario, the processing unit 303 is further configured to determine the distance to the shooting target based on the target rotation angle when a preset condition is met.
[0125] In a specific application scenario, the processing unit 303 is further configured to calculate the actual physical offset based on the pixel coordinate difference and the magnification, where the actual physical offset includes a horizontal physical offset or a vertical physical offset; and calculate the distance to the photographed target using a trigonometric function relationship based on the target rotation angle and the actual physical offset.
[0126] It should be noted that for other corresponding descriptions of the functional units involved in the target measurement device provided in this embodiment, please refer to Figure 1 or Figure 2 The corresponding description in will not be repeated here.
[0127] Based on the above Figure 1 or Figure 2The method shown in FIG. 1 is a method for performing the above-mentioned steps. Accordingly, this embodiment further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program can realize the above-mentioned steps. Figure 1 or Figure 2 The method shown.
[0128] Based on the above Figure 1 or Figure 2 The method shown in FIG. 1 is a method for performing the above-mentioned operations. Accordingly, this embodiment further provides a computer program product having a computer program stored thereon. When the computer program is executed by a processor, the above-mentioned Figure 1 or Figure 2 The method shown.
[0129] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present application.
[0130] Based on the above Figure 1 or Figure 2 The method shown, and Figure 3 In order to achieve the above-mentioned purpose, see the virtual device embodiment shown in FIG. Figure 4 The embodiment of the present application further provides an electronic device 400, which can be configured on a computer terminal, etc. The device includes a processor 401 and a memory 402 storing a storage medium; the processor 401 is used to execute a computer program to implement the above-mentioned Figure 1 or Figure 2 The method shown.
[0131] Optionally, the electronic device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a Wi-Fi module, and the like. The user interface may include a display, an input unit such as a keyboard, and the like. The user interface may also optionally include a USB interface, a card reader interface, and the like. The network interface may optionally include a standard wired interface, a wireless interface (such as a Wi-Fi interface), and the like.
[0132] Those skilled in the art will understand that the structure of the electronic device provided in this embodiment does not limit the electronic device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0133] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the physical device, supporting the execution of information processing programs and other software and / or programs. The network communication module is used to enable communication between components within the storage medium, as well as with other hardware and software within the physical information processing device.
[0134] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by means of hardware. By applying the solution of this embodiment, compared with related technologies, without the need to introduce methods such as laser ranging, the correction factor is calculated only by the basic parameters of the image and the device. This improves measurement accuracy compared to methods using trigonometric function conversion, reduces errors caused by lens distortion, projection deformation, or environmental factors, and also reduces hardware costs.
[0135] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a..." do not exclude the presence of other identical elements in the process, method, article or device that includes the elements.
[0136] The foregoing is merely a list of specific embodiments of the present application, intended to enable those skilled in the art to understand and implement the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments described herein, but is intended to conform to the broadest scope consistent with the principles and novel features of the present application.
Claims
1. A target measurement method, characterized in that: include: Acquire a captured image, wherein the captured image contains a captured object; determining device parameters and pixel coordinate differences, and calculating a correction factor using the device parameters and the pixel coordinate differences, wherein the device parameters are determined by a photographing device that photographs the photographed image, and the pixel coordinate differences are determined based on the photographed image; The correction factor is used to determine a target rotation angle, and the pan / tilt platform is controlled to adjust based on the target rotation angle.
2. The method according to claim 1, characterized in that The device parameters include a focus step and a magnification corresponding to the captured image, and the pixel coordinate difference is a coordinate difference of the captured target relative to a reference point.
3. The method according to claim 2, characterized in that The pixel coordinate difference includes a horizontal dimension difference and a vertical dimension difference; The determining of the device parameters and the pixel coordinate difference, and calculating the correction factor using the device parameters and the pixel coordinate difference, includes: Calculating a horizontal physical offset according to the horizontal dimension difference and the magnification; Calculating a first intermediate variable parameter based on the horizontal physical offset and the focusing step, where the first intermediate variable parameter is used to correct an influence of the vertical dimension on the horizontal dimension; A first correction factor is calculated based on the first intermediate variable parameter, where the first correction factor is a correction factor of the horizontal dimension.
4. The method according to claim 2, characterized in that The pixel coordinate difference includes a horizontal dimension difference and a vertical dimension difference; The determining of the device parameters and the pixel coordinate difference, and calculating the correction factor using the device parameters and the pixel coordinate difference, further includes: Calculating a vertical physical offset according to the vertical dimension difference and the magnification; Calculating a second intermediate variable parameter based on the vertical physical offset and the focusing step, wherein the second intermediate variable parameter is used to correct the influence of the horizontal dimension on the vertical dimension; A second correction factor is calculated based on the second intermediate variable parameter, where the second correction factor is a correction factor in the vertical dimension.
5. The method according to claim 1, wherein The method of determining a target rotation angle by using the correction factor and controlling the pan / tilt head to adjust based on the target rotation angle includes: Calculating the initial rotation angle required to center the shooting target according to a trigonometric function relationship; The initial rotation angle is corrected using the correction factor to obtain the target rotation angle, and the pan / tilt platform is controlled to adjust based on the target rotation angle.
6. The method according to claim 2, characterized in that After correcting the initial rotation angle using the correction factor to obtain a target rotation angle, and controlling the gimbal to adjust based on the target rotation angle, the method further includes: Under predetermined conditions, determining the distance to the photographed target based on the target rotation angle; The determining of the distance to the photographed target based on the target rotation angle under a preset condition includes: Calculating an actual physical offset based on the pixel coordinate difference and the magnification, where the actual physical offset includes the horizontal physical offset or the vertical physical offset; The distance to the shooting target is calculated using a trigonometric function relationship according to the target rotation angle and the actual physical offset.
7. A target measurement device, characterized in that: include: an acquisition unit configured to acquire a captured image, wherein the captured image includes a captured object; a calculation unit configured to determine a device parameter and a pixel coordinate difference, and calculate a correction factor using the device parameter and the pixel coordinate difference, wherein the device parameter is determined by a photographing device that photographs the photographed image, and the pixel coordinate difference is determined based on the photographed image; The processing unit is configured to determine a target rotation angle using the correction factor and control the gimbal to adjust based on the target rotation angle.
8. An electronic device comprising a memory storing a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Coordinate conversion method and device, electronic equipment and storage medium
CN117221730A
Perpendicular angle correction method and device, electronic equipment and storage medium
CN118052750A
High-precision alarm positioning method and device based on PTZ (Pan / Tilt / Zoom) camera calibration
CN119131150A
Target tracking method and device, and computer storage medium
WO2020258164A1
Gimbal target conversion control method, apparatus, device, and storage medium
WO2022134490A1
Cited By
Measurement apparatus and method for controlling the same
CN120740665A
Measuring apparatus and method of controlling the same
CN120740665B