Optimal focusing method, device and equipment of camera module and storage medium
By calculating the MTF value of the camera module test card image in real time, the focal length position is determined, and the focusing process is optimized. This solves the problems of low product standards and long focusing time in the existing technology, and realizes efficient standardization and fast focusing of the camera module.
Patent Information
- Application Number
- CN202411892988.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2044-12-20
AI Technical Summary
Existing camera modules have low uniformity standards and resolution values below the set standard values when manually focusing, while automatic focusing solutions take too long.
By acquiring images from the camera module test card, the MTF value is calculated in real time, the focal length position is determined, and the peak point is identified, thus optimizing the focusing process to shorten the time and improve standardization.
This has enabled the unified standardization of camera module products, shortened focusing time, and improved resolution.
Smart Images

Figure CN119697498B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of camera module focusing, and particularly relates to a camera module optimized focusing method, device, equipment and storage medium. BACKGROUND
[0002] The existing camera module has a threaded structure, and production line staff usually manually focus in a manner of setting a standard value. In the manual focusing process, the focusing is stopped once the standard setting value is reached. However, due to lens difference, the standard setting value is usually low. This will cause the camera module to not reach the best center peak, that is, the camera module is not adjusted to the best state. This not only reduces the unified standard of the product, but also causes the resolution value to be lower than the set standard value when encountering shrinkage temperature drift and the like.
[0003] On the other hand, the existing automatic focusing scheme needs a program to obtain the entire focusing process and complete corresponding MTF defocus curve scanning, and then determine the center peak of the camera module. This wastes a large amount of production process time. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide a camera module optimized focusing method, device, equipment and storage medium, so as to solve the problems of low product unified standard and resolution value lower than the set standard value in the prior art when manually focusing the camera module.
[0005] In order to solve the above technical problems, the embodiments of the present application provide a camera module optimized focusing method, which adopts the following technical scheme, comprising:
[0006] Step 100, obtaining a camera module, and obtaining a test card image by using the camera module;
[0007] Step 200, manually adjusting the focal length of the camera module and calculating the first MTF value of all regions of the test card image in real time, comparing the first MTF value with a first specified threshold value, if the first MTF value is greater than the first specified threshold value, obtaining the second MTF value of the center region of the test card image;
[0008] Step 300, obtaining the drop value of the second MTF value, if the drop value is greater than the size of the specified step length multiple, and the second MTF value is greater than the set standard value, then the focal length position corresponding to the second MTF value is taken as the peak point of the camera module;
[0009] Step 400, if the second MTF value is less than the set standard value, then steps 200-300 are repeatedly executed until a specified number of cycles is reached.
[0010] Further, the step 100 comprises:
[0011] Step 110, fixing the camera module on a stable support, making the lens of the camera module vertical to the test card;
[0012] Step 120, adjusting the distance between the camera module and the test card, making the distance reach the size of the specified multiple of the diagonal line of the test card;
[0013] Wherein, the test card is provided with a sinusoidal grating pattern.
[0014] Further, the step 200 comprises:
[0015] Step 210, acquiring the sinusoidal grating pattern of the central area of the test card pattern;
[0016] Step 220, extracting the gray value curve of the sinusoidal grating pattern along the grating direction of the sinusoidal grating pattern of the central area.
[0017] Further, after the step 220, the step 200 further comprises:
[0018] Step 230, acquiring the maximum value Lmax and the minimum value Lmin of the gray value curve;
[0019] Step 240, using the maximum value and the minimum value to calculate the MTF value by using formula (1):
[0020] MTF=Lmax-Lmin / Lmax+Lmin (1).
[0021] Further, the step 300 comprises:
[0022] Step 310, comparing the second MTF value corresponding to the current focal length with the second MTF value corresponding to the next focal length;
[0023] Step 320, if the second MTF value corresponding to the current focal length is less than the second MTF value corresponding to the next focal length, continue to focus and acquire the second MTF value.
[0024] Further, the step 300 further comprises:
[0025] Step 330, comparing the second MTF value corresponding to the current focal length with the second MTF value corresponding to the next focal length;
[0026] Step 340, if the second MTF value corresponding to the current focal length is greater than the second MTF value corresponding to the next focal length, calculating the MTF difference value of the second MTF value corresponding to the current focal length and the second MTF value corresponding to the next focal length.
[0027] Further, after the step 340, the step 300 further comprises:
[0028] Step 350, divide the MTF difference value by the specified step length to obtain a step multiple;
[0029] Step 360, determine whether the step multiple is greater than a specified threshold value;
[0030] Step 370, if greater than the specified threshold value, compare the second MTF value corresponding to the current focal length with the set standard value to determine the peak point.
[0031] Further, after the step 400, the method further comprises:
[0032] Step 500, compare the number of cycles with a specified value;
[0033] Step 600, if the number of cycles reaches the specified value and the second MTF value corresponding to the current focal length is less than the set standard value, determine that the MTF value of the camera module is not up to standard.
[0034] To solve the above technical problems, the embodiment of the application further provides an optimization focusing device of a camera module, which adopts the optimization focusing method of the camera module of the first aspect, and comprises:
[0035] A first comparison and determination module is configured to, when manually adjusting the focal length of the camera module, calculate and obtain the first MTF value of all regions of the test card image in real time, compare the first MTF value with a first specified threshold value, and obtain the second MTF value of the central region of the test card image if the first MTF value is greater than the first specified threshold value.
[0036] A second comparison and determination module is configured to obtain the drop value of the second MTF value, and if the drop value is greater than the size of the multiple of the specified step length and the second MTF value is greater than a set standard value, take the focal length position corresponding to the second MTF value as the peak point of the camera module.
[0037] To solve the above technical problems, the embodiment of the application further provides a computer device, which comprises a memory and a processor, the memory stores computer readable instructions, and the processor executes the computer readable instructions to realize the steps of the optimization focusing method of the camera module.
[0038] To solve the above technical problems, the embodiment of the application further provides a computer readable storage medium, which stores computer readable instructions, and the computer readable instructions are executed by the processor to realize the steps of the optimization focusing method of the camera module.
[0039] Compared with the prior art, the embodiments of this application have the following main technical effects: by calculating the second MTF value corresponding to the center area of the test card image, and obtaining the corresponding focal length when the second MTF value decreases, the peak point of the camera module is used as the peak point of the camera module, and the scanning defocus calculation is stopped. This not only ensures the uniformity of camera module products, but also shortens the optimization focusing time. Attached Figure Description
[0040] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a flowchart of an embodiment of an optimized focusing method for a camera module according to this application;
[0042] Figure 2 yes Figure 1 A flowchart of a specific implementation of S100;
[0043] Figure 3 yes Figure 1 A flowchart of a specific implementation of S200;
[0044] Figure 4 yes Figure 3 A flowchart of a specific implementation method following S220;
[0045] Figure 5 yes Figure 1 A flowchart of a specific implementation of S300;
[0046] Figure 6 yes Figure 5 A flowchart of a specific implementation method following S320;
[0047] Figure 7 yes Figure 6 A flowchart of a specific implementation method following S340;
[0048] Figure 8 This is a flowchart of another specific implementation of the optimized focusing method for a camera module;
[0049] Figure 9 This is a schematic diagram of the module structure of an optimized focusing device for a camera module according to this application;
[0050] Figure 10 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. DETAILED DESCRIPTION
[0051] The technical solutions in the present application will be described clearly and completely below in combination with the drawings in the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, other embodiments obtained by those skilled in the art without creative effort belong to the scope of protection of the present application.
[0052] Reference herein to“an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase that the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of other embodiments. It is explicitly contemplated that embodiments described herein can be combined with other embodiments.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the application; the use herein of terms such as“comprise”,“comprises” or“comprising” are to be construed as not limited to the presence of the recited elements or steps but rather to the presence of the recited elements or steps or any additional elements or steps.
[0054] In addition, the terms“first”,“second”, and the like, are used only for the purpose of description, and are not to be construed as indicating or implying relative importance or an indicated number of technical features. Therefore, the features defined with“first”,“second” can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of“a plurality of” is two or more, unless otherwise specifically defined.
[0055] The purpose of the embodiments of the present application is to propose an optimization focusing method, device and equipment of a camera module and a storage medium, so as to solve the problems of low product uniform standard and lower analysis value than the set standard value in manual focusing of the camera module in the prior art.
[0056] In order to solve the above technical problems, the embodiments of the present application provide an optimization focusing method of a camera module, which adopts the following technical scheme, such as Figure 1 , Figure 1 is a flowchart of an embodiment of the optimization focusing method of the camera module of the present application; comprising:
[0057] S100, acquiring a camera module, and acquiring a test card image by using the camera module.
[0058] In the embodiment, the test card can adopt an ISO 12233 standard test card containing sinusoidal grating patterns of different spatial frequencies, which can be used to accurately measure the resolving power of the camera module, ensure uniform and stable illumination of the test environment, avoid the influence of light on the imaging quality, and use a standard light source box for testing.
[0059] In a preferred embodiment, as Figure 2 , Figure 2 is Figure 1 a flowchart of one specific implementation of S100 in S100 includes: S110, fixing the camera module on a stable support so that the lens of the camera module is perpendicular to the test card; S120, adjusting the distance between the camera module and the test card so that the distance reaches a specified multiple of the diagonal line of the test card; wherein the test card is provided with a sinusoidal grating pattern.
[0060] In the embodiment, the camera module is fixed on a stable support so that its lens is perpendicular to the test card and the distance meets the test requirements, which can be about 4 to 6 times the length of the diagonal line of the card.
[0061] In the embodiment, the camera module is used to shoot the test card, and during shooting, the focus needs to be accurate, and the clearest and most stable image is selected for subsequent analysis.
[0062] S200, manually adjusting the focal length of the camera module and calculating the first MTF value of all regions of the test card image in real time, comparing the first MTF value with the first specified threshold value, if greater than the first specified threshold value, obtaining the second MTF value of the central region of the test card image.
[0063] In the embodiment, the shot image is imported into professional image processing software such as ImageJ, Matlab, etc., to obtain the sinusoidal grating image of all regions of the image, and in the embodiment, the purpose of setting the first specified threshold value is to perform preliminary screening to ensure the clarity of the selected test card image.
[0064] In a preferred embodiment, as Figure 3 , Figure 3 is Figure 1 a flowchart of one specific implementation of S200 in S200 includes: S210, obtaining the sinusoidal grating pattern of the central region of the test card pattern; S220, extracting the gray value curve of the sinusoidal grating pattern along the grating direction of the central region of the sinusoidal grating pattern.
[0065] In this embodiment, a sinusoidal grating pattern is selected in the central region of the test card image, as the imaging quality of this region best represents the central performance of the camera module. A grayscale curve is extracted along the direction of the grating, which reflects the changes in brightness in the image. Typically, a horizontal or vertical grating is selected for extraction to obtain the corresponding MTF value.
[0066] In a preferred embodiment, such as Figure 4 , Figure 4 yes Figure 3 A flowchart of a specific implementation method following S220; after S220, S200 further includes: S230, obtaining the maximum value Lmax and minimum value Lmin of the grayscale curve; S240, using the maximum and minimum values, calculating the MTF value using formula (1):
[0067] MTF=Lmax-Lmin / Lmax+Lmin (1).
[0068] In this embodiment, the maximum value Lmax and the minimum value Lmin in the curve represent the brightness of the brightest and darkest parts of the sinusoidal grating, respectively. The MTF value at this spatial frequency is calculated using formula (1). This value reflects the ability of the camera module to modulate and transmit spatial frequency information, that is, the degree of contrast reproduction of the image.
[0069] S300: Obtain the decrease value of the second MTF value. If the decrease value is greater than a multiple of the specified step size and the second MTF value is greater than the set standard value, then the focal length position corresponding to the second MTF value is taken as the peak point of the camera module.
[0070] In this embodiment, the determination of the downward trend of the second MTF value in the central region of the test card image is mainly based on the magnitude of the second MTF value between the two previous focusing adjustments.
[0071] In this embodiment, the size of the specified step size can be understood as the size of the multiple of the difference between the MTF values of two adjacent focusing operations, for example, the size of 3 units.
[0072] In a preferred embodiment, such as Figure 5 , Figure 5 yes Figure 1 A flowchart of a specific implementation of S300; S300 includes:
[0073] S310. Compare the second MTF value corresponding to the current focal length with the second MTF value corresponding to the next focal length; S320. If the second MTF value corresponding to the current focal length is less than the second MTF value corresponding to the next focal length, continue to adjust the focus and obtain the second MTF value.
[0074] Furthermore, such asFigure 6 , Figure 6 is Figure 5 a flow chart of one specific embodiment after S320; S300 further comprises:
[0075] S330, comparing the second MTF value corresponding to the current focal length with the second MTF value corresponding to the next focal length; S340, if the second MTF value corresponding to the current focal length is greater than the second MTF value corresponding to the next focal length, calculating the MTF difference value of the second MTF value corresponding to the current focal length and the second MTF value corresponding to the next focal length.
[0076] As Figure 7 , Figure 7 is Figure 6 a flow chart of one specific embodiment after S340; after S340, S300 further comprises: S350, dividing the MTF difference value by the specified step length to obtain a step length multiple; S360, judging whether the step length multiple is greater than a specified threshold value; S370, if greater than the specified threshold value, comparing the second MTF value corresponding to the current focal length with a set standard value to determine the peak point.
[0077] In the present embodiment, by comparing the difference value, it is determined that a decline occurs, and the decline value reaches or is greater than 3 step lengths, then it is still necessary to compare the second MTF value of the current focal length with the set standard value, and still need to meet the condition of being greater than the set standard value.
[0078] S400, if the second MTF value is less than the set standard value, cyclically executing S200-S300 until a specified number of cycles is reached.
[0079] When the number of cycles is not reached and a declining trend does not occur, it is necessary to scan the defocus curve all the time, that is, to continue adjusting the focal length and calculating the corresponding MTF value. In the present embodiment, the multiple focusing is a process of gradually approaching the best sharpness, that is, a process of gradually increasing the second MTF value.
[0080] In a preferred embodiment, as Figure 8 , Figure 8 is a flow chart of another specific embodiment of the optimization focusing method of the camera module;
[0081] The method further comprises: S500, comparing the number of cycles with a specified value; S600, if the number of cycles reaches the specified value and the second MTF value corresponding to the current focal length is less than the set standard value, determining that the MTF value of the camera module does not meet the standard. By calculating the second MTF value corresponding to the center region of the test card image, and obtaining the corresponding focal length as the peak point of the camera module when the second MTF value decreases, and stopping scanning the defocus calculation, not only the uniform standard of the camera module product is ensured, but also the optimization focusing time is shortened.
[0082] In the embodiment, when the maximum number of cycles is reached, but the condition of the peak point is not met, it is determined that the MTF value of the camera module does not meet the standard.
[0083] To solve the above technical problems, the embodiment of the application further provides an optimal focusing device of a camera module, which adopts the optimal focusing method of the camera module of the first aspect, such as Figure 9 , Figure 9 is a schematic diagram of a module structure of an optimal focusing device 700 of a camera module of the application; comprising:
[0084] The first comparison and determination module 701 is configured to calculate the first MTF value of all regions of the test card image in real time when the focal length of the camera module is manually adjusted, compare the first MTF value with the first specified threshold value, and obtain the second MTF value of the central region of the test card image if the first MTF value is greater than the first specified threshold value.
[0085] The second comparison and determination module 702 is configured to obtain the drop value of the second MTF value, and if the drop value is greater than the size of the specified step length multiple and the second MTF value is greater than the set standard value, the focal length position corresponding to the second MTF value is taken as the peak point of the camera module.
[0086] To solve the above technical problems, the embodiment of the application further provides a computer device, which comprises a memory and a processor, the memory stores computer readable instructions, and the processor executes the computer readable instructions to realize the steps of the optimal focusing method of the camera module as above.
[0087] The computer device adopts the following technical solution: comprising a processor, a network module and a memory, the processor and the memory are connected with each other through the network module.
[0088] The computer device can be a computer, a server, a workstation and the like, or a mobile device such as a mobile phone, a tablet computer, a vehicle-mounted mobile terminal, or other devices with program execution capability. The internal structure of the computer device can be as shown in Figure 10 , Figure 10is a structural schematic diagram of an embodiment of a computer device according to the present application. The computer device comprises a processor, a memory and a network module. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile and / or volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, instructions or codes. The internal memory provides an environment for the operating system and the instructions or codes in the non-volatile storage medium to run. The instructions or codes are executed by the processor to implement the functions or steps of the above-mentioned optimization focusing method of the camera module. The network module of the computer device can comprise a network interface and / or a wireless network module, and the computer device can communicate with other devices or service platforms through the network module. In addition, the computer device can further comprise a display screen, an input device and the like.
[0089] The memory is configured to store a computer program, and the computer program comprises program instructions. The processor is configured to invoke the program instructions. When the processor executes the instructions or codes, the steps of the above-mentioned optimization focusing method of the camera module are implemented.
[0090] To solve the above-mentioned technical problems, the embodiments of the present application further provide a computer readable storage medium, and the computer readable storage medium stores computer readable instructions. When the computer readable instructions are executed by a processor, the steps of the above-mentioned optimization focusing method of the camera module are implemented.
[0091] The computer readable storage medium stores a computer program, and the computer program comprises program instructions. When the program instructions are executed by the processor, the optimization focusing method of the camera module provided by each step in the method is implemented. For details, refer to the implementation manners provided by each step above, which will not be described here. Figures 1 to 8 The computer readable storage medium stores a computer program, and the computer program comprises program instructions. When the program instructions are executed by the processor, the optimization focusing method of the camera module provided by each step in the method is implemented. For details, refer to the implementation manners provided by each step above, which will not be described here.
[0092] The computer readable storage medium can be an internal storage unit of the camera module distributed test device or the terminal device provided by any of the above-mentioned embodiments, such as a hard disk or a memory of the computer device. The computer readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card and the like.
[0093] Further, the computer readable storage medium can include both the internal storage unit and the external storage device of the computer device. The computer readable storage medium is configured to store the computer program and other programs and data required by the computer device. The computer readable storage medium can also be used to temporarily store data that has been output or will be output.
[0094] However, it should be understood that all the illustrated components are not required, and that more or fewer components can be alternatively used. As such, the computer device herein can be a device capable of automatically processing data and / or information, according to pre-set or stored instructions, and can include, but is not limited to, a microprocessor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, and the like.
[0095] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server, and the like. The computer device can interact with a user through a keyboard, a mouse, a remote controller, a touchpad, a voice control device, and the like.
[0096] Compared with the prior art, the embodiments of the present application have the following technical effects: by calculating the second MTF value corresponding to the center region of the test card image, and obtaining the corresponding focal length as the peak point of the camera module when the second MTF value decreases, and stopping the scanning defocus calculation, not only the unified standard of the camera module product is ensured, but also the optimization focusing time is shortened.
[0097] The above is only the preferred embodiment of the present application, and is not used to limit the present application, and any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. An optimal focusing method of a camera module, comprising: Step 100, obtaining a camera module, and using the camera module to obtain a test card image; Step 200, manually adjusting the focal length of the camera module and calculating in real time a first MTF value of all regions of the test card image, comparing the first MTF value with a first specified threshold value, if the first MTF value is greater than the first specified threshold value, obtaining a second MTF value of a central region of the test card image; Step 300, obtaining a drop value of the second MTF value, if the drop value is greater than a specified step size multiple, and the second MTF value is greater than a set standard value, then the focal length position corresponding to the second MTF value is taken as the peak point of the camera module; Step 400, if the second MTF value is less than the set standard value, then steps 200-300 are executed in a loop until a specified number of loops is reached.
2. The method of claim 1, wherein, The step 200 comprises: Step 210, obtaining a sinusoidal grating pattern of the central region of the test card pattern; Step 220, extracting a gray value curve of the sinusoidal grating pattern along the grating direction of the sinusoidal grating pattern of the central region.
3. The method of claim 2, wherein, After the step 220, the step 200 further comprises: Step 230, obtaining a maximum value Lmax and a minimum value Lmin of the gray value curve; Step 240, using the maximum value and the minimum value to calculate the MTF value by using formula (1): MTF = Lmax - Lmin / Lmax + Lmin (1).
4. The method of claim 1, wherein, The step 300 comprises: Step 310, comparing the second MTF value corresponding to the current focal length with the second MTF value corresponding to the next focal length; Step 320, if the second MTF value corresponding to the current focal length is less than the second MTF value corresponding to the next focal length, then continue to focus and obtain the second MTF value.
5. The method of claim 4, wherein, The step 300 further comprises: Step 330, comparing the second MTF value corresponding to the current focal length with the second MTF value corresponding to the next focal length; Step 340, if the second MTF value corresponding to the current focal length is greater than the second MTF value corresponding to the next focal length, then calculate the MTF difference value of the second MTF value corresponding to the current focal length and the second MTF value corresponding to the next focal length.
6. The method of claim 5, wherein, After the step 340, the step 300 further comprises: Step 350, dividing the MTF difference value by the specified step size to obtain a step size multiple; Step 360, determining whether the step size multiple is greater than a specified threshold value; Step 370, if the step size multiple is greater than the specified threshold value, then comparing the second MTF value corresponding to the current focal length with the set standard value to determine the peak point.
7. The method of claim 1, wherein, After the step 400, the method further comprises: Step 500, comparing the number of loops with a specified value; Step 600, if the number of loops reaches the specified value, and the second MTF value corresponding to the current focal length is less than the set standard value, then determining that the MTF value of the camera module is not up to standard.
8. An optimized focusing device of a camera module, employing the optimized focusing method of any one of claims 1-7, wherein, Comprising: The first comparison and determination module is configured to calculate a first MTF value of all regions of the test card image in real time when the focal length of the camera module is manually adjusted, compare the first MTF value with a first specified threshold value, obtain a second MTF value of a central region of the test card image if the first MTF value is greater than the first specified threshold value, and obtain a second MTF value of a central region of the test card image. The second comparison and determination module is configured to obtain a drop value of the second MTF value, and if the drop value is greater than a multiple of a specified step size and the second MTF value is greater than a set standard value, the focal length position corresponding to the second MTF value is taken as the peak point of the camera module.
9. A computer device, comprising: The computer readable storage medium stores computer readable instructions, and the processor executes the computer readable instructions to implement the steps of the optimization focusing method of the camera module according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer readable instructions, and the processor executes the computer readable instructions to implement the steps of the optimization focusing method of the camera module according to any one of claims 1 to 7.
Citation Information
Patent Citations
Automatic focusing method, device and system for lens
CN113176696A
Module Peak point test method and system and readable storage medium
CN114071124A