Camera module focusing method, device, equipment and medium

By determining multiple initial focus positions within the adjustable focus range of the camera module and fitting image sharpness using the Bezier curve algorithm, the problem of low focus accuracy and accuracy in the prior art is solved, and more efficient and accurate focus process.

CN115499583BActive Publication Date: 2025-01-17KUNSHAN QIUTI PHOTOELECTRIC TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211031246.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-26
Publication Date
2025-01-17
Estimated Expiration
2042-08-26

AI Technical Summary

Technical Problem

The accuracy and accuracy of the autofocus function of the existing camera modules is not high, resulting in inaccurate image clarity prediction, which is easy to misjudgment or miss the peak point of clarity.

Method used

By determining multiple initial focus positions within the adjustable focus range of the camera module, the image clarity is calculated, and the curve fitting is used to determine the target focus position, replacing the traditional mountain climbing algorithm.

Benefits of technology

It improves the accuracy and accuracy of the camera module focus, reduces the number of motor movements and calculation amount, shortens the calculation time, and intuitively and accurately determines the target focus position.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115499583B_ABST
    Figure CN115499583B_ABST
Patent Text Reader

Abstract

The present invention discloses a camera module focusing method, device, equipment and medium, the method comprising: determining m initial focus positions according to the adjustable focus range of the camera module; performing definition calculation on m focus images corresponding to the m initial focus positions to obtain the definition of m images corresponding to the m initial focus positions; performing focusing processing on the definition of m images corresponding to the m initial focus positions to obtain the target focus position of the camera module. The present invention can solve the technical problems of low focusing precision and accuracy of the camera module in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of optical imaging technology, and in particular to a camera module focusing method, device, equipment and medium. Background Art

[0002] In recent years, with the rapid development of the electronic technology industry, the camera functions of various devices have become more and more powerful, such as enhanced Selfie, optical image stabilization, camera autofocus, etc. At present, for the camera autofocus function, the camera module generally moves the motor and uses the hill climbing algorithm to perform autofocus, making the camera module's photo images clearer.

[0003] Specifically, when the motor moves from the initial focus position of the camera module to the farthest focus position, the image quality of the image captured by the camera module will change from blurry to clear and then blurry again; the peak point with the highest clarity is found through the hill climbing algorithm, and the clarity of the two positions before and after the motor moves is compared. If the clarity of the current position of the motor is less than the clarity of the previous position, the motor is moved to the previous position to complete the focus of the camera module.

[0004] However, in practice, it is found that since the correspondence between image clarity and motor movement distance is not a smooth curve, the image clarity in the process from blur to clarity and then back to blur cannot be effectively predicted based on the motor movement distance. Therefore, when the motor setting movement step is small, the image clarity of the front and back positions is similar, and it is easy to misjudge the clarity peak point; when the motor setting movement step is large, it is easy to miss the clarity peak point. This will result in low precision and accuracy of the camera module autofocus. Therefore, it is urgent to propose a better camera module focusing solution. Summary of the invention

[0005] The embodiments of the present application solve the technical problems of low focusing precision and accuracy of camera modules in the prior art by providing a camera module focusing method, device, equipment and medium.

[0006] On the one hand, the present application provides a camera module focusing method through an embodiment of the present application, and the method comprises the following steps:

[0007] S1. Determine m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer;

[0008] S2, calculating the clarity of m focused images taken at the m initial focus positions to obtain the clarity of m images corresponding to the m initial focus positions;

[0009] S3. Perform focusing processing on the m image sharpnesses corresponding to the m initial focus positions to obtain a target focusing position of the camera module.

[0010] Optionally, the step S1 includes:

[0011] In the adjustable focus range of the camera module, m evenly distributed initial focus positions are selected.

[0012] Optionally, step S3 includes:

[0013] Performing curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain a focus fitting curve;

[0014] The focus position corresponding to the peak point in the focus fitting curve is determined as the target focus position.

[0015] Optionally, performing curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain a focus fitting curve comprises:

[0016] Performing curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain an initial fitting curve;

[0017] Selecting two reference focus positions including a peak point from the initial fitting curve, and updating the focus range between the two reference focus positions as the adjustable focus range;

[0018] Repeat the above steps S1-S2 to obtain the m image sharpnesses corresponding to the current m initial focus positions;

[0019] Curve fitting is performed on the m image sharpnesses corresponding to the current m initial focus positions to obtain the focus fitting curve.

[0020] Optionally, step S2 includes:

[0021] Acquire m focused images captured by the camera module at the m initial focus positions;

[0022] The clarity of the m focused images is calculated to obtain the clarity of the m images corresponding to the m initial focus positions.

[0023] Optionally, the performing clarity calculation on the m focused images to obtain the clarity of m images corresponding to the m initial focus positions comprises:

[0024] The grayscale variance product function is used to calculate the clarity of each of the m focused images to obtain the clarity of m images corresponding to the m initial focus positions.

[0025] Optionally, the method further comprises:

[0026] The motor device in the camera module is driven to the target focusing position to complete the focusing of the camera module.

[0027] On the other hand, the present application provides a camera module focusing device through an embodiment of the present application, the device comprising: a determination module, a calculation module and a processing module, wherein:

[0028] The determination module is used to determine m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer;

[0029] The calculation module is used to calculate the clarity of the m focused images taken corresponding to the m initial focus positions to obtain the clarity of the m images corresponding to the m initial focus positions;

[0030] The processing module is used to perform focusing processing on the m image sharpnesses corresponding to the m initial focus positions to obtain the target focusing position of the camera module.

[0031] For the contents not introduced or described in the embodiments of the present application, please refer to the relevant introduction in the aforementioned method embodiments, which will not be repeated here.

[0032] On the other hand, the present application provides a terminal device through an embodiment of the present application, and the terminal device includes: a processor, a memory, a communication interface and a bus; the processor, the memory and the communication interface are connected through the bus and communicate with each other; the memory stores executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the camera module focusing method as described above.

[0033] On the other hand, the present application provides a computer-readable storage medium through an embodiment of the present application, wherein the computer-readable storage medium stores a program, and when the program runs on a terminal device, the camera module focusing method as described above is executed.

[0034] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: the present application determines m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer; performs clarity calculation on the m focused images taken at the m initial focus positions to obtain the clarity of the m images corresponding to the m initial focus positions; performs focusing processing on the clarity of the m images corresponding to the m initial focus positions to obtain the target focus position of the camera module. In the above scheme, the present application adopts the Bezier curve algorithm to replace the hill climbing algorithm to realize the focus of the camera module, so that the target focus position of the camera module can be calculated conveniently and accurately, and the technical problems of low focusing precision and accuracy of the camera module in the prior art can be solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0036] Figure 1 It is a flow chart of a camera module focusing method provided in an embodiment of the present application.

[0037] Figure 2 It is a schematic diagram of a focus fitting curve provided in an embodiment of the present application.

[0038] Figure 3 It is a schematic diagram of a focus fitting curve provided in an embodiment of the present application.

[0039] Figure 4 It is a structural schematic diagram of a camera module focusing device provided in an embodiment of the present application.

[0040] Figure 5 It is a structural diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] The embodiments of the present application solve the technical problems of low focusing precision and accuracy of camera modules in the prior art by providing a camera module focusing method.

[0042] The technical solution of the embodiment of the present application is to solve the above technical problems, and the overall idea is as follows:

[0043] The present application provides a camera module focusing method, the method comprising the following steps:

[0044] S1. Determine m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer;

[0045] S2, calculating the clarity of m focused images taken at the m initial focus positions to obtain the clarity of m images corresponding to the m initial focus positions;

[0046] S3. Use a Bezier curve algorithm to perform focusing processing on the m image sharpnesses corresponding to the m initial focus positions to obtain a target focusing position of the camera module.

[0047] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0048] First of all, the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0049] See also Figure 1 , is a flow chart of a camera module focusing method provided in an embodiment of the present application. Figure 1 The method shown includes the following implementation steps:

[0050] S1. Determine m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer.

[0051] The adjustable focus range described in the present application is the moving range of the focus position custom-set in the camera module, which is usually the interval range corresponding to the starting focus position to the farthest focus position.

[0052] In a specific implementation, the present application can arbitrarily select m initial focus positions from the adjustable focus range of the camera module, wherein m is a positive integer customized according to the system or the user according to actual needs.

[0053] In another specific embodiment, the present application may select m evenly distributed initial focus positions from the adjustable focus range of the camera module.

[0054] S2. Calculate the clarity of m focused images taken at the m initial focus positions to obtain the clarity of m images corresponding to the m initial focus positions.

[0055] The present application can move the motor device in the camera device to respectively shoot at the m initial focus positions to obtain the corresponding m focused images. Then, the image clarity of the m focused images is calculated to obtain the m image clarity corresponding to the m initial focus positions.

[0056] The present application does not limit the specific implementation of the image definition calculation. Specifically, for example, the present application may use a grayscale variance product function to calculate the definition of each of the m focused images, thereby obtaining the m image definitions. The specific expression of the grayscale variance product function is shown in the following formula (1):

[0057]

[0058] Wherein, (x, y) represents the pixel point (x, y); f(x, y) represents the pixel value of the pixel point (x, y); and D(f) represents the image clarity.

[0059] S3. Use a Bezier curve algorithm to perform focusing processing on the m image sharpnesses corresponding to the m initial focus positions to obtain a target focusing position of the camera module.

[0060] In a specific implementation, the present application may use a Bezier curve algorithm to perform a curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain a corresponding focus fitting curve. The horizontal coordinate corresponding to the focus fitting curve is the focus position, and the vertical coordinate is the image sharpness. Then, the present application may determine the focus position corresponding to the peak point in the focus fitting curve as the target focus position of the camera module.

[0061] In another specific embodiment, the present application may first use the Bezier curve algorithm to perform a curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain an initial fitting curve. Then, from the initial fitting curve, two reference focus positions including the peak point of the initial fitting curve are selected, that is, the two reference focus positions correspond to the curve segments on the initial fitting curve that must include the peak point of the initial fitting curve. Then, the focus position range corresponding to the two reference focus positions is determined / updated as the adjustable focus range of the current camera module. Then, the above steps S1-S3 are repeated i times to obtain the m image sharpnesses corresponding to the m initial focus positions output for the i-th time. Wherein, i is a positive integer set by the system or user, and at each repetition, the number m of the initial focus positions selected in step S1 may change or not change. Usually, in order to improve the calculation accuracy, the present application will increase the value of m at each repetition, and the present application is not limited.

[0062] Furthermore, the present application uses a Bezier curve algorithm to perform curve fitting on the m image sharpnesses corresponding to the m initial focus positions output for the i-th time, thereby obtaining a focus fitting curve. Finally, the present application can determine the focus position corresponding to the peak point in the focus fitting curve as the target focus position of the camera module.

[0063] Among them, the specific implementation method of the present application using the Bezier curve algorithm to perform corresponding curve fitting can be: using the Bezier curve formula corresponding to the Bezier curve algorithm to perform corresponding curve fitting, and the Bezier curve formula is specifically shown in the following formula (2):

[0064]

[0065]

[0066] Wherein, m is the total number of the initial focus positions, i represents the i-th initial focus position, P i represents the i-th initial focus position (which can be understood as the abscissa value on the fitting curve), or represents the image clarity corresponding to the i-th initial focus position (which can be understood as the ordinate value on the fitting curve), B(t) represents the abscissa fitting curve or the ordinate fitting curve obtained by fitting the Bezier curve algorithm, t represents the distance between two adjacent focus positions, and t is between 0 and 1. This application does not elaborate on the Bezier curve algorithm or the Bezier curve formula.

[0067] In an optional embodiment, after obtaining the target focus position, the present application can drive / move the motor device in the camera module to the target focus position, thereby completing the focus of the entire camera module.

[0068] To help users better understand the embodiments of the present application, an example is used for specific explanation below. Specifically, it is assumed that the present application selects 5 evenly distributed initial focus positions from the starting focus position to the farthest focus position (i.e., the adjustable focus range) of the camera module, and calculates the image clarity corresponding to each of the initial focus positions. Then, these 5 initial focus positions and the image clarity corresponding to each of the 5 initial focus positions are substituted into the Bezier curve formula shown in formula (2), and the following is calculated: Figure 2 The figure shows a fitting curve of the image clarity when the motor device is moving. Figure 2 Two reference focus positions including a peak point are determined in the fitting curve L1 shown, which may be an initial focus position p2 and an initial focus position p4.

[0069] Furthermore, the present application can select 10 uniformly distributed initial focus positions from the adjustable focus range between the initial focus position p2 and the initial focus position p4 according to the calculation accuracy requirements, and then perform the recursive operation based on the same principle as above to obtain the focus fitting curves of the image clarity corresponding to the 10 initial focus positions and the 10 initial focus positions. Then, the focus position corresponding to the peak point in the focus fitting curve is determined as the target focus position of the camera module. Finally, the motor device of the camera module is moved to the target focus position to complete the focusing.

[0070] In an optional embodiment, the present application may combine the Bezier curve algorithm with the traditional hill climbing method. First, the traditional hill climbing method is used to determine the range of the image clarity peak, and then the Bezier curve algorithm is used to calculate the focus position within the range of the image clarity peak. The focus position corresponding to the peak point in the focus fitting curve is obtained, and determined as the target focus position of the camera module.

[0071] For example, assuming that the present application selects five evenly distributed initial focus positions p1, p2, p3, p4, and p5 from the starting focus position to the farthest focus position (i.e., the adjustable focus range) of the camera module, and calculates the image clarity corresponding to each of the initial focus positions, and obtains the following Figure 3 The image clarity curve of the motor device when it moves is shown in the figure. Then, the image clarity of the motor device when it moves to the initial focus position before and after is compared by the hill climbing method until the image clarity of curve A shows a low-high-low change trend. It is determined that the image clarity peak is between the initial focus position p2 and the initial focus position p4. Then, the initial focus position p2 and the initial focus position p4 and their corresponding image clarity are substituted into the Bezier curve formula shown in formula (2) to obtain the following calculation: Figure 3 The focus fitting curve L2 of the image clarity when the motor device is moving is shown. Figure 3 The focus fitting curve L2 shown can be determined to include a peak point T, and the corresponding focus position p is determined as the target focus position of the camera module. The more initial focus positions selected in the above embodiment, the more complicated the traditional hill climbing calculation process is, but the narrower the range of the image clarity peak is, and the more accurate the target focus position is calculated by the Bezier curve algorithm.

[0072] Based on the above scheme, the present application can combine the Bezier curve algorithm with the traditional hill climbing method. First, the traditional hill climbing method is used to determine the range of the image clarity peak, which can reduce the amount of calculation and shorten the calculation time. The Bezier curve algorithm is used to calculate the focal position within the range of the image clarity peak. The obtained focal position result is more intuitive and has a higher accuracy rate.

[0073] By implementing the embodiments of the present application, the present application determines m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer; the clarity of the m focus images corresponding to the m initial focus positions is calculated to obtain the clarity of the m images corresponding to the m initial focus positions; the clarity of the m images corresponding to the m initial focus positions is processed to obtain the target focus position of the camera module. In the above scheme, the present application adopts the Bezier curve algorithm to replace the hill climbing algorithm to realize the focus of the camera module, so that the target focus position of the camera module can be calculated conveniently and accurately, and the technical problems such as the low focus precision and accuracy of the camera module in the prior art can be solved. Specifically, the present application adopts the Bezier curve algorithm to fit the image clarity at different focus positions, and judges the focus position range with the maximum image clarity by the changing trend of the fitting curve, which is more intuitive and more accurate than directly performing numerical judgment. Secondly, the present application only needs to take a small number of initial focus positions, which can reduce the number of movements of the motor device, reduce the amount of calculation, and shorten the calculation time.

[0074] Based on the same inventive concept, another embodiment of the present application provides a device and a terminal device corresponding to the camera module focusing method described in the embodiment of the present application.

[0075] See also Figure 4 , is a schematic diagram of the structure of a camera module focusing device provided in an embodiment of the present application. Figure 4 The device 40 shown includes: a determination module 401, a calculation module 402 and a processing module 403, wherein:

[0076] The determination module 401 is used to determine m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer;

[0077] The calculation module 402 is used to calculate the clarity of the m focused images taken at the m initial focus positions to obtain the clarity of the m images corresponding to the m initial focus positions;

[0078] The processing module 403 is used to perform focusing processing on the m image sharpnesses corresponding to the m initial focus positions to obtain the target focusing position of the camera module.

[0079] Optionally, the determining module 401 is specifically configured to:

[0080] In the adjustable focus range of the camera module, m evenly distributed initial focus positions are selected.

[0081] Optionally, the processing module 403 is specifically configured to:

[0082] Using a Bezier curve algorithm to perform curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain a focus fitting curve;

[0083] The focus position corresponding to the peak point in the focus fitting curve is determined as the target focus position.

[0084] Optionally, the processing module 403 is further specifically configured to:

[0085] Using a Bezier curve algorithm to perform curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain an initial fitting curve;

[0086] Selecting two reference focus positions including a peak point from the initial fitting curve, and updating the focus range between the two reference focus positions as the adjustable focus range;

[0087] Repeat the steps of determining the focus position and calculating the definition to obtain the m image definitions corresponding to the current m initial focus positions;

[0088] A Bezier curve algorithm is used to perform curve fitting on the m image sharpnesses corresponding to the current m initial focus positions to obtain the focus fitting curve.

[0089] Optionally, the calculation module 402 is specifically used for:

[0090] Acquire m focused images captured by the camera module at the m initial focus positions;

[0091] The clarity of the m focused images is calculated to obtain the clarity of the m images corresponding to the m initial focus positions.

[0092] Optionally, the calculation module 402 is specifically used for:

[0093] The grayscale variance product function is used to calculate the clarity of each of the m focused images to obtain the clarity of m images corresponding to the m initial focus positions.

[0094] Optionally, the processing module 403 is further configured to:

[0095] The motor device in the camera module is driven to the target focusing position to complete the focusing of the camera module.

[0096] Please also see Figure 5 , is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Figure 5The terminal device 50 shown includes a camera module, and may also include: at least one processor 501, a communication interface 502, a user interface 503 and a memory 504. The processor 501, the communication interface 502, the user interface 503 and the memory 504 may be connected via a bus or other means. The embodiment of the present invention takes the connection via a bus 505 as an example. Among them,

[0097] The processor 501 may be a general-purpose processor, such as a central processing unit (CPU).

[0098] The communication interface 502 may be a wired interface (eg, an Ethernet interface) or a wireless interface (eg, a cellular network interface or a wireless local area network interface) for communicating with other terminals or websites. In the embodiment of the present invention, the communication interface 502 is specifically used to obtain orbital parameters.

[0099] The user interface 503 may be a touch panel, including a touch screen and a touch screen, for detecting operation instructions on the touch panel, a physical button or a mouse, or a display screen for outputting and displaying images or data.

[0100] The memory 504 may include a volatile memory, such as a random access memory (RAM); the memory may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 504 may also include a combination of the above-mentioned types of memory. The memory 504 is used to store a set of program codes, and the processor 501 is used to call the program codes stored in the memory 504 and perform the following operation steps:

[0101] S1. Determine m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer;

[0102] S2, calculating the clarity of m focused images taken at the m initial focus positions to obtain the clarity of m images corresponding to the m initial focus positions;

[0103] S3. Perform focusing processing on the m image sharpnesses corresponding to the m initial focus positions to obtain a target focusing position of the camera module.

[0104] Optionally, the step S1 includes:

[0105] In the adjustable focus range of the camera module, m evenly distributed initial focus positions are selected.

[0106] Optionally, step S3 includes:

[0107] Performing curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain a focus fitting curve;

[0108] The focus position corresponding to the peak point in the focus fitting curve is determined as the target focus position.

[0109] Optionally, performing curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain a focus fitting curve comprises:

[0110] Performing curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain an initial fitting curve;

[0111] Selecting two reference focus positions including a peak point from the initial fitting curve, and updating the focus range between the two reference focus positions as the adjustable focus range;

[0112] Repeat the above steps S1-S2 to obtain the m image sharpnesses corresponding to the current m initial focus positions;

[0113] Curve fitting is performed on the m image sharpnesses corresponding to the current m initial focus positions to obtain the focus fitting curve.

[0114] Optionally, step S2 includes:

[0115] Acquire m focused images captured by the camera module at the m initial focus positions;

[0116] The clarity of the m focused images is calculated to obtain the clarity of the m images corresponding to the m initial focus positions.

[0117] Optionally, the performing clarity calculation on the m focused images to obtain the clarity of m images corresponding to the m initial focus positions comprises:

[0118] The grayscale variance product function is used to calculate the clarity of each of the m focused images to obtain the clarity of m images corresponding to the m initial focus positions.

[0119] Optionally, the processor 501 is further configured to:

[0120] The motor device in the camera module is driven to the target focusing position to complete the focusing of the camera module.

[0121] Since the terminal device introduced in this embodiment is a terminal device used to implement the camera module focusing method in the embodiment of the present application, based on the camera module focusing method introduced in the embodiment of the present application, a person skilled in the art can understand the specific implementation of the terminal device of the present embodiment and its various variations, so how the terminal device implements the method in the embodiment of the present application is not described in detail here. As long as a person skilled in the art implements the terminal device used by the method in the embodiment of the present application, it belongs to the scope of protection of this application.

[0122] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: the present application determines m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer; performs clarity calculation on the m focused images taken at the m initial focus positions to obtain the clarity of the m images corresponding to the m initial focus positions; performs focusing processing on the clarity of the m images corresponding to the m initial focus positions to obtain the target focus position of the camera module. In the above scheme, the present application adopts the Bezier curve algorithm to replace the hill climbing algorithm to realize the focus of the camera module, so that the target focus position of the camera module can be calculated conveniently and accurately, and the technical problems of low focusing precision and accuracy of the camera module in the prior art can be solved.

[0123] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0124] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.

[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0127] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0128] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A camera module focusing method, characterized in that: The method comprises the following steps: S1. Determine m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer; S2, calculating the clarity of m focused images taken at the m initial focus positions to obtain the clarity of m images corresponding to the m initial focus positions; S3, using a Bezier curve algorithm to perform focusing processing on the m image sharpnesses corresponding to the m initial focus positions to obtain a target focus position of the camera module; The step S3 comprises: Using a Bezier curve algorithm to perform curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain a focus fitting curve; Determine the focus position corresponding to the peak point in the focus fitting curve as the target focus position; The use of the Bezier curve algorithm to perform curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain a focus fitting curve includes: Using a Bezier curve algorithm to perform curve fitting on the m image sharpnesses corresponding to the m initial focus positions to obtain an initial fitting curve; Selecting two reference focus positions including a peak point from the initial fitting curve, and updating the focus range between the two reference focus positions as the adjustable focus range; Repeat the above steps S1-S2 to obtain the m image sharpnesses corresponding to the current m initial focus positions; A Bezier curve algorithm is used to perform curve fitting on the m image sharpnesses corresponding to the current m initial focus positions to obtain the focus fitting curve.

2. The method according to claim 1, characterized in that: The step S1 comprises: In the adjustable focus range of the camera module, m evenly distributed initial focus positions are selected.

3. The method according to claim 1, characterized in that The step S2 comprises: Acquire m focused images captured by the camera module at the m initial focus positions; The clarity of the m focused images is calculated to obtain the clarity of the m images corresponding to the m initial focus positions.

4. The method according to claim 3, characterized in that The step of calculating the clarity of the m focused images to obtain the clarity of the m images corresponding to the m initial focus positions includes: The grayscale variance product function is used to calculate the clarity of each of the m focused images to obtain the clarity of m images corresponding to the m initial focus positions.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: The motor device in the camera module is driven to the target focusing position to complete the focusing of the camera module.

6. A camera module focusing device, the camera module focusing device is used to implement the method according to any one of claims 1 to 4, characterized in that: The device comprises: a determination module, a calculation module and a processing module, wherein: The determination module is used to determine m initial focus positions according to the adjustable focus range of the camera module, where m is a positive integer; The calculation module is used to calculate the clarity of the m focused images taken corresponding to the m initial focus positions to obtain the clarity of the m images corresponding to the m initial focus positions; The processing module is used to perform focusing processing on the m image sharpnesses corresponding to the m initial focus positions to obtain the target focusing position of the camera module.

7. A terminal device, characterized in that: The terminal device includes: a processor, a memory, a communication interface and a bus; the processor, the memory and the communication interface are connected through the bus and communicate with each other; the memory stores executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the camera module focusing method as described in any one of claims 1 to 4 above.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, and when the program is run on a terminal device, the camera module focusing method as described in any one of claims 1 to 4 is executed.

Citation Information

Patent Citations

  • Lens position adjusting method and device

    CN110557547A