Camera focusing parameter calibration method and device, electronic equipment and storage medium

By employing preset parameters to optimize the search strategy and binary search method in the camera, the focus circle position information is collected in real time, a time-series characteristic curve is generated and compared with the ideal curve, which solves the problems of subjectivity and low efficiency in the calibration of camera focus parameters in the prior art, and realizes efficient and automated focus parameter calibration.

CN120980211AActive Publication Date: 2025-11-18SHENZHEN JYC TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511481664.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2025-11-18
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 by methods such as binary search. The position information of the focusing circle is collected in real time during the focusing process to generate a time-series characteristic curve. The final score is calculated by comparing it with the ideal curve and the optimal focusing parameters are selected.

Benefits of technology

It enables efficient, automated, and quantitative evaluation of focusing parameters, ensuring the calibration of globally optimal parameters and improving calibration efficiency and applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120980211A_ABST
    Figure CN120980211A_ABST
Patent Text Reader

Abstract

The invention relates to a camera focusing parameter calibration method and device, electronic equipment and a storage medium, and the method comprises the steps: optimizing a search strategy according to a preset parameter, and sequentially determining focusing parameters within a preset parameter range; based on each determined focusing parameter, controlling a lens of the camera to carry out automatic focusing according to an aperture and a focal section of a specified combination, 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; extracting a focusing dynamic curve of each time sequence characteristic curve, comparing the focusing dynamic curve with an ideal curve, and calculating a final score of the focusing dynamic curve; selecting the focusing parameter with the highest final score as a candidate optimal focusing parameter; and determining the neighborhood range of the candidate optimal focusing parameters, and taking the focusing parameter with the highest final score in the neighborhood range as the optimal focusing parameter, so that the global optimal parameter can be obtained in the calibration process, the focusing effect is quantified, and the subjective error of manual judgment is 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 have obvious defects and cannot meet the high precision, high efficiency and objectivity requirements of camera focusing. Specifically, the manual experience calibration method has strong subjectivity, low efficiency and poor 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 focusing effect evaluation standard, and has the defects of strong subjectivity, low efficiency, poor adaptability, and no quantitative evaluation standard. SUMMARY

[0005] Therefore, the 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 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 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; extracting 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 threshold range again, and taking the focusing parameter with the highest final score in the neighborhood threshold 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 calculation of the final score of all focusing parameters in the neighborhood threshold range, and the taking of the focusing parameter with the highest final score in the neighborhood threshold range as the optimal focusing parameter, the method further comprises adjusting the lens aperture and / or focal length 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 following steps iteratively executed: 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, adjusting the maximum value of the parameter search range to the midpoint value minus one; when the characteristics of the focusing dynamic curve appear response delay or focusing time extension, adjusting the minimum value of the parameter search range 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 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 extract 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, which stores a computer program, wherein the computer program is executable on a processor to implement a camera focusing parameter calibration method.

[0023] In a fifth aspect, a camera is provided, which stores an optimal focusing parameter query table obtained through a camera parameter calibration method, and the camera performs focusing according to a corresponding parameter in the query table according to a current aperture and focal length combination 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: The predetermined parameter range is iteratively selected multiple times through 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, the subjective error of manual judgment is avoided, and the calibration efficiency is high, the degree of automation is high, and the applicability is strong. BRIEF DESCRIPTION OF DRAWINGS

[0025] Figure 1 A step flowchart of the camera focusing parameter calibration method provided by the first embodiment of the present application; Figure 2This is a time-series characteristic curve showing the change in the motion state of the focus ring during each focusing process; Figure 3 This is an ideal curve representing the change in the motion state of the focusing ring; Figure 4 This is a timing characteristic curve diagram showing the oscillation and overshoot of the focus ring during the focusing process. Figure 5 This is a timing characteristic curve diagram corresponding to the extension of the focusing time of the focusing ring during focusing overshoot; Figure 6 This is a schematic diagram of the focus start point and stabilization point of the focus dynamic curve; Figure 7 A flowchart outlining the steps for calibrating focus parameters for multiple lens aperture and focal length combinations. Detailed Implementation

[0026] 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.

[0027] 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.

[0028] 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.

[0029] like Figure 1 As shown, the camera focus parameter calibration method provided in the first embodiment of this application includes: S100 optimizes the search strategy based on preset parameters and sequentially determines the focus parameters within the predetermined parameter range; It can be understood that the predetermined parameter range is the value boundary of the focus parameter issued by the control terminal, which needs to be matched with the aperture-focal length combination specified by the current lens. The range directly corresponds to the focusing ring sensitivity characteristics of the lens, provides clear numerical limits for the selection of focus parameters during camera focusing, and avoids abnormal focusing caused by parameters exceeding the driving capability of the lens (such as parameter overshoot causing oscillation, and parameter being too small causing slow focusing). The preset parameter optimization search strategy is the core logic of the control terminal for determining specific issued parameters from the predetermined parameter range. The purpose is to reduce invalid tests through regular search to efficiently locate the optimal parameters.

[0030] In this embodiment, the predetermined parameter range is selected as [1-1024], and the preset parameter optimization search strategy includes bisection method, genetic algorithm, hill climbing algorithm, particle swarm optimization, etc. These strategies all need to dynamically adjust parameter selection combined with subsequent focus curve score results to ensure that the parameter search direction is consistent with the goal of "approaching ideal focusing effect".

[0031] It should be noted that the control terminal includes various implementable forms, such as mobile phone APP, tablet computer, computer software terminal, and control module integrated in the adapter ring, which can be flexibly selected according to actual application scenarios. It can realize information interaction through communication methods such as Bluetooth to issue focus parameters to the camera, send automatic focusing start instructions, and receive focus ring position information and final score results collected during focusing, etc. to provide data and instruction transmission support for parameter calibration process, ensure the landing of core functions such as focus parameter issuance, data collection instruction transmission, and score result feedback, and further ensure the automation of the automatic focusing parameter calibration process and accuracy.

[0032] S200, based on each determined focus parameter, controlling the lens of the camera to automatically focus with the specified aperture and focal length combination, and real-time collecting position information of the focusing ring during the focusing process, wherein the initial position of the focusing ring is located at the travel endpoint; It can be understood that after determining a focus parameter according to the preset parameter optimization search strategy each time in step S100, the control terminal issues the focus parameter to the camera, and controls the camera to start automatic focusing based on the issued focus parameter. Before starting automatic focusing each time, the focusing ring needs to be rotated to the travel endpoint (i.e. the nearest end or the farthest end), so as to unify the initial position of the focusing ring, ensure the consistency of the starting condition of each parameter test, and improve the accuracy and repeatability of the test results.

[0033] During the automatic focusing process, the position information of the focusing ring during the entire rotation process is collected in real time, i.e. the position information of the focusing ring from the travel endpoint to the focusing point, and from the focusing point back to the travel endpoint after completing the automatic focusing.

[0034] It should be noted that the camera can be switched to a manual focus mode, the focus ring is rotated to the end of the stroke, or the camera can be controlled by the control terminal to automatically rotate the focus ring to the end of the stroke, which is not limited here.

[0035] S300, according to the collected position information, a time sequence characteristic curve reflecting the change of the motion state of the focus ring is generated; It can be understood that after collecting the position information of the focus ring rotating from the end of the stroke to the focus point and returning to the end of the stroke during the automatic focusing process, the time sequence characteristic curve corresponding to each focusing parameter in the entire automatic focusing process can be generated according to the obtained position information.

[0036] S400, extracting 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; It can be understood that the focusing dynamic curve is the curve corresponding to the rotating part of the focus ring in each time sequence characteristic curve. Based on the automatic focusing process, the entire time sequence characteristic curve includes a large amount of noise data irrelevant to the focusing performance, such as waiting time (flat line segment) before the focusing instruction is issued, and meaningless static segment (flat line segment) after the focusing is stable. These data will dilute the core data that truly reflects the focusing dynamic performance (start, acceleration, deceleration, and stability), resulting in inaccurate final score. Therefore, comparing the focusing dynamic curve with the ideal curve can directly reflect the response speed, overshoot, and oscillation of the focusing system, and eliminate irrelevant noise, so that the score result can more truly reflect the advantages and disadvantages of the focusing parameters.

[0037] The ideal curve is a pre-set standardized curve indicating that the automatic focusing process should follow, which is used as a reference to compare with the extracted actual focusing dynamic curve to determine whether the actual focusing effect is close to the ideal state.

[0038] The final score is obtained by standardizing the extracted focusing dynamic curve, comparing it with the ideal curve by using a pre-set curve matching algorithm (which can be normalized matching, or can be replaced by correlation analysis, Fourier transform, or machine learning model), and optimizing it in combination with the time factor in the focusing process. Finally, the score result reflecting the advantages and disadvantages of the actual focusing effect is obtained.

[0039] S500, selecting the focusing parameter corresponding to the focusing dynamic curve with the highest final score as the candidate best focusing parameter; It can be understood that, after the automatic focusing using the issued focusing parameters in step S200 in turn, and after the time sequence characteristic curve corresponding to each issued focusing parameter is formed in each focusing process in step S300, the focusing dynamic curve of each time sequence characteristic curve is extracted in step S400, the focusing dynamic curves corresponding to the multiple issued focusing parameters can be obtained. After each focusing dynamic curve is compared with the ideal curve respectively, the final score of each focusing dynamic curve can be obtained. After all the final scores are compared, the focusing parameter corresponding to the focusing dynamic curve with the highest final score is selected as the candidate optimal focusing parameter.

[0040] S600, determining the neighborhood range of the candidate optimal focusing parameter, calculating the final scores of all the focusing parameters in the neighborhood threshold range again, and taking the focusing parameter with the highest final score in the neighborhood threshold range as the optimal focusing parameter; It can be understood that the neighborhood range is a plurality of continuous focusing parameter values centered on the candidate optimal focusing parameter, which is a parameter set around the converged parameter selected for further improving the parameter accuracy after the candidate optimal focusing parameter meets the convergence requirement. The essence is to select a plurality of parameters close to the converged parameter, test and calculate the final scores of the focusing parameters in each neighborhood range, compare the scores of the converged parameter and the focusing parameters in all the neighborhood ranges, and select the parameter with the highest score as the optimal focusing parameter under the current lens aperture-focal length combination, so as to realize fine verification and confirmation of the parameter.

[0041] In the embodiment, the neighborhood range includes 7 focusing parameters, i.e. in the vicinity of the candidate optimal parameter that meets the convergence rule at present, 7 continuous neighboring values centered on the candidate optimal focusing parameter are selected as new issued parameters together with the candidate optimal parameter, and the above steps S200 to S400 are repeated to obtain the final scores of the focusing dynamic curves corresponding to the 7 focusing parameters, and the focusing parameter corresponding to the highest score is selected from the 7 final scores as the optimal focusing parameter under the current aperture and focal length combination.

[0042] Taking a specific example as an illustration, when the candidate optimal parameter is 280 after steps S100 and steps S500, the neighborhood threshold range of the candidate optimal parameter includes 277, 278, 279, 280, 281, 282, and 283. Then, the 7 focusing parameters are used for automatic focusing to form corresponding time sequence characteristic curves, and the focusing dynamic curves are extracted to calculate the final scores, and the highest score among the 7 final scores is selected as the optimal focusing parameter.

[0043] In some embodiments, when the lens of the camera is automatically focused in the specified combination of aperture and focal length, the lens of the camera is directed towards the focusing target.

[0044] It can be understood that the focusing target is placed in front of the camera, and the focusing target has a target with high local contrast and clear boundary. The lens is directed to the focusing target as a reference target in the automatic focusing process, which can provide clear signals for contrast detection or phase difference detection, so as to make the focusing faster and more accurate.

[0045] It should be noted that in some embodiments, the camera focusing parameter calibration method can be executed without setting an external focusing target. That is, when the lens of the camera is automatically focused at a specified combination of aperture and focal length, the lens of the camera does not need to be directed to any specific focusing target.

[0046] In such embodiments, the calibration method uses the inherent physical characteristics of the camera lens optical system as a reference for automatic focusing. A typical implementation is to control the camera to perform a "focus to infinity" operation under the initial condition that the focusing ring is placed at the end of the stroke (such as the nearest focusing distance end). The "infinity" focusing position of the lens is an optically stable, known fixed point, which can be used as an ideal target for the focusing process.

[0047] When the camera adopts this mode, the focusing parameters issued by the control terminal are used to control the camera to complete an automatic focusing process with the goal of "reaching optical infinity". In this process, the focusing ring moves from the determined initial position at the end of the stroke to the physical position corresponding to "infinity". By collecting and analyzing the time sequence characteristic curve (i.e. focusing dynamic curve) of this movement process, and comparing it with a pre-set ideal curve representing a rapid and smooth arrival at the "infinity" position from the initial point, the optimization and calibration of the focusing parameters are completed. This method is particularly suitable for fast calibration of camera production lines, or parameter self-recovery after lens maintenance, etc. scenes, which eliminates the dependence on physical targets, while ensuring the consistency of the calibration process, and improving the reliability, flexibility and environmental adaptability of the calibration.

[0048] In some embodiments, the time sequence characteristic curve reflecting the change in the movement state of the focusing ring is generated by: continuously collecting the position information of the focusing ring during the automatic focusing process at predetermined time intervals; constructing a time sequence characteristic curve with time information as the horizontal axis and the position information of the focusing ring as the vertical axis; It can be understood that the predetermined time refers to a fixed position information collection interval in the autofocus process, for example, each collection interval is set to 20 ms. By fixing the time interval, the collected focus ring position data has a uniform time dimension reference, providing a stable time reference for subsequent analysis of motion state changes. The position information of the focus ring needs to be continuously collected during the focusing process, and the value needs to follow a specific definition: the minimum value is the infinity point, and the maximum value is the nearest point. This definition can clearly reflect the actual physical position of the focus ring at different times, providing accurate position data support for subsequent curve generation. The time sequence characteristic curve reflecting the motion state change rule of the focus ring is a curve generated by taking the collected time as the horizontal axis and the position of the focus ring as the vertical axis. It can intuitively present the complete motion process of the focus ring from start to stability. For example, when the parameter is too large, the curve will oscillate and overshoot, and when the parameter is too small, the curve will take too long to reach the stable point. These characteristics can be directly used for subsequent comparative analysis with the ideal curve. For example, Figure 2 and Figure 3 wherein Figure 2 is the time sequence characteristic curve formed by each time the focus parameter is issued in turn, Figure 3 is the high-frequency curve (ideal curve).

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

[0050] In some embodiments, the preset parameter optimization search strategy is a binary search method, including the following steps iteratively executed: determining a 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 focus parameter; adjusting the parameter search range based on the focus dynamic curve formed after automatic focusing based on the current focus parameter; when the characteristics of the focus dynamic curve appear oscillation or overshoot, the maximum value of the parameter search range is adjusted to the midpoint value minus one, and when the characteristics of the focus dynamic curve appear response delay or focus time extension, the minimum value of the parameter search range is adjusted to the midpoint value plus one.

[0051] wherein, when any one of the following conditions is met, the iteration process of the binary search method stops: the minimum value of the current parameter search range is greater than the maximum value, the score change of the candidate optimal focus parameter obtained by continuous multiple iterations is less than a threshold value, and the iteration number reaches a preset maximum value.

[0052] 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.

[0053] 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.

[0054] 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.

[0055] 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.

[0056] 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 is the sign that the focusing action has started.

[0057] The stable point is a point at which the position of the focusing ring remains stable for a plurality of consecutive sampling periods, indicating that the focusing process has been completed and a stable state has been reached. The focusing dynamic curve between these two points is extracted as the analysis object, as shown in Figure 6 Preferably, the stable point is a point at which the position of the focusing ring remains stable for a plurality of consecutive sampling periods, indicating that the focusing process has been completed and a stable state has been reached. The focusing dynamic curve between these two points is extracted as the analysis object, as shown in

[0058] In some embodiments, the final score of the focusing dynamic curve is calculated according to the comparison result, including: normalizing the focusing dynamic curve; calculating the similarity between the normalized focusing dynamic curve and the ideal curve as an intermediate score; correcting the intermediate score by introducing a time penalty factor according to the actual time consumed by the current autofocus, to obtain the final score; It can be understood that the focusing dynamic curve is normalized in time domain and value, so that the numerical range and time scale of the focusing dynamic curve are standardized, and then the similarity between the focusing dynamic curve and the ideal curve is calculated as an intermediate score by matching the degree of curve similarity. Finally, the intermediate score is corrected according to the actual time, and the final score is obtained.

[0059] In some embodiments, the similarity between the normalized focusing dynamic curve and the ideal curve is calculated, including: 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; weighting and summing the cosine similarity, the inverse of the Euclidean distance, and the Pearson correlation coefficient to obtain the intermediate score; The weight distribution of the weighted sum is: the cosine similarity weight is 0.2, the Euclidean distance weight is 0.6, and the Pearson correlation coefficient weight is 0.2.

[0060] It can be understood that by using the three matching calculation methods of cosine similarity matching, Euclidean distance calculation, and Pearson correlation coefficient calculation, the similarity between the focusing dynamic curve and the ideal curve can be quantified comprehensively and objectively from different dimensions, avoiding the one-sidedness of a single method, and ensuring that the matching result meets the core needs of camera autofocus.

[0061] The core logic of the weight distribution is to prioritize the "core influencing factors" of focusing accuracy, while considering the auxiliary dimensions to ensure that the intermediate score accurately reflects the indicators that play a key role in the final focusing effect. The specific basis is as follows: Euclidean distance calculation (weight 0.6, highest): In camera autofocus, the "numerical deviation between actual focusing position and ideal position" is the core indicator of imaging clarity. Even if the curve direction and trend are synchronized, if the position deviation of the corresponding sampling point is large (Euclidean distance is large), the final imaging will still be blurred. Therefore, as the "accuracy core dimension", the highest weight should be given to ensure that the intermediate score reflects the "position accuracy" first; 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 ineffective fluctuations. Pearson correlation coefficient ensures that the curve change rhythm is synchronized, avoiding fast and slow focusing during the focusing process. However, the influence of both needs to be based on "small numerical deviation". If the numerical deviation is already large, the direction and rhythm are meaningless. Therefore, both are given the same low weight as a complementary evaluation of "core accuracy" to avoid excessive influence on the core judgment of the intermediate score.

[0062] It should be noted that the core purpose of introducing the time penalty factor is to make the final score consider both the "accuracy" and "efficiency" of focusing, ensuring that the selected parameters meet both "ideal curve matching degree" and the actual camera use scene "focusing speed" requirements.

[0063] A specific example is used as an illustration: Assume that the lens is in a test scene with "aperture f / 2.8, focal length 50mm", and the ideal focusing curve (after normalization) is set as the sequence of time (1 sampling point every 20ms, a total of 5 points) and focusing ring position (normalized to 0-1 range): A=[(0ms,0.1),(20ms,0.3),(40ms,0.5),(60ms,0.7),(80ms,0.9)], representing an ideal trend of fast and smooth approach to the target position.

[0064] Focusing dynamic curve (after normalization): The collected sequence is: 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 is a small numerical deviation). The focusing time is set: the "ideal focusing time" for this aperture and focal length is 80ms (i.e. 5 sampling points complete focusing), and the penalty rule is: if the actual focusing time T>80ms, deduct 0.02 weight for every 20ms exceeded; T≤80ms has no penalty.

[0065] Cosine similarity matching: calculate the cosine value of the position vectors of A and B through the vector dot product formula, the result is 0.98 (close to 1, indicating that the curve direction is highly consistent); 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; 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.

[0066] 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 the limit by 10ms = 0.02 × (10 / 20) = 0.01; Final score: 0.9844 - 0.01 = 0.9744.

[0067] 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: 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; 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.

[0068] It should be noted that the adjustment of the aperture and / or focal length combination can be achieved by manual adjustment after setting the camera to manual focus mode, or automatic adjustment using the control terminal, which is not limited herein.

[0069] The second embodiment of the present application provides a camera focusing parameter calibration device, which comprises: A parameter searching module is configured to determine the focusing parameters in a predetermined parameter range according to a preset parameter optimization search strategy. A focusing execution module is configured to control the lens of the camera to automatically focus 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 focusing process, wherein the initial position of the focusing ring is located at the stroke endpoint. A curve generation module is configured to generate a timing characteristic curve reflecting the change in the motion state of the focusing ring according to the collected position information. A score calculation module is configured to extract the focusing dynamic curve of each timing characteristic curve, compare it with an ideal curve respectively, and calculate the final score of the focusing dynamic curve according to the comparison result. A screening module is configured to select the focusing parameter corresponding to the focusing dynamic curve with the highest final score as the candidate optimal focusing parameter. A calibration module is configured to determine the neighborhood range of the candidate optimal focusing parameter, calculate the final scores of all focusing parameters in the neighborhood threshold range again, and take the focusing parameter with the highest final score in the neighborhood threshold range as the optimal focusing parameter.

[0070] The third embodiment of the present application provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the camera focusing parameter calibration method when executing the program.

[0071] The fourth embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the steps of the camera focusing parameter calibration method in the above method embodiments.

[0072] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto. The technical features of the above embodiments can be combined arbitrarily, and to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combinations of the technical features do not exist contradictory, they should be considered as the scope of the present application.

[0073] The fifth embodiment of the present application provides a camera which stores an optimal focusing parameter query table obtained by calibrating the camera focusing parameter method. When the camera is in automatic focusing, the corresponding parameters in the query table are called to focus according to the current aperture and focal length combination.

[0074] Compared with the prior art, the camera focusing parameter calibration method, device, electronic equipment and storage medium provided by the application perform multiple iteration selection on the predetermined parameter range through the preset parameter optimization search strategy, so that the multiple focusing parameters in the predetermined parameter range converge to the optimal interval, and the global optimal parameter is ensured. Meanwhile, the final score is formed by matching and comparing the time sequence characteristic curve with the ideal curve, the focusing effect can be quantified, and the subjective error of artificial judgment is avoided.

[0075] Moreover, the calibration efficiency is high: only about 5 seconds are needed for each calibration, the efficiency is improved by about 60 times compared with the traditional method; the degree of automation is high: the whole process is completed through the interaction between the control terminal and the camera, without manual intervention. The applicability is strong: it can be used for different aperture and focal length combinations, and the effect of the focusing characteristics of the lens is fully covered.

[0076] The specific embodiments of the application described above do not constitute a limitation on the protection scope of the application. Any various other corresponding changes and modifications made according to the technical concept of the application shall be included in the protection scope of the claims of the application.

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 focus parameter, the camera lens is controlled to autofocus with a specified combination of aperture and focal length, and the position information of the focus ring is collected in real time during the focusing process, wherein the initial position of the focus 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; Extract the focusing dynamic curve of each time-series characteristic curve, compare it with the ideal curve, and calculate the final score of the focusing dynamic curve 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 optimal 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 calibration parameters for all lens aperture and focal length combinations are completed.

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 focusing 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, Calculate the similarity between the normalized focus dynamic curve and the ideal curve, including: Calculate the cosine similarity, reciprocal of the Euclidean distance, and Pearson correlation coefficient between the normalized focus dynamic segment 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 focus ring in real time during the focusing process, wherein the initial position of the focus 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 feature 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, 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

  • Method for controlling movement of focusing module set to obtain depth-of-field information

    CN109975948A

  • Zoom lens focusing curve calibration system and method thereof

    CN113487682A

  • Focusing curve correction method and device and correction equipment

    CN116233405A