Two-stage focusing calibration method and device based on resolution function and storage medium

Through a two-stage focus calibration method based on the resolution function, the resolution and step distance of the camera's focus calibration position are calculated, and the focus calibration function is calculated based on the temperature data, which solves the problem of insufficient accuracy of the camera's focus calibration parameters, and achieves high-precision and high-reliability focus calibration.

CN119941865APending Publication Date: 2025-05-06SHENZHEN KANDAO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411997732.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

The prior art is difficult to improve the accuracy of camera focus calibration parameters, affecting the speed and accuracy of the autofocus system.

Method used

Using a two-stage focus calibration method based on the resolution function, the corresponding resolution is calculated by obtaining multiple step distances of the focus calibration position, and the target step range and the second step distance are determined based on the resolution, and the focus calibration function is calculated based on the temperature data to achieve high-precision focus calibration.

Benefits of technology

Improves the accuracy and reliability of camera focus calibration, ensures the image sharpness to the best state, and enhances the efficiency and quality of the autofocus system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119941865A_ABST
    Figure CN119941865A_ABST
Patent Text Reader

Abstract

The invention provides a two-stage focusing calibration method and device based on a resolution function and a storage medium, and the method employs a resolution extraction mode to calculate a first resolution corresponding to a first stepping distance, determines a target stepping range of each focusing calibration position according to the first resolution, and provides guidance for further focusing adjustment. And the second stepping distance is further extracted in the target stepping range, so that the camera can perform fine-tuning focusing calibration in a smaller range, and the accuracy of focusing calibration is improved. By calculating the second resolution corresponding to the second stepping distance, the focusing effect can be evaluated and adjusted more meticulously, and it is ensured that the image definition reaches the optimal state. And the first temperature data and the second resolution are combined to calculate a focusing calibration function, so that an accurate focusing basis is provided for each focusing calibration position, and high-precision and high-reliability focusing calibration is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of camera calibration, and in particular to a two-level focus calibration method, device and storage medium based on a resolution function. Background Art

[0002] Camera calibration is an important foundation in the field of photogrammetry and computer vision. It involves using known reference objects (such as calibration plates) to determine the intrinsic and extrinsic parameters of the camera, as well as the distortion parameters of the lens. This process is crucial for tasks such as image measurement, machine vision applications, and 3D reconstruction. The purpose of camera calibration is to establish a geometric model of camera imaging so that points in the 3D world can be accurately mapped to the 2D image plane.

[0003] The core purpose of focus calibration is to determine the optimal focal length of the camera at different shooting distances, so as to achieve fast and accurate focus in the autofocus system.

[0004] Therefore, how to improve the accuracy of camera focus calibration parameters has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The present application provides a two-level focus calibration method, device and storage medium based on a resolution function, aiming to improve the accuracy of camera focus calibration parameters.

[0006] In a first aspect, the present application provides a two-level focus calibration method based on a resolution function, and the two-level focus calibration method based on a resolution function comprises the following steps:

[0007] S01, obtaining a focus calibration position, and setting a plurality of the first step distances within a preset step range corresponding to the focus calibration position based on a first set interval;

[0008] S02. Calculating first resolutions corresponding to a plurality of first step distances based on a resolution extraction method;

[0009] S03, determining a target stepping range corresponding to the focus calibration position based on the first resolutions corresponding to the plurality of first stepping distances;

[0010] S04. extracting a plurality of second stepping distances within the target stepping range based on a second set interval, wherein the second set interval is smaller than the first set interval;

[0011] S05. Calculating second resolutions corresponding to a plurality of second step distances based on the resolution extraction method;

[0012] S06, calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data corresponding to the focus calibration position, a plurality of the second step distances, and a second resolution corresponding to the plurality of the second step distances;

[0013] Repeating step S01 to step S06 to calculate the focus calibration function corresponding to a plurality of focus calibration positions;

[0014] A current focus calibration position of a target camera is acquired, and a focus calibration operation is performed on the target camera based on the focus calibration function corresponding to the current focus calibration position.

[0015] In a second aspect, the present application further provides a two-stage focus calibration device based on a resolution function, the two-stage focus calibration device based on a resolution function comprising:

[0016] A focus calibration position acquisition module, used to acquire a focus calibration position and set a plurality of the first step distances within a preset step range corresponding to the focus calibration position based on a first set interval;

[0017] A first resolution calculation module, used for calculating first resolutions corresponding to the plurality of first step distances based on a resolution extraction method;

[0018] a target step range determination module, configured to determine a target step range corresponding to the focus calibration position based on the first resolutions corresponding to the plurality of first step distances;

[0019] A second step distance extraction module, configured to extract a plurality of second step distances within the target step range based on a second set interval, wherein the second set interval is smaller than the first set interval;

[0020] A second resolution calculation module, used for calculating second resolutions corresponding to a plurality of second step distances based on the resolution extraction method;

[0021] A focus calibration function calculation module, configured to calculate a focus calibration function corresponding to the focus calibration position based on first temperature data corresponding to the focus calibration position, a plurality of second step distances, and second resolutions corresponding to the plurality of second step distances;

[0022] The focus calibration operation module is used to obtain the current focus calibration position of the target camera, and perform a focus calibration operation on the target camera based on the focus calibration function corresponding to the current focus calibration position.

[0023] In a third aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the two-stage focus calibration method based on the resolution function as described above are implemented.

[0024] The present application provides a two-level focus calibration method, device and storage medium based on a resolution function. The method of the present application provides an initial reference point for camera focus by determining at least one focus calibration position and the corresponding first step distance. The first resolution corresponding to the first step distance is calculated by using a resolution extraction method, and the target step range of each focus calibration position is determined according to the first resolution to provide guidance for further focus adjustment. The second step distance is further extracted within the target step range, so that the camera can fine-tune the focus calibration within a smaller range, thereby improving the accuracy of the focus calibration. By calculating the second resolution corresponding to the second step distance, the focus effect can be evaluated and adjusted more carefully to ensure that the image clarity reaches the optimal state. Combined with the first temperature data and the second resolution, the focus calibration function is calculated. This function provides an accurate focus basis for each focus calibration position, guiding the camera to perform focus operations according to environmental changes and device characteristics, thereby achieving high-precision and high-reliability focus calibration. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0026] Figure 1 A schematic flow chart of a first embodiment of a two-level focus calibration method based on a resolution function provided by the present application;

[0027] Figure 2 A schematic flow chart of an extended solution for the first step of the first embodiment of a two-stage focus calibration method based on a resolution function provided by the present application;

[0028] Figure 3 It is a structural schematic diagram of a first embodiment of a two-stage focus calibration device based on a resolution function provided by the present application;

[0029] Figure 4 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application.

[0030] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0032] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0033] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0034] Please refer to Figure 1 , Figure 1 A schematic flow chart of a first embodiment of a two-stage focus calibration method based on a resolution function provided in the present application.

[0035] like Figure 1 As shown, the two-stage focus calibration method based on the resolution function includes steps S01 to S08.

[0036] S01, obtaining a focus calibration position, and setting a plurality of the first step distances within a preset step range corresponding to the focus calibration position based on a first set interval;

[0037] Generally, in a camera module, a built-in motor (such as a VCM motor (Voice Coil Motor)) is used to control the up and down movement of the lens, thereby realizing the focusing function of the lens.

[0038] The VCM motor is a device that converts electrical energy into mechanical energy. It uses the force exerted on a current-carrying conductor in a magnetic field to achieve motion. When current passes through a coil, the coil is acted upon by a force in a permanent magnetic field, resulting in linear motion or motion with a limited swing angle. This motion can be controlled by changing the direction and magnitude of the current. In the camera module, the VCM motor controls the up and down movement of the lens by changing the magnitude of the DC current in the coil inside the motor, thereby achieving the focusing function of the lens. This operation of moving the entire lens at a micro-distance can change the focal length and achieve the purpose of clear images. The control accuracy and speed of the VCM motor are crucial to achieving functions such as fast autofocus and optical image stabilization. The positioning accuracy and force control of the VCM motor are achieved through a position feedback device and a controller. The design structure and current intensity of the VCM motor itself determine the magnitude of the thrust generated, while the accuracy of its motion depends on the feedback and control system. The focal length of the lens is adjusted by adjusting the stepper motor of the VCM module. That is, focusing means adjusting the stepping distance of the motor to achieve the clearest picture at a specified focal length, that is, maximizing the resolution.

[0039] Therefore, multiple first step distances can be set within a preset step range, and focus analysis can be performed at the multiple first step distances respectively to find the most accurate focus step distance for camera focus calibration.

[0040] In one embodiment, the focus calibration position refers to the shooting distance of the camera focus calibration. During the focus calibration process, the default focus calibration data of the VCM motor can be used to accelerate the focus calibration calculation. Generally, the focus calibration positions can include positions such as 80mm, 150mm, 350mm, and 5000mm. Since 150mm and 350mm are more difficult to test during the test, the test distance can be changed to 80mm, 600mm, 5000mm, etc., that is, 600mm is the simulation distance.

[0041] S02. Calculating first resolutions corresponding to a plurality of first step distances based on a resolution extraction method;

[0042] In one embodiment, with the current stepping distance of the VCM motor as x, the focal length f, and the ambient temperature t, the resolution R is expressed as a function:

[0043] R(x,f,t)

[0044] Through experiments, we know that: the curve of resolution R is a parabolic curve with an opening downward, that is, the resolution is highest at the focus point when the stepper motor is moved; the curve of temperature compensation is an approximate linear curve; the curve of each focal length is different; when the left and right eyes achieve the same resolution focus calibration, the binocular focus calibration can also be consistent.

[0045] Therefore, from an engineering perspective, the resolution R at a given focal length f can be simplified to:

[0046] R(x, t) = ax 2 +bx+ct+d

[0047] Among them, the constant coefficients a, b, c, and d are the focus calibration data that need to be determined.

[0048] It can be seen that by specifying several key focal lengths, such as f0, f1, f2, f3, and calculating the resolution curve at the corresponding focal lengths, the focus calibration data can be obtained.

[0049] Furthermore, based on preset camera acquisition parameters, the target camera is controlled to acquire images of the calibration plate at multiple first step distances corresponding to the focus calibration position to obtain a first calibration image; based on a resolution algorithm, the first calibration image is analyzed to obtain first resolutions corresponding to multiple first step distances.

[0050] In one embodiment, the focus calibration target position is set, such as 80mm, 600mm, 5000mm, etc., the three-axis position (x, y, z) of the mobile platform is moved, and the ISP (Image Signal Processor) parameters are set, and the VCM motor position is set for segmented shooting. Among them, the ISP (Image Signal Processor) parameters are mainly used for post-processing the signal output by the front-end image sensor, and the main functions include linear correction, noise removal, bad pixel removal, interpolation, white balance, automatic exposure control, etc.

[0051] In one embodiment, in order to speed up the camera focus calibration process, the embodiment of the present application performs preliminary calculations based on the default focus calibration parameters to give a default value x0. Considering that the calculation of each point takes a lot of time, it is considered to take a certain number of points near the default value for calculation. For example, 11 points are taken in a step of s, such as x0-5s, x0-4s...x0,....x0+4s,x0+5s.

[0052] The default value is the initial position of the lens focus, that is, the initial value at 80, 600, and 5000.

[0053] Since the actual calibration values ​​are 150, 350, 5000, and 80, 600 are observed values, it is necessary to perform linear interpolation based on the known 150, 350 to get the initial positions of 80, 600. Let the step distance function be D(x), we have:

[0054]

[0055] Given D(150) and D(80), we can find D(80) and D(600).

[0056] In one embodiment, after setting the camera acquisition parameters, the target camera can be controlled to acquire images of the calibration plate at multiple first step distances to obtain a first calibration image. The first calibration image can be a RAW image. The RAW image is the original data image output by the image sensor Sensor. Commonly used ones are RAW8, RAW10, RAW12, etc., which respectively indicate that a pixel has 8-bit, 10-bit, and 12-bit data.

[0057] In one embodiment, the resolution algorithm may be an SFR algorithm.

[0058] Among them, SFR (Spatial frequency response) refers to the amplitude response of a system relative to the input spatial frequency. For camera systems, SFR is similar to the MTF (modulation transfer function) of traditional optical systems, which can intuitively determine the resolution of the system. The International Standardization Organization (ISO) has formulated and standardized the relevant definitions and test methods of SFR.

[0059] Generally, the steps of calculating the resolution of a RAW image using the SFR algorithm may include: obtaining the ROI (Region of interest) of the vertical edge; normalizing the data; calculating the pixel centroid of each row of the image; performing a linear fit on the centroid of each row using the least squares method to obtain a straight line about the centroid; repositioning the ROI to obtain the ESF (Edge Spread Function); performing four times supersampling on the obtained ESF; obtaining the LSF (Line Spread Function) by differential operation; applying a Hamming window to the LSF; and performing a DFT (Discrete Fourier Transform) operation. Through the above steps, the SFR algorithm calculates the RAW image and obtains the corresponding resolution value.

[0060] It is understandable that the SFR algorithm is not protected by the present application, and the present application embodiment does not describe in detail the specific calculation steps of the SFR algorithm. The SFR algorithm is a conventional algorithm in the field of image processing technology, and the present application embodiment uses it as an example for explanation, and does not specifically limit the resolution algorithm.

[0061] S03, determining a target stepping range corresponding to the focus calibration position based on the first resolutions corresponding to the plurality of first stepping distances;

[0062] In one embodiment, multiple first resolutions corresponding to multiple first step distances of the same focus calibration position can be constructed as a curve opening downward. The first step distance corresponding to the vertex of the curve is the optimal step distance corresponding to the current focus calibration position, and accordingly, the first resolution value corresponding to the vertex of the curve is the maximum resolution value. However, when performing the focus calibration operation, the selected first step distance is not necessarily the optimal step distance. In order to improve the calibration accuracy of the diagonal calibration parameters, a more accurate step distance can be further selected for resolution calculation, thereby extracting a more accurate step distance and calculating a more accurate focus calibration parameter.

[0063] A first resolution with a maximum value may be selected from the first resolutions corresponding to the multiple first stepping distances currently selected as a basis for selecting the target stepping range.

[0064] In one embodiment, based on the first resolution corresponding to each of the first step distances at each of the focus calibration positions, the two first step distances with the largest resolution values ​​are determined; based on the two first step distances with the largest resolution values, the target step range of each of the focus calibration positions is obtained.

[0065] Because the distance interval between any two adjacent first step distances is the same, and the first resolutions corresponding to multiple first step distances form a curve opening downward, therefore, among the multiple first resolutions calculated by the first step distance, the maximum resolution value corresponding to the curve vertex is between the two first resolutions of the calculated maximum values. Therefore, the range between the two first step distances with the largest corresponding resolution values ​​can be used as the target step range.

[0066] In another embodiment, based on the first resolution corresponding to each of the first step distances at each of the focus calibration positions, the target first step distance with the largest resolution value is determined; based on the target first step distance, the target step range corresponding to the focus calibration position is determined.

[0067] Since the first resolution with the largest value among the multiple first resolutions calculated according to the first step distance is closest to the vertex of the resolution curve, the first resolution with the largest value can be used as the basis for selecting the target step range, and the target step range can be selected within a certain range before and after the first resolution.

[0068] For example, assuming that among the multiple first resolutions calculated based on the multiple first step distances, the first resolution with the largest value is R1, and the first step distance corresponding to R1 is x1, the target step range can be determined as (x1-50, x1+50). Among them, x1-50 is between x1 and the previous first step distance adjacent to it, and x1+50 is between x1 and the next first step distance adjacent to it.

[0069] S04. extracting a plurality of second stepping distances within the target stepping range based on a second set interval, wherein the second set interval is smaller than the first set interval;

[0070] In one embodiment, a plurality of second stepping distances are selected in the target stepping range according to a second setting interval. Because the second stepping distance has a higher precision than the first stepping distance, the second setting interval is smaller than the first setting interval.

[0071] For example, the second set interval can be selected according to the actual accuracy requirement or according to the equipment parameters. For example, if the first set interval (i.e., the interval between two adjacent step distances) is 100 mm, then the second set interval can be 10 mm. That is, assuming that the target step range is (0, 100), the second step distance can be extracted as (10, 20, ..., 90).

[0072] S05. Calculating second resolutions corresponding to a plurality of second step distances based on the resolution extraction method;

[0073] In one embodiment, the previously set camera acquisition parameters are used to control the target camera to acquire images of the calibration plate at multiple second step distances to obtain a second calibration image. The second calibration image is analyzed by the above-mentioned resolution algorithm to obtain a second resolution corresponding to the multiple second step distances.

[0074] It can be understood that the calculation method and calculation process of the second resolution and the first resolution are the same. The only difference lies in the calibration images collected from different stepping distances, but the image analysis process is the same. Here, the embodiment of the present application does not elaborate on this process, and the calculation process of extracting the first resolution can refer to the above-mentioned SFR algorithm.

[0075] S06, calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data corresponding to the focus calibration position, a plurality of the second step distances, and a second resolution corresponding to the plurality of the second step distances;

[0076] In one embodiment, based on the first temperature data, the temperature difference between the ambient temperature and the device temperature is calculated for the step distance compensation of the motor; the second step distance is compensated for by the step distance compensation to achieve correction of the second step distance.

[0077] According to the first temperature data, the multiple corrected second step distances, the second resolutions corresponding to the multiple second step distances, and the corresponding relationship between the second step distances and the second resolutions, a focus calibration function of the focus calibration position can be constructed:

[0078] R(x, t) = ax 2 +bx+ct+d

[0079] According to the multiple second stepping distances x, the first temperature data t and the second resolutions R corresponding to the multiple second stepping distances, the constant coefficients a, b, c and d of the focus calibration function are solved to construct a focus calibration function.

[0080] S07, repeating step S01 to step S06 to calculate the focus calibration function corresponding to a plurality of focus calibration positions;

[0081] After completing the calculation of the focus calibration function of one focus calibration position, you can switch to the next focus calibration position, repeat the above steps S01 to S06, and calculate the focus calibration function corresponding to each focus calibration position in turn, until the focus calibration function corresponding to all focus calibration positions that need to perform calibration operations is calculated, and then the focus calibration can be ended.

[0082] S08. Acquire a current focus calibration position of the target camera, and perform a focus calibration operation on the target camera based on the focus calibration function corresponding to the current focus calibration position.

[0083] After calculating the focus calibration functions corresponding to multiple focus calibration positions, the focus calibration functions corresponding to each focus calibration position can be stored in the camera. When fast focusing is required, the corresponding focus calibration function can be called according to the current focus calibration position to calculate the optimal stepping distance, and then the stepping motor is adjusted to move to the optimal stepping distance, or the stepping distance supported by the camera that is closest to the optimal stepping distance, to focus the camera, thereby improving the camera's autofocus efficiency and quality.

[0084] The present embodiment provides a two-stage focus calibration method based on a resolution function. The present method provides an initial reference point for camera focus by determining at least one focus calibration position and the corresponding first step distance. The first resolution corresponding to the first step distance is calculated by using a resolution extraction method, and the target step range of each focus calibration position is determined according to the first resolution to provide guidance for further focus adjustment. The second step distance is further extracted within the target step range, so that the camera can fine-tune the focus calibration within a smaller range, thereby improving the accuracy of the focus calibration. By calculating the second resolution corresponding to the second step distance, the focus effect can be evaluated and adjusted more carefully to ensure that the image clarity reaches the optimal state. Combining the first temperature data and the second resolution, the focus calibration function is calculated. This function provides an accurate focus basis for each focus calibration position, guiding the camera to perform focus operations according to environmental changes and device characteristics, thereby achieving high-precision and high-reliability focus calibration.

[0085] Please refer to Figure 2 , Figure 2 A schematic flow chart of a second embodiment of a two-stage focus calibration method based on a resolution function provided in the present application.

[0086] In this embodiment, Figure 2 As shown, based on the above Figure 1 In the illustrated embodiment, step S06 includes:

[0087] S11, obtaining the first temperature data corresponding to the target camera at the focus calibration position, wherein the first temperature data includes a device temperature and an ambient temperature;

[0088] During the shooting process, the device temperature is obtained from the camera. Multiple temperature sensors can be set in the camera to measure the ambient temperature and device temperature. The device temperature can include the sensor temperature and the processor CPU temperature.

[0089] For example, changes in temperature may affect the performance of a stepper motor. At extreme temperatures, the torque and efficiency of the motor may decrease, which may cause inaccuracies in step distance. For example, high temperatures may reduce the resistance of the motor windings, thereby affecting the current and power output of the motor.

[0090] For example, an increase in processor temperature may cause it to reduce its frequency to prevent overheating, which may affect the execution speed and accuracy of the motor control algorithm. If the processor reduces performance due to overheating, the pulse signal it sends to the stepper motor may be delayed or inaccurate, thus affecting the control of the stepping distance.

[0091] The ambient temperature can be measured by using external temperature sensors, thermometers and other equipment, or the above-mentioned temperature measurement device can be configured in the camera.

[0092] S12, calculating a device-ambient temperature difference based on the device temperature and the ambient temperature;

[0093] The camera and its components will experience thermal expansion at different temperatures, which may change the focal length of the lens and the stepping accuracy of the motor stepper motor. For example, the camera lens may expand when the temperature rises, causing the focal length to become longer, which requires adjusting the stepping distance of the stepper motor to compensate for this change.

[0094] In one embodiment, the operating temperature is calculated based on a preset temperature weight and the device temperature, wherein the device temperature includes a sensor temperature and a processor CPU temperature; and the device-ambient temperature difference is calculated based on the operating temperature and the ambient temperature.

[0095] The calculation formula of the equipment environment temperature difference is:

[0096] dT=(T Sensor *ω1+T CPU *ω2)-T Base

[0097] Where dT represents the temperature difference of the equipment environment, T Sensor Indicates the sensor temperature, T CPU represents the CPU temperature, ω1 represents the temperature weight corresponding to the Sensor temperature, ω2 represents the temperature weight corresponding to the CPU temperature, (T Sensor *ω1+T CPU *ω2) represents the operating temperature, T Base Indicates the ambient temperature.

[0098] For example, assuming the weight w=2:1, the device environment temperature difference dT function is:

[0099]

[0100] Among them, T Base is the ambient temperature, such as 38°C.

[0101] For example, if the sensor temperature is 32°C, the CPU temperature is 25°C, the sensor temperature weight is 0.6, the CPU temperature weight is 0.4, and the ambient temperature is 25°C, the device ambient temperature difference is calculated as follows:

[0102] First calculate the operating temperature T1:

[0103] T1=(T Sensor *ω1+T CPU*ω2)=(32×0.6)+(25×0.4)=29.2

[0104] Then calculate the device ambient temperature difference dT:

[0105] dT=T1-T Base =29.2-25=4.2

[0106] Therefore, the device ambient temperature difference is 4.2 degrees C. This temperature difference can be used to evaluate the performance changes of the camera and its components at the current operating temperature and adjust the stepper motor step distance as needed to compensate for the changes due to thermal expansion.

[0107] S13, calculating the step distance compensation amount corresponding to the focus calibration position based on the device environment temperature difference;

[0108] In one embodiment, a temperature compensation algorithm is implemented to adjust the stepping distance of the stepping motor according to the temperature difference of the device environment to ensure accurate focus and image quality at different temperatures.

[0109] Furthermore, based on a step distance compensation calculation formula and the device environment temperature difference, the step distance compensation corresponding to the focus calibration position is calculated.

[0110] The step distance compensation calculation formula is:

[0111] Distance_off=a0*dT 2 +a1*dT+a2

[0112] Wherein, Distance_off represents the step distance compensation amount, dT represents the device environment temperature difference, and a0, a1, and a2 represent constant coefficients.

[0113] For example, the present embodiment provides a set of constant coefficients: a0=0.9464, a1=-3.2445, a2=0.38. These coefficients can be determined by experimental measurement or according to the characteristic curve of the stepper motor.

[0114] In this embodiment, in the step distance compensation calculation formula, the quadratic term (a0*dT 2 ) takes into account the nonlinear effect of temperature change on the stepping distance of the stepper motor. These high-order terms can compensate for the nonlinear deformation and hysteresis effect of the internal structure of the motor caused by temperature change. The first-order term (a1*dT) represents the linear effect of temperature change on the stepping distance of the stepper motor. This is the most direct compensation term, reflecting the impact of temperature change on motor parameters such as resistance and inductance.

[0115] Generally, the constant coefficients a0, a1, and a2 can be adjusted according to the specific model of the stepper motor and the use environment. Usually, these coefficients can be obtained by experimental methods, that is, measuring the actual step distance of the stepper motor at different temperatures and comparing it with the theoretical value to determine the best coefficient.

[0116] S14, performing distance correction on a plurality of the second step distances based on the step distance compensation amount to obtain a plurality of corrected third step distances;

[0117] Generally, the process of correcting the stepping distance based on the stepping distance compensation is mainly to ensure that the stepping motor can maintain accurate positioning and motion control under different temperature conditions.

[0118] Furthermore, based on the step distance compensation formula, the step distance compensation amount is used to correct a plurality of the second step distances to obtain a plurality of the third step distances.

[0119] Wherein, the step distance compensation formula is:

[0120] Distance_best=Distance_top+Distance_off

[0121] Wherein, Distance_best represents the third stepping distance, Distance_top represents the second stepping distance, and Distance_off represents the stepping distance compensation amount.

[0122] In one embodiment, the step distance correction is to perform addition and subtraction calculations on the second step distance according to the step distance compensation amount. If the step distance compensation amount is positive, the second step distance needs to be added, that is, the second step distance plus the step distance compensation amount is the corrected third step distance; if the step distance compensation amount is negative, the second step distance needs to be subtracted, that is, the second step distance minus the step distance compensation amount is the corrected third step distance.

[0123] S15, calculating the focus calibration function corresponding to the focus calibration position based on the first temperature data, the plurality of third step distances, and the second resolution corresponding to the plurality of second step distances.

[0124] The second step distance is compensated for by the step distance compensation amount. At this time, the corresponding relationship between the third step distance and the second resolution is obtained according to the corresponding relationship between the second step distances and the third step distance.

[0125] Exemplarily, a focus calibration function of a focus calibration position is constructed according to the first temperature data, a plurality of third step distances, a second resolution corresponding to a plurality of second step distances, and a correspondence between the third step distance and the second resolution:

[0126] R9x,t)=ax 2 +bx+ct+d

[0127] According to the third stepping distances x, the first temperature data t and the second resolutions R corresponding to the third stepping distances, the constant coefficients a, b, c and d of the focus calibration function are solved to construct a focus calibration function.

[0128] This embodiment calculates the step distance error caused by the change in ambient temperature through the first temperature data, and performs error compensation on the first step distance, thereby ensuring that the camera can maintain accurate focusing performance under different temperature conditions and improving the accuracy of camera focus calibration. The first resolution of each first step distance corresponding to each focus calibration position is calculated through the focus calibration formula to achieve quantitative evaluation of the calibration quality, thereby intuitively showing the focus calibration effect of each first step distance. By comparing the first resolution corresponding to each first step distance, the focus calibration function corresponding to each of the focus calibration positions is calculated, and then the optimal focus calibration parameters of the camera at different focus calibration positions are determined, thereby improving the data accuracy of the camera focus calibration parameters and further improving the accuracy and reliability of the camera autofocus.

[0129] See also Figure 3 , Figure 3 It is a structural schematic diagram of a first embodiment of a two-stage focus calibration device based on a resolution function provided in the present application. The two-stage focus calibration device based on a resolution function is used to execute the aforementioned two-stage focus calibration method based on a resolution function.

[0130] like Figure 3 As shown, the two-stage focus calibration device 200 based on the resolution function includes: a focus calibration position acquisition module 201, a first resolution calculation module 202, a target step range determination module 203, a second step distance extraction module 204, a second resolution calculation module 205, a focus calibration function calculation module 206, a repeated calibration module 207 and a focus calibration operation module 208.

[0131] A focus calibration position acquisition module 201 is used to acquire a focus calibration position and set a plurality of first step distances within a preset step range corresponding to the focus calibration position based on a first set interval;

[0132] A first resolution calculation module 202, used for calculating first resolutions corresponding to the plurality of first step distances based on a resolution extraction method;

[0133] A target step range determination module 203, configured to determine a target step range corresponding to the focus calibration position based on the first resolutions corresponding to the plurality of first step distances;

[0134] A second step distance extraction module 204, configured to extract a plurality of second step distances within the target step range based on a second set interval, wherein the second set interval is smaller than the first set interval;

[0135] A second resolution calculation module 205, configured to calculate second resolutions corresponding to a plurality of second step distances based on the resolution extraction method;

[0136] A focus calibration function calculation module 206, configured to calculate a focus calibration function corresponding to the focus calibration position based on the first temperature data corresponding to the focus calibration position, a plurality of the second step distances, and a second resolution corresponding to the plurality of the second step distances;

[0137] The focus calibration operation module 207 is used to obtain the current focus calibration position of the target camera, and perform a focus calibration operation on the target camera based on the focus calibration function corresponding to the current focus calibration position.

[0138] In one embodiment, the first resolution calculation module 202 includes:

[0139] An image acquisition unit, configured to control the target camera to acquire images of the calibration plate at a plurality of first step distances corresponding to the focus calibration position based on preset camera acquisition parameters, so as to obtain a first calibration image;

[0140] The first resolution calculation unit is used to perform image analysis on the first calibration image based on a resolution algorithm to obtain a plurality of first resolutions corresponding to the first step distances.

[0141] In one embodiment, the target step range determination module 203 includes:

[0142] A maximum step distance determining first unit, configured to determine two first step distances with maximum resolution values ​​based on the first resolutions corresponding to the first step distances at the focus calibration positions;

[0143] The target step range determining first unit is used to obtain the target step range of each focus calibration position based on the two first step distances with the largest resolution values.

[0144] In one embodiment, the target step range determination module 203 further includes:

[0145] A second maximum step distance determination unit is configured to determine a target first step distance having a maximum resolution value based on the first resolutions corresponding to the first step distances at the focus calibration positions;

[0146] The target step range determining unit is used to determine the target step range corresponding to the focus calibration position based on the target first step distance.

[0147] In one embodiment, the focus calibration function calculation module 206 includes:

[0148] A first temperature data acquisition unit, used to acquire the first temperature data corresponding to the target camera at the focus calibration position, wherein the first temperature data includes a device temperature and an ambient temperature;

[0149] A temperature difference calculation unit, used for calculating a temperature difference between a device and an environment based on the device temperature and the environment temperature;

[0150] A step distance compensation amount calculation unit, used to calculate the step distance compensation amount corresponding to the focus calibration position based on the device environment temperature difference;

[0151] A step distance correction unit, configured to perform distance correction on a plurality of the second step distances based on the step distance compensation amount to obtain a plurality of corrected third step distances;

[0152] A focus calibration function calculation unit is used to calculate the focus calibration function corresponding to the focus calibration position based on the first temperature data, multiple third step distances and second resolutions corresponding to multiple second step distances.

[0153] In one embodiment, the temperature difference calculation unit includes:

[0154] An operating temperature calculation subunit, configured to calculate an operating temperature based on a preset temperature weight and the device temperature, wherein the device temperature includes a sensor temperature and a processor CPU temperature;

[0155] A temperature difference calculation subunit, used to calculate the device environment temperature difference based on the working temperature and the ambient temperature;

[0156] The calculation formula of the equipment environment temperature difference is:

[0157] dT=(T Sensor *ω1+T CPU *ω2)-T Base

[0158] Where dT represents the temperature difference of the equipment environment, T Sensor Indicates the sensor temperature, TCPU represents the CPU temperature, ω1 represents the temperature weight corresponding to the Sensor temperature, ω2 represents the temperature weight corresponding to the CPU temperature, (T Sensor *ω1+T CPU *ω2) represents the operating temperature, T Base Indicates the ambient temperature.

[0159] In one embodiment, the step distance compensation amount calculation unit includes:

[0160] A step distance compensation amount calculation subunit, used to calculate the step distance compensation amount corresponding to the focus calibration position based on a step distance compensation amount calculation formula and the device environment temperature difference;

[0161] The step distance compensation calculation formula is:

[0162] Distance_off=a0*dT 2 +a1*dT+a2

[0163] Wherein, Distance_off represents the step distance compensation amount, dT represents the device environment temperature difference, and a0, a1, and a2 represent constant coefficients.

[0164] In one embodiment, the step distance correction unit includes:

[0165] A step distance correction subunit, configured to correct a plurality of the second step distances using the step distance compensation amount based on a step distance compensation formula to obtain a plurality of the third step distances;

[0166] Wherein, the step distance compensation formula is:

[0167] Distance_best=Distance_top+Distance_off

[0168] Wherein, Distance_best represents the third stepping distance, Distance_top represents the second stepping distance, and Distance_off represents the stepping distance compensation amount.

[0169] It should be noted that technical personnel in the relevant field can clearly understand that, for the convenience and conciseness of description, the specific working process of the device and each module described above can refer to the corresponding process in the aforementioned two-stage focus calibration method embodiment based on the resolution function, and will not be repeated here.

[0170] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 4 Runs on the computer device shown.

[0171] See also Figure 4 , Figure 4 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.

[0172] See also Figure 4 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.

[0173] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any two-level focus calibration method based on a resolution function.

[0174] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0175] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any two-level focus calibration method based on the resolution function.

[0176] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0177] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0178] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any one of the two-stage focus calibration methods based on the resolution function provided in the embodiments of the present application.

[0179] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.

[0180] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A two-level focus calibration method based on a resolution function, characterized in that: The method comprises: S01, obtaining a focus calibration position, and setting a plurality of the first step distances within a preset step range corresponding to the focus calibration position based on a first set interval; S02. Calculating first resolutions corresponding to a plurality of first step distances based on a resolution extraction method; S03, determining a target stepping range corresponding to the focus calibration position based on the first resolutions corresponding to the plurality of first stepping distances; S04. extracting a plurality of second stepping distances within the target stepping range based on a second set interval, wherein the second set interval is smaller than the first set interval; S05. Calculating second resolutions corresponding to a plurality of second step distances based on the resolution extraction method; S06, calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data corresponding to the focus calibration position, a plurality of the second step distances, and a second resolution corresponding to the plurality of the second step distances; Repeating step S01 to step S06 to calculate the focus calibration function corresponding to a plurality of focus calibration positions; A current focus calibration position of a target camera is acquired, and a focus calibration operation is performed on the target camera based on the focus calibration function corresponding to the current focus calibration position.

2. The two-stage focus calibration method based on resolution function according to claim 1, characterized in that: The method of calculating the first resolutions corresponding to the plurality of first step distances based on the resolution extraction method includes: Based on preset camera acquisition parameters, control the target camera to acquire images of the calibration plate at the plurality of first step distances corresponding to the focus calibration position to obtain a first calibration image; Based on a resolution algorithm, the first calibration image is analyzed to obtain a plurality of first resolutions corresponding to the first step distances.

3. The two-stage focus calibration method based on resolution function according to claim 1, characterized in that: The determining the target stepping range corresponding to the focus calibration position based on the first resolutions corresponding to the plurality of first stepping distances includes: Based on the first resolutions corresponding to the first step distances at the focus calibration positions, determining two first step distances with the largest resolution values; Based on the two first step distances with the largest resolution values, a target step range for each focus calibration position is obtained.

4. The two-stage focus calibration method based on resolution function according to claim 1, characterized in that: The determining, based on the first resolutions corresponding to the plurality of first step distances, a target step range corresponding to the focus calibration position, further comprises: Determine a target first step distance with a maximum resolution value based on the first resolutions corresponding to the first step distances at the focus calibration positions; Based on the target first step distance, a target step range corresponding to the focus calibration position is determined.

5. The two-stage focus calibration method based on resolution function according to claim 1, characterized in that: The calculating the focus calibration function corresponding to the focus calibration position based on the first temperature data corresponding to the focus calibration position, the plurality of second step distances, and the second resolutions corresponding to the plurality of second step distances comprises: Acquire the first temperature data corresponding to the focus calibration position of the target camera, wherein the first temperature data includes the device temperature and the ambient temperature; Calculating a device-ambient temperature difference based on the device temperature and the ambient temperature; Based on the device environment temperature difference, calculating the step distance compensation amount corresponding to the focus calibration position; Based on the step distance compensation amount, performing distance correction on a plurality of the second step distances to obtain a plurality of corrected third step distances; The focus calibration function corresponding to the focus calibration position is calculated based on the first temperature data, a plurality of the third step distances, and a second resolution corresponding to a plurality of the second step distances.

6. The two-stage focus calibration method based on resolution function according to claim 5, characterized in that: The calculating the device-ambient temperature difference based on the device temperature and the ambient temperature includes: Calculate the operating temperature based on the preset temperature weight and the device temperature, wherein the device temperature includes the sensor temperature and the processor CPU temperature; Calculating the device-ambient temperature difference based on the operating temperature and the ambient temperature; The calculation formula of the equipment environment temperature difference is: dT=(T Sensor *ω1+T CPU *ω2)-T Base Where dT represents the temperature difference of the equipment environment, T Sensor Indicates the sensor temperature, T CPU represents the CPU temperature, ω1 represents the temperature weight corresponding to the Sensor temperature, ω2 represents the temperature weight corresponding to the CPU temperature, (T Sensor *ω1+T CPU *ω2) represents the operating temperature, T Base Indicates the ambient temperature.

7. The two-stage focus calibration method based on resolution function according to claim 5, characterized in that: The stepping distance compensation amount corresponding to the focus calibration position is calculated based on the device environment temperature difference, including: Calculate the step distance compensation amount corresponding to the focus calibration position based on the step distance compensation amount calculation formula and the device environment temperature difference; The step distance compensation calculation formula is: Distance_off=a0*dT 2 +a1*dT+a2 Wherein, Distance_off represents the step distance compensation amount, dT represents the device environment temperature difference, and a0, a1, and a2 represent constant coefficients.

8. The two-stage focus calibration method based on resolution function according to claim 5, characterized in that: The method of performing distance correction on the plurality of second step distances based on the step distance compensation amount to obtain a plurality of corrected third step distances includes: Based on the step distance compensation formula, using the step distance compensation amount, correcting the plurality of the second step distances to obtain the plurality of the third step distances; Wherein, the step distance compensation formula is: Distance_best=Distance_top+Distance_off Wherein, Distance_best represents the third stepping distance, Distance_top represents the second stepping distance, and Distance_off represents the stepping distance compensation amount.

9. A two-stage focus calibration device based on a resolution function, characterized in that: The two-stage focus calibration device based on the resolution function comprises: A focus calibration position acquisition module, used to acquire a focus calibration position and set a plurality of the first step distances within a preset step range corresponding to the focus calibration position based on a first set interval; A first resolution calculation module, used for calculating first resolutions corresponding to the plurality of first step distances based on a resolution extraction method; a target step range determination module, configured to determine a target step range corresponding to the focus calibration position based on the first resolutions corresponding to the plurality of first step distances; A second step distance extraction module, configured to extract a plurality of second step distances within the target step range based on a second set interval, wherein the second set interval is smaller than the first set interval; A second resolution calculation module, used for calculating second resolutions corresponding to a plurality of second step distances based on the resolution extraction method; A focus calibration function calculation module, configured to calculate a focus calibration function corresponding to the focus calibration position based on first temperature data corresponding to the focus calibration position, a plurality of second step distances, and second resolutions corresponding to the plurality of second step distances; The focus calibration operation module is used to obtain the current focus calibration position of the target camera, and perform a focus calibration operation on the target camera based on the focus calibration function corresponding to the current focus calibration position.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the two-stage focus calibration method based on a resolution function as claimed in any one of claims 1 to 8 are implemented.