A lens fast focusing method, computing device and storage medium

By recording and analyzing the frame count and definition evaluation value of multi-frame images captured by the lens, determining the target image and moving the lens to its shooting position, the problem of inefficiency of the existing autofocus method is solved and the lens is quickly focused.

CN116437204BActive Publication Date: 2025-03-07SHANGHAI JIQING HUISHI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310449202.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-24
Publication Date
2025-03-07
Estimated Expiration
2043-04-24

AI Technical Summary

Technical Problem

The existing automatic focus method requires multiple lens movements, resulting in inefficiency, and frequent lens movements occupy a large number of clock cycles, affecting focus efficiency.

Method used

By recording the frame count per frame and the definition evaluation value of the multi-frame image captured by the lens, the frame with the largest definition evaluation value is determined as the target image, and the lens is moved to the first lens position where the target image was captured according to the frame count of the target image, so as to achieve fast focus.

Benefits of technology

This reduces the number of lens movements and clock cycles, improves focus efficiency, and can quickly find the image position with the best definition evaluation value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116437204B_ABST
    Figure CN116437204B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image shooting automation, and discloses a lens fast focusing method, a computing device and a storage medium. The method of the present invention comprises the steps of: in response to receiving a lens focus instruction, moving the lens from the starting point of the focus stroke to the end point, recording the frame count and clarity evaluation value of each frame of multiple frames of images shot by the lens; determining a frame of images with the largest clarity evaluation value and the frame count of the frame of images in the multiple frames of images, and taking the image as the target image; and moving the lens to the first lens position for shooting the target image according to the frame count of the target image. After receiving the lens focus instruction, the present invention can determine the lens position that can shoot an image with the best clarity evaluation value through less instruction interaction and short lens position search, and stop the lens at this position to achieve focusing; focusing is achieved by traversing the focus stroke once, reducing the process of the lens reciprocating to find the best shooting position, and improving the focusing efficiency and shooting speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image shooting automation, and in particular to a lens fast focusing method, a computing device and a storage medium. Background Art

[0002] The key to autofocus research is the image clarity evaluation method and peak search algorithm. At present, image clarity evaluation methods can be divided into three categories: evaluation methods based on spatial domain, evaluation methods based on frequency domain, and evaluation methods based on statistical informatics. Commonly used peak search algorithms mainly include hill climbing, that is, moving the camera lens back and forth multiple times to perform a rough scan with a large step length and a fine scan with a small step length, so as to compare the image clarity evaluation values ​​of each position, and finally analyze and compare to find the focus position, but this is easy to get a local optimal solution instead of a global optimal solution, and its accuracy is also easily affected by the search step length. The shorter the step length, the higher the accuracy, but the efficiency will also increase with the shortening of the step length. Another peak search method is the large step search method, that is, driving the lens motor to start moving with a large step length, and calculating the image clarity evaluation value corresponding to each movement process. After obtaining the evaluation values ​​within all unit step lengths, a small step search is performed within the unit distance containing the maximum evaluation value to find the actual maximum value. The disadvantage of this method is that it requires multiple operations to complete the entire lens step length first, and then search again according to one section to find the maximum value position, which is relatively time-consuming.

[0003] Both of the above methods require multiple lens movements. However, the camera lens itself has a very low clock frequency, and each reception of an operation command or return of a data command requires a large number of clock cycles. The time spent on multiple operation commands is added up, which seriously affects the focusing efficiency.

[0004] To do this, a new method for quickly focusing lenses is needed. Summary of the invention

[0005] To this end, the present invention provides a lens fast focusing method to try to solve or at least alleviate the above problems.

[0006] According to one aspect of the present invention, a lens fast focusing method is provided, which is suitable for execution in a computing device, and the method includes the steps of: in response to receiving a lens focus instruction, moving the lens from the starting point to the end point of the focus stroke, recording the frame count and clarity evaluation value of each frame of multiple frames of images captured by the lens; determining a frame of image with the largest clarity evaluation value and the frame count of the frame in the multiple frames, and using the image as a target image; and moving the lens to a first lens position for capturing the target image according to the frame count of the target image.

[0007] Optionally, the method according to the present invention also includes: obtaining a clarity evaluation value of a first image captured by the lens when the lens is at a first lens position; determining whether the clarity evaluation value of the first image satisfies a fluctuation range of a maximum clarity evaluation value; if not, moving the lens using a preset step size according to a hill climbing search method, and determining a second image with the largest clarity evaluation value; and using a second lens position for capturing the second image as an optimal shooting position to capture the image.

[0008] Optionally, in the method according to the present invention, the focusing stroke of the lens includes an acceleration motion segment, a uniform motion segment and a deceleration motion segment, and moving the lens to a first lens position for capturing the target image according to a frame count of the target image includes: determining in which segment of the focusing stroke the target image is captured; if the target image is captured in the acceleration motion segment, moving the lens to the end position of the acceleration motion segment.

[0009] Optionally, the method according to the present invention further comprises: if the target image is shot in a deceleration motion segment, moving the lens to a starting position of the deceleration motion segment.

[0010] Optionally, the method according to the present invention further includes: if the target image is shot in a uniform motion segment, determining a third lens position for shooting the target image in the uniform motion segment according to a frame count of the target image; and moving the lens to the third lens position.

[0011] Optionally, in the method according to the present invention, determining the third lens position for shooting the target image in the uniform motion segment according to the frame count of the target image includes: determining the third lens position according to the frame count of the target image, the motion time of the accelerated motion segment, and the motion speed of the lens in the uniform motion segment.

[0012] Optionally, in the method according to the present invention, the step of obtaining the motion speed of the uniform motion segment includes: setting the lens at the end point of the focusing stroke, and placing the target focus object in front of the lens, so that the clarity evaluation value when the lens shoots the target focus object is the maximum value within the focusing stroke; measuring the time for the lens to reach the end point of the focusing stroke from the starting point of the focusing stroke to obtain a first stroke time; measuring the time for the lens to reach the midpoint of the focusing stroke from the starting point of the focusing stroke to obtain a second stroke time; determining the motion speed of the uniform motion segment according to the first stroke time, the second stroke time and the length of the focusing stroke.

[0013] Optionally, in the method according to the present invention, the step of acquiring the motion time of the accelerated motion segment includes: determining the motion time of the accelerated motion segment according to the motion speed of the uniform motion segment, the first stroke time and the length of the focusing stroke.

[0014] According to another aspect of the present invention, a computing device is provided, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for executing any method of a lens fast focusing method according to the present invention.

[0015] According to another aspect of the present invention, there is provided a computer-readable storage medium storing one or more programs, wherein the one or more programs include instructions, which, when executed by a computing device, enable the computing device to perform any one of the lens fast focusing methods according to the present invention.

[0016] A lens fast focusing method in the present invention is suitable for execution in a computing device, and the method includes the following steps: in response to receiving a lens focus instruction, the lens is moved from the starting point to the end point of the focus stroke, and the frame count and clarity evaluation value of each frame of multiple frames of images captured by the lens are recorded; a frame of image with the largest clarity evaluation value and the frame count of the frame of image are determined in the multiple frames of images, and the image is used as the target image; the lens is moved to the first lens position for capturing the target image according to the frame count of the target image. After receiving the lens focus instruction, the present invention can determine the lens position that can capture an image with the best clarity evaluation value through less instruction interaction and short lens position search, and stop the lens at this position to achieve focusing, so as to take pictures. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other purposes, features and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout the present disclosure, the same reference numerals generally refer to the same parts or elements.

[0018] Figure 1 A schematic diagram of a process of a lens fast focusing method 100 according to an exemplary embodiment of the present invention is shown;

[0019] Figure 2 A schematic diagram of a computing device according to an exemplary embodiment of the present invention is shown;

[0020] Figure 3a and Figure 3b A schematic diagram showing the movement of a lens in a focus stroke according to an exemplary embodiment of the present invention is shown;

[0021] Figure 4a and Figure 4bA schematic diagram of focusing stroke division according to an exemplary embodiment of the present invention is shown;

[0022] Figure 5a and Figure 5b Schematic diagrams of measuring a first travel time and a second travel time according to an exemplary embodiment of the present invention are respectively shown;

[0023] Figure 6 A schematic diagram of lens movement according to an exemplary embodiment of the present invention is shown;

[0024] Figure 7 A schematic diagram showing a method of determining a position of a third lens according to an exemplary embodiment of the present invention is shown;

[0025] Figure 8 FIG. 4 is a schematic diagram of a process of auto-focusing according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0026] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to enable the scope of the present disclosure to be fully conveyed to those skilled in the art. The same reference numerals generally refer to the same components or elements.

[0027] Figure 1 FIG. 1 is a flow chart of a method 100 for fast focusing of a lens according to an exemplary embodiment of the present invention. The method 100 for fast focusing of a lens according to the present invention is suitable for being executed in a computing device.

[0028] Figure 2 1 shows a block diagram of a computing device according to an exemplary embodiment of the present invention. In a basic configuration, computing device 200 includes at least one processing unit 220 and system memory 210. According to one aspect, depending on the configuration and type of computing device, system memory 210 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, system memory 210 includes operating system 211.

[0029] According to one aspect, operating system 211, for example, is suitable for controlling the operation of computing device 200. Furthermore, examples may be practiced in conjunction with graphics libraries, other operating systems, or any other application programs, and are not limited to any particular application or system. Figure 2This basic configuration is illustrated in FIG by those components within dashed line 215. According to one aspect, computing device 200 has additional features or functionality. For example, according to one aspect, computing device 200 includes additional data storage devices (removable and / or non-removable), such as magnetic disks, optical disks, or tapes.

[0030] As stated above, according to one aspect, the program module 212 is stored in the system memory 210. According to one aspect, the program module 212 may include one or more application programs, and the present invention does not limit the type of application program, for example, the application program also includes: email and contact application programs, word processing application programs, spreadsheet application programs, database application programs, slide show application programs, drawing or computer-aided application programs, web browser application programs, etc.

[0031] According to one aspect, the examples may be practiced on a circuit comprising discrete electronic components, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or a single chip containing electronic components or a microprocessor. Figure 2 Each or many components shown in can be integrated into a system on a chip (SOC) on a single integrated circuit to practice examples. According to one aspect, such a SOC device may include one or more processing units, a graphics unit, a communication unit, a system virtualization unit, and various application functions, all of which are integrated (or "burned") into a chip substrate as a single integrated circuit. When operated via SOC, the functions described in this article can be operated via a dedicated logic integrated with other components of the computing device 200 on a single integrated circuit (chip). Other technologies that can perform logical operations (such as AND, OR, and NOT) can also be used to practice embodiments of the present invention, including but not limited to mechanical, optical, fluid, and quantum technologies. In addition, embodiments of the present invention can be practiced in a general-purpose computer or in any other circuit or system.

[0032] According to one aspect, the computing device 200 may also have one or more input devices 231, such as a keyboard, a mouse, a pen, a voice input device, a touch input device, etc. Output devices 232 may also be included, such as a display, a speaker, a printer, etc. The aforementioned devices are examples and other devices may also be used. The computing device 200 may include one or more communication connections 233 that allow communication with other computing devices 240. Examples of suitable communication connections 233 include, but are not limited to: RF transmitters, receivers and / or transceiver circuits; Universal Serial Bus (USB), parallel and / or serial ports. The computing device 200 can be communicatively connected to other computing devices 240 via the communication connection 233.

[0033] The embodiment of the present invention also provides a non-transitory readable storage medium, which stores instructions, and the instructions are used to enable the computing device to execute a lens fast focusing method implemented according to the present invention. The readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be a computer-readable instruction, a data structure, a module of a program, or other data. Examples of readable storage media include, but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassette, tape disk storage or other magnetic storage device or any other non-transitory readable storage medium.

[0034] According to one aspect, communication media is implemented by computer readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., a carrier wave or other transport mechanism), and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more characteristics set or changed in a manner that encodes information in the signal. By way of example and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.

[0035] It should be noted that, although the computing device shown above only includes the processing unit 220, the system memory 210, the input device 231, the output device 232, and the communication connection 233, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the device may only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0036] Back to Figure 1 A lens fast focusing method 100 begins at step 110. In response to receiving a lens focus instruction, the lens is moved from a starting point to an end point of a focus stroke, and a frame count and a clarity evaluation value of each frame of a plurality of frames of images captured by the lens are recorded.

[0037] According to an embodiment of the present invention, the lens referred to in the present invention can be set in any device that can be set with a lens, including but not limited to mobile phones, cameras, tablets, computers, etc. The present invention does not limit the specific setting method of the lens, the type and model of the lens, etc. The lens can be implemented as an optical lens, etc.

[0038] The lens focus command can be triggered by the user using the lens, such as the user operating the focus button of the camera to trigger the lens focus command, or it can be automatically triggered by the lens or a device equipped with the lens, such as a mobile phone triggering the lens focus command and automatically focusing when detecting the object to be photographed. The present invention does not limit the specific triggering method of the lens focus command.

[0039] The lens focus command is used to move the lens on the focus stroke when the lens is shooting a target object, so that the image obtained by the lens shooting the target object is the clearest. The focus stroke refers to the path that the lens moves to achieve zooming. The two ends of the focus stroke are the starting point and end point of the focus stroke, that is, the zero position of the lens and the maximum step length of the lens movement.

[0040] When the lens moves from the starting point of the focus stroke to the end point of the focus stroke, it will capture multiple image frames. Each frame of the image is a photo of the target object captured by the lens. Whether the image is clear or not means whether the target object in the photo is clear or not. The clarity evaluation value is the clarity of the target object captured by the lens. The present invention does not limit the specific determination method and calculation method of the clarity evaluation value, such as it can be automatically determined by a neural network algorithm. The frame count of the image is the frame number of all images.

[0041] According to an embodiment of the present invention, if the position of the lens is not at the starting point of the focus stroke when the lens focus instruction is received, the position of the lens is first moved to the starting point of the focus stroke.

[0042] Then, step 120 is executed to determine a frame image with the largest definition evaluation value among the multiple frames of images and the frame count of the frame image, and the image is used as the target image.

[0043] The frame of image having the largest definition evaluation value can be determined by comparing the definition evaluation values ​​of all images.

[0044] Finally, step 130 is executed to move the lens to a first lens position for capturing the target image according to the frame count of the target image.

[0045] According to an embodiment of the present invention, when the lens moves on the focus stroke, it will first accelerate, then move at a constant speed, and finally decelerate, and finally reach the end of the focus stroke. Accordingly, according to the movement law of the lens, the focus stroke of the lens can be divided into an acceleration motion segment, a constant speed motion segment, and a deceleration motion segment.

[0046] Figure 3a and Figure 3b Schematic diagrams showing the movement of a lens in a focusing stroke according to an exemplary embodiment of the present invention are shown respectively.

[0047] like Figure 3aAs shown, the horizontal axis t is the time the lens moves on the focusing stroke, and the vertical axis v is the speed at which the lens moves on the focusing stroke. Figure 3a This is a graph showing how the speed of the lens moving along the focusing stroke varies with time.

[0048] Correspondingly, the time the lens takes to move on the focus stroke can be reflected by the frame count. Since the frame rate of the lens shooting remains unchanged, the frame count increases linearly with time. The larger the frame count, the longer the time. Figure 3b As shown, the abscissa f is the frame count of the captured image when the lens moves on the focus stroke, and the ordinate v is the speed at which the lens moves on the focus stroke. Figure 3a This is a graph showing the relationship between the speed of the lens moving along the focus stroke and the frame count.

[0049] According to an embodiment of the present invention, if the frame rate of the camera is 60 frames per second, the time per frame t f =1 / 60s, then the time the lens has been moving can be calculated as: T = f*t f The higher the frame rate, the more accurate the time measured by frame counting. The present invention does not limit the specific frame rate captured by the camera.

[0050] According to one embodiment of the present invention, moving the lens to the first lens position for photographing the target image according to the frame count of the target image includes: determining in which focusing stroke the target image is photographed; if the target image is photographed in the accelerated motion segment, moving the lens to the end position of the accelerated motion segment. If the target image is photographed in the decelerated motion segment, moving the lens to the starting position of the decelerated motion segment. If the target image is photographed in the uniform motion segment, determining the third lens position for photographing the target image in the uniform motion segment according to the frame count of the target image; and moving the lens to the third lens position.

[0051] According to an embodiment of the present invention, the movement process of the lens in the focus stroke is divided according to the frame count. The frame count when the lens starts to move is f0, the frame count when the acceleration ends and the uniform motion begins is f1, the frame count when the deceleration begins is f2, and the frame count when the motion ends and reaches the end of the focus stroke is f3. The frame interval of the lens can be divided into an acceleration motion segment (f0-f1), a uniform motion segment (f1-f2) and a deceleration motion segment (f2-f3).

[0052] Figure 4a and Figure 4b FIG. 2 shows a schematic diagram of focusing stroke division according to an exemplary embodiment of the present invention. Figure 4a As shown, the abscissa f is the frame count of the captured image when the lens moves on the focus stroke, and the ordinate v is the speed at which the lens moves on the focus stroke. Indicates the movement speed of the lens in the uniform speed section. The shaded part is the length of the focusing stroke that the lens has traveled.

[0053] Determine the frame count f of the image corresponding to the maximum value of the image clarity evaluation m Location, if f m In the acceleration motion segment (f0-f1), it moves to the interval boundary f1.

[0054] like Figure 4b As shown, if f m In the deceleration motion section (f2-f3), it moves to the interval boundary f2.

[0055] According to one embodiment of the present invention, when determining the third lens position for shooting the target image in the uniform motion segment based on the frame count of the target image, the third lens position is determined based on the frame count of the target image, the motion time of the accelerated motion segment, and the motion speed of the lens in the uniform motion segment.

[0056] According to an embodiment of the present invention, the time from sending the lens start movement command to the lens starting uniform movement, and the speed of the lens uniform movement cannot be accurately measured by an algorithm, so the present invention obtains the movement speed of the uniform movement segment through the following steps:

[0057] Set the lens to the end of the focus stroke, and place the target focus object in front of the lens, so that the clarity evaluation value when the lens shoots the target focus object is the maximum value within the focus stroke. When placing the target focus object in front of the lens, you can obtain lens information in advance, such as the lens model to determine the minimum focus distance of the lens, and then place the target focus object in front of the lens according to the minimum focus distance. If the image of the target focus object is not clear at this time, you can manually fine-tune the position of the target focus object to make it clear. At this time, the lens can obtain the image with the highest clarity evaluation value at the starting point of the focus stroke.

[0058] Subsequently, the time taken by the lens to reach the end point of the focusing stroke from the starting point of the focusing stroke is measured to obtain the first stroke time, and the time taken by the lens to reach the midpoint of the focusing stroke from the starting point of the focusing stroke is measured to obtain the second stroke time. The present invention does not limit the measurement order of the first stroke time and the second stroke time. The midpoint of the focusing stroke is a point in the focusing stroke that marks half the distance of the focusing stroke.

[0059] Finally, the motion speed of the uniform motion segment is determined according to the first travel time, the second travel time and the length of the focusing travel.

[0060] Figure 5a and Figure 5b Schematic diagrams of measuring a first travel time and a second travel time according to an exemplary embodiment of the present invention are respectively shown.

[0061] like Figure 5a As shown in the figure, the lens has the maximum clarity evaluation value at the frame count of f3, and f3 is the frame count f of the image corresponding to the maximum value of the image clarity evaluation. m .

[0062] The length of the focus stroke may be recorded as TotalStep. The specific value of the length of the focus stroke may be obtained from pre-acquired lens information. The present invention does not limit the specific method for obtaining the length of the focus stroke.

[0063] According to the measurement data of Figure 5, the following formula 1 can be obtained:

[0064]

[0065] By expressing the speed v with the function F(f), we can get formula 2:

[0066]

[0067] like Figure 5b As shown in the figure, the lens has the maximum clarity evaluation value at the frame count of f5, and f5 is the frame count f of the image corresponding to the maximum value of the image clarity evaluation. m .

[0068] according to Figure 5b The measured data can be used to obtain the following formula 3:

[0069]

[0070] According to formula 2 and formula 3, the uniform speed of the lens can be obtained. Formula 4:

[0071]

[0072] Transforming formula 4 into formula 5:

[0073]

[0074] f3 is the first travel time, and f5 is the second travel time.

[0075] The step of acquiring the motion time of the accelerated motion segment includes: determining the motion time of the accelerated motion segment according to the motion speed of the uniform motion segment, the first travel time, and the length of the focusing travel.

[0076] Figure 6 FIG. 2 shows a schematic diagram of lens movement according to an exemplary embodiment of the present invention. Figure 6 As shown in the figure, the time for the lens to accelerate and decelerate is short, so it can be approximated as the same non-uniform motion. Filling in the shaded part can be approximated as a rectangle. Figure 6The formula six is:

[0077]

[0078] According to formula 6, formula 7 for calculating the end time f2 of the uniform motion segment can be determined:

[0079]

[0080] According to the similarity between the acceleration and deceleration stages of the lens, we can get Formula 8:

[0081]

[0082] According to formula 8, formula 9 for calculating f1 can be obtained:

[0083]

[0084] According to one embodiment of the present invention, a measurement and calculation result of f1 is 5 frames.

[0085] Figure 7 FIG. 2 shows a schematic diagram of determining the position of the third lens according to an exemplary embodiment of the present invention. Figure 7 As shown:

[0086] The third lens position is the position where the lens has moved during the focus stroke, which can be calculated according to Formula 10:

[0087]

[0088] Such as m In the uniform motion segment (f1-f2), the lens is moved in the opposite direction by the distance of TotalStep-P to reach the third lens position.

[0089] According to one embodiment of the present invention, the method of the present invention also includes: obtaining a clarity evaluation value of a first image captured by the lens when the lens is in a first lens position; determining whether the clarity evaluation value of the first image satisfies a fluctuation range of a maximum clarity evaluation value; if not, moving the lens using a preset step length according to a hill climbing search method, and determining a second image with the largest clarity evaluation value; and using a second lens position for capturing the second image as an optimal shooting position to capture the image.

[0090] According to an embodiment of the present invention, the preset step length is a small step length, such as one thousandth of the focus stroke, and the present invention does not limit the specific length of the preset step length.

[0091] When using the hill climbing method to quickly search with a small step size, the image clarity evaluation value of the lens at the first lens position can be recorded, and the lens can be moved from the current position to a position with a larger image clarity evaluation value. The peak is determined based on whether the image clarity evaluation value decreases after the lens moves, and the focus is completed. Since the lens is already near the peak of the clarity evaluation curve, the peak point can be found more quickly and accurately.

[0092] Figure 8 FIG. 2 shows a schematic diagram of an automatic focusing process according to an exemplary embodiment of the present invention. Figure 8 As shown, the focusing starts with the reception of the lens focus command as the mark of the start of focusing. When starting to focus, if the position of the lens is not at the starting point of the focusing stroke, the position of the lens is first moved to the starting point of the focusing stroke. Subsequently, the lens is moved from the starting point to the end point of the focusing stroke, and the frame count and clarity evaluation value of each frame of the multiple frames of images captured by the lens are recorded.

[0093] Then, determine the frame image with the largest definition evaluation value and the frame count of the frame image among the multiple frames, and use the image as the target image. The largest definition evaluation value can be recorded as FV_m, and its corresponding frame number can be recorded as f m .

[0094] Then, the distance P that the lens has moved when capturing the target image is determined, which can be calculated using the following formula:

[0095]

[0096] Determine the f of the target image captured by the lens m Whether it is in the uniform motion segment (corresponding interval: f1-f2), if it is in the uniform motion segment, the lens is moved in the opposite direction by the distance of TotalStep-P to reach the third lens position, and the third lens position is used as the first lens position for shooting the target image.

[0097] If it is not in the uniform motion segment, further judgment: if f m In the accelerated motion segment (f0-f1), move to the interval boundary f1 and use the interval boundary f1 as the first lens position; if f m In the deceleration motion section (f2-f3), it moves to the interval boundary f2, and the interval boundary f2 is used as the first lens position.

[0098] Subsequently, a clarity evaluation value of a first image captured by the lens when the lens is in a first lens position is obtained; it is determined whether the clarity evaluation value of the first image satisfies a fluctuation range of a maximum clarity evaluation value; if not, the lens is moved using a preset step length according to a hill climbing search method, and a second image having a maximum clarity evaluation value is determined; and a second lens position for capturing the second image is used as an optimal shooting position to capture the image.

[0099] According to one embodiment of the present invention, the method of the present invention also includes: when the single focus button is pressed, the focusing process is exited after one focus is completed; when the continuous focus button is pressed, the lens monitoring state is entered after one focus is completed, and when the image clarity values ​​calculated from adjacent frames of image data change dramatically, indicating that the scene has changed, focusing is restarted after the image clarity values ​​stabilize.

[0100] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0101] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.

[0102] Those skilled in the art will appreciate that the modules or units or groups of the devices in the examples disclosed herein may be arranged in the device as described in the embodiment, or alternatively may be located in one or more devices different from the devices in the example. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.

[0103] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or groups in the embodiments may be combined into one module or unit or group, and in addition they may be divided into a plurality of submodules or subunits or subgroups. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device so disclosed may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0104] Furthermore, those skilled in the art will appreciate that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present invention and to form different embodiments.

[0105] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.

[0106] The various techniques described herein may be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or portions of the method and apparatus of the present invention may be in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a floppy disk, a hard disk drive, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.

[0107] In the case where the program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the method for determining the shutdown state of the device of the present invention according to the instructions in the program code stored in the memory.

[0108] By way of example and not limitation, computer readable media include computer storage media and communication media. Computer readable media include computer storage media and communication media. Computer storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and includes any information delivery medium. Any combination of the above is also included within the scope of computer readable media.

[0109] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.

[0110] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and teaching purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is illustrative, not restrictive, with respect to the scope of the present invention, which is defined by the appended claims.

Claims

1. A lens focusing method, suitable for execution in a computing device, the method comprising the steps of: In response to receiving a lens focus instruction, the lens is moved from a starting point to an end point of a focus stroke, and a frame count and a clarity evaluation value of each frame of a plurality of frames of images captured by the lens are recorded; Determine a frame image with the largest definition evaluation value and a frame count of the frame image among the multiple frame images, and use the frame image as a target image; Moving the lens to a first lens position for capturing the target image according to the frame count of the target image; Obtaining a clarity evaluation value of a first image captured by the lens when the lens is at a first lens position; Determining whether the definition evaluation value of the first image satisfies a fluctuation range of a maximum definition evaluation value; If not, the lens is moved using a preset step size according to a hill climbing search method, and the second image with the largest definition evaluation value is determined; using a second lens position for capturing a second image as an optimal capturing position to capture the image; The focusing stroke of the lens includes an acceleration motion segment, a uniform motion segment and a deceleration motion segment, and the moving of the lens to a first lens position for shooting the target image according to the frame count of the target image includes: Determine in which focusing stroke the target image is captured; If the target image is captured during an accelerated motion segment, the lens is moved to the end position of the accelerated motion segment.

2. The method of claim 1, wherein: The method further comprises: If the target image is captured in the deceleration motion segment, the lens is moved to the starting point of the deceleration motion segment.

3. The method of claim 1, wherein: The method further comprises: If the target image is captured in a uniform motion segment, determining a third lens position for capturing the target image in the uniform motion segment according to a frame count of the target image; The lens is moved to the third lens position.

4. The method of claim 3, wherein: Determining the third lens position for shooting the target image in the uniform motion segment according to the frame count of the target image includes: The third lens position is determined according to the frame count of the target image, the motion time of the accelerated motion segment, and the motion speed of the lens in the uniform motion segment.

5. The method of claim 4, wherein: The steps of obtaining the motion speed of the uniform motion segment include: Set the lens to the end of the focus range, and place the target focus object in front of the lens, so that the clarity evaluation value when the lens shoots the target focus object is the maximum value within the focus range; Measuring the time taken by the lens from the starting point of the focusing stroke to the end point of the focusing stroke to obtain a first stroke time; Measuring the time taken by the lens from the starting point of the focusing stroke to the midpoint of the focusing stroke to obtain a second stroke time; The motion speed of the uniform motion segment is determined according to the first travel time, the second travel time and the length of the focusing travel.

6. The method of claim 5, wherein: The steps for obtaining the motion time of the accelerated motion segment include: The motion time of the accelerated motion segment is determined according to the motion speed of the uniform motion segment, the first stroke time, and the length of the focusing stroke.

7. A computing device comprising: one or more processors; Memory; as well as One or more devices comprising instructions for performing any of the methods according to claims 1 to 6.

8. A computer-readable storage medium storing one or more programs, the one or more programs comprising instructions which, when executed by a computing device, cause the computing device to perform any of the methods according to claims 1 to 6.

Citation Information

Patent Citations

  • Automatic focusing process

    CN101241223A

  • Focusing method and device, electronic equipment and storage medium

    CN114460791A