Temperature compensation focusing calibration method and device based on resolution function and storage medium
Through the temperature-complement focus calibration method based on the resolution function, the problem of inaccurate focus calibration parameters of the camera under different temperature conditions is solved, and the camera's precise focus and high-accurate automatic focus are achieved at different temperatures.
Patent Information
- Application Number
- CN202411997735.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The prior art is difficult to improve the accuracy of camera focus calibration parameters, especially under different temperature conditions.
Through the temperature-complement focus calibration method based on the resolution function, the step distance error is calculated using temperature data, error compensation is performed, and the focus calibration function of each focus calibration position is calculated through the focus calibration formula to determine the optimal focus calibration parameters.
Ensure that the camera maintains accurate focus performance under different temperature conditions, improves the data accuracy of camera focus calibration parameters, and thus improves the accuracy and reliability of autofocus.
Smart Images

Figure CN119941866A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of camera calibration, and in particular to a temperature compensation 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 temperature compensation 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 temperature compensation focus calibration method based on a resolution function, the temperature compensation focus calibration method based on a resolution function comprising the following steps:
[0007] S01, acquiring a focus calibration position, a plurality of first step distances corresponding to the focus calibration position, and first temperature data corresponding to the focus calibration position;
[0008] S02. Calculating first resolutions corresponding to a plurality of first step distances based on a resolution extraction method;
[0009] S03. Calculating the device environment temperature difference based on the first temperature data;
[0010] S04, calculating a step distance compensation amount corresponding to the focus calibration position based on the device environment temperature difference;
[0011] S05, based on the step distance compensation amount, correcting the plurality of first step distances to obtain a plurality of corrected second step distances;
[0012] S06, calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data, a plurality of the second stepping distances, and a plurality of first resolutions corresponding to the first stepping 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 temperature compensation focus calibration device based on a resolution function, the temperature compensation focus calibration device based on a resolution function comprising:
[0016] A data acquisition module, used to acquire a focus calibration position, a plurality of first step distances corresponding to the focus calibration position, and first temperature data corresponding to the focus calibration position;
[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 device environment temperature difference calculation module, used to calculate the device environment temperature difference based on the first temperature data;
[0019] A step distance compensation amount calculation module, used to calculate the step distance compensation amount corresponding to the focus calibration position based on the device environment temperature difference;
[0020] A step distance correction module, used for correcting the plurality of first step distances based on the step distance compensation amount to obtain a plurality of corrected second step distances;
[0021] A focus calibration function calculation module, used for calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data, a plurality of the second step distances and a first resolution corresponding to a plurality of the first step distances;
[0022] The focus calibration 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 temperature-compensated focus calibration method based on the resolution function as described above are implemented.
[0024] The present application provides a temperature-compensated focus calibration method, device and storage medium based on a resolution function. The method of the present application 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, so as to ensure that the camera can maintain accurate focusing performance under different temperature conditions and improve the accuracy of the 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. 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 temperature compensation 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 temperature compensation 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 temperature compensation 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 temperature compensation focus calibration method based on a resolution function provided in the present application.
[0035] like Figure 1 As shown, the temperature compensation focus calibration method based on the resolution function includes steps S01 to S08.
[0036] S01, acquiring a focus calibration position, a plurality of first step distances corresponding to the focus calibration position, and first temperature data corresponding to the focus calibration position;
[0037] Generally, in a camera module, the up and down movement of the lens is controlled by a built-in motor (such as a VCM motor (Voice Coil Motor)) to achieve 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] In one embodiment, it is found through experiments that: the curve of the 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 the 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. Calculating the device environment temperature difference based on the first temperature data;
[0062] In one embodiment, the first temperature data includes device temperature and ambient temperature.
[0063] Furthermore, based on the preset temperature weight and the device temperature, the operating temperature is calculated, wherein the device temperature includes the sensor temperature and the processor CPU temperature; based on the operating temperature and the ambient temperature, the device-ambient temperature difference is calculated.
[0064] The calculation formula of the equipment environment temperature difference is:
[0065] dT=(T Sensor *ω1+TCPU *ω2)-T Base
[0066] 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.
[0067] In one embodiment, during the shooting process, the device temperature is obtained from the camera. The camera may be provided with multiple temperature sensors for measuring the ambient temperature and the device temperature. Therefore, the device temperature may include the sensor temperature and the processor CPU temperature.
[0068] 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.
[0069] 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.
[0070] 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.
[0071] 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.
[0072] Based on the preset temperature weight and the device temperature, the operating temperature is calculated, wherein the device temperature includes the sensor temperature and the processor CPU temperature; based on the operating temperature and the ambient temperature, the device ambient temperature difference is calculated.
[0073] The calculation formula of the equipment environment temperature difference is:
[0074] dT=(T Sensor *ω1+T CPU *ω2)-T Base
[0075] 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.
[0076] For example, assuming the weight w=2:1, the device environment temperature difference dT function is:
[0077]
[0078] Among them, T Base is the ambient temperature, such as 38°C.
[0079] 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:
[0080] First calculate the operating temperature T1:
[0081] T1=(T Sensor *ω1+T CPU *ω2)=(32×0.6)+(25×0.4)=29.2
[0082] Then calculate the device ambient temperature difference dT:
[0083] dT=T1-T Base =29.2-25=4.2
[0084] 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.
[0085] S04, calculating a step distance compensation amount corresponding to the focus calibration position based on the device environment temperature difference;
[0086] According to the temperature difference of the equipment environment, a temperature compensation algorithm is implemented to adjust the stepping distance of the stepper motor to ensure accurate focus and image quality under different temperatures.
[0087] 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.
[0088] The step distance compensation calculation formula is:
[0089] Distance_off=a0*dT 2 +a1*dT+a2
[0090] Wherein, Distance_off represents the step distance compensation amount, dT represents the device environment temperature difference, and a0, a1, and a2 represent constant coefficients.
[0091] In one embodiment, the present application 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.
[0092] 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.
[0093] In one embodiment, the constant coefficients a0, a1, and a2 can be adjusted according to the specific model of the stepper motor and the use environment. Generally, these coefficients can be obtained by experimental methods, that is, measuring the actual stepping distance of the stepper motor at different temperatures and comparing it with the theoretical value to determine the optimal coefficient.
[0094] S05, based on the step distance compensation amount, correcting the plurality of first step distances to obtain a plurality of corrected second step distances;
[0095] In one embodiment, the process of correcting the stepping distance based on the stepping distance compensation amount is mainly to ensure that the stepping motor can maintain accurate positioning and motion control under different temperature conditions.
[0096] Furthermore, based on the step distance compensation formula, the step distance compensation amount is used to correct the plurality of the first step distances to obtain the plurality of the second step distances.
[0097] Wherein, the step distance compensation formula is:
[0098] Distance_best=Distance_top+Distance_off
[0099] Wherein, Distance_best represents the second stepping distance, Distance_top represents the first stepping distance, and Distance_off represents the stepping distance compensation amount.
[0100] Among them, the step distance correction is to add or subtract the first step distance according to the step distance compensation. If the step distance compensation is positive, the first step distance needs to be added, that is, the first step distance plus the step distance compensation, which is the corrected second step distance; if the step distance compensation is negative, the first step distance needs to be subtracted, that is, the first step distance minus the step distance compensation, as the corrected second step distance.
[0101] S06, calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data, a plurality of the second stepping distances, and a plurality of first resolutions corresponding to the first stepping distances;
[0102] In one embodiment, the step distance compensation is performed on the first step distance through the step distance compensation amount. At this time, the correspondence between the second step distance and the first resolution is obtained according to the correspondence between the first step distances and the second step distances.
[0103] A focus calibration function of a focus calibration position is constructed according to the first temperature data, the first resolutions corresponding to the second stepping distances and the first stepping distances, and the corresponding relationship between the second stepping distances and the first resolutions:
[0104] R(x, t) = ax 2 +bx+ct+d
[0105] According to multiple second step distances x, first temperature data t and the first resolutions R corresponding to the multiple second step distances, the constant coefficients a, b, c and d of the above-mentioned focus calibration function are solved (or the above-mentioned constants can minimize the difference between the calculated first resolution and the actual resolution under different second step distances), so as to construct a focus calibration function.
[0106] S07, repeating step S01 to step S06 to calculate the focus calibration function corresponding to a plurality of focus calibration positions;
[0107] In one embodiment, after completing the calculation of the focus calibration function of one focus calibration position, it is possible to 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 require calibration operations is calculated, and the focus calibration is ended.
[0108] S08. Acquire a current focus calibration position of a 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.
[0109] In one embodiment, after the focus calibration functions corresponding to multiple focus calibration positions are calculated, 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 focus calibration position to calculate the optimal stepping distance, and then the stepping motor is adjusted to move to the optimal stepping distance, or to the stepping distance supported by the camera that is closest to the optimal stepping distance, to focus the camera, thereby improving the efficiency and quality of the camera's automatic focusing.
[0110] 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.
[0111] Please refer to Figure 2 , Figure 2 A schematic flow chart of a second embodiment of a temperature compensation focus calibration method based on a resolution function provided in the present application.
[0112] In this embodiment, Figure 2 As shown, based on the above Figure 1 In the illustrated embodiment, after step S04, the following steps are further included:
[0113] S11, determining a target stepping range corresponding to the focus calibration position based on the first resolutions corresponding to the plurality of first stepping distances;
[0114] 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.
[0115] Here, the first resolution with the maximum value can be selected from the first resolutions corresponding to the multiple first step distances currently selected as the basis for selecting the target step range. Based on the first resolutions 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. Because the distance interval between any two adjacent first step distances is the same, and the first resolutions corresponding to the multiple first step distances form a curve opening downward, therefore, among the multiple first resolutions calculated from the first step distance, the maximum resolution value corresponding to the vertex of the curve is between the two first resolutions of the calculated maximum value, therefore, the range between the two first step distances with the largest corresponding resolution values can be used as the target step range.
[0116] 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.
[0117] 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.
[0118] 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.
[0119] S12, extracting a plurality of third step distances within the target step range based on the first set interval;
[0120] The first set interval is smaller than the interval between two adjacent first step distances. The first set interval can be selected according to the actual accuracy requirement or according to the equipment parameters. For example, if the interval between two adjacent first step distances is 100 mm, then the first set interval can be 10 mm. That is, assuming that the target step range is (0, 100), the third step distance can be extracted as (10, 20, ..., 90).
[0121] S13, calculating the second resolutions corresponding to the plurality of third step distances based on the resolution extraction method;
[0122] 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 third 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 multiple third step distances.
[0123] 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.
[0124] S14, based on the step distance compensation amount, correcting the plurality of third step distances to obtain a plurality of corrected fourth step distances;
[0125] In one embodiment, based on the step distance compensation formula, the plurality of third step distances are corrected using the step distance compensation amount to obtain a plurality of fourth step distances.
[0126] Among them, the step distance compensation formula is:
[0127] Distance_4=Distance_3+Distance_I
[0128] Wherein, Distance_4 represents the fourth step distance, Distance_3 represents the third step distance, and Distance_I represents the step distance compensation amount.
[0129] In one embodiment, the step distance correction is to perform addition and subtraction calculations on the third step distance according to the step distance compensation amount. If the step distance compensation amount is positive, the third step distance needs to be added, that is, the third step distance plus the step distance compensation amount is the fourth step distance after correction; if the step distance compensation amount is negative, the third step distance needs to be subtracted, that is, the third step distance minus the step distance compensation amount is the fourth step distance after correction.
[0130] S15, calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data, a plurality of the fourth step distances, and a second resolution corresponding to a plurality of the third step distances;
[0131] In one embodiment, the third step distance is compensated for by the step distance compensation amount. At this time, the corresponding relationship between the fourth step distance and the second resolution is obtained according to the corresponding relationship between the third step distances and the fourth step distance.
[0132] A focus calibration function of a focus calibration position is constructed according to the first temperature data, the second resolutions corresponding to the plurality of fourth step distances and the plurality of third step distances, and the corresponding relationship between the fourth step distance and the second resolution:
[0133] R(x, t) = ax 2 +bx+ct+d
[0134] According to the plurality of fourth step distances x, the first temperature data t and the second resolutions R corresponding to the plurality of fourth step distances, the constant coefficients a, b, c and d of the focus calibration function are solved, so as to construct a focus calibration function.
[0135] S16, repeating the step of calculating the focus calibration function to calculate the focus calibration function corresponding to a plurality of focus calibration positions;
[0136] After completing the focus calibration function calculation of one focus calibration position, you can switch to the next focus calibration position and repeat the above steps to 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.
[0137] S17: 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.
[0138] 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.
[0139] This embodiment 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 using a resolution extraction method, and the target step range of each focus calibration position is determined based on 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, a 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.
[0140] See also Figure 3 , Figure 3 It is a structural schematic diagram of a first embodiment of a temperature-compensated focus calibration device based on a resolution function provided in the present application. The temperature-compensated focus calibration device based on a resolution function is used to execute the aforementioned temperature-compensated focus calibration method based on a resolution function.
[0141] like Figure 3 As shown, the temperature-compensated focus calibration device 200 based on the resolution function includes: a data acquisition module 201, a first resolution calculation module 202, an equipment environment temperature difference calculation module 203, a step distance compensation amount calculation module 204, a step distance correction module 205, a focus calibration function calculation module 206, a function repetition calculation module 207 and a focus calibration module 208.
[0142] The data acquisition module 201 is used to acquire a focus calibration position, a plurality of first step distances corresponding to the focus calibration position, and first temperature data corresponding to the focus calibration position;
[0143] 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;
[0144] A device environment temperature difference calculation module 203, used to calculate the device environment temperature difference based on the first temperature data;
[0145] A step distance compensation amount calculation module 204, used to calculate the step distance compensation amount corresponding to the focus calibration position based on the device environment temperature difference;
[0146] A step distance correction module 205 is used to correct the first step distances based on the step distance compensation amount to obtain a plurality of corrected second step distances;
[0147] 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, a plurality of the second step distances, and a plurality of first resolutions corresponding to the first step distances;
[0148] The focus calibration module 207 is used to obtain 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.
[0149] In one embodiment, the first resolution calculation module 202 includes:
[0150] An image acquisition unit, configured to control the target camera to acquire an image of the calibration plate at each of the first step distances corresponding to the current focus calibration position based on preset camera acquisition parameters, so as to obtain a first calibration image;
[0151] The first resolution calculation unit is used to perform image analysis on the first calibration image based on a resolution algorithm to obtain the first resolution corresponding to each of the first step distances.
[0152] In one embodiment, the first temperature data includes device temperature and ambient temperature;
[0153] The device environment temperature difference calculation module 203 includes:
[0154] An operating temperature calculation unit, 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 unit, 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, 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.
[0159] In one embodiment, the step distance compensation amount calculation module 204 includes:
[0160] A step distance compensation amount calculation unit, 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 module 205 includes:
[0165] A step distance correction unit, configured to correct the plurality of first step distances using the step distance compensation amount based on a step distance compensation formula to obtain a plurality of second step distances;
[0166] Wherein, the step distance compensation formula is:
[0167] Distance_best=Distance_top+Distance_off
[0168] Wherein, Distance_best represents the second stepping distance, Distance_top represents the first stepping distance, and Distance_off represents the stepping distance compensation amount.
[0169] In one embodiment, the temperature compensation focus calibration device 300 based on the resolution function further includes a graded focus calibration module, including:
[0170] a target step range determining unit, 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;
[0171] A third step distance extraction unit, configured to extract a plurality of third step distances within the target step range based on a first set interval;
[0172] A second resolution calculation unit, used for calculating second resolutions corresponding to a plurality of the third step distances based on the resolution extraction method;
[0173] A first step distance correction unit, used for correcting a plurality of the third step distances based on the step distance compensation amount to obtain a plurality of corrected fourth step distances;
[0174] A first focus calibration function calculation unit, configured to calculate a focus calibration function corresponding to the focus calibration position based on the first temperature data, a plurality of the fourth step distances, and a second resolution corresponding to a plurality of the third step distances;
[0175] The focus calibration operation unit is used to obtain a current focus calibration position of a 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.
[0176] In one embodiment, the target step range determination unit includes:
[0177] A maximum step distance determination first subunit is used 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;
[0178] The target step range determines the first subunit, which 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.
[0179] In one embodiment, the target step range determination unit further includes:
[0180] A maximum step distance determination second subunit is used to determine a target first step distance with a maximum resolution value based on the first resolutions corresponding to each of the first step distances at each of the focus calibration positions;
[0181] The target step range determines the second subunit, which is used to determine the target step range corresponding to the focus calibration position based on the target first step distance.
[0182] 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 above-described device and each module can refer to the corresponding process in the aforementioned embodiment of the temperature compensation focus calibration method based on the resolution function, and will not be repeated here.
[0183] 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.
[0184] 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.
[0185] 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.
[0186] 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 temperature compensation focus calibration method based on a resolution function.
[0187] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0188] 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 temperature compensation focus calibration method based on the resolution function.
[0189] 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.
[0190] 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.
[0191] 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 temperature-compensated focus calibration methods based on the resolution function provided in the embodiments of the present application.
[0192] 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.
[0193] 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 temperature compensation focus calibration method based on a resolution function, characterized in that: The method comprises: S01, acquiring a focus calibration position, a plurality of first step distances corresponding to the focus calibration position, and first temperature data corresponding to the focus calibration position; S02. Calculating first resolutions corresponding to a plurality of first step distances based on a resolution extraction method; S03. Calculating the device environment temperature difference based on the first temperature data; S04, calculating a step distance compensation amount corresponding to the focus calibration position based on the device environment temperature difference; S05, based on the step distance compensation amount, correcting the plurality of first step distances to obtain a plurality of corrected second step distances; S06, calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data, a plurality of the second stepping distances, and a plurality of first resolutions corresponding to the first stepping 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 temperature compensation focus calibration method based on the 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 the preset camera acquisition parameters, the target camera is controlled to acquire an image of the calibration plate at each of the first step distances corresponding to the current focus calibration position to obtain a first calibration image; Based on a resolution algorithm, the first calibration image is analyzed to obtain the first resolution corresponding to each of the first step distances.
3. The temperature compensation focus calibration method based on resolution function according to claim 1, characterized in that: The first temperature data includes device temperature and ambient temperature; The calculating the device environment temperature difference based on the first temperature data 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.
4. The temperature compensation focus calibration method based on resolution function according to claim 1, 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.
5. The temperature compensation focus calibration method based on resolution function according to claim 1, characterized in that: The step of correcting the first step distances based on the step distance compensation amount to obtain a plurality of corrected second step distances includes: Based on a step distance compensation formula, using the step distance compensation amount, correcting the plurality of first step distances to obtain the plurality of second step distances; Wherein, the step distance compensation formula is: Distance_best=Distance_top+Distance_off Wherein, Distance_best represents the second stepping distance, Distance_top represents the first stepping distance, and Distance_off represents the stepping distance compensation amount.
6. The temperature compensation focus calibration method based on resolution function according to claim 1, characterized in that: After calculating the step distance compensation amount corresponding to the focus calibration position based on the device environment temperature difference, the method further includes: Determining a target stepping range corresponding to the focus calibration position based on the first resolutions corresponding to the plurality of first stepping distances; Based on the first set interval, extracting a plurality of third step distances within the target step range; Based on the resolution extraction method, calculating the second resolutions corresponding to the plurality of third step distances; Based on the step distance compensation amount, correcting the plurality of third step distances to obtain a plurality of corrected fourth step distances; Calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data, a plurality of the fourth step distances, and a second resolution corresponding to a plurality of the third step distances; Repeating the step of calculating the focus calibration function 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.
7. The temperature compensation focus calibration method based on resolution function according to claim 6, 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.
8. The two-stage focus calibration method based on resolution function according to claim 6, 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.
9. A temperature compensation focus calibration device based on a resolution function, characterized in that: The temperature compensation focus calibration device based on the resolution function comprises: A data acquisition module, used to acquire a focus calibration position, a plurality of first step distances corresponding to the focus calibration position, and first temperature data corresponding to the focus calibration position; 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 device environment temperature difference calculation module, used to calculate the device environment temperature difference based on the first temperature data; A step distance compensation amount calculation module, used to calculate the step distance compensation amount corresponding to the focus calibration position based on the device environment temperature difference; A step distance correction module, used for correcting the plurality of first step distances based on the step distance compensation amount to obtain a plurality of corrected second step distances; A focus calibration function calculation module, used for calculating a focus calibration function corresponding to the focus calibration position based on the first temperature data, a plurality of the second step distances and a first resolution corresponding to a plurality of the first step distances; The focus calibration 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 temperature-compensated focus calibration method based on a resolution function as claimed in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Lens focusing method for stepping motor based on temperature compensation
CN107942601A
Automatic focusing method and system based on ultrasonic microscope point focusing transducer
CN112630306A
Focal length test method and compensation method
CN112666805A