Compensation calibration method and device for automatic focusing offset, equipment and medium
By obtaining and utilizing the position coordinates of the test image card in the camera device, calculating and applying the offset compensation strategy, the problem of cumbersome and inefficient automatic focus offset calibration is solved, and efficient offset compensation calibration is achieved.
Patent Information
- Application Number
- CN202411377808.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-14
AI Technical Summary
The prior art is complicated and cannot intuitively observe the offset compensation effect in the automatic focus offset calibration process, and the calibration efficiency is low.
By obtaining the position coordinates of the center of the image card and the center of the camera software marking the camera in the camera screen, adjusting the lens to the furthest and closest focal positions, the first and second offset compensation strategies are used to calculate the first and second offset compensation. And a third offset compensation for the current focal length is determined based on these compensations to calibrate the lens offset due to the influence of the magnetic field of the OIS device.
It realizes the offset compensation effect of intuitive and real-time feedback lens position and automatic focus, improving calibration efficiency and effect.
Smart Images

Figure CN119450215A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of automatic focusing technology, and in particular relates to a compensation calibration method, device, equipment and medium for automatic focusing offset. Background Art
[0002] With the popularization of terminal devices such as smart phones and tablets and users' increasing attention to the camera function, the camera module technology on terminal devices has developed rapidly. As the core component of imaging, the performance of the camera module directly determines the quality of photo and video recording. The ball motor, as an important component of the camera module, plays an important role in improving shooting effects and user experience.
[0003] In camera modules, ball motors are mainly used to implement auto focus (AF) and optical image stabilization (OIS) functions to reduce image blur caused by device shaking during shooting. The driving method of ball motor OIS is similar to that of AF motors. Both are based on the principle that the energized coil is subjected to Ampere force in a magnetic field. When current passes through the coil, a magnetic field is generated that interacts with the fixed magnetic field, thereby generating Ampere force to drive the ball to guide the carrier carrying the lens (Lens) to move along the motor axis. However, during the autofocus process of recording videos or taking photos, since the OIS and AF motors work simultaneously and each generates a magnetic field, the two magnetic fields may interfere with each other. This magnetic field interference will cause the Lens to not only focus and move along the optical axis, but also produce an offset perpendicular to the optical axis. Ideally, the OIS device should focus on detecting and compensating for the movement caused by device shaking to maintain the stability of the picture, but when the OIS device is interfered by the AF motor or other external force fields (such as magnetic fields), its anti-shake effect may be affected, and the picture may have an unexpected offset, thereby reducing the actual effectiveness of the OIS device.
[0004] In order to solve the above problems, the prior art usually adopts the method of printing the focus process log, and collects and analyzes the data in the log to determine whether the position of the Lens and the compensation data meet expectations, that is, whether the autofocus motor movement process is achieved, and the mutual influence between the OIS magnetic field and the focus motor magnetic field is compensated and eliminated. Although this method can solve the problem to a certain extent, it has many limitations. First, the accuracy of the print position data in the log needs to be verified, such as: the alignment problem of the timestamp of the print data and the actual corresponding position of the Lens (that is, time accuracy) needs to be taken into consideration, which makes the log analysis process cumbersome and complicated, not intuitive and convenient enough; secondly, data analysis takes a certain amount of time and cannot reflect the problem in real time; finally, for unexpected situations, the compensation data needs to be repeatedly adjusted and re-analyzed, which is inefficient. Therefore, a new calibration scheme is urgently needed to solve the above problems. Summary of the invention
[0005] The purpose of the present invention is to provide a compensation calibration method, device, equipment and medium for automatic focus offset, aiming to solve the problems that the offset calibration process is cumbersome and the offset compensation effect cannot be intuitively observed due to the prior art, and the calibration efficiency is low.
[0006] In one aspect, the present invention provides a compensation calibration method for auto focus offset, the method comprising the following steps:
[0007] Obtaining the position coordinates of the test card circle center in the camera image of the camera device when the center of the card circle coincides with the center of the camera software mark circle, and setting the position coordinates as the initial position coordinates of the center of the card circle;
[0008] The lens of the camera device is adjusted to the farthest focal position within the physical movement range of the camera module of the camera device, and based on the initial position coordinates, a first offset compensation between the center of the camera software mark and the center of the chart card is calculated using an offset compensation strategy at the farthest focal position;
[0009] The lens is adjusted to the closest focus position within the physical movement range, and based on the initial position coordinates, the offset compensation strategy is used to calculate a second offset compensation between the center of the camera software mark and the center of the chart at the closest focus position;
[0010] Based on the first and second offset compensations, a third offset compensation corresponding to the current focal length of the camera device is determined, and the third offset compensation is used to calibrate the offset of the lens in the direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device on the current focal length of the camera device.
[0011] Preferably, based on the initial position coordinates, the step of using an offset compensation strategy to calculate a first offset compensation between the center of the camera software mark and the center of the chart at the farthest focus position comprises:
[0012] Acquire the position coordinates of the center of the circle of the chart card in the camera image at the farthest focus position to obtain the first position coordinates of the center of the circle of the chart card;
[0013] Calculating the number of offset pixels between the center of the camera software mark and the center of the chart card at the farthest focus position according to the initial position coordinates and the first position coordinates;
[0014] According to the offset pixel number, a compensation code value for offset compensation of the OIS device in the camera device is calculated, and the calculated compensation code value is used as the first offset compensation to perform offset compensation calibration on the autofocus process performed by the camera device at the farthest focus position.
[0015] Preferably, the offset pixel number includes an x-axis offset pixel number and a y-axis offset pixel number, and the step of calculating the offset pixel number between the center of the camera software mark and the center of the chart card at the farthest focus position according to the initial position coordinates and the far focus position coordinates comprises:
[0016] Use the offset pixel calculation formula and Calculate the x-axis offset pixel number and y-axis offset pixel number between the center of the camera software mark circle and the center of the chart circle at the farthest focus position, where (X0, Y0) is the initial position coordinate, (X1, Y1) is the first position coordinate, and X pixels_total is the total number of pixels on the X axis, X screen_boundary is the X-axis screen boundary coordinate value, X pixels_drift is the number of pixels offset on the x-axis, pixels_total is the total number of pixels on the Y axis, Y screen_boundary Y is the screen boundary coordinate value on the Y axis. pixels_drift The number of pixels to offset the y axis.
[0017] Preferably, the compensation code value includes an x-axis compensation code value and a y-axis compensation code value, and the step of calculating the compensation code value for offset compensation of the OIS device in the camera device according to the offset pixel number includes:
[0018] Using the code value compensation calculation formula and The x-axis compensation code value and the y-axis compensation code value for offset compensation of the OIS device in the camera device are calculated respectively, wherein x code_drift is the x-axis compensation code value, Ycode_drift is the y-axis compensation code value, Max code is the maximum code value used by the camera device to represent position or displacement, X s_total is the total travel of the X axis, Y s_total is the total Y-axis travel, and α is the single pixel size of the camera sensor of the camera device.
[0019] Preferably, the step of determining a third offset compensation corresponding to the current focal length of the camera device based on the first and second offset compensations includes:
[0020] According to the current focal length of the camera device, the first offset compensation and the second offset compensation are interpolated to obtain the third offset compensation.
[0021] In another aspect, the present invention provides a compensation calibration device for automatic focus offset, the device comprising:
[0022] An initial position obtaining unit, used for obtaining the position coordinates when the center of the test card circle of the camera device coincides with the center of the camera software mark circle, and setting the position coordinates as the initial position coordinates of the center of the test card circle;
[0023] A first compensation calculation unit is used to adjust the lens of the camera device to the farthest focal position within the physical movement range of the camera module of the camera device, and to calculate, based on the initial position coordinates, a first offset compensation between the center of the camera software mark and the center of the chart card at the farthest focal position by adopting an offset compensation strategy;
[0024] A second compensation calculation unit is used to adjust the lens to the closest focus position within the physical movement range, and based on the initial position coordinates, use the offset compensation strategy to calculate a second offset compensation between the center of the camera software mark and the center of the chart at the closest focus position;
[0025] An autofocus calibration unit is used to determine a third offset compensation corresponding to the current focal length of the camera device based on the first and second offset compensations, and use the third offset compensation to calibrate the offset of the lens in a direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device on the current focal length of the camera device.
[0026] Preferably, the first compensation calculation unit includes:
[0027] A far-focus coordinate obtaining unit, used to obtain the position coordinates of the center of the chart card in the camera image at the farthest focus position, and obtain the first position coordinates of the center of the chart card;
[0028] An offset pixel calculation unit, used for calculating the number of offset pixels between the center of the camera software mark and the center of the chart card at the farthest focus position according to the initial position coordinates and the first position coordinates;
[0029] A code value calculation unit is used to calculate a compensation code value for offset compensation of the OIS device in the camera device according to the number of offset pixels, and use the calculated compensation code value as the first offset compensation to perform offset compensation calibration on the autofocus process performed by the camera device at the farthest focus position.
[0030] Preferably, the offset pixel number includes an x-axis offset pixel number and a y-axis offset pixel number, and the offset pixel calculation unit includes:
[0031] Pixel number calculation subunit, used to use the offset pixel calculation formula and Calculate the x-axis offset pixel number and y-axis offset pixel number between the center of the camera software mark circle and the center of the chart circle at the farthest focus position, where (X0, Y0) is the initial position coordinate, (X1, Y1) is the first position coordinate, and X pixels_total is the total number of pixels on the X axis, X screen_boundary is the X-axis screen boundary coordinate value, X pixels_drift is the number of pixels offset on the x-axis, pixels_total is the total number of pixels on the Y axis, Y screen_boundary Y is the screen boundary coordinate value on the Y axis. pixels_drift The number of pixels to offset the y axis.
[0032] On the other hand, the present invention also provides a camera device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps described in the above-mentioned method for compensating and calibrating autofocus offset are implemented.
[0033] On the other hand, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps described in the above-mentioned compensation calibration method for automatic focus offset are implemented.
[0034] The present invention first obtains the position coordinates of a test chart card in a camera image when the center of the chart card coincides with the center of a camera software mark, sets the position coordinates as the initial position coordinates of the center of the chart card, and then adjusts the lens of the camera device to the farthest focal position within the physical movement range of its camera module, and based on the initial position coordinates, adopts an offset compensation strategy to calculate a first offset compensation between the center of the camera software mark and the center of the chart card at the farthest focal position, and then adjusts the lens to the closest focal position within the physical movement range, and based on the initial position coordinates, adopts an offset compensation strategy to calculate a second offset compensation between the center of the camera software mark and the center of the chart card at the closest focal position, and finally, based on the first and second offset compensations, determines a third offset compensation corresponding to the current focal length of the camera device, and uses the third offset compensation to perform an offset calibration of the lens in a direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device on the current focal length of the camera device, thereby achieving intuitive and real-time feedback of the lens position and the offset compensation effect of autofocus, and improving the calibration efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is a flow chart of an implementation method for automatic focus offset compensation calibration provided by the first embodiment of the present invention;
[0036] Figure 2 This is a schematic diagram of the display when the camera device provided in the first embodiment of the present invention shoots a test picture card;
[0037] Figure 3 is a schematic structural diagram of a compensation calibration device for automatic focus offset provided by Embodiment 2 of the present invention;
[0038] Figure 4 1 is a schematic diagram of a preferred structure of a compensation calibration device for automatic focus offset provided in Embodiment 2 of the present invention;
[0039] Figure 5 It is a structural diagram of a camera device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0041] It should be understood that the terms "first", "second", etc. in the present invention are used to distinguish between identical items or similar items with basically the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on quantity and execution order, unless otherwise specified.
[0042] The specific implementation of the present invention is described in detail below in conjunction with specific embodiments:
[0043] Embodiment 1:
[0044] Figure 1 The implementation process of the compensation calibration method for automatic focus offset provided by the first embodiment of the present invention is shown. For the convenience of description, only the part related to the embodiment of the present invention is shown, which is described in detail as follows:
[0045] In step S101, the position coordinates of the test card circle center in the camera image of the camera device when the card circle center coincides with the camera software mark circle center are obtained, and the position coordinates are set as the initial position coordinates of the card circle center.
[0046] The embodiment of the present invention is applicable to a camera device, such as a camera, having a ball motor and a camera sensor. In the embodiment of the present invention, the position where the screen center coordinates of the camera device are located is used as the center of the circle marked by the camera software of the camera device, and the center of the circle marked by the camera software is used as the center point. A fixed circle of a preset size is added to the camera screen of the camera device using relevant software to serve as a reference for observing the focus offset, so that the relative position offset can be observed intuitively in the camera screen, and a test chart (such as ISO 12233 chart) is prepared to ensure that there is a clear circle on it, and the center point of the circle is the center of the circle card of the test chart. The camera application of the camera device is entered, and the test chart is used as the shooting object. The position and distance of the camera device are adjusted so that the circle on the test chart coincides with the fixed circle in the camera screen, that is, the center of the circle card is completely aligned with the center of the circle marked by the camera software (such as ISO 12233 chart). Figure 2 (a) shows), at this time, the camera device is fixed (such as using a tripod to fix the camera device) to ensure stability during subsequent operations, and the position coordinates of the position where the two circle centers coincide are obtained, and the position coordinates are used as the initial position coordinates of the center of the chart card circle for subsequent calculation of the offset, and the initial position coordinates are represented as (X0, Y0).
[0047] In step S102, the lens of the camera device is adjusted to the farthest focus position within the physical movement range of the camera module of the camera device, and based on the initial position coordinates, an offset compensation strategy is used to calculate the first offset compensation between the center of the camera software mark and the center of the chart at the farthest focus position.
[0048] In the embodiments of the present invention, the physical movement range refers to the range within which the lens of a camera device can physically move within the camera module (such as a lens barrel) of the device (this depends on the physical structure and design of the lens), and the farthest / closest focus position of the physical movement range is the farthest or closest point that the lens can reach within the lens barrel. For a camera device that uses a ball motor to drive the lens, here, in the professional mode of the camera application, manual focus (MF) is used to control the ball motor of the camera device to adjust the lens of the camera device to the farthest focus position (such as the closest point) that it can reach within the lens barrel. Figure 2 (b), the focus ring is at the far left end). When the lens is at this position, for the center of the camera software mark circle and the center of the chart card displayed in the camera image, if the two centers are not aligned at this time, it means that focus offset has occurred. In this case, an offset compensation strategy is used to calculate the offset compensation data between the two centers at this time. The offset compensation data includes an offset direction and an offset distance. For the sake of ease of description and distinction, the offset compensation data calculated when the lens is at the farthest focus position is referred to as the first offset compensation (also referred to as the far focus offset compensation).
[0049] In a feasible embodiment, the calculation of the first offset compensation is implemented by the following steps:
[0050] (1) Obtaining the position coordinates of the center of the chart circle in the camera image when the chart circle is at the farthest focus position, and obtaining the first position coordinates of the center of the chart circle;
[0051] In the embodiment of the present invention, Figure 2 As shown in (b), when the lens is at the farthest end of the movable range (i.e., the farthest focus position), the position coordinates of the center of the chart card in the camera image are obtained. For the convenience of description and distinction, the obtained position coordinates are used as the first position coordinates of the center of the chart card (also called the far focus position coordinates), and the far focus position coordinates are expressed as (X1, Y1).
[0052] (2) Calculating the number of pixels offset between the center of the camera software mark and the center of the chart at the farthest focus position based on the initial position coordinates and the first position coordinates;
[0053] In an embodiment of the present invention, the number of offset pixels between the center of the camera software mark and the center of the chart card is determined by calculating the coordinate difference between the initial position coordinates and the far-focus position coordinates. Based on this, the number of offset pixels includes the number of x-axis offset pixels (i.e., the number of pixels that need to be supplemented in the X-axis direction) and the number of y-axis offset pixels (i.e., the number of pixels that need to be supplemented in the Y-axis direction). In addition, the positive or negative value of the offset pixel number is determined by the positive or negative value of the coordinate difference, and the direction of the offset (left, right, up, or down) can be determined by the positive or negative value of the offset pixel number.
[0054] In a feasible embodiment, the offset pixel calculation formula is adopted and Calculate the x-axis offset pixel number and y-axis offset pixel number between the camera software mark circle center and the chart circle center at the farthest focus position, where (X0, Y0) is the initial position coordinate, (X1, Y1) is the far focus position coordinate, and X pixels_total is the total number of pixels on the X axis (i.e., the total number of pixels along the horizontal direction (X axis) of the image formed by the camera device. This value is crucial to the resolution and clarity of the image). screen_boundary is the X-axis screen boundary coordinate value (i.e. the leftmost or rightmost coordinate value on the horizontal direction (X-axis) of the camera device's screen. Here, the positive and rightmost coordinate value is taken as the X screen_boundary ), X pixels_drift is the number of pixels offset on the x-axis, pixels_total is the total number of pixels on the Y axis, Y screen_boundary The Y-axis screen boundary coordinate value (i.e., the top or bottom coordinate value on the vertical direction (Y-axis) of the camera device's screen. Here, the positive, top coordinate value is taken as the Y screen_boundary ), Y pixels_drift The number of pixels offset on the y-axis is increased to improve the accuracy of the offset pixel number.
[0055] (3) Calculating a compensation code value for offset compensation of an OIS device in a camera device based on the number of offset pixels, and using the calculated compensation code value as a first offset compensation for offset compensation calibration of an autofocus process of the camera device at the farthest focus position.
[0056] In an embodiment of the present invention, the offset pixel number is converted into an instruction that can be understood and executed by the OIS device in the camera device, namely, a compensation code value, according to a preset code value conversion strategy. For the convenience of description and distinction, the compensation code value converted at the farthest focal position of the lens is used as the first offset compensation (also called far-focus offset compensation), so as to control the OIS device to perform offset compensation through the far-focus offset compensation, thereby compensating for the picture offset or picture jitter that may occur during the autofocus process of the lens at the far-focus focal length during actual shooting.
[0057] In a feasible embodiment, when calculating the compensation code value for offset compensation of the OIS device in the camera device according to the number of offset pixels, the compensation code value corresponding to the number of offset pixels includes an x-axis compensation code value and a y-axis compensation code value. Here, the code value compensation calculation formula is adopted: and The x-axis compensation code value and the y-axis compensation code value for offset compensation of the OIS device in the camera device are calculated respectively, where X code_drift is the x-axis compensation code value, Y code_drift is the y-axis compensation code value, Maxcode X is the maximum code value used by the camera device to represent position or displacement. s_total is the total travel of the X axis, Y s_total is the total Y-axis travel, and α is the single pixel size of the camera sensor of the camera device.
[0058] In the embodiment of the present invention, the single pixel size of the camera sensor is its minimum unit size (usually a square). Camera sensors of different specifications have different single pixel sizes. For example, some are 1um (micrometer), some are 0.8um, and some are 2um. Here, the single pixel size can be obtained from the camera sensor specification. The total stroke of the X-axis and Y-axis usually refers to the maximum range in which the mechanical structure can move in the X-axis and Y-axis directions. This range is usually measured in physical units (such as millimeters, micrometers, etc.). The total stroke of the X-axis and Y-axis can usually be obtained from the supplier of the camera device or the information marked in its specification. In addition, the numerical range used by the camera device to indicate the position or displacement is called the code value range (i.e., Code range). The Code range can be expressed as [-Max code ,+Max code ], for the calculation of the compensation code value, as an example, when the Code range of the camera device's lens is from -8191 to +8191, the single pixel area (pixel size) of its camera sensor is 1um), that is, each pixel corresponds to an actual size of 1 micron, and the total travel of the X-axis and Y-axis is 200um and 150um respectively, then for the X-axis, the Code value change corresponding to each micron of movement is (code / um), for the Y axis, the code value change corresponding to each micron of movement is (code / um), then calculate the x-axis compensation code value and the y-axis compensation code value according to the code value compensation calculation formula, that is, By X code_drift and Y code_drift Control the lens or sensor to move the corresponding distance to compensate for the pixel offset on the X and Y axes, where X code_drift and Y code_drift The unit is code.
[0059] In step S103, the lens is adjusted to the closest focus position within the physical movement range, and based on the initial position coordinates, an offset compensation strategy is used to calculate a second offset compensation between the center of the camera software mark and the center of the chart at the closest focus position.
[0060] In the embodiment of the present invention, in the professional mode of the camera application, the ball motor of the camera device is controlled by MF to adjust the lens of the camera device to the closest focus position that can be reached in the lens barrel (such as Figure 2 (c), the focus ring is at the rightmost end). When the lens is at this position, for the center of the camera software mark circle and the center of the chart card displayed in the camera image, if the two centers are not aligned at this time, it means that focus offset has occurred. Then, an offset compensation strategy is used to calculate the offset compensation data between the two centers at this time. For the convenience of description and distinction, the offset compensation data calculated when the lens is at the closest focus position is called the second offset compensation (also called the near focus offset compensation). The implementation principle and calculation process of the second offset compensation are similar to those of the first offset compensation. Therefore, the specific implementation of step S103 can refer to the description of step S102 and will not be repeated here.
[0061] In step S104, a third offset compensation corresponding to the current focal length of the camera device is determined based on the first and second offset compensations, and the third offset compensation is used to calibrate the offset of the lens in the direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device on the current focal length of the camera device.
[0062] In the embodiment of the present invention, when the lens of the camera device is at any intermediate position within its physical movement range (such as Figure 2 As shown in (d), when the focus ring is at any middle position at this time), the current offset compensation (i.e., the third offset compensation) corresponding to the current focal length is dynamically calculated according to the current focal length (i.e., the current physical position of the lens), the far focus offset compensation for compensating for the optical errors that may be generated during the autofocus process of the lens at the far focus focal length during actual shooting, and the near focus offset compensation for compensating for the optical errors that may be generated during the autofocus process of the lens at the near focus focal length during actual shooting. In the AF mode, the calculated current offset compensation including the direction and distance of the offset is used to perform offset compensation on the OIS device of the camera device to compensate for or eliminate the image offset caused by external factors (such as hand shaking) to the greatest extent. The effect diagram after compensation is as shown in FIG. Figure 2 As shown in (e), it can be seen from the calibration reference image that after the offset compensation calibration, the center of the chart card and the center of the camera software mark are coincident at any position in the middle focal length range, indicating that the compensation is effective, thereby realizing the offset compensation calibration of the autofocus process of the camera device in any middle focal length range. This focal length-based calibration ensures the best image stabilization effect under different shooting conditions and improves the overall shooting performance of the camera device.
[0063] In a feasible embodiment, when determining the third offset compensation corresponding to the current focal length of the camera device based on the first and second offset compensations, the first offset compensation and the second offset compensation are interpolated according to the current focal length of the camera device to obtain the third offset compensation, thereby improving the accuracy and reliability of the third offset compensation.
[0064] In an embodiment of the present invention, the position coordinates of the test chart in the camera image of the camera device when the center of the chart card coincides with the center of the camera software mark are first obtained, and the position coordinates are set as the initial position coordinates of the center of the chart card. Then, the lens of the camera device is adjusted to the farthest focal position within the physical movement range of its camera module. Based on the initial position coordinates, an offset compensation strategy is used to calculate the first offset compensation between the center of the camera software mark and the center of the chart card at the farthest focal position. Then, the lens is adjusted to the closest focal position within the physical movement range. Based on the initial position coordinates, an offset compensation strategy is used to calculate the second offset compensation between the center of the camera software mark and the center of the chart card at the closest focal position. Finally, based on the first and second offset compensations, a third offset compensation corresponding to the current focal length of the camera device is determined. Using the third offset compensation, the current focal length of the camera device is calibrated for the offset of the lens in the direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device, thereby achieving intuitive and real-time feedback of the lens position and the offset compensation effect of autofocus, thereby improving the calibration efficiency and effect.
[0065] Embodiment 2:
[0066] Figure 3 The structure of the compensation calibration device for automatic focus offset provided by the second embodiment of the present invention is shown. For the convenience of description, only the part related to the embodiment of the present invention is shown, including:
[0067] The initial position obtaining unit 31 is used to obtain the position coordinates when the center of the test card circle in the camera image of the camera device coincides with the center of the camera software mark circle, and set the position coordinates as the initial position coordinates of the center of the card circle;
[0068] A first compensation calculation unit 32 is used to adjust the lens of the camera device to the farthest focal position within the physical movement range of the camera module of the camera device, and to calculate the first offset compensation between the center of the camera software mark and the center of the chart at the farthest focal position by using an offset compensation strategy based on the initial position coordinates;
[0069] A second compensation calculation unit 33 is used to adjust the lens to the closest focus position within the physical movement range, and based on the initial position coordinates, use an offset compensation strategy to calculate a second offset compensation between the center of the camera software mark and the center of the chart at the closest focus position;
[0070] The autofocus calibration unit 34 is used to determine the third offset compensation corresponding to the current focal length of the camera device based on the first and second offset compensations, and use the third offset compensation to calibrate the offset of the lens in the direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device on the current focal length of the camera device.
[0071] Preferably, if Figure 4 As shown, the first compensation calculation unit 32 includes:
[0072] A far-focus coordinate obtaining unit 321 is used to obtain the position coordinates of the center of the chart card in the camera image when the chart card is at the farthest focus position, and obtain the first position coordinates of the center of the chart card;
[0073] The offset pixel calculation unit 322 is used to calculate the number of offset pixels between the center of the camera software mark and the center of the chart at the farthest focus position according to the initial position coordinates and the first position coordinates;
[0074] The code value calculation unit 323 is used to calculate the compensation code value for offset compensation of the OIS device in the camera device according to the number of offset pixels, and use the calculated compensation code value as the first offset compensation to calibrate the offset compensation of the autofocus process performed by the camera device at the farthest focus position.
[0075] Preferably, the offset pixel number includes an x-axis offset pixel number and a y-axis offset pixel number, and the offset pixel calculation unit includes 322:
[0076] Pixel number calculation subunit, used to use the offset pixel calculation formula and Calculate the x-axis offset pixel number and y-axis offset pixel number between the camera software mark circle center and the chart circle center at the farthest focus position, where (X0, Y0) is the initial position coordinate, (X1, Y1) is the first position coordinate, and X pixels_total is the total number of pixels on the X axis, X screen_boundary is the X-axis screen boundary coordinate value, X pixels_drift is the number of pixels offset on the x-axis, pixels_total is the total number of pixels on the Y axis, Y screen_boundary Y is the screen boundary coordinate value on the Y axis. pixels_drift The number of pixels to offset the y axis.
[0077] Preferably, the compensation code value includes an x-axis compensation code value and a y-axis compensation code value, and the code value calculation unit 323 includes:
[0078] Code value calculation subunit, used to use code value compensation calculation formula and The x-axis compensation code value and the y-axis compensation code value for offset compensation of the OIS device in the camera device are calculated respectively, where X code_drift is the x-axis compensation code value, Y code_drift is the y-axis compensation code value, Max code X is the maximum code value used by the camera device to represent position or displacement. s_total is the total travel of the X axis, Y s_total is the total Y-axis travel, and α is the single pixel size of the camera sensor of the camera device.
[0079] Preferably, the automatic focus calibration unit 34 comprises:
[0080] The data interpolation calculation unit is used to perform interpolation calculation on the first offset compensation and the second offset compensation according to the current focal length of the camera device to obtain a third offset compensation.
[0081] In the embodiment of the present invention, each unit of the compensation calibration device for automatic focus offset can be implemented by a corresponding hardware or software unit, and each unit can be an independent software or hardware unit, or can be integrated into a software or hardware unit, which is not intended to limit the present invention. Specifically, the implementation of each unit can refer to the description of the aforementioned embodiment 1, which will not be repeated here.
[0082] Embodiment three:
[0083] Figure 5 The structure of the camera device provided in the third embodiment of the present invention is shown. For the convenience of description, only the part related to the embodiment of the present invention is shown.
[0084] The camera device 5 of the embodiment of the present invention includes a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50. When the processor 50 executes the computer program 52, the steps in the above-mentioned embodiment of the compensation calibration method for automatic focus offset are implemented, for example Figure 1 Alternatively, when the processor 50 executes the computer program 52, the functions of each unit in the above-mentioned device embodiments are realized, for example Figure 3 Function of the unit shown.
[0085] In an embodiment of the present invention, the position coordinates of the test chart in the camera image of the camera device when the center of the chart card coincides with the center of the camera software mark are first obtained, and the position coordinates are set as the initial position coordinates of the center of the chart card. Then, the lens of the camera device is adjusted to the farthest focal position within the physical movement range of its camera module. Based on the initial position coordinates, an offset compensation strategy is used to calculate the first offset compensation between the center of the camera software mark and the center of the chart card at the farthest focal position. Then, the lens is adjusted to the closest focal position within the physical movement range. Based on the initial position coordinates, an offset compensation strategy is used to calculate the second offset compensation between the center of the camera software mark and the center of the chart card at the closest focal position. Finally, based on the first and second offset compensations, a third offset compensation corresponding to the current focal length of the camera device is determined. Using the third offset compensation, the current focal length of the camera device is calibrated for the offset of the lens in the direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device, thereby achieving intuitive and real-time feedback of the offset compensation effect of the lens position and autofocus, and improving the calibration efficiency.
[0086] The camera device of the embodiment of the present invention may be a camera. The steps implemented when the processor 50 in the camera device 5 executes the computer program 52 to implement the compensation calibration method for automatic focus offset can refer to the description of the aforementioned method embodiment, which will not be repeated here.
[0087] Embodiment 4:
[0088] In an embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned embodiment of the compensation calibration method for automatic focus offset are implemented, for example, Figure 1 Alternatively, when the computer program is executed by a processor, the functions of each unit in the above-mentioned device embodiments are realized, for example Figure 3 Function of the unit shown.
[0089] In an embodiment of the present invention, the position coordinates of the test chart in the camera image of the camera device when the center of the chart card coincides with the center of the camera software mark are first obtained, and the position coordinates are set as the initial position coordinates of the center of the chart card. Then, the lens of the camera device is adjusted to the farthest focal position within the physical movement range of its camera module. Based on the initial position coordinates, an offset compensation strategy is used to calculate the first offset compensation between the center of the camera software mark and the center of the chart card at the farthest focal position. Then, the lens is adjusted to the closest focal position within the physical movement range. Based on the initial position coordinates, an offset compensation strategy is used to calculate the second offset compensation between the center of the camera software mark and the center of the chart card at the closest focal position. Finally, based on the first and second offset compensations, a third offset compensation corresponding to the current focal length of the camera device is determined. Using the third offset compensation, the current focal length of the camera device is calibrated for the offset of the lens in the direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device, thereby achieving intuitive and real-time feedback of the offset compensation effect of the lens position and autofocus, and improving the calibration efficiency.
[0090] The computer-readable storage medium of the embodiment of the present invention may include any entity or device or recording medium capable of carrying computer program code, for example, ROM / RAM, magnetic disk, optical disk, flash memory and other memories.
[0091] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A compensation calibration method for auto focus offset, characterized in that: The method comprises the following steps: Obtaining the position coordinates of the test card circle center in the camera image of the camera device when the center of the card circle coincides with the center of the camera software mark circle, and setting the position coordinates as the initial position coordinates of the center of the card circle; The lens of the camera device is adjusted to the farthest focal position within the physical movement range of the camera module of the camera device, and based on the initial position coordinates, a first offset compensation between the center of the camera software mark and the center of the chart card is calculated using an offset compensation strategy at the farthest focal position; The lens is adjusted to the closest focus position within the physical movement range, and based on the initial position coordinates, the offset compensation strategy is used to calculate a second offset compensation between the center of the camera software mark and the center of the chart at the closest focus position; Based on the first and second offset compensations, a third offset compensation corresponding to the current focal length of the camera device is determined, and the third offset compensation is used to calibrate the offset of the lens in the direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device on the current focal length of the camera device.
2. The method according to claim 1, characterized in that The step of calculating the first offset compensation between the center of the camera software mark and the center of the chart card at the farthest focus position by using an offset compensation strategy based on the initial position coordinates includes: Acquire the position coordinates of the center of the circle of the chart card in the camera image at the farthest focus position to obtain the first position coordinates of the center of the circle of the chart card; Calculating the number of offset pixels between the center of the camera software mark and the center of the chart card at the farthest focus position according to the initial position coordinates and the first position coordinates; According to the offset pixel number, a compensation code value for offset compensation of the OIS device in the camera device is calculated, and the calculated compensation code value is used as the first offset compensation to perform offset compensation calibration on the autofocus process performed by the camera device at the farthest focus position.
3. The method according to claim 2, characterized in that The offset pixel number includes an x-axis offset pixel number and a y-axis offset pixel number. The step of calculating the offset pixel number between the center of the camera software mark and the center of the chart card at the farthest focus position according to the initial position coordinates and the first position coordinates includes: Use the offset pixel calculation formula and Calculate the x-axis offset pixel number and y-axis offset pixel number between the center of the camera software mark circle and the center of the chart circle at the farthest focus position, where (X0, Y0) is the initial position coordinate, (X1, Y1) is the first position coordinate, and X pixels_total is the total number of pixels on the X axis, X screen_boundary is the X-axis screen boundary coordinate value, X pixels_drift is the number of pixels offset on the x-axis, pixels_total is the total number of pixels on the Y axis, Y screen_boundary Y is the screen boundary coordinate value on the Y axis. pixels_drift The number of pixels to offset the y axis.
4. The method according to claim 3, characterized in that The compensation code value includes an x-axis compensation code value and a y-axis compensation code value. According to the offset pixel number, the step of calculating the compensation code value for offset compensation of the OIS device in the camera device includes: Using the code value compensation calculation formula and The x-axis compensation code value and the y-axis compensation code value for offset compensation of the OIS device in the camera device are calculated respectively, wherein x code_drift is the x-axis compensation code value, Y code_drift is the y-axis compensation code value, Max code is the maximum code value used by the camera device to represent position or displacement, X s_total is the total travel of the X axis, Y s_total is the total Y-axis travel, and α is the single pixel size of the camera sensor of the camera device.
5. The method according to claim 1, characterized in that The step of determining a third offset compensation corresponding to the current focal length of the camera device based on the first and second offset compensations includes: According to the current focal length of the camera device, the first offset compensation and the second offset compensation are interpolated to obtain the third offset compensation.
6. A compensation calibration device for automatic focus offset, characterized in that: The device comprises: An initial position obtaining unit, used for obtaining the position coordinates when the center of the test card circle of the camera device coincides with the center of the camera software mark circle, and setting the position coordinates as the initial position coordinates of the center of the test card circle; A first compensation calculation unit is used to adjust the lens of the camera device to the farthest focal position within the physical movement range of the camera module of the camera device, and to calculate, based on the initial position coordinates, a first offset compensation between the center of the camera software mark and the center of the chart card at the farthest focal position by adopting an offset compensation strategy; A second compensation calculation unit is used to adjust the lens to the closest focus position within the physical movement range, and based on the initial position coordinates, use the offset compensation strategy to calculate a second offset compensation between the center of the camera software mark and the center of the chart at the closest focus position; An autofocus calibration unit is used to determine a third offset compensation corresponding to the current focal length of the camera device based on the first and second offset compensations, and use the third offset compensation to calibrate the offset of the lens in a direction perpendicular to the optical axis due to the influence of the magnetic field of the OIS device on the current focal length of the camera device.
7. The device according to claim 6, characterized in that The first compensation calculation unit comprises: A far-focus coordinate obtaining unit, used to obtain the position coordinates of the center of the chart card in the camera image at the farthest focus position, and obtain the first position coordinates of the center of the chart card; An offset pixel calculation unit, used for calculating the number of offset pixels between the center of the camera software mark and the center of the chart card at the farthest focus position according to the initial position coordinates and the first position coordinates; A code value calculation unit is used to calculate a compensation code value for offset compensation of the OIS device in the camera device according to the number of offset pixels, and use the calculated compensation code value as the first offset compensation to perform offset compensation calibration on the autofocus process performed by the camera device at the farthest focus position.
8. The device according to claim 7, characterized in that The offset pixel number includes an x-axis offset pixel number and a y-axis offset pixel number, and the offset pixel calculation unit includes: Pixel number calculation subunit, used to use the offset pixel calculation formula and Calculate the x-axis offset pixel number and y-axis offset pixel number between the center of the camera software mark circle and the center of the chart circle at the farthest focus position, where (X0, Y0) is the initial position coordinate, (X1, Y1) is the first position coordinate, and X pixels_total is the total number of pixels on the X axis, X screen_boundary is the X-axis screen boundary coordinate value, X pixels_drift is the number of pixels offset on the x-axis, pixels_total is the total number of pixels on the Y axis, Y screen_boundary Y is the screen boundary coordinate value on the Y axis. pixels_drift The number of pixels to offset the y axis.
9. A camera 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 computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Cited By
Ball motor driving method
CN120050522A