A camera focusing parameter calibration method and device, electronic equipment and storage medium

By employing a parameter optimization search strategy and a temporal characteristic curve scoring method in the camera, the problems of subjectivity and inefficiency in the calibration of focusing parameters in the prior art are solved, achieving efficient and automated focusing parameter calibration and ensuring the optimization and consistency of camera focusing performance.

CN120980211BActive Publication Date: 2026-02-03SHENZHEN JYC TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511481664.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2026-02-03
Estimated Expiration
2045-10-16

AI Technical Summary

Technical Problem

Existing methods for calibrating camera focus parameters are highly subjective, inefficient, and have poor repeatability, making it difficult to meet the requirements for high precision and high efficiency.

Method used

A preset parameter optimization search strategy is adopted. The focusing parameters are determined iteratively within a predetermined parameter range using strategies such as binary search. The focusing ring position information is collected in real time to generate a time-series characteristic curve. The curve is compared with the ideal curve to calculate the final score, select the optimal focusing parameters, and further verify them in the neighborhood.

Benefits of technology

It achieves global optimal convergence of focusing parameters, quantifies focusing effect, improves calibration efficiency and automation, reduces subjective error, and has strong applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120980211B_ABST
    Figure CN120980211B_ABST
Patent Text Reader

Abstract

The application relates to a camera focusing parameter calibration method and device, electronic equipment and a storage medium. The method comprises the following steps: according to a preset parameter optimization search strategy, sequentially determining focusing parameters in a predetermined parameter range; based on each determined focusing parameter, controlling the lens of the camera to automatically focus at a specified combination of an aperture and a focal length, and collecting position information of a focusing ring in a focusing process in real time; generating a time sequence characteristic curve according to the collected position information; intercepting a focusing dynamic curve of each time sequence characteristic curve, comparing the focusing dynamic curve with an ideal curve respectively, and calculating the final score of the focusing dynamic curve; selecting the focusing parameter with the highest final score as a candidate optimal focusing parameter; determining the neighborhood range of the candidate optimal focusing parameter, and taking the focusing parameter with the highest final score in the neighborhood range as an optimal focusing parameter, so that the globally optimal parameter can be ensured in the calibration process, the focusing effect can be quantified, and subjective errors in artificial judgment can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of optical technology, and particularly relates to a camera focusing parameter calibration method and device, electronic equipment and storage medium. BACKGROUND

[0002] In a camera imaging system, focusing performance directly determines imaging clarity and shooting experience, and focusing parameters (such as focusing sensitivity, motor driving strength, etc.) are core factors affecting focusing performance. Such parameters need to be accurately matched with the "aperture + focal length" combination of the camera lens, so as to achieve the effect of "fast focusing start, no overshoot oscillation, and stable target clarity". Camera focusing parameter calibration refers to the process of determining the optimal focusing parameters for each combination by testing and optimizing, in view of different aperture settings (such as F1.8, F2.0, F2.2, etc.) and focal length combinations (such as 24mm, 28mm, 35mm, etc.) of the lens. The core goal is to enable the camera to achieve the performance standards of "fast focusing speed, high stability, and accurate clarity" under any aperture-focal length setting.

[0003] Currently, the mainstream camera focusing parameter calibration methods in the industry mainly include manual experience calibration method, linear search automatic calibration method, and general parameter unified calibration method. The manual experience calibration method mainly relies on subjective experience and manually adjusts the focusing sensitivity parameter. After each adjustment, the autofocus is started, and the clarity of the focusing target, whether the focusing ring oscillates or overshoots, and the speed of focusing completion are observed by naked eye. The current parameter is judged subjectively whether it is "qualified", and the "optimal" parameter is recorded. After completing a combination, the next "aperture + focal length" combination is manually switched, and the above process is repeated. The linear search automatic calibration method presets the value range of the focusing parameter, and sequentially sends the parameter to the camera in the order of "from the minimum value to the maximum value". The process of "starting focusing, collecting focusing process data, and judging focusing effect" is performed for each parameter. Finally, the parameter with the best focusing effect is selected as the calibration value of the "aperture + focal length" combination. The general parameter unified calibration method does not distinguish the differences between the aperture and focal length of the lens. Only a few typical combinations are tested to determine a set of "general focusing parameters", which are applied to all "aperture + focal length" combinations of the lens without the need for individual calibration for each combination.

[0004] However, the above existing methods all have obvious defects and cannot meet the high precision, high efficiency and objectivity requirements of camera focusing. Specifically, the manual experience calibration method is highly subjective, low in efficiency and poor in repeatability. The linear search automatic calibration method has many iterations, takes a long time, and is difficult to adapt to large parameter ranges. The general parameter unified calibration method has poor adaptability and cannot balance the focusing performance of all combinations. None of the above methods establishes a quantitative evaluation standard for focusing effect, and all have the defects of strong subjectivity, low efficiency, poor adaptability, and no quantitative evaluation standard. SUMMARY

[0005] Therefore, the present application provides a camera focusing parameter calibration method, device and storage medium, which solves the problems of long time consumption, strong subjectivity and poor repeatability in the camera focusing parameter calibration process.

[0006] To achieve the above-mentioned purpose, in a first aspect, the technical solution of the present application to solve the technical problem is to provide a camera focusing parameter calibration method, comprising: determining the focusing parameter in the predetermined parameter range in turn according to the preset parameter optimization search strategy; based on each determined focusing parameter, controlling the lens of the camera to automatically focus at a specified combination of aperture and focal length, and collecting the position information of the focusing ring in real time during the focusing process, wherein the initial position of the focusing ring is located at the stroke endpoint; generating a time sequence characteristic curve reflecting the change of the motion state of the focusing ring according to the collected position information; intercepting the focusing dynamic curve of each time sequence characteristic curve, respectively comparing with the ideal curve, and calculating the final score of the focusing dynamic curve according to the comparison result; selecting the focusing parameter corresponding to the focusing dynamic curve with the highest final score as the candidate optimal focusing parameter; determining the neighborhood range of the candidate optimal focusing parameter, and calculating the final score of all focusing parameters in the neighborhood range again, and taking the focusing parameter with the highest final score in the neighborhood range as the optimal focusing parameter.

[0007] In an optional embodiment, after the determination of the neighborhood range of the candidate optimal focusing parameter, the recalculation of the final score of all focusing parameters in the neighborhood range, and the taking of the focusing parameter with the highest final score in the neighborhood range as the optimal focusing parameter, the method further comprises: adjusting the aperture and / or focal length of the lens of the camera to the next specified combination until the calibration of the focusing parameters of all lens aperture and focal length combinations is completed.

[0008] In an optional embodiment, when the lens of the camera automatically focuses at the specified combination of aperture and focal length, the lens of the camera is directed towards the focusing target.

[0009] In an optional embodiment, the preset parameter optimization search strategy is the dichotomy method, which comprises the steps of iterative execution: determining the parameter search range, wherein the initial parameter search range is the predetermined parameter range; calculating the midpoint of the minimum value and the maximum value of the parameter search range, and taking the midpoint as the current focusing parameter; adjusting the parameter search range based on the focusing dynamic curve formed after automatic focusing based on the current focusing parameter.

[0010] In an optional embodiment, the judgment basis for adjusting the parameter search range comprises: when the characteristics of the focusing dynamic curve appear oscillation or overshoot, the maximum value of the parameter search range is adjusted to the midpoint value minus one; when the characteristics of the focusing dynamic curve appear response delay or focusing time extension, the minimum value of the parameter search range is adjusted to the midpoint value plus one.

[0011] In an optional implementation, the iteration process of the dichotomy method stops when one of the following conditions is met: the minimum value of the current parameter search range is greater than the maximum value; the score of the candidate optimal focusing parameter obtained in consecutive iterations changes by less than a threshold value; the number of iterations reaches a preset maximum value.

[0012] In an optional implementation, the focusing dynamic curve is a curve segment between a focusing starting point and a stable point in the time sequence characteristic curve; the focusing starting point is a sampling point at which the position of the focusing ring first changes, and the stable point is a point at which the position of the focusing ring remains stable for consecutive sampling periods.

[0013] In an optional implementation, the judgment condition of the stable point is that the change amount of the position of the focusing ring in consecutive 15 sampling periods is less than a preset threshold value.

[0014] In an optional implementation, the final score of the focusing dynamic curve according to the comparison result comprises: performing normalization processing on the focusing dynamic curve; calculating the similarity between the normalized focusing dynamic curve and an ideal curve as an intermediate score; and introducing a time penalty factor to correct the intermediate score according to the actual time consumption of this time automatic focusing to obtain the final score.

[0015] In an optional implementation, the calculation of the similarity between the normalized focusing dynamic curve and the ideal curve comprises: calculating the cosine similarity, the inverse of the Euclidean distance, and the Pearson correlation coefficient between the normalized focusing dynamic curve and the ideal curve; and performing weighted summation on the cosine similarity, the inverse of the Euclidean distance, and the Pearson correlation coefficient to obtain the intermediate score.

[0016] In an optional implementation, the weight distribution of the weighted summation is: the cosine similarity weight is 0.2, the inverse of the Euclidean distance weight is 0.6, and the Pearson correlation coefficient weight is 0.2.

[0017] In an optional implementation, the generation of the time sequence characteristic curve reflecting the change in the motion state of the focusing ring according to the collected position information comprises: continuously collecting the position information of the focusing ring in the automatic focusing process at a predetermined time interval; and constructing the time sequence characteristic curve with the time information as the horizontal axis and the position information of the focusing ring as the vertical axis.

[0018] In an optional implementation, the predetermined time interval is 20 ms, and the position information collection of the focusing ring comprises motor encoder acquisition, optical sensor acquisition, or image sharpness evaluation function acquisition.

[0019] In an optional implementation, the neighborhood range comprises a plurality of consecutive focusing parameter values centered on the candidate optimal focusing parameter.

[0020] In a second aspect, a camera focusing parameter calibration device is provided, comprising: a parameter search module configured to determine focusing parameters in a predetermined parameter range according to a preset parameter optimization search strategy; a focusing execution module configured to control a lens of a camera to perform automatic focusing at a specified combination of aperture and focal length based on each determined focusing parameter, and collect position information of a focusing ring in real time during the automatic focusing, wherein an initial position of the focusing ring is located at an endpoint of a stroke; a curve generation module configured to generate a time sequence characteristic curve reflecting a change in a motion state of the focusing ring according to the collected position information; a score calculation module configured to intercept a focusing dynamic curve of each time sequence characteristic curve, compare the focusing dynamic curve with an ideal curve respectively, and calculate a final score of the focusing dynamic curve according to a comparison result; a screening module configured to select a focusing dynamic curve corresponding to a focusing parameter with a highest final score as a candidate optimal focusing parameter; and a calibration module configured to determine a neighborhood range of the candidate optimal focusing parameter, calculate final scores of all focusing parameters in the neighborhood range again, and select a focusing parameter with a highest final score in the neighborhood range as an optimal focusing parameter.

[0021] In a third aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a camera focusing parameter calibration method when executing the program.

[0022] In a fourth aspect, a computer readable storage medium is provided, having a computer program stored thereon, wherein the computer program is executable by a processor to implement a camera focusing parameter calibration method.

[0023] In a fifth aspect, a camera is provided, having an optimal focusing parameter lookup table calibrated by a camera parameter calibration method, wherein the camera calls a corresponding parameter in the lookup table according to a current aperture and focal length combination to perform focusing during automatic focusing.

[0024] Compared with the prior art, the camera focusing parameter calibration method, device, electronic device, and storage medium provided by the present application have the following beneficial effects:

[0025] The predetermined parameter range is iteratively selected multiple times by the preset parameter optimization search strategy, so that multiple focusing parameters in the predetermined parameter range converge to an optimal interval, and the global optimal parameter is ensured. The final score is formed by matching and comparing the time sequence characteristic curve with the ideal curve, the focusing effect can be quantified, subjective errors of artificial judgment are avoided, and the calibration efficiency is high, the degree of automation is high, and the applicability is strong. BRIEF DESCRIPTION OF DRAWINGS

[0026] Figure 1 A step flowchart of the camera focusing parameter calibration method provided by the first embodiment of the present application;

[0027] Figure 2 This is a time-series characteristic curve showing the change in the motion state of the focus ring during each focusing process;

[0028] Figure 3 This is an ideal curve representing the change in the motion state of the focusing ring;

[0029] Figure 4 This is a timing characteristic curve diagram showing the oscillation and overshoot of the focus ring during the focusing process.

[0030] Figure 5 This is a timing characteristic curve diagram corresponding to the extension of the focusing time of the focusing ring during focusing overshoot;

[0031] Figure 6 This is a schematic diagram of the focus start point and stabilization point of the focus dynamic curve;

[0032] Figure 7 A flowchart outlining the steps for calibrating focus parameters for multiple lens aperture and focal length combinations. Detailed Implementation

[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0034] It should be noted that all directional indications in the embodiments of this application are only used to explain the relative positional relationship and movement of each component in a specific posture. If the specific posture changes, the directional indications will also change accordingly.

[0035] Furthermore, the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of a person skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, the user should consider such a combination of technical solutions to be non-existent and not within the scope of protection claimed in this application.

[0036] like Figure 1 As shown, the camera focus parameter calibration method provided in the first embodiment of this application includes:

[0037] S100 optimizes the search strategy based on preset parameters and sequentially determines the focus parameters within the predetermined parameter range;

[0038] Understandably, the predetermined parameter range represents the boundary of the focus parameters issued by the control terminal. It must be compatible with the aperture-focal length combination specified by the current lens. This range directly corresponds to the sensitivity characteristics of the lens's focus ring, providing clear numerical limitations for the selection of focus parameters during camera focusing. This prevents focusing anomalies caused by parameters exceeding the lens's driving capabilities (e.g., parameters that are too large causing oscillation overshoot, or parameters that are too small causing focusing sluggishness). The preset parameter optimization search strategy is the core logic of the control terminal determining the specific parameters to be issued from the predetermined parameter range. Its purpose is to reduce invalid testing through regular searches to efficiently locate the optimal parameters.

[0039] In this embodiment, the predetermined parameter range is selected as [1-1024]. The preset parameter optimization search strategy includes strategies such as binary search, genetic algorithm, hill climbing algorithm, and particle swarm optimization. These strategies all need to dynamically adjust the parameter selection in combination with the subsequent focus curve scoring results to ensure that the parameter search direction is in line with the goal of "approaching the ideal focus effect".

[0040] It should be noted that the control terminal can take various forms, such as a mobile app, tablet, computer software, or a control module integrated within the adapter ring, which can be flexibly selected according to the actual application scenario. It can achieve information interaction via Bluetooth and other communication methods to send focus parameters to the camera, send autofocus start commands, and receive focus ring position information and final scoring results collected during the focusing process. This provides data and command transmission support for the parameter calibration process, ensuring the implementation of core functions such as focus parameter issuance, data acquisition command transmission, and scoring result feedback, thereby guaranteeing the automated progress and accuracy of the autofocus parameter calibration process.

[0041] S200, based on each determined focusing parameter, controls the camera lens to perform automatic focusing with a specified combination of aperture and focal length, and collects the position information of the focusing ring in real time during the focusing process, wherein the initial position of the focusing ring is located at the end of the travel.

[0042] Understandably, in step S100, after determining a focus parameter each time based on the preset parameter optimization search strategy, the control terminal sends the focus parameter to the camera and controls the camera to start autofocus based on the sent focus parameter. Before each autofocus is started, the focus ring needs to be rotated to the end of its travel (i.e., the closest or farthest end). By unifying the initial position of the focus ring, the starting conditions for each parameter test are ensured to be consistent, thereby improving the accuracy and repeatability of the test results.

[0043] During autofocus, the position information of the focus ring throughout its entire rotation process is collected in real time, that is, the position information of the focus ring as it rotates from the end of its travel to the focus point and then returns from the focus point to the end of its travel after autofocus is completed.

[0044] It should be noted that the camera can be switched to manual focus mode and the focus ring can be rotated to the end of its travel. Alternatively, the camera can be automatically rotated to the end of its travel by controlling the control terminal. No limitation is made here.

[0045] S300 generates a time-series characteristic curve reflecting the changes in the motion state of the focusing ring based on the collected location information;

[0046] Understandably, after acquiring the position information of the focus ring rotating from the end of its travel to the focus point and then back to the end of its travel during the autofocus process, the timing characteristic curve corresponding to each focus parameter in the entire autofocus process can be generated based on the acquired position information.

[0047] S400 extracts the focus dynamic curve of each timing characteristic curve, compares it with the ideal curve, and calculates the final score of the focus dynamic curve based on the comparison results.

[0048] It's understandable that the focus dynamic curve is the curve representing the rotation of the focus ring during autofocus within each time-series characteristic curve. However, the entire time-series characteristic curve includes a large amount of noise data unrelated to focus performance during autofocus, such as the waiting time before the focus command is issued (a flat segment) and the meaningless static segment after focus stabilization (also a flat segment). This data dilutes the core data that truly reflects the focus dynamic performance (start-up, acceleration, deceleration, and stabilization), leading to inaccurate final scores. Therefore, comparing the focus dynamic curve with the ideal curve directly reflects key performance indicators of the focusing system, such as response speed, overshoot, and oscillation, while removing irrelevant noise, making the scoring results more accurately reflect the quality of the focus parameters.

[0049] The ideal curve is a pre-set standardized curve that indicates the autofocus process should follow. Its function is to serve as a benchmark for comparison with the actual focusing dynamic curve to determine whether the actual focusing effect is close to the ideal state.

[0050] The final score is obtained by standardizing the captured focus dynamic curve, comparing it with the ideal curve using a preset curve matching algorithm (normalized matching, or alternative methods such as correlation analysis, Fourier transform, or machine learning models can be used), and optimizing it in combination with the time factor in the focusing process, and finally obtaining a score that reflects the quality of the actual focusing effect.

[0051] For the S500, the focus parameters corresponding to the focus dynamic curve with the highest final score are selected as the candidate best focus parameters.

[0052] Understandably, after step S200 sequentially uses the issued focus parameters for autofocus, and after step S300 generates a timing characteristic curve corresponding to each issued focus parameter during each focusing process, step S400 extracts the focus dynamic curve of each timing characteristic curve to obtain multiple focus dynamic curves corresponding to the issued focus parameters. Each focus dynamic curve is then compared with the ideal curve to obtain a final score for each focus dynamic curve. All final scores are compared, and the focus parameter corresponding to the focus dynamic curve with the highest final score is selected as the candidate optimal focus parameter.

[0053] S600, determine the neighborhood range of the candidate best focus parameter, recalculate the final score of all focus parameters in the neighborhood range, and take the focus parameter with the highest final score in the neighborhood range as the optimal focus parameter.

[0054] Understandably, the neighborhood range is a set of consecutive focusing parameter values ​​centered on the candidate optimal focusing parameter. After the candidate optimal focusing parameter meets the convergence requirement, it is a set of parameters selected around the convergence parameter to further improve parameter accuracy. Essentially, it involves selecting several parameters that are close to the convergence parameter, testing each focusing parameter in the neighborhood range separately, calculating the final score, and then comparing the scores of the convergence parameter with those of all focusing parameters in the neighborhood range. The parameter with the highest score is selected as the optimal focusing parameter under the specified aperture-focal length combination of the current lens, thereby achieving fine verification and confirmation of the parameters.

[0055] In this embodiment, the neighborhood range includes 7 focusing parameters. That is, in the vicinity of the candidate best parameter that currently meets the convergence rule, taking the candidate best focusing parameter as the center, together with the candidate best parameter, a total of 7 consecutive neighboring values ​​are selected as new parameters to be issued. The above steps S200 to S400 are repeated to obtain the final score of the focusing dynamic curve corresponding to the 7 focusing parameters. From these 7 final scores, the focusing parameter corresponding to the highest score is selected as the optimal focusing parameter under the current aperture and focal length combination.

[0056] To illustrate with a specific example, after steps S100 and S500, the candidate optimal parameter is 280. At this time, the neighborhood range of the candidate optimal parameter includes 277, 278, 279, 280, 281, 282, and 283. Then, autofocus is performed using these 7 focusing parameters to form corresponding time-series characteristic curves. The focusing dynamic curves are extracted separately, and the final score is calculated. The highest score among the 7 final scores is selected as the optimal focusing parameter.

[0057] In some embodiments, when the camera lens performs autofocus with a specified combination of aperture and focal length, the camera lens is oriented toward a focus target.

[0058] Understandably, the focus target is placed in front of the camera. It is a target with high local contrast and sharp boundaries. The lens is pointed towards the focus target as a reference target in the autofocus process, which can provide a clear signal for contrast detection or phase difference detection, thereby making focusing faster and more accurate.

[0059] It should be noted that, in some embodiments, the camera focus parameter calibration method can be performed without setting an external focus target. That is, when the camera lens performs autofocus with a specified combination of aperture and focal length, the camera lens does not need to be pointed towards any specific focus target.

[0060] In such embodiments, the calibration method utilizes the inherent physical characteristics of the camera lens optical system as a reference for autofocus. A typical implementation involves controlling the camera to perform a "focus to infinity" operation with the focus ring initially positioned at the end of its travel (e.g., the closest focusing distance). The lens's "infinity" focus position is an optically stable, known fixed point that can serve as an ideal target for the focusing process.

[0061] When the camera adopts this mode, the focusing parameters sent by the control terminal are used to control the camera to complete an autofocus process aimed at "optical infinity". During this process, the focus ring moves from a defined initial position at the end of its travel path to the physical position corresponding to "infinity". By collecting and analyzing the temporal characteristic curve of this movement process (i.e., the focusing dynamic curve), and comparing and scoring it with a preset ideal curve representing a rapid and smooth journey from the initial point to the "infinity" position, the focusing parameters are optimized and calibrated. This method is particularly suitable for rapid calibration on camera production lines or parameter self-recovery after lens repair, eliminating the dependence on physical targets while ensuring the consistency of conditions in the calibration process, thus improving the reliability, flexibility, and environmental adaptability of the calibration.

[0062] In some embodiments, generating a time-series characteristic curve reflecting the change in the motion state of the focus ring includes:

[0063] The position information of the focus ring during the autofocus process is continuously collected at predetermined time intervals.

[0064] A temporal characteristic curve is constructed with time information as the horizontal axis and the position information of the focus ring as the vertical axis.

[0065] Understandably, the predetermined time refers to a fixed interval for acquiring position information during autofocus. For example, setting each acquisition interval to 20ms ensures that the acquired focus ring position data has a uniform time dimension reference, providing a stable time base for subsequent analysis of motion state changes. The focus ring's position information needs to be continuously acquired during focusing, and its values ​​must follow a specific definition: minimum value at infinity and maximum value at the nearest point. This definition clearly reflects the actual physical position of the focus ring at different times, providing accurate position data support for subsequent curve generation. The time-series characteristic curve reflecting the change law of the focus ring's motion state is a curve generated with the acquired time as the horizontal axis and the focus ring position as the vertical axis. It can intuitively present the complete motion process of the focus ring from start-up to stabilization. For example, when the parameter is too large, the curve will exhibit oscillations and overshoot; when the parameter is too small, the curve takes too long to reach the stabilization point. These characteristics can be directly used for subsequent comparative analysis with the ideal curve. Figure 2 and Figure 3 As shown, where Figure 2 The time-series characteristic curves are generated sequentially for each issuance of benchmark parameters. Figure 3 This is a high-scoring curve (ideal curve).

[0066] It should be noted that the position information of the focusing ring can be obtained through a motor encoder, or through an optical sensor or an image sharpness evaluation function.

[0067] In some embodiments, the preset parameter optimization search strategy is a binary search method, which includes iterative execution steps:

[0068] Determine the parameter search range, wherein the initial parameter search range is the predetermined parameter range;

[0069] Calculate the midpoint between the minimum and maximum values ​​of the parameter search range, and use this midpoint as the current focus parameter;

[0070] Adjust the parameter search range based on the focus dynamic curve generated after autofocusing with the current focus parameters;

[0071] When the focus dynamic curve exhibits oscillations or overshoot, adjust the maximum value of the parameter search range to the midpoint value minus one. When the focus dynamic curve exhibits slow response or prolonged focusing time, adjust the minimum value of the parameter search range to the midpoint value plus one.

[0072] The binary search method stops when any one of the following conditions is met: the minimum value of the current parameter search range is greater than the maximum value; the change in the candidate best focus parameter score obtained from multiple consecutive iterations is less than the threshold; or the number of iterations reaches the preset maximum value.

[0073] To illustrate with a specific example: In this embodiment, the preset parameter optimization search strategy adopts a binary search method. The initial parameter search range is low=1, high=1024. When the focus parameter is issued for the first time, the calculated midpoint is Mid=(low+high) / 2. Since Mid=(1+1024) / 2=512.5, it needs to be rounded down to select 512 or 513 as the focus parameter for issuance. Taking the selection of 512 as the focus parameter as an example, in the subsequent steps S200-S300, autofocus is performed with 512 as the focus parameter, forming the corresponding time-series characteristic curves. At this time, the adjustment direction of the parameter search range can be determined based on the characteristics of the time-series characteristic curves. When the time-series characteristic curves exhibit characteristics such as increased oscillation and overshoot, indicating "parameters are too large," such as... Figure 4 As shown, the currently issued focusing parameter 512 is too large. The optimal parameter should be located in the left interval of the current search range. Therefore, the maximum value of the parameter search range is adjusted to mid-1, i.e., 512-1=511. At this time, the new parameter search range is updated to 1~511. If the timing characteristic curve shows characteristics of "parameter too small" such as slow response and significantly prolonged focusing time, such as... Figure 5 As shown, this indicates that the focusing parameter 512 is too small. The optimal parameter needs to be found in the right-hand interval of the current search range. Therefore, the minimum value of the parameter search range is adjusted to mid+1, that is, 512+1=513, and the new search range becomes 513~1024.

[0074] The above logic is repeated iteratively: in each iteration, the midpoint between the minimum and maximum values ​​of the current search range is calculated and rounded to obtain the new focus parameter. The search range is then adjusted based on the temporal characteristic curve features corresponding to the focus parameter until the search range meets the convergence rules of "minimum value is greater than maximum value", "focus score corresponding to parameter converges to a stable value", or "number of iterations reaches the preset maximum value". Theoretically, this process only requires 10 iterations to converge to the optimal interval from 1024 possible values.

[0075] It should be noted that the core of the bisection method is to gradually narrow the range by "testing the midpoint parameter and adjusting the search range according to the characteristics of the focus curve". Regardless of whether the initial selection is 512 or 513, the direction can be corrected by the logic of "if the curve oscillates too much, reduce the upper limit; if the response is too slow, expand the lower limit", and finally it can still quickly converge to the optimal parameter range.

[0076] In some embodiments, the focus dynamic curve is a line segment in the time-series characteristic curve from the focus start point to the stabilization point.

[0077] The focus start point refers to the sampling point where the position of the focus ring first changes, that is, the first point in the time sequence characteristic curve where the position changes, which marks the start of the focusing action.

[0078] A stable point is a point where the focus ring position remains stable over multiple consecutive sampling periods. This indicates that the focusing process has been completed and has reached a stable state. The focus dynamic curve between these two points should be used as the analysis object. Figure 6 As shown. Preferably, the stable point is the point in the curve where there is no positional change for 15 consecutive sampling points.

[0079] In some embodiments, the final score of the focus dynamic curve is calculated based on the comparison results, including:

[0080] The focus dynamic curve is normalized.

[0081] Calculate the similarity between the normalized focus dynamic curve and the ideal curve, and use it as an intermediate score;

[0082] Based on the actual autofocus time, a time penalty factor is introduced to correct the intermediate scores and obtain the final score.

[0083] Understandably, the extracted focus dynamic curve undergoes time-domain and value normalization to standardize its numerical range and time scale. Then, the similarity between the focus dynamic curve and the ideal segment is calculated using curve similarity quantification analysis as an intermediate score. Finally, the intermediate score is adjusted based on the actual time taken to obtain the final score.

[0084] In some embodiments, calculating the similarity between the normalized focus dynamic curve and the ideal curve includes:

[0085] Calculate the cosine similarity, reciprocal of the Euclidean distance, and Pearson correlation coefficient between the normalized focus dynamic curve and the ideal curve;

[0086] The intermediate score is obtained by weighted summation of cosine similarity, reciprocal Euclidean distance, and Pearson correlation coefficient.

[0087] The weights for the weighted summation are: cosine similarity weight 0.2, inverse Euclidean distance weight 0.6, and Pearson correlation coefficient weight 0.2.

[0088] Understandably, by using three matching methods—cosine similarity matching, Euclidean distance calculation, and Pearson correlation coefficient calculation—the similarity between the focus dynamic curve and the ideal curve can be comprehensively and objectively quantified from different dimensions, avoiding the one-sidedness of a single method and ensuring that the matching results meet the core requirements of the camera's autofocus.

[0089] The core logic of weighting is to prioritize the "core influencing factors" of focusing accuracy while also considering auxiliary dimensions, ensuring that the intermediate scores accurately reflect the "indicators that play a key role in the final focusing effect." The specific basis is as follows:

[0090] Euclidean distance calculation (weight 0.6, highest): In camera autofocus, the "numerical deviation between the actual focus position and the ideal position" is the core indicator that determines image sharpness. Even if the curve direction and trend are synchronized, if the positional deviation of the corresponding sampling point is large (large Euclidean distance), the final image will still be blurry. Therefore, Euclidean distance, as the "core dimension of accuracy," should be given the highest weight to ensure that the intermediate score prioritizes "positional accuracy."

[0091] Cosine similarity matching (weight 0.2) and Pearson correlation coefficient calculation (weight 0.2): Both are "auxiliary dimensions." Cosine similarity ensures that the overall direction of the curve does not deviate from the ideal trend, avoiding reverse focusing and invalid fluctuations. Pearson correlation coefficient ensures that the rhythm of curve changes is synchronized, avoiding sudden changes in the focusing process. However, the influence of both must be based on "small numerical deviations." If the numerical deviation is already large, even the best direction and rhythm are meaningless. Therefore, both are given equal low weights and are only used as supplementary evaluations to "core accuracy" to avoid excessively influencing the core judgment of intermediate scores.

[0092] It should be noted that the core purpose of introducing the time penalty factor is to ensure that the final score takes into account both the "accuracy" and "efficiency" of focusing, so that the selected parameters not only meet the "ideal curve matching degree" but also meet the "focusing speed" requirements of actual camera usage scenarios.

[0093] Let's take a specific example as an illustration:

[0094] Assuming the lens is used in a test scenario with an aperture of f / 2.8 and a focal length of 50mm, the ideal focus curve (after normalization) is defined as a sequence of time (1 sampling point every 20ms, for a total of 5 points) and focus ring position (normalized range of 0-1):

[0095] A = [(0ms, 0.1), (20ms, 0.3), (40ms, 0.5), (60ms, 0.7), (80ms, 0.9)] represents an ideal trend that rapidly and smoothly approaches the target position.

[0096] Focusing dynamic curve (after normalization): The acquired sequence is as follows:

[0097] B=[(0ms,0.12),(20ms,0.31),(40ms,0.48),(60ms,0.72),(80ms,0.89)] (The overall trend is close to the ideal curve, but there are slight numerical deviations). Focusing time setting: The "ideal focusing time" at this aperture focal length is 80ms (i.e., focusing is completed in 5 sampling points). The penalty rule is: when the actual focusing time T>80ms, 0.02 weight is deducted for every 20ms exceeding the limit; there is no penalty for T≤80ms.

[0098] Cosine similarity matching: The cosine value of the position vectors A and B is calculated using the vector dot product formula, and the result is 0.98 (close to 1, indicating that the curve directions are highly consistent).

[0099] Euclidean distance calculation: First, calculate the Euclidean distance between the position vectors of A and B (√[(0.12-0.1)²+(0.31-0.3)²+(0.48-0.5)²+(0.72-0.7)²+(0.89-0.9)²]≈0.036), then normalize the distance to "similarity" (formula: 1-distance / maximum possible distance, where the maximum possible distance ≈√(5×1²)=2.236), the result is 0.984, close to 1, indicating that the difference in curve values ​​is extremely small;

[0100] Pearson correlation coefficient calculation: The correlation coefficient between the A and B position sequences was calculated using the covariance and standard deviation formula. The result was 0.99, which is close to 1, indicating that the curve trends are completely synchronized.

[0101] Weighted summation with weights of 0.2, 0.6, and 0.2: Intermediate score = (0.98 × 0.2) + (0.984 × 0.6) + (0.99 × 0.2) = 0.196 + 0.5904 + 0.198 = 0.9844; Actual focusing time: The actual focusing time was 90ms, exceeding the ideal time by 10ms; Penalty factor calculation: According to the rule "deduct 0.02 for every 20ms exceeding the limit", the corresponding weight deduction for exceeding 10ms is 0.02 × (10 / 20) = 0.01; Final score: 0.9844 - 0.01 = 0.9744.

[0102] like Figure 7 As shown, in some embodiments, after determining the neighborhood range of the candidate optimal focus parameter, recalculating the final score of all focus parameters within the neighborhood range, and using the focus parameter with the highest final score within the neighborhood range as the optimal focus parameter, the method further includes:

[0103] S700, adjust the lens aperture and / or focal length sequentially to the next specified combination until the calibration parameters of all lens aperture and focal length combinations are completed;

[0104] It is understandable that in the above steps S100-S600, the focusing parameters of a specified combination of aperture and focal length are calibrated. That is, within the specified combination of lens aperture and focal length, the focusing parameters within the preset parameter range are iteratively selected multiple times through a preset parameter optimization search strategy, so that multiple focusing parameters within the predetermined parameter range converge to the optimal range. After the calibration of the optimal focusing parameters corresponding to the specified combination, the aperture and / or zoom ring can be adjusted again, so that the aperture and zoom ring form the next combination of aperture and focal length. The above steps are repeated until the optimal focusing parameters under all aperture and focal length combinations of the lens are obtained. That is, the focusing parameters of all aperture and focal length combinations of the lens are calibrated.

[0105] It should be noted that the aperture and / or focal length combination can be adjusted manually by setting the camera to manual focus mode, or it can be automatically adjusted using the control terminal; there is no limitation here.

[0106] A second embodiment of this application provides a camera focus parameter calibration device, which includes:

[0107] The parameter search module is used to optimize the search strategy based on preset parameters and determine the focus parameters sequentially within a predetermined parameter range;

[0108] The focusing execution module is used to control the camera lens to perform automatic focusing with a specified combination of aperture and focal length based on each determined focusing parameter, and to collect the position information of the focusing ring in real time during the focusing process, wherein the initial position of the focusing ring is located at the end of the travel.

[0109] The curve generation module is used to generate a time-series characteristic curve reflecting the changes in the motion state of the focusing ring based on the collected location information.

[0110] The scoring calculation module is used to extract the focus dynamic curve of each time-series characteristic curve, compare it with the ideal curve, and calculate the final score of the focus dynamic curve based on the comparison results.

[0111] The filtering module is used to select the focus parameters corresponding to the focus dynamic curve with the highest final score as candidate best focus parameters.

[0112] The calibration module is used to determine the neighborhood range of the candidate best focus parameters, recalculate the final score of all focus parameters within the neighborhood range, and take the focus parameter with the highest final score within the neighborhood range as the optimal focus parameter.

[0113] The third embodiment of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements a camera focus parameter calibration method.

[0114] The fourth embodiment of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the camera focus parameter calibration method in the above-described method embodiments.

[0115] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (Read-Only Memory). Memory includes ROM, magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application may include at least one of relational databases and non-relational databases. Non-relational databases may include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these. The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered to be within the scope of this specification.

[0116] The fifth embodiment of this application provides a camera that stores an optimal focus parameter lookup table obtained by camera focus parameter calibration. When the camera is autofocusing, it calls the corresponding parameters in the lookup table to focus based on the current aperture and focal length combination.

[0117] Compared with existing technologies, the camera focusing parameter calibration method, device, electronic device, and storage medium provided by this invention perform multiple iterative selections within a predetermined parameter range using a preset parameter optimization search strategy. This allows multiple focusing parameters within the predetermined parameter range to converge to the optimal interval, ensuring globally optimal parameters are obtained. Simultaneously, by matching and comparing the time-series characteristic curve with the ideal curve to form a final score, the focusing effect can be quantified, avoiding subjective errors from manual judgment.

[0118] Furthermore, it boasts high calibration efficiency: each calibration takes only about 5 seconds, improving efficiency by approximately 60 times compared to traditional methods; high degree of automation: the entire process is completed through interaction between the control terminal and the camera, requiring no manual intervention; and strong applicability: it can be used with different aperture and focal length combinations, comprehensively covering the focusing characteristics of lenses.

[0119] The specific embodiments of the present invention described above do not constitute a limitation on the scope of protection of the present invention. Any other corresponding changes and modifications made in accordance with the technical concept of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for calibrating camera focusing parameters, characterized in that, include: Based on the preset parameters, the search strategy is optimized, and the focus parameters are determined sequentially within the predetermined parameter range; Based on each determined focusing parameter, the camera lens is controlled to autofocus with a specified combination of aperture and focal length, and the position information of the focusing ring is collected in real time during the focusing process, wherein the initial position of the focusing ring is located at the end of the travel. Based on the collected location information, a time-series characteristic curve reflecting the changes in the motion state of the focusing ring is generated; The focusing dynamic curve of each time-series characteristic curve is extracted and compared with the ideal curve. The final score of the focusing dynamic curve is calculated based on the comparison results. The focus parameters corresponding to the focus dynamic curve with the highest final score are selected as candidate optimal focus parameters; Determine the neighborhood range of the candidate best focus parameter, recalculate the final score of all focus parameters within the neighborhood range, and take the focus parameter with the highest final score within the neighborhood range as the optimal focus parameter.

2. The camera focus parameter calibration method as described in claim 1, characterized in that, The process of determining the neighborhood range of the candidate optimal focus parameter, recalculating the final score of all focus parameters within the neighborhood range, and using the focus parameter with the highest final score within the neighborhood range as the optimal focus parameter, further includes: Adjust the camera's lens aperture and / or focal length to the next specified combination until the focus parameters for all lens aperture and focal length combinations are calibrated.

3. The camera focus parameter calibration method as described in claim 1, characterized in that: When the camera lens performs autofocus with a specified combination of aperture and focal length, the camera lens is oriented toward the focus target.

4. The camera focus parameter calibration method as described in claim 1, characterized in that, The preset parameter optimization search strategy is a binary search method, which includes iterative execution steps: Determine the parameter search range, wherein the initial parameter search range is the predetermined parameter range; Calculate the midpoint between the minimum and maximum values ​​of the parameter search range, and use this midpoint as the current focus parameter; Adjust the parameter search range based on the focus dynamic curve generated after autofocusing with the current focus parameters.

5. The camera focus parameter calibration method as described in claim 4, characterized in that, The criteria for determining the search range of the adjustment parameters include: When the focus dynamic curve exhibits oscillations or overshoot, adjust the maximum value of the parameter search range to the midpoint value minus one. When the focus dynamic curve exhibits slow response or prolonged focusing time, adjust the minimum value of the parameter search range to the midpoint value plus one.

6. A camera focus parameter calibration method as described in claim 4 or 5, characterized in that, The iterative process of the binary search method stops when one of the following conditions is met: The minimum value in the current parameter search range is greater than the maximum value; The score of the candidate optimal focus parameter obtained through multiple consecutive iterations changes less than the threshold. The number of iterations has reached the preset maximum value.

7. The camera focus parameter calibration method as described in claim 1, characterized in that: The focusing dynamic curve is the curve segment in the time-series characteristic curve from the focusing start point to the stable point; The focusing starting point is the sampling point where the position of the focusing ring first changes, and the stable point is the point where the position of the focusing ring remains stable over multiple consecutive sampling periods.

8. The camera focus parameter calibration method as described in claim 7, characterized in that: The criterion for determining the stable point is that the change in the position of the focus ring within 15 consecutive sampling periods is less than a preset threshold.

9. A camera focus parameter calibration method as described in claim 1, characterized in that, The calculation of the final score for the focus dynamic curve based on the comparison results includes: The focus dynamic curve is normalized. Calculate the similarity between the normalized focus dynamic curve and the ideal curve, and use it as an intermediate score; Based on the actual autofocus time, a time penalty factor is introduced to correct the intermediate scores, resulting in the final score.

10. A camera focus parameter calibration method as described in claim 9, characterized in that, The similarity between the normalized focus dynamic curve and the ideal curve is calculated and used as an intermediate score, including: Calculate the cosine similarity, reciprocal of the Euclidean distance, and Pearson correlation coefficient between the normalized focus dynamic curve and the ideal curve; The intermediate score is obtained by weighted summation of cosine similarity, reciprocal Euclidean distance, and Pearson correlation coefficient.

11. A camera focus parameter calibration method as described in claim 10, characterized in that: The weights for the weighted summation are: cosine similarity weight 0.2, inverse Euclidean distance weight 0.6, and Pearson correlation coefficient weight 0.

2.

12. The camera focus parameter calibration method as described in claim 1, characterized in that, The step of generating a time-series characteristic curve reflecting the changes in the motion state of the focusing ring based on the collected location information includes: The position information of the focus ring during the autofocus process is continuously collected at predetermined time intervals. A time-series characteristic curve is constructed with time information as the horizontal axis and the position information of the focus ring as the vertical axis.

13. A camera focus parameter calibration method as described in claim 12, characterized in that: The predetermined time interval is 20ms, and the position information acquisition of the focusing ring includes acquisition by the motor encoder, optical sensor, or image sharpness evaluation function.

14. The camera focus parameter calibration method as described in claim 1, characterized in that: The neighborhood range includes multiple consecutive focus parameter values ​​centered on the candidate optimal focus parameter.

15. A camera focusing parameter calibration device, characterized in that, include: The parameter search module is used to optimize the search strategy based on preset parameters and determine the focus parameters sequentially within a predetermined parameter range; The focusing execution module is used to control the camera lens to perform automatic focusing with a specified combination of aperture and focal length based on each determined focusing parameter, and to collect the position information of the focusing ring in real time during the focusing process, wherein the initial position of the focusing ring is located at the end of the travel. The curve generation module is used to generate a time-series characteristic curve reflecting the changes in the motion state of the focusing ring based on the collected location information. The scoring calculation module is used to extract the focus dynamic curve of each time-series characteristic curve, compare it with the ideal curve, and calculate the final score of the focus dynamic curve based on the comparison results. The filtering module is used to select the focus parameters corresponding to the focus dynamic curve with the highest final score as candidate best focus parameters. The calibration module is used to determine the neighborhood range of the candidate best focus parameters, recalculate the final score of all focus parameters within the neighborhood range, and take the focus parameter with the highest final score within the neighborhood range as the optimal focus parameter.

16. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the camera focus parameter calibration method as described in any one of claims 1 to 14.

17. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the camera focus parameter calibration method according to any one of claims 1 to 14.

18. A camera, comprising a lens, characterized in that, The camera stores an optimal focus parameter lookup table calibrated by any one of the methods described in claims 1 to 14. When the camera is autofocusing, it calls the corresponding parameters in the lookup table to focus based on the current aperture and focal length combination.

Citation Information

Patent Citations

  • Zoom lens focusing curve calibration system and method thereof

    CN113487682A

  • Focusing curve correction method and device and correction equipment

    CN116233405A