Optical lens focusing processing method and device, equipment and medium

By acquiring ambient brightness information to determine the focusing strategy and using the Spearman rank coefficient method to judge the sharpness trend, the problem of slow focusing speed and poor accuracy in low light or low contrast scenes is solved, achieving a faster and more accurate focusing effect.

CN121691907AActive Publication Date: 2026-03-17TIANJIN YUNSHENG INTELLIGENT TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202610188980.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-10
Publication Date
2026-03-17
Estimated Expiration
2046-02-10

AI Technical Summary

Technical Problem

In low-light or low-contrast scenarios, traditional contrast-based focusing algorithms suffer from slow focusing speed and poor accuracy due to the reduced signal-to-noise ratio of sharpness values. This makes it difficult to meet the conditions for maximum peak value and peak value descent, thus affecting user experience and image quality.

Method used

By acquiring ambient brightness information from the imaging device, a focusing strategy is determined, including searching for resource configuration and trend determination conditions. A target sharpness sequence is collected, and focusing is controlled based on sharpness trend characteristics, thus eliminating dependence on the magnitude of sharpness values. The Spearman rank coefficient method is used to determine trend continuity.

Benefits of technology

It improves focusing speed and accuracy in low-light and low-contrast scenarios, reduces repeated adjustments during the focusing process, and enhances user experience and image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121691907A_ABST
    Figure CN121691907A_ABST
Patent Text Reader

Abstract

The invention provides an optical lens focusing processing method and device, equipment and a medium, and relates to the technical field of automatic focusing, and the method comprises the steps: obtaining the environment brightness information of a scene where imaging equipment is located at present, so as to determine a focusing strategy corresponding to the environment brightness information; collecting a target definition sequence according to the search resource configuration information in the focusing search process of the imaging equipment; under the condition that the definition trend feature corresponding to the target definition sequence does not meet the trend judgment condition, continuing to collect a new target definition sequence until the definition trend feature corresponding to the new target definition sequence meets the trend judgment condition; and controlling the imaging device to focus based on the new target definition sequence. The method can get rid of the dependence of a hill climbing algorithm on the definition value, and further improves the focusing speed and focusing accuracy in a low-light and low-contrast scene.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of automatic focusing, in particular to an optical lens focusing processing method, device, equipment and medium. BACKGROUND

[0002] With the popularity of digital cameras, smartphones and other imaging devices, automatic focusing technology has become one of the key functions in modern photography systems. As a common automatic focusing method, the contrast detection autofocus (CDAF) algorithm works by real-time image data acquisition through an image sensor, using the built-in filtering algorithm to calculate the image sharpness value, and using it as the focusing evaluation standard.

[0003] In specific implementation, the CDAF system usually uses the hill climbing algorithm as the search strategy. This algorithm adjusts the lens position constantly to find the peak point of the sharpness curve to achieve fast focusing. In theory, when the sharpness value reaches the local maximum, the system can determine that the focusing is completed. To ensure focusing accuracy, the prior art usually sets two judgment conditions: the maximum peak condition requires the sharpness value to exceed the preset threshold, and the peak value decline condition requires the detection of the sharpness value starting to decline from the peak value.

[0004] However, in actual application scenarios, especially in low-light environments or low-contrast scenes, due to insufficient light or lack of texture details of the shooting subject, the sharpness value output by the filtering algorithm presents the characteristics of reduced signal-to-noise ratio. This leads to phenomena such as insufficient peak amplitude and flattened peak shape of the sharpness curve, making it difficult to effectively satisfy the maximum peak condition and the peak value decline condition. In such scenarios, the traditional hill climbing algorithm may repeatedly adjust the lens position, prolong the focusing time, and deviate from the best focus point, which seriously affects the user experience and imaging quality. SUMMARY

[0005] Therefore, the purpose of the present application is to provide an optical lens focusing processing method, device, equipment and medium, which can break away from the dependence of the hill climbing algorithm on the sharpness value, and thus improve the focusing speed and accuracy in low-light and low-contrast scenes.

[0006] In a first aspect, the present application provides an optical lens focusing processing method, comprising: obtaining the environmental brightness information of the scene in which the imaging device is currently located to determine the focusing strategy corresponding to the environmental brightness information, the focusing strategy including search resource configuration information and trend judgment conditions; During the focusing search process of the imaging device, a target sharpness sequence is collected according to the search resource configuration information. The target sharpness sequence includes the sharpness values ​​corresponding to multiple preview images during the focusing search process. If the sharpness trend feature corresponding to the target sharpness sequence does not meet the trend determination condition, continue to collect new target sharpness sequences until the sharpness trend feature corresponding to the new target sharpness sequence meets the trend determination condition. Focusing is achieved using a new target sharpness sequence control imaging device.

[0007] In one implementation, the search resource configuration information includes a minimum search range and a minimum number of search points; collecting the target sharpness sequence according to the search resource configuration information includes: The focusing motor in the imaging device is controlled to move the optical lens in the imaging device along the optical axis by a preset search step size, and the sharpness value corresponding to the preview image is collected. Add the sharpness value to the current sharpness sequence; Determine whether the number of search steps for the focusing motor is greater than the minimum search range, and determine whether the number of sharpness values ​​contained in the current sharpness sequence is greater than the minimum number of search points; If all the judgment results are yes, the current sharpness sequence is taken as the target sharpness sequence.

[0008] In one implementation, the trend determination criteria include an upward trend criterion and a downward trend criterion; the method further includes: Extract the sharpness trend features corresponding to the target sharpness sequence. The sharpness trend features include upward trend continuity features and downward trend continuity features. Determine whether the continuity characteristics of an upward trend meet the upward trend conditions, and determine whether the continuity characteristics of a downward trend meet the downward trend conditions; If all the judgment results are yes, then the trend determination condition is met; If any judgment result is negative, it is determined that the trend determination condition is not met.

[0009] In one implementation, the sharpness trend features corresponding to the target sharpness sequence are extracted, including: Identify the maximum sharpness value in the target sharpness sequence; Using the maximum sharpness value as a benchmark, the target sharpness sequence is divided into a first sharpness subsequence and a second sharpness subsequence; Based on the first and second resolution subsequences, the upward trend continuity feature and the downward trend continuity feature are extracted; The continuity features of upward and downward trends are used as the clarity trend features corresponding to the target clarity sequence.

[0010] In one implementation, based on a first sharpness subsequence and a second sharpness subsequence, upward trend continuity features and downward trend continuity features are extracted, including: Determine the first sub-value corresponding to the sharpness value contained in the first sharpness subsequence, and determine the Spearman rank coefficient corresponding to the first sharpness subsequence based on the first sub-value, as a feature of the upward trend continuity; Determine the second rank value corresponding to the sharpness value contained in the second sharpness subsequence, and determine the Spearman rank coefficient corresponding to the second sharpness subsequence based on the second rank value, as a feature of the downward trend continuity.

[0011] In one implementation, determining whether the upward trend continuity feature satisfies the upward trend condition, and determining whether the downward trend continuity feature satisfies the downward trend condition, includes: If the continuity of the upward trend is greater than the first preset threshold, the upward trend condition is determined to be met. If the continuity of the downward trend is greater than the second preset threshold, the downward trend condition is determined to be met.

[0012] In one implementation, focusing is controlled by a novel target sharpness sequence-based imaging device, including: Determine the new maximum sharpness value in the new target sharpness sequence; The focusing motor in the imaging device is controlled to drive the optical lens in the imaging device to move along the optical axis to the position corresponding to the new maximum resolution value, so that the optical lens can focus.

[0013] In a second aspect, the present invention also provides an optical lens focusing processing device, comprising: The strategy acquisition module is used to acquire the ambient brightness information of the scene where the imaging device is currently located, so as to determine the focusing strategy corresponding to the ambient brightness information. The focusing strategy includes search resource configuration information and trend judgment conditions. The sharpness collection module is used to collect the target sharpness sequence according to the search resource configuration information during the focusing search process of the imaging device. The target sharpness sequence includes the sharpness values ​​corresponding to multiple preview images during the focusing search process. The condition determination module is used to continue collecting new target sharpness sequences when the sharpness trend features corresponding to the target sharpness sequence do not meet the trend determination conditions, until the sharpness trend features corresponding to the new target sharpness sequence meet the trend determination conditions. The focus control module is used to control the focusing of the imaging device based on the new target sharpness sequence.

[0014] Thirdly, the present invention also provides an electronic device including a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement any of the methods provided in the first aspect.

[0015] Fourthly, the present invention also provides a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement any of the methods provided in the first aspect.

[0016] This invention provides an optical lens focusing processing method, apparatus, device, and medium. First, it acquires the ambient brightness information of the scene currently in which the imaging device is located to determine the focusing strategy corresponding to the ambient brightness information. The focusing strategy includes search resource configuration information and trend determination conditions. Then, during the focusing search process of the imaging device, a target sharpness sequence is collected according to the search resource configuration information. The target sharpness sequence includes sharpness values ​​corresponding to multiple frames of preview images during the focusing search process. Next, if the sharpness trend characteristics corresponding to the target sharpness sequence do not meet the trend determination conditions, a new target sharpness sequence is collected until the sharpness trend characteristics corresponding to the new target sharpness sequence meet the trend determination conditions. Finally, the imaging device is controlled to focus based on the new target sharpness sequence. The above method first determines the focusing strategy corresponding to the current ambient brightness information to better adapt to the current ambient brightness information and accelerate the focusing speed under the current ambient brightness information. On this basis, the target sharpness sequence is collected according to the search resource configuration information in the focusing strategy. By extracting the sharpness trend features of the target sharpness sequence, it is determined whether it meets the trend judgment condition in the focusing strategy. If the trend judgment condition is met, focusing is achieved. Compared with the prior art, the present invention gets rid of the dependence of the hill climbing algorithm on the sharpness value, thereby improving the focusing speed and focusing accuracy in low light and low contrast scenes.

[0017] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0018] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0019] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0020] Figure 1 A schematic flowchart of an optical lens focusing processing method provided in an embodiment of the present invention; Figure 2 A flowchart illustrating another optical lens focusing method provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an optical lens focusing processing device provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] Currently, existing technologies suffer from issues such as unclear peak values ​​and low sharpness values ​​in the output sharpness value of the filter during the focusing process. Based on this, embodiments of the present invention provide an optical lens focusing processing method, apparatus, device, and medium that can eliminate the dependence of the hill-climbing algorithm on the magnitude of the sharpness value, thereby improving the focusing speed and focusing accuracy in low-light and low-contrast scenes.

[0023] To facilitate understanding of this embodiment, a detailed description of an optical lens focusing processing method disclosed in this invention will be provided first. The imaging device can be a camera, a mobile phone camera module, or other similar devices. See [link to relevant documentation]. Figure 1 The diagram shows a flow chart of an optical lens focusing method, which mainly includes the following steps S102 to S108: Step S102: Obtain the ambient brightness information of the scene where the imaging device is currently located, so as to determine the focusing strategy corresponding to the ambient brightness information.

[0024] The focusing strategy includes search resource configuration information and trend determination conditions. Search resource configuration information describes the search resource input standards required during the focusing search process, and may include the minimum search range and the minimum number of search points. The minimum search range represents the shortest lens displacement interval allowed in this focusing search, and the minimum number of search points represents the minimum number of sharpness values ​​to be collected in this focusing search. Trend determination conditions characterize the minimum continuity requirements that the upward and downward trend continuity characteristics of the target sharpness sequence must meet, and may include upward trend conditions and downward trend conditions.

[0025] In one example, the minimum search range, minimum number of search points, upward trend conditions, and downward trend conditions corresponding to different ambient brightness information can be pre-configured, thereby directly calling the minimum search range, minimum number of search points, upward trend conditions, and downward trend conditions corresponding to the ambient brightness information of the scene where the imaging device is currently located.

[0026] Step S104: During the focusing search process of the imaging device, a target sharpness sequence is collected according to the search resource configuration information.

[0027] The target sharpness sequence includes the sharpness values ​​corresponding to multiple frames of preview images during the focus search process. The preview image is a dynamic picture that is captured by the optical lens, converted into an electrical signal by the sensor, and then quickly rendered by the image processor. It can be displayed on the device screen in real time without waiting for complete storage or post-processing, ensuring that users can observe scene changes instantly.

[0028] In one example, during the focusing search of the imaging device, multiple sharpness values ​​output by the filter of the imaging device are collected, and it is determined whether the collected sharpness values ​​meet the minimum search range and minimum number of search points mentioned above. If they do, the collection can be stopped, and a target sharpness sequence is formed.

[0029] Step S106: If the sharpness trend feature corresponding to the target sharpness sequence does not meet the trend determination condition, continue to collect new target sharpness sequences until the sharpness trend feature corresponding to the new target sharpness sequence meets the trend determination condition.

[0030] The sharpness trend feature is used to describe the continuity of the upward trend in sharpness of the target sharpness sequence (i.e., the upward trend continuity feature) and the continuity of the downward trend in sharpness (i.e., the downward trend continuity feature). In one example, the upward trend continuity feature and the downward trend continuity feature corresponding to the target sharpness sequence are first extracted. If either feature does not meet the above trend determination condition, the process returns to step S104 to continue collecting new target sharpness sequences. If both features meet the above trend determination condition, the collection can be stopped and the final target sharpness sequence can be obtained.

[0031] Step S108: Focusing is performed using the new target sharpness sequence-controlled imaging device.

[0032] In one example, the imaging device can be controlled to focus based on the maximum sharpness value in the new target sharpness sequence.

[0033] The optical lens focusing processing method provided in this invention first determines the focusing strategy corresponding to the current ambient brightness information to better adapt to the current ambient brightness information and accelerate the focusing speed under the current ambient brightness information. On this basis, the target sharpness sequence is collected according to the search resource configuration information in the focusing strategy. The sharpness trend features of the target sharpness sequence are extracted and it is determined whether they meet the trend determination conditions in the focusing strategy. If the trend determination conditions are met, focusing is achieved. Compared with the prior art, this invention gets rid of the dependence of the hill climbing algorithm on the sharpness value, thereby improving the focusing speed and focusing accuracy in low light and low contrast scenes.

[0034] Before implementing the optical lens focusing process, it is necessary to pre-configure the focusing strategies corresponding to different ambient brightness levels. Specifically: (1) Determine the minimum search range under different ambient brightness conditions. The minimum search range is determined based on the number of steps the focusing motor moves during the change in image sharpness. Specifically: when the optical lens is in the optimal focusing state, drive the focusing motor to deviate from the focal position to both sides until the image becomes significantly blurred. Record the number of steps the focusing motor moves during this process, and multiply this number by a specified value (e.g., 2) as the minimum search range. In low-light environments, image noise is enhanced. To improve the accuracy and robustness of focus peak detection, the minimum search range increases accordingly as the ambient brightness decreases (i.e., the minimum search range is negatively correlated with the ambient brightness) to avoid misjudgments caused by noise interference.

[0035] (2) The minimum number of search points is dynamically determined based on the ambient brightness. The minimum number of search points is used to constrain the search step size during lens focusing to prevent skipping the minimum search range due to an excessively large step size, thereby missing key feature areas of sharpness change trends. In low-light scenes, the image signal-to-noise ratio is low. To improve the stability and accuracy of focus peak identification, the minimum number of search points is increased accordingly (i.e., the minimum number of search points is negatively correlated with ambient brightness) to ensure sufficient sampling density under a larger search step size, thus ensuring the reliability of trend analysis.

[0036] (3) Dynamically set the upward trend condition according to the different ambient brightness. After the minimum search range and the minimum number of search points are determined, if the maximum value of the sharpness value is located within the currently collected target sharpness sequence, the area to its left is regarded as the upward edge area, and it is determined whether the continuity of the upward trend in this area meets the upward trend condition. In low-light scenes, due to the enhancement of image noise, the stability of trend judgment decreases. In order to improve the robustness of focus determination, the upward trend condition is relaxed accordingly as the ambient brightness decreases (that is, the upward trend condition is negatively correlated with the ambient brightness), that is, a certain degree of trend interruption or non-monotonic increase is allowed to avoid misjudgment or missed judgment due to noise interference.

[0037] (4) Dynamically set the descent trend condition according to different ambient brightness. After determining the minimum search range and the minimum number of search points, if the maximum value of the sharpness value is located within the currently collected target sharpness sequence, the area to its right is regarded as the descent edge area, and it is determined whether the continuity of the descent trend in this area satisfies the descent trend condition. In low-light scenes, due to the significant increase in image noise, the reliability of trend recognition is reduced. In order to improve the robustness of the focus peak determination, the descent trend condition is relaxed accordingly as the ambient brightness decreases (that is, the descent trend condition is negatively correlated with the ambient brightness), which allows for local non-ideal decreasing fluctuations, thereby avoiding misjudgment caused by noise.

[0038] Based on the aforementioned focusing strategy, this embodiment of the invention provides a specific implementation of an optical lens focusing processing method. See also... Figure 2 The flowchart of another optical lens focusing method shown includes: Step S202: Obtain the ambient brightness information of the scene where the imaging device is currently located, so as to determine the minimum search range, minimum number of search points, upward trend condition and downward trend condition corresponding to the ambient brightness information.

[0039] Step S204: During the focusing search process of the imaging device, a target sharpness sequence is collected according to the search resource configuration information. Specifically, this includes: (1) Control the focusing motor in the imaging device to drive the optical lens in the imaging device to move along the optical axis with a preset search step size, and collect the sharpness value corresponding to the preview image. In one example, during the process of driving the optical lens in the imaging device to move along the optical axis, the sharpness value corresponding to multiple frames of preview images can be collected by a filter.

[0040] (2) Add the sharpness value to the current sharpness sequence.

[0041] (3) Determine whether the number of search steps of the focusing motor is greater than the minimum search range, and determine whether the number of sharpness values ​​contained in the current sharpness sequence is greater than the minimum number of search points.

[0042] (4) If all the judgment results are yes, the current sharpness sequence is taken as the target sharpness sequence. If any condition is not met (e.g., the number of search steps of the focusing motor is less than the minimum search range, and / or, the number of sharpness values ​​contained in the current sharpness sequence is less than the minimum number of search points), the sharpness values ​​corresponding to the preview image are collected until the number of search steps of the focusing motor is greater than the minimum search range, and the number of sharpness values ​​contained in the current sharpness sequence is greater than the minimum number of search points, then the collection is stopped and the target sharpness sequence is obtained.

[0043] For example, the minimum search range is 8 steps, meaning the focusing motor must move at least 8 steps; the minimum number of search points is 6, meaning the sharpness sequence must contain at least 6 sharpness values. During a single focusing search, the focusing motor is controlled to move gradually and sharpness values ​​are collected. If the following information is currently available: the focusing motor has moved a total of 10 steps from the starting position, and 7 sharpness values ​​have been collected during this process, the judgment process is as follows: the motor has moved 10 steps, which is greater than the minimum search range of 8 steps, and the sharpness sequence contains 7 sharpness values, which is greater than the minimum number of search points of 6. Therefore, collection and construction of the target sharpness sequence are stopped. If the following information is currently available: the focusing motor has moved a total of 10 steps from the starting position, and 6 sharpness values ​​have been collected during this process, the judgment process is as follows: the motor has moved 10 steps, which is greater than the minimum search range of 8 steps, and the sharpness sequence contains 5 sharpness values, which is less than the minimum number of search points of 6. Therefore, sharpness values ​​are collected again until the number of sharpness values ​​is greater than 6.

[0044] Step S206: Extract the sharpness trend features corresponding to the target sharpness sequence. The sharpness trend features include upward trend continuity features and downward trend continuity features. Specifically, this includes: (1) Identify the maximum sharpness value in the target sharpness sequence.

[0045] (2) Using the maximum sharpness value as the benchmark, the target sharpness sequence is divided into a first sharpness subsequence and a second sharpness subsequence.

[0046] In one example, if the maximum sharpness value is not the first or last sharpness value in the target sharpness sequence, the following operation can be performed: construct the sharpness values ​​to the left of the maximum sharpness value in the target sharpness sequence as the first sharpness subsequence, and construct the sharpness values ​​to the right of the maximum sharpness value in the target sharpness sequence as the second sharpness subsequence.

[0047] In one example, if the maximum sharpness value is the first sharpness value in the target sharpness sequence, then the first sharpness subsequence is empty, and the target sharpness sequence is used as the second sharpness subsequence.

[0048] In one example, if the maximum sharpness value is the last sharpness value in the target sharpness sequence, then the target sharpness sequence is taken as the first sharpness subsequence, and the second sharpness subsequence is empty.

[0049] Furthermore, if the maximum sharpness value is the sharpness value at the top of the target sharpness sequence, the previously collected target sharpness sequence can be called, the two collected target sharpness sequences can be combined, and it can be determined whether there is a new maximum sharpness threshold in the combined target sharpness sequence. If there is, it can be divided into a first sharpness subsequence and a second sharpness subsequence according to the aforementioned example, and the corresponding upward trend continuity features and downward trend continuity features can be extracted. If there is no such feature, the combined target sharpness sequence is discarded, and the current collected target sharpness sequence is divided into a first sharpness subsequence and a second sharpness subsequence, and the corresponding upward trend continuity features and downward trend continuity features are extracted.

[0050] (3) Based on the first and second resolution subsequences, extract the upward trend continuity features and the downward trend continuity features.

[0051] The feature extraction process is as follows: Determine the first sub-value corresponding to the sharpness value contained in the first sharpness subsequence, and determine the Spearman rank coefficient corresponding to the first sharpness subsequence based on the first sub-value, as the upward trend continuity feature; determine the second sub-value corresponding to the sharpness value contained in the second sharpness subsequence, and determine the Spearman rank coefficient corresponding to the second sharpness subsequence based on the second sub-value, as the downward trend continuity feature.

[0052] The principle for extracting sharpness trend features is as follows: Near sharp points in the image, the sharpness output by the filter exhibits a clear continuous upward and downward trend. Noise / outliers in low light also show upward and downward trends, but not a continuous upward or downward trend. The noise value and peak value are distinguished by the continuous upward / downward trend. This embodiment of the invention uses the Spearman rank correlation coefficient method to extract the upward trend continuity feature and the downward trend continuity feature, as shown in the following formula:

[0053] in, For Spearman's rank coefficient, The number of sharpness values ​​contained in the first or second sharpness subsequence. For the first resolution subsequence or the second resolution subsequence, the first... The position of a resolution value in the first resolution subsequence or the second resolution subsequence.

[0054] In practical implementation, This indicates a continuous decline in data. This indicates that the data is rising continuously. This indicates that the data has no trend. The closer the value is to 1 / -1, the better the continuous upward / downward trend of the data. The Spearman rank correlation coefficient of the first or second resolution subsequence is used as the characteristic of its upward or downward trend continuity.

[0055] (4) The upward trend continuity feature and the downward trend continuity feature are used as the clarity trend features corresponding to the target clarity sequence.

[0056] Step S208: Determine whether the upward trend continuity feature meets the upward trend condition, and determine whether the downward trend continuity feature meets the downward trend condition. If both determinations are yes, the trend determination condition is met, and step S210 is executed; if either determination is no, the trend determination condition is not met, and step S204 is executed.

[0057] In one implementation, if the continuity of the upward trend is greater than a first preset threshold, the upward trend condition is determined to be met; if the continuity of the downward trend is greater than a second preset threshold, the downward trend condition is determined to be met. The first and second preset thresholds may be the same or different, and are specifically related to the ambient brightness information of the current scene.

[0058] Step S210: Determine the new maximum resolution value in the new target resolution sequence, control the focusing motor in the imaging device, and drive the optical lens in the imaging device to move along the optical axis to the position corresponding to the new maximum resolution value so that the optical lens is focused.

[0059] During autofocus, the system analyzes the acquired sharpness sequence to identify the focus position corresponding to optimal image sharpness. Specifically: First, a new maximum sharpness value, or peak point, is determined from the target sharpness sequence that satisfies both upward and downward trend conditions. This peak represents the optimal focus achievable under the current shooting conditions. Then, based on the stepping position of the focusing motor corresponding to this maximum sharpness value, a drive command is generated and sent to the focusing motor in the imaging device. The focusing motor responds to the command, precisely moving the lens elements along the optical axis to the target position. Finally, the optical lens reaches the optimal focus point, achieving a sharp image of the subject in the scene.

[0060] In summary, the embodiments of the present invention can determine whether a peak is reached by continuously increasing and decreasing the sharpness value near the peak point, thus eliminating the dependence of the hill-climbing algorithm on the magnitude of the sharpness value and improving the focusing speed and accuracy of contrast-based focusing in low-light / low-contrast scenes.

[0061] Based on the foregoing embodiments, this invention provides an optical lens focusing processing device, see [link to previous embodiment]. Figure 3 The diagram shows a structural schematic of an optical lens focusing processing device, which mainly includes the following parts: The strategy acquisition module 302 is used to acquire the ambient brightness information of the scene where the imaging device is currently located, so as to determine the focusing strategy corresponding to the ambient brightness information. The focusing strategy includes search resource configuration information and trend judgment conditions. The sharpness collection module 304 is used to collect the target sharpness sequence according to the search resource configuration information during the focus search process of the imaging device. The target sharpness sequence includes the sharpness values ​​corresponding to multiple frames of preview images during the focus search process. The condition determination module 306 is used to continue collecting new target sharpness sequences when the sharpness trend features corresponding to the target sharpness sequence do not meet the trend determination conditions, until the sharpness trend features corresponding to the new target sharpness sequence meet the trend determination conditions. The focus control module 308 is used to control the focusing of the imaging device based on the new target sharpness sequence.

[0062] The optical lens focusing processing device provided in this embodiment of the invention first determines the focusing strategy corresponding to the current ambient brightness information in order to better adapt to the current ambient brightness information and accelerate the focusing speed under the current ambient brightness information. On this basis, it collects the target sharpness sequence according to the search resource configuration information in the focusing strategy, extracts the sharpness trend features of the target sharpness sequence, and determines whether it meets the trend determination condition in the focusing strategy. If the trend determination condition is met, focusing is achieved. Compared with the prior art, the present invention gets rid of the dependence of the hill climbing algorithm on the sharpness value, thereby improving the focusing speed and focusing accuracy in low light and low contrast scenes.

[0063] In one implementation, the search resource configuration information includes a minimum search range and a minimum number of search points; the clarity collection module 304 is specifically used for: The focusing motor in the imaging device is controlled to move the optical lens in the imaging device along the optical axis by a preset search step size, and the sharpness value corresponding to the preview image is collected. Add the sharpness value to the current sharpness sequence; Determine whether the number of search steps for the focusing motor is greater than the minimum search range, and determine whether the number of sharpness values ​​contained in the current sharpness sequence is greater than the minimum number of search points; If all the judgment results are yes, the current sharpness sequence is taken as the target sharpness sequence.

[0064] In one implementation, the trend determination conditions include an upward trend condition and a downward trend condition; the condition determination module 306 is specifically used for: Extract the sharpness trend features corresponding to the target sharpness sequence. The sharpness trend features include upward trend continuity features and downward trend continuity features. Determine whether the continuity characteristics of an upward trend meet the upward trend conditions, and determine whether the continuity characteristics of a downward trend meet the downward trend conditions; If all the judgment results are yes, then the trend determination condition is met; If any judgment result is negative, it is determined that the trend determination condition is not met.

[0065] In one implementation, the condition determination module 306 is specifically used for: Identify the maximum sharpness value in the target sharpness sequence; Using the maximum sharpness value as a benchmark, the target sharpness sequence is divided into a first sharpness subsequence and a second sharpness subsequence; Based on the first and second resolution subsequences, the upward trend continuity feature and the downward trend continuity feature are extracted; The continuity features of upward and downward trends are used as the clarity trend features corresponding to the target clarity sequence.

[0066] In one implementation, the condition determination module 306 is specifically used for: Determine the first sub-value corresponding to the sharpness value contained in the first sharpness subsequence, and determine the Spearman rank coefficient corresponding to the first sharpness subsequence based on the first sub-value, as a feature of the upward trend continuity; Determine the second rank value corresponding to the sharpness value contained in the second sharpness subsequence, and determine the Spearman rank coefficient corresponding to the second sharpness subsequence based on the second rank value, as a feature of the downward trend continuity.

[0067] In one implementation, the condition determination module 306 is specifically used for: If the continuity of the upward trend is greater than the first preset threshold, the upward trend condition is determined to be met. If the continuity of the downward trend is greater than the second preset threshold, the downward trend condition is determined to be met.

[0068] In one implementation, the focus control module 308 is specifically used for: Determine the new maximum sharpness value in the new target sharpness sequence; The focusing motor in the imaging device is controlled to drive the optical lens in the imaging device to move along the optical axis to the position corresponding to the new maximum resolution value, so that the optical lens can focus.

[0069] The device provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.

[0070] This invention provides an electronic device, specifically, the electronic device includes a processor and a memory; the memory stores a computer program, which, when run by the processor, executes the method described in any of the above embodiments.

[0071] Figure 4 The present invention provides a schematic diagram of the structure of an electronic device 100, which includes a processor 40, a memory 41, a bus 42 and a communication interface 43. The processor 40, the communication interface 43 and the memory 41 are connected through the bus 42. The processor 40 is used to execute executable modules, such as computer programs, stored in the memory 41.

[0072] The memory 41 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 43 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.

[0073] Bus 42 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0074] The memory 41 is used to store programs. After receiving an execution instruction, the processor 40 executes the program. The method executed by the device for defining the flow process disclosed in any of the foregoing embodiments of the present invention can be applied to the processor 40 or implemented by the processor 40.

[0075] Processor 40 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 40 or by instructions in software form. Processor 40 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 41. The processor 40 reads the information in memory 41 and, in conjunction with its hardware, completes the steps of the above method.

[0076] The computer program product of the readable storage medium provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the foregoing method embodiments. For specific implementation, please refer to the foregoing method embodiments, which will not be repeated here.

[0077] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0078] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. An optical lens focusing processing method, characterized by, The method comprises: obtaining environment brightness information of a scene in which an imaging device is currently located, to determine a focusing strategy corresponding to the environment brightness information, the focusing strategy comprising search resource configuration information and trend determination conditions; in a process of focusing search performed by the imaging device, collecting a target sharpness sequence according to the search resource configuration information, the target sharpness sequence comprising sharpness values corresponding to multiple frames of preview images in the process of focusing search; in a case where a sharpness trend feature corresponding to the target sharpness sequence does not satisfy the trend determination conditions, continuing to collect a new target sharpness sequence until the sharpness trend feature corresponding to the new target sharpness sequence satisfies the trend determination conditions; controlling the imaging device to perform focusing based on the new target sharpness sequence. 2.The optical lens focusing processing method of claim 1, wherein, The search resource configuration information comprises a minimum search range and a minimum search point number; collecting a target sharpness sequence according to the search resource configuration information comprises: controlling a focusing motor in the imaging device to drive an optical lens in the imaging device to move along an optical axis direction at a preset search step length, and collecting a sharpness value corresponding to a preview image; adding the sharpness value to a current sharpness sequence; judging whether a search step number of the focusing motor is greater than the minimum search range, and judging whether a number of the sharpness values contained in the current sharpness sequence is greater than the minimum search point number; in a case where the judgment results are both yes, regarding the current sharpness sequence as a target sharpness sequence. 3.The optical lens focusing processing method of claim 1, wherein, The trend determination conditions comprise an upward trend condition and a downward trend condition; the method further comprises: extracting a sharpness trend feature corresponding to the target sharpness sequence, the sharpness trend feature comprising an upward trend continuity feature and a downward trend continuity feature; judging whether the upward trend continuity feature satisfies the upward trend condition, and judging whether the downward trend continuity feature satisfies the downward trend condition; in a case where the judgment results are both yes, determining that the trend determination conditions are satisfied; in a case where any judgment result is no, determining that the trend determination conditions are not satisfied.

4. The optical lens focusing processing method according to claim 3, wherein, extracting a sharpness trend feature corresponding to the target sharpness sequence comprises: identifying a position where a maximum sharpness value in the target sharpness sequence is located; dividing the target sharpness sequence into a first sharpness sub-sequence and a second sharpness sub-sequence, taking the position where the maximum sharpness value is located as a reference point; extracting an upward trend continuity feature and a downward trend continuity feature based on the first sharpness sub-sequence and the second sharpness sub-sequence; taking the upward trend continuity feature and the downward trend continuity feature as the sharpness trend feature corresponding to the target sharpness sequence.

5. The optical lens focusing processing method according to claim 4, wherein, extracting an upward trend continuity feature and a downward trend continuity feature based on the first sharpness sub-sequence and the second sharpness sub-sequence comprises: determining a first rank value corresponding to a sharpness value contained in the first sharpness sub-sequence, determining a Spearman rank coefficient corresponding to the first sharpness sub-sequence based on the first rank value, and taking the Spearman rank coefficient as an upward trend continuity feature; determine a second bit order value corresponding to a sharpness value included in the second sharpness subsequence, determine a Spearman rank coefficient corresponding to the second sharpness subsequence based on the second bit order value, and take the Spearman rank coefficient as a descending trend continuity feature.

6. The optical lens focusing processing method according to claim 3, wherein, The method further includes: determining that the ascending trend condition is satisfied when the ascending trend continuity feature is greater than a first preset threshold value; determining that the descending trend condition is satisfied when the descending trend continuity feature is greater than a second preset threshold value.

7. The optical lens focusing processing method of claim 1, wherein, The method further includes: determining a new maximum sharpness value in the new target sharpness sequence; controlling a focus motor in the imaging device to drive an optical lens in the imaging device to move to a position corresponding to the new maximum sharpness value along an optical axis direction, so that the optical lens is focused.

8. An optical lens focusing processing apparatus, characterized in that, The method further includes: a policy acquisition module configured to acquire environmental brightness information of a scene in which an imaging device is currently located, to determine a focus policy corresponding to the environmental brightness information, and to determine search resource configuration information and trend determination conditions in the focus policy; a sharpness collection module configured to collect a target sharpness sequence according to the search resource configuration information during a focus search process of the imaging device, the target sharpness sequence including sharpness values corresponding to multiple preview images in the focus search process; a condition determination module configured to continue to collect a new target sharpness sequence when a sharpness trend feature corresponding to the target sharpness sequence does not satisfy the trend determination conditions, until the sharpness trend feature corresponding to the new target sharpness sequence satisfies the trend determination conditions; a focus control module configured to control the imaging device to focus based on the new target sharpness sequence.

9. An electronic device, comprising: The computer readable storage medium stores computer executable instructions, and the computer executable instructions, when invoked and executed by a processor, cause the processor to implement the method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer executable instructions, and the computer executable instructions, when invoked and executed by a processor, cause the processor to implement the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Focusing method and device and computer readable storage medium

    CN111757008A

  • Automatic focusing method and automatic focusing system

    CN112601015A

  • Automatic focusing method and system

    CN117319796A

  • Focus position determination method, device, electronic equipment and electric lens

    CN119788963A

  • Imaging device, automatic focusing method and recording medium on which a program is recorded

    US20010010556A1