Camera module focusing method and system, electronic equipment and storage medium
By pre-focusing the difference between the lens height of the preset standard parts and the height difference between the target camera module, and combining the dynamic adjustment of the motor rotation and imaging quality evaluation value, the problems of the depth of field limit and low focus efficiency of the fixed-focus lens in the prior art are solved, and efficient and accurate camera module focus is achieved to meet the high-definition imaging requirements.
Patent Information
- Application Number
- CN202510196313.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-05-16
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
During the production of existing security and on-board cameras, the depth of field limit of the fixed-focus lens and the low efficiency and low accuracy of manual or passive focus lead to blurring of imaging and inability to meet high definition requirements.
Pre-focusing is performed by pre-focusing based on the height difference between the lens height of the preset standard parts and the current lens height of the target camera module, combined with the dynamic adjustment of motor rotation and imaging quality evaluation value, the target focus position is gradually determined to improve focus efficiency and accuracy.
The efficiency and accuracy of the camera module focus is improved, so that the initial position of the lens is close to the peak of clarity, narrowing the focus range, and meeting the imaging requirements of high definition.
Smart Images

Figure CN120017964A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of focusing technology, and in particular to a camera module focusing method, system, electronic equipment and storage medium. Background Art
[0002] Security cameras and vehicle-mounted cameras use fixed-focus lenses during the production process. This type of lens has a limited depth of field range and needs to be focused during the production process to ensure that the lens' imaging capability meets the requirements. Products with unqualified focusing will have blurry and unclear images in actual applications, so the focusing process is an important part of the production process of security and vehicle-mounted lenses.
[0003] Currently, factories basically use manual focusing or passive focusing for focusing. Manual focusing has low production efficiency, and because the focusing degree of manual focusing is limited, it is easy to miss the peak area and cannot fully exert the lens's capabilities. Passive focusing has low accuracy and cannot meet the requirements of high definition, and has high requirements for material consistency. Summary of the invention
[0004] In view of this, embodiments of the present invention provide a camera module focusing method, system, electronic device and storage medium to improve the camera module focusing efficiency.
[0005] According to one aspect of the present invention, a camera module focusing method is provided, the method comprising:
[0006] Pre-focusing the target camera module based on the height difference between the lens height of the preset standard part and the current lens height of the target camera module;
[0007] Obtaining an imaging quality evaluation value of the target camera module after pre-focusing as a first evaluation value;
[0008] Controlling the motor to rotate in a first preset direction by a first preset rotation angle, and calculating an imaging quality evaluation value of the target camera module after the rotation as a second evaluation value;
[0009] In the case where the second evaluation value is greater than the first evaluation value, the second evaluation value is used as a new first evaluation value, and the control motor is returned to rotate in a first preset direction by a first preset rotation angle, and the imaging quality evaluation value of the target camera module after rotation is calculated as a second evaluation value step, until the second evaluation value is not greater than the first evaluation value;
[0010] Controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the first current evaluation value; wherein the second preset direction is the opposite direction of the first preset direction, and the second preset rotation angle is less than the first preset rotation angle;
[0011] When the first current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the third preset rotation angle is less than or equal to the second preset rotation angle;
[0012] When the first current evaluation value is greater than the latest first evaluation value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
[0013] In a possible embodiment, the method further includes: when the second evaluation value is not greater than the first evaluation value calculated after the pre-focusing is completed, controlling the motor to rotate in the second preset rotation direction by a fourth preset rotation angle, and calculating the imaging quality evaluation value of the target lens module after rotation as a third evaluation value, the fourth preset rotation angle being less than the first preset rotation angle;
[0014] In the case where the third evaluation value is greater than the first evaluation value, the third evaluation value is used as a new first evaluation value, and the control motor is returned to rotate the fourth preset rotation angle in the second preset rotation direction, and the imaging quality evaluation value of the target lens module after rotation is calculated as the third evaluation value step, until the third evaluation value is not greater than the first evaluation value;
[0015] Controlling the motor to rotate in the first preset direction by a fifth preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the second current evaluation value; wherein the fifth preset rotation angle is smaller than the fourth preset rotation angle;
[0016] When the second current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the second preset direction by a sixth preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the sixth preset rotation angle is less than or equal to the fifth preset rotation angle;
[0017] When the second current evaluation value is greater than the latest first evaluation value, the control motor is returned to rotate to the first preset direction by a fifth preset rotation angle, and the imaging quality evaluation value of the target lens group after rotation is calculated as the second current evaluation value.
[0018] In a possible embodiment, the method further includes: in a process of controlling the motor to rotate in a first preset direction by a first preset rotation angle, updating a maximum value of the imaging quality evaluation value after each rotation;
[0019] When the first current evaluation value is less than or equal to the maximum value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, determining that the target camera module reaches a target focusing position;
[0020] When the first current evaluation value is greater than the maximum value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
[0021] In a possible embodiment, pre-focusing the target camera module based on the height difference between the lens height of the preset standard component and the current lens height of the target camera module includes:
[0022] Calculating a target height difference between the lens height of the preset standard component and the current lens height of the target camera module;
[0023] Determine a pre-focus distance based on the target height difference and a ratio between pitches of threads in the target camera module;
[0024] Determining a pre-focusing rotation angle and a rotation direction of the motor based on the pre-focusing distance and a unit step length of a motor included in the camera module;
[0025] A prefocus torsion signal is sent to the motor based on the prefocus rotation angle and the rotation direction, so that the motor rotates according to the prefocus rotation angle and the rotation direction, thereby completing the prefocusing of the target camera module.
[0026] According to another aspect of the present invention, a camera module focusing system is provided, the system comprising:
[0027] A pre-focusing module, used for pre-focusing the target camera module based on the height difference between the lens height of the preset standard part and the current lens height of the target camera module;
[0028] A calculation module, used to obtain an imaging quality evaluation value of the target camera module after pre-focusing as a first evaluation value;
[0029] A focusing module, used for controlling the motor to rotate in a first preset direction by a first preset rotation angle, and calculating an imaging quality evaluation value of the target camera module after the rotation as a second evaluation value;
[0030] In the case where the second evaluation value is greater than the first evaluation value, the second evaluation value is used as a new first evaluation value, and the control motor is returned to rotate in a first preset direction by a first preset rotation angle, and the imaging quality evaluation value of the target camera module after rotation is calculated as a second evaluation value step, until the second evaluation value is not greater than the first evaluation value;
[0031] Controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the first current evaluation value; wherein the second preset direction is the opposite direction of the first preset direction, and the second preset rotation angle is less than the first preset rotation angle;
[0032] When the first current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the third preset rotation angle is less than or equal to the second preset rotation angle;
[0033] When the first current evaluation value is greater than the latest first evaluation value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
[0034] In a possible embodiment, the focusing module is further used to control the motor to rotate a fourth preset rotation angle in the second preset rotation direction when the second evaluation value is not greater than the first evaluation value calculated after the pre-focusing is completed, and calculate the imaging quality evaluation value of the target lens module after rotation as the third evaluation value, and the fourth preset rotation angle is less than the first preset rotation angle;
[0035] In the case where the third evaluation value is greater than the first evaluation value, the third evaluation value is used as a new first evaluation value, and the control motor is returned to rotate the fourth preset rotation angle in the second preset rotation direction, and the imaging quality evaluation value of the target lens module after rotation is calculated as the third evaluation value step, until the third evaluation value is not greater than the first evaluation value;
[0036] Controlling the motor to rotate in the first preset direction by a fifth preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the second current evaluation value; wherein the fifth preset rotation angle is smaller than the fourth preset rotation angle;
[0037] When the second current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the second preset direction by a sixth preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the sixth preset rotation angle is less than or equal to the fifth preset rotation angle;
[0038] When the second current evaluation value is greater than the latest first evaluation value, the control motor is returned to rotate to the first preset direction by a fifth preset rotation angle, and the imaging quality evaluation value of the target lens group after rotation is calculated as the second current evaluation value.
[0039] In a possible embodiment, the focusing module is further used to update the maximum value of the imaging quality evaluation value after each rotation in the process of controlling the motor to rotate in the first preset direction by the first preset rotation angle;
[0040] When the first current evaluation value is less than or equal to the maximum value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, determining that the target camera module reaches a target focusing position;
[0041] When the first current evaluation value is greater than the maximum value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
[0042] In a possible embodiment, pre-focusing the target camera module based on the height difference between the lens height of the preset standard component and the current lens height of the target camera module includes:
[0043] Calculating a target height difference between the lens height of the preset standard component and the current lens height of the target camera module;
[0044] Determine a pre-focus distance based on the target height difference and a ratio between pitches of threads in the target camera module;
[0045] Determining a pre-focusing rotation angle and a rotation direction of the motor based on the pre-focusing distance and a unit step length of a motor included in the camera module;
[0046] A prefocus torsion signal is sent to the motor based on the prefocus rotation angle and the rotation direction, so that the motor rotates according to the prefocus rotation angle and the rotation direction, thereby completing the prefocusing of the target camera module.
[0047] According to another aspect of the present invention, there is provided an electronic device, comprising:
[0048] Processor; and
[0049] Memory for storing programs,
[0050] Wherein, the program includes instructions, and when the instructions are executed by the processor, the processor executes any of the above-mentioned camera module focusing methods.
[0051] According to another aspect of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute any of the above-mentioned camera module focusing methods.
[0052] One or more technical solutions provided in the embodiments of the present invention are applied to the embodiments of the present invention, and the target camera module is pre-focused based on the height difference between the preset standard part and the target camera module, so that the initial position of the target camera module is close to the clarity peak, that is, close to the target focusing position, and the focusing range of the target camera module is reduced, thereby improving the focusing efficiency of the target camera module. In addition, the target camera module is imaged preferably by traversing the quality index values of each position of the target camera module at a larger angle, and then the imaging position with the highest clarity is obtained by traversing the imaging preferably range at a smaller angle. The efficiency of traversing the imaging preferably range is improved by adjusting the traversal angle, and the accuracy of obtaining the clarity peak is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Further details, features and advantages of the invention are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0054] Figure 1 A schematic diagram of a flow chart of a camera module focusing method provided by an embodiment of the present invention;
[0055] Figure 2 A schematic diagram of a process of pre-focusing in a camera module focusing method provided by an embodiment of the present invention;
[0056] Figure 3 A schematic diagram showing how the clarity changes with the number of focusing times in an embodiment of the present invention;
[0057] Figure 4 is another schematic diagram showing how the clarity changes with the number of focusing times in an embodiment of the present invention;
[0058] Figure 5 A schematic diagram of another flow chart of a camera module focusing method provided by an embodiment of the present invention;
[0059] Figure 6 A schematic diagram of a logical structure of a camera module focusing system provided by an embodiment of the present invention;
[0060] Figure 7 A block diagram of an exemplary electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0061] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.
[0062] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0063] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0064] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0065] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.
[0066] In order to improve the focusing efficiency of a camera module, an embodiment of the present invention provides a camera module focusing method, system, device, electronic device and storage medium. The camera module focusing method provided by the embodiment of the present invention can be applied to any electronic device with a camera focusing function, and the electronic device can be a server, an industrial computer, a mobile terminal, etc. The scheme of the present invention is described below with reference to the accompanying drawings:
[0067] Figure 1 A schematic flow chart of a camera module focusing method provided in an embodiment of the present invention may include the following steps:
[0068] S101, pre-focusing the target camera module based on a height difference between a lens height of a preset standard part and a current lens height of the target camera module;
[0069] S102, obtaining an imaging quality evaluation value of the target camera module after pre-focusing as a first evaluation value;
[0070] S103, controlling the motor to rotate in a first preset direction by a first preset rotation angle, and calculating an imaging quality evaluation value of the target camera module after the rotation as a second evaluation value;
[0071] S104, when the second evaluation value is greater than the first evaluation value, taking the second evaluation value as a new first evaluation value, returning the control motor to rotate in a first preset direction by a first preset rotation angle, and calculating the imaging quality evaluation value of the target camera module after rotation as a second evaluation value step, until the second evaluation value is not greater than the first evaluation value;
[0072] S105, controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the first current evaluation value; wherein the second preset direction is the opposite direction of the first preset direction, and the second preset rotation angle is smaller than the first preset rotation angle;
[0073] S106, when the first current evaluation value is less than or equal to the latest first evaluation value, controlling the motor to rotate in the first preset direction by a third preset rotation angle, and determining that the target camera module reaches a target focusing position, the third preset rotation angle being less than or equal to the second preset rotation angle;
[0074] S107. When the first current evaluation value is greater than the latest first evaluation value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
[0075] By applying the embodiment of the present invention, the target camera module is pre-focused based on the height difference between the preset standard part and the target camera module, so that the initial position of the target camera module is close to the clarity peak value, that is, close to the target focusing position, and the focusing range of the target camera module is reduced, thereby improving the focusing efficiency of the target camera module. In addition, the target camera module is imaged preferably by traversing the quality index value of each position at a larger angle to determine the target camera module imaging range, and then the imaging position with the highest clarity is obtained by traversing the imaging preferably range at a smaller angle. The efficiency of traversing the imaging preferably range is improved by adjusting the traversal angle, and the accuracy of obtaining the clarity peak value is improved.
[0076] The above S101-S107 are exemplarily described below:
[0077] In an embodiment of the present invention, the target camera module refers to a camera module that has been produced and the target focusing position is to be determined. The target camera module may include an optical lens, a sensor, a housing and a bracket, and a driving circuit, wherein the optical lens is connected to the sensor, and the sensor is used to convert the optical signal collected by the optical lens into an electrical signal, thereby achieving imaging. The driving circuit includes a motor and a transmission device, and the motor is connected to the optical lens through the transmission device, and is used to change the relative distance between the lens and the sensor, thereby achieving clear imaging of the target camera module. For ease of description, the distance between the lens and the sensor is referred to as the lens height below. In actual application scenarios, the camera module is usually focused by adjusting the distance between the lens and the reference plane. Therefore, the lens height can also refer to the distance between the lens and the reference plane. The reference plane can be the surface where the lens and the sensor are connected.
[0078] In a possible embodiment, a standard part (also called a gold machine) can be pre-set, and the standard part refers to a camera module with an imaging clarity that reaches a peak clarity. As a possible implementation method, the camera module with the highest imaging clarity after focusing can be retained as a standard part during the historical focusing process, and the lens height of the standard part can also be stored without saving the standard part itself to improve operational convenience.
[0079] Since the imaging clarity of the standard part reaches the peak clarity, that is, the lens height of the standard part meets the focusing standard, therefore, in a possible embodiment, the target camera module can be pre-focused based on the standard part, so that the initial position of the target camera before the formal focusing begins is close to the target focusing position, thereby reducing the focusing time and improving the focusing efficiency.
[0080] As a possible implementation, the target camera module may be pre-focused based on the lens height of the standard component and the lens height of the target camera module. For example, the lens height of the target camera module may be adjusted to the lens height of the standard component. Figure 2 As shown, Figure 2 A schematic diagram of a process for pre-focusing a target lens module in an embodiment of the present invention may include the following steps:
[0081] S111, calculating a target height difference between a lens height of the preset standard component and a current lens height of the target camera module;
[0082] As a possible implementation, the lens height of the target camera module can be measured by a measuring tool, and the target height difference can be calculated based on the lens height of the stored preset standard part. The above-mentioned measuring tool can be selected according to the actual application scenario, such as a camera measuring instrument, a vernier caliper, etc.
[0083] S112, determining a pre-focusing distance based on the target height difference and a ratio between pitches of threads in the target camera module;
[0084] In the camera module, the motor converts rotational motion into linear motion through a threaded mechanism, thereby controlling the lens to move closer to or farther from the sensor by controlling the rotation of the motor. In this case, every time the motor rotates a certain angle, it will drive the threaded mechanism to rotate a corresponding number of times, that is, there is a definite relationship between the motor rotation angle and the thread rotation angle. Since the thread can drive the lens closer to or away from the sensor by rotating, there is a corresponding relationship between the motor rotation angle and the lens movement distance. The pitch of the thread refers to the axial distance between the two points corresponding to the two adjacent teeth on the mid-diameter line. The pitch determines the lens movement distance corresponding to one circle of the thread rotation. Therefore, the number of circles that the thread needs to rotate can be determined by the ratio of the target height difference to the thread pitch. In the present invention, the number of circles that the thread needs to rotate is called the pre-focusing distance.
[0085] S113, determining a pre-focusing rotation angle and a rotation direction of the motor based on the pre-focusing distance and a unit step length of a motor included in the camera module;
[0086] The unit step length of the motor refers to the number of turns of the thread driven by the motor per unit angle. For example, the ratio of the pre-focus distance to the unit step length can be calculated to determine the pre-focus rotation angle. As a possible implementation, a positive direction can be preset, which can be the rotation direction corresponding to the lens approaching the sensor or the rotation direction corresponding to the lens moving away from the sensor.
[0087] Exemplarily, when calculating the target lens height difference, the lens height of the preset standard part can be subtracted from the current lens height of the target camera module. If the value is positive, the pre-focusing rotation direction is determined to be the rotation direction corresponding to the lens approaching the sensor.
[0088] S114, sending a pre-focus torsion signal to the motor based on the pre-focus rotation angle and the rotation direction, so that the motor rotates according to the pre-focus rotation angle and the rotation direction, thereby completing pre-focusing of the target camera module.
[0089] In a possible embodiment, after the pre-focusing rotation angle is calculated, a rotation control signal can be applied to the motor through an electronic device, and the rotation control signal includes the pre-focusing rotation angle and the rotation direction. After the motor receives the pre-focusing rotation angle, the motor rotation can be controlled according to the pre-focusing rotation angle, thereby making the lens close to or away from the sensor, and completing the pre-focusing of the target camera module.
[0090] After the pre-focusing is completed, the current imaging quality evaluation value of the target camera module can be obtained, and the imaging quality evaluation value can reflect the clarity of the imaging of the target camera module. For example, the imaging quality evaluation value can be an SFR (Spatial Frequency Response) value, an MTF (Modulation Transfer Function) value, etc. Among them, SFR is used to describe the response of the camera module to different spatial frequencies, and MTF is an indicator that describes the resolution of the lens, which refers to a function of the modulation degree changing with the spatial frequency. For the sake of ease of description, the imaging quality evaluation value of the target camera module after pre-focusing is referred to as the first evaluation value below.
[0091] In a possible embodiment, after the pre-focusing is completed and the first evaluation value is calculated, the motor can be controlled to rotate in a preset direction by a preset angle. The preset direction can be set according to the actual application scenario. For example, a fixed direction can be pre-set as the preset direction, or the rotation direction of the motor during the pre-focusing process can be used as the preset direction. The above-mentioned preset rotation angle can also be set according to the actual application scenario, and the present invention does not make specific limitations on this. For the convenience of description, the preset direction is referred to as the first preset direction, and the preset angle is referred to as the first rotation angle hereinafter.
[0092] In a possible embodiment, the first preset direction and the first rotation angle data may be pre-stored in an electronic device. After the pre-focusing is completed and the first evaluation value is calculated, a first rotation control signal may be applied to the motor by the electronic device. The first rotation control signal includes the first preset direction and the first rotation angle, so that the motor rotates in the first preset direction by the first rotation angle, thereby driving the lens closer to or away from the sensor.
[0093] After the motor is controlled to rotate by the first rotation angle in the first preset direction, the current imaging quality evaluation value of the camera can be calculated as the second evaluation value. The first evaluation value and the second evaluation value are compared. Specifically, since the change trend of the camera clarity is usually in the form of a parabola, if the first evaluation value is greater than the second evaluation value, it means that the imaging clarity of the pre-focused position is higher than the current position, that is, the current focusing direction is the direction in which the imaging clarity of the target camera module decreases. Therefore, the next step is to focus in the opposite direction of the first preset direction; if the first evaluation value is less than the second evaluation value, it means that the imaging clarity of the current position of the target camera module is higher than the pre-focused position, that is, the current focusing direction is the direction in which the imaging clarity of the target camera module increases. Therefore, the focus can continue to be adjusted in the first preset direction; if the first evaluation value is equal to the second evaluation value, it means that the peak area of the imaging clarity of the target camera module is between the pre-focused position and the current position, so the focus can be adjusted in the opposite direction of the first preset direction.
[0094] In a possible embodiment, when the second evaluation value is higher than the first evaluation value, the motor can continue to be controlled to rotate in the first preset direction by the first rotation angle, and the imaging quality evaluation value of the target camera module is calculated after each rotation, and compared with the imaging quality evaluation value after the last rotation. Exemplarily, when the second evaluation value is higher than the first evaluation value, the first evaluation value can be replaced by the second evaluation value, that is, the second evaluation value is used as the new first evaluation value, and the imaging quality evaluation value calculated after each rotation is recorded as the second evaluation value until the second evaluation value is no higher than the first evaluation value.
[0095] In a possible embodiment, after each calculation of the imaging quality evaluation value during the focusing process, the maximum value of the imaging quality value may be updated. Exemplarily, after the pre-focusing is completed, the first evaluation value may be recorded as the maximum value of the imaging quality value, and when the second evaluation value is calculated during the focusing process, the second evaluation value may be compared with the current maximum value, and when the second evaluation value is greater than the current maximum value, the second evaluation value is used to update the maximum value, otherwise the maximum value is not updated.
[0096] When the second evaluation value obtained after multiple rotations is not higher than the first evaluation value, that is, when the second evaluation value is less than or equal to the first evaluation value, the motor can be controlled to rotate in the opposite direction of the first preset direction. For the sake of convenience of description, the opposite direction of the first preset direction will be referred to as the second preset direction below.
[0097] In a possible embodiment, the motor can be controlled to rotate in a second preset direction according to a second preset rotation angle, and the second preset rotation angle is smaller than the first preset rotation angle, such as 1 / 2 of the first rotation angle. Since the second evaluation value is smaller than the first evaluation value, it means that the current position exceeds the optimal position, so a smaller rotation angle can be used to call back to avoid missing a position with higher imaging clarity due to a single rotation angle that is too large.
[0098] As a possible implementation, after controlling the motor to rotate in the second preset direction by the second preset rotation angle, the current imaging quality evaluation value of the target camera module can be calculated as the current evaluation value. Compare the current evaluation value with the current maximum value. If the current evaluation value is greater than or equal to the current maximum value, the current position can be determined as the target focus position, that is, the clarity peak area; if the current evaluation value is less than the current maximum value, the motor can be controlled to rotate in the opposite direction of the second preset direction by the third preset rotation angle, and the rotated position is determined as the target focus position. The third preset rotation angle can be less than or equal to the above-mentioned second preset rotation angle.
[0099] As a possible implementation, if the current evaluation value is greater than the current maximum value, the motor can continue to be controlled to rotate in the second preset direction by a second preset rotation angle until the current evaluation value is less than or equal to the current maximum value, and the motor is controlled to rotate in the opposite direction of the second preset direction by a third preset rotation angle, and the position after rotation is determined as the target focusing position.
[0100] like Figure 3 As shown, Figure 3 1 is a schematic diagram of the change of clarity with the number of focusing times in an embodiment of the present invention. Specifically, after the pre-focusing is completed, the target camera module corresponds to a clarity a1. After the motor is controlled to rotate in a first preset direction by a first rotation angle, the target camera module corresponds to a clarity a2. The clarity a2 is greater than the clarity a1. Therefore, the motor can continue to be controlled to rotate in the first preset direction by a first rotation angle. After the rotation, the clarity of the target camera module is a4. Figure 3 It can be seen that a4 has exceeded the clarity peak a3, and a4 is smaller than a2. Therefore, the motor can be controlled to rotate in the opposite direction, that is, in the second preset direction, by a smaller angle to find the target focus position so that the target focus position is as close to the clarity peak a3 as possible.
[0101] In a possible embodiment, after the pre-focusing is completed and the motor is controlled to rotate in the first preset direction by a first preset rotation angle, when the second evaluation value is less than the first evaluation value, the motor can be controlled to rotate in the second preset direction by a fourth preset rotation angle. The fourth preset rotation angle can be less than the first preset rotation angle, such as 1 / 2 of the first preset rotation angle.
[0102] After each time the motor is controlled to rotate in the second preset direction by the fourth preset rotation angle, the image quality evaluation value after rotation can be calculated. For the sake of convenience, the image quality evaluation value is referred to as the third evaluation value below. If the third evaluation value is greater than the first evaluation value calculated after pre-focusing, the first evaluation value can be updated using the third evaluation value, and the motor is continued to be controlled to rotate in the second preset direction by the third preset rotation angle until the third evaluation value is less than or equal to the first evaluation value.
[0103] In a possible embodiment, in the process of controlling the motor to rotate in the first preset direction by the fourth rotation angle, the maximum value of the imaging quality evaluation value may be recorded and updated as the second maximum value.
[0104] If the third evaluation value is less than or equal to the first evaluation value, it means that the current position has passed the clarity peak area. Therefore, the motor can be controlled to rotate in the opposite direction of the second preset direction at a smaller angle, that is, to rotate in the first preset direction. Exemplarily, the motor can be controlled to rotate in the first preset direction at a fifth rotation angle, which is less than the fourth rotation angle.
[0105] In a possible embodiment, after each time the motor is controlled to rotate in the first preset direction by the fifth rotation angle, the image quality evaluation value after the rotation can be calculated as the second current evaluation value. The second current evaluation value is compared with the second maximum value. If the second current evaluation value is greater than or equal to the second maximum value, the current position can be determined as the target focus position. If the second current evaluation value is less than the second maximum value, the motor can be controlled to rotate in the opposite direction of the first preset direction, that is, in the second preset direction by the sixth rotation angle, and the position after the rotation is used as the target focus position. The sixth rotation angle is less than or equal to the fifth rotation angle.
[0106] like Figure 4 As shown, Figure 4It is a schematic diagram of the change of clarity with the number of focusing times in an embodiment of the present invention. After the pre-focusing is completed, the clarity of the target camera module corresponds to b1. At this time, after the motor is controlled to rotate in the first preset direction by a first preset rotation angle, the clarity of the target camera module corresponds to b3. b3 exceeds the clarity peak b2, and the clarity represented by b3 is less than b1, that is, after the pre-focusing is completed, the second evaluation value obtained by controlling the motor to rotate in the first preset direction by the first preset rotation angle is less than the first evaluation value. Therefore, the motor can be controlled to rotate in the opposite direction of the first preset direction by a second rotation angle, and the second rotation angle can be less than the above-mentioned first rotation angle to find the target focusing position.
[0107] like Figure 5 As shown, Figure 5 Another flowchart of a camera module focusing method provided by an embodiment of the present invention may include the following steps:
[0108] S501, using a height meter to measure the lens height of the target camera module, and calculating the height difference between the lens height of the target camera module and the lens height of the gold machine.
[0109] S502: Calculate a torsion angle of the motor based on the height difference, and apply a torsion signal to the motor based on the torsion angle.
[0110] In practical applications, the motor torsion angle and the stepping distance of the lens have a definite corresponding relationship. Therefore, the ratio of the height difference to the stepping distance corresponding to the unit torsion angle can be used as the torsion angle of the motor, and a torsion signal is applied to the motor based on the torsion angle, so that the motor controls the lens height of the target camera module to reach the lens height of the gold machine, thereby completing the pre-focusing of the target camera module.
[0111] S503: Determine the current SFR value of the target camera module, recorded as SFR1.
[0112] S504 , control the motor to rotate in a preset direction by an angle B, and obtain the current SFR value of the target camera module after rotation, which is recorded as SFR2.
[0113] S505 , determine whether SFR1 is greater than SFR2, if so, execute S506 , if not, execute S512 .
[0114] S506 , using the value of SFR1 as SFRold, and controlling the motor to rotate in the opposite direction of the preset direction by an angle of 1 / 2B.
[0115] S507 , controlling the motor to rotate in the opposite direction of the preset direction by an angle B1 , and calculating the SFR value of the target lens module after rotation, recorded as SFRnew.
[0116] S508 , determine whether SFRnew is greater than SFRold, if so, execute S509 , if not, execute S510 .
[0117] S509 , record SFRnew as the maximum value of SFR, record SFRnew as SFRold, and return to S507 .
[0118] S510 , controlling the motor to rotate in a preset direction by an angle of 1 / 2B, and calculating the SFR value of the target camera module after rotation as the current SFR value.
[0119] S511, determine whether the current SFR value is greater than or equal to the SFR maximum value. If so, determine that the current position is the clarity peak area. If not, control the motor to rotate 1 / 2B in the preset direction to determine that the target camera module reaches the target focusing position.
[0120] S512. Set the value of SFR2 as SFRold.
[0121] S513, control the motor to rotate to a preset angle by an angle B, and calculate the SFR value after the rotation, recorded as SFRnew.
[0122] S514: Determine whether SFRnew is greater than SFRold. If so, execute S515; if not, execute S516.
[0123] S515 , record SFRnew as the maximum value of SFR, and record SFRnew as SFRold, and return to S513 .
[0124] S516, control the motor to rotate in the opposite direction of the preset direction by an angle of 1 / 2B, and obtain the current SFR value.
[0125] S517, determine whether the current SFR value is not less than the SFR maximum value. If so, determine that the current position is the clarity peak area, that is, determine that the current position is the target focusing position. If not, control the motor to rotate 1 / 2B in the opposite direction of the preset direction, and then determine that the current position is the clarity peak area.
[0126] By applying the camera module focusing method provided in the embodiment of the present invention, the motor pre-focusing rotation angle is determined based on the lens height difference between the target camera module and the standard part, so as to pre-focus the target camera module. In this way, there is no need to manually control the initial position of the lens focus, and since the pre-focusing is based on the standard part, the initial position of the lens is near the target focusing position.
[0127] Furthermore, in the formal focusing process, the peak value curve is traversed at a relatively large angle to obtain the trend value of SFR. After passing the highest point, a small angle is used to traverse this interval to make the lens near the clarity peak. The camera module focusing method provided by the embodiment of the present invention can make the lens reach a better value of the lens imaging capability. Compared with the qualified value of the lens imaging capability obtained by the prior art, the focusing accuracy is higher.
[0128] Based on the same inventive concept, the embodiment of the present invention also provides a camera module focusing system, such as Figure 6 As shown, the system 600 may include:
[0129] A pre-focusing module 601 is used to pre-focus the target camera module based on the height difference between the lens height of the preset standard part and the current lens height of the target camera module;
[0130] A calculation module 602 is used to obtain an imaging quality evaluation value of the target camera module after pre-focusing as a first evaluation value;
[0131] A focusing module 603 is used to control the motor to rotate in a first preset direction by a first preset rotation angle, and calculate the imaging quality evaluation value of the target camera module after the rotation as a second evaluation value;
[0132] In the case where the second evaluation value is greater than the first evaluation value, the second evaluation value is used as a new first evaluation value, and the control motor is returned to rotate in a first preset direction by a first preset rotation angle, and the imaging quality evaluation value of the target camera module after rotation is calculated as a second evaluation value step, until the second evaluation value is not greater than the first evaluation value;
[0133] Controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the first current evaluation value; wherein the second preset direction is the opposite direction of the first preset direction, and the second preset rotation angle is less than the first preset rotation angle;
[0134] When the first current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the third preset rotation angle is less than or equal to the second preset rotation angle;
[0135] When the first current evaluation value is greater than the latest first evaluation value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
[0136] In a possible embodiment, the focusing module is further used to control the motor to rotate a fourth preset rotation angle in the second preset rotation direction when the second evaluation value is not greater than the first evaluation value calculated after the pre-focusing is completed, and calculate the imaging quality evaluation value of the target lens module after rotation as the third evaluation value, and the fourth preset rotation angle is less than the first preset rotation angle;
[0137] In the case where the third evaluation value is greater than the first evaluation value, the third evaluation value is used as a new first evaluation value, and the control motor is returned to rotate the fourth preset rotation angle in the second preset rotation direction, and the imaging quality evaluation value of the target lens module after rotation is calculated as the third evaluation value step, until the third evaluation value is not greater than the first evaluation value;
[0138] Controlling the motor to rotate in the first preset direction by a fifth preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the second current evaluation value; wherein the fifth preset rotation angle is smaller than the fourth preset rotation angle;
[0139] When the second current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the second preset direction by a sixth preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the sixth preset rotation angle is less than or equal to the fifth preset rotation angle;
[0140] When the second current evaluation value is greater than the latest first evaluation value, the control motor is returned to rotate to the first preset direction by a fifth preset rotation angle, and the imaging quality evaluation value of the target lens group after rotation is calculated as the second current evaluation value.
[0141] In a possible embodiment, the focusing module is further used to update the maximum value of the imaging quality evaluation value after each rotation in the process of controlling the motor to rotate in the first preset direction by the first preset rotation angle;
[0142] When the first current evaluation value is less than or equal to the maximum value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, determining that the target camera module reaches a target focusing position;
[0143] When the first current evaluation value is greater than the maximum value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
[0144] In a possible embodiment, pre-focusing the target camera module based on the height difference between the lens height of the preset standard component and the current lens height of the target camera module includes:
[0145] Calculating a target height difference between the lens height of the preset standard component and the current lens height of the target camera module;
[0146] Determine a pre-focus distance based on the target height difference and a ratio between pitches of threads in the target camera module;
[0147] Determining a pre-focusing rotation angle and a rotation direction of the motor based on the pre-focusing distance and a unit step length of a motor included in the camera module;
[0148] A prefocus torsion signal is sent to the motor based on the prefocus rotation angle and the rotation direction, so that the motor rotates according to the prefocus rotation angle and the rotation direction, thereby completing the prefocusing of the target camera module.
[0149] Among them, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the present invention are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0150] The exemplary embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and the computer program is used to enable the electronic device to perform a method according to an embodiment of the present invention when executed by the at least one processor.
[0151] Exemplary embodiments of the present invention also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present invention.
[0152] An exemplary embodiment of the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor of a computer, the computer is used to enable the computer to perform a method according to an embodiment of the present invention.
[0153] refer to Figure 7, a block diagram of an electronic device 700 that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0154] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0155] A plurality of components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 may be any type of device capable of inputting information to the electronic device 700, and the input unit 706 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 707 may be any type of device capable of presenting information, and may include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 708 may include but is not limited to a disk, an optical disk. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0156] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above. For example, in some embodiments, any of the above-described camera module focusing methods may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via the ROM 702 and / or the communication unit 709. In some embodiments, the computing unit 701 may be configured to perform any of the above-described camera module focusing methods by any other appropriate means (e.g., by means of firmware).
[0157] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0158] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0159] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0160] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0161] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0162] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
Claims
1. A camera module focusing method, characterized in that: The method comprises: Pre-focusing the target camera module based on the height difference between the lens height of the preset standard part and the current lens height of the target camera module; Obtaining an imaging quality evaluation value of the target camera module after pre-focusing as a first evaluation value; Controlling the motor to rotate in a first preset direction by a first preset rotation angle, and calculating an imaging quality evaluation value of the target camera module after the rotation as a second evaluation value; In the case where the second evaluation value is greater than the first evaluation value, the second evaluation value is used as a new first evaluation value, and the control motor is returned to rotate in a first preset direction by a first preset rotation angle, and the imaging quality evaluation value of the target camera module after rotation is calculated as a second evaluation value step, until the second evaluation value is not greater than the first evaluation value; Controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the first current evaluation value; wherein the second preset direction is the opposite direction of the first preset direction, and the second preset rotation angle is less than the first preset rotation angle; When the first current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the third preset rotation angle is less than or equal to the second preset rotation angle; When the first current evaluation value is greater than the latest first evaluation value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
2. The method according to claim 1, characterized in that The method further comprises: When the second evaluation value is not greater than the first evaluation value calculated after the pre-focusing is completed, the motor is controlled to rotate in the second preset rotation direction by a fourth preset rotation angle, and the imaging quality evaluation value of the target lens module after rotation is calculated as the third evaluation value, and the fourth preset rotation angle is less than the first preset rotation angle; In the case where the third evaluation value is greater than the first evaluation value, the third evaluation value is used as a new first evaluation value, and the control motor is returned to rotate the fourth preset rotation angle in the second preset rotation direction, and the imaging quality evaluation value of the target lens module after rotation is calculated as the third evaluation value step, until the third evaluation value is not greater than the first evaluation value; Controlling the motor to rotate in the first preset direction by a fifth preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the second current evaluation value; wherein the fifth preset rotation angle is smaller than the fourth preset rotation angle; When the second current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the second preset direction by a sixth preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the sixth preset rotation angle is less than or equal to the fifth preset rotation angle; When the second current evaluation value is greater than the latest first evaluation value, the control motor is returned to rotate to the first preset direction by a fifth preset rotation angle, and the imaging quality evaluation value of the target lens group after rotation is calculated as the second current evaluation value.
3. The method according to claim 1, characterized in that The method further comprises: In the process of controlling the motor to rotate in the first preset direction by the first preset rotation angle, updating the maximum value of the imaging quality evaluation value after each rotation; When the first current evaluation value is less than or equal to the maximum value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, determining that the target camera module reaches a target focusing position; When the first current evaluation value is greater than the maximum value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
4. The method according to claim 1, characterized in that: The method of pre-focusing the target camera module based on the height difference between the lens height of the preset standard part and the current lens height of the target camera module includes: Calculating a target height difference between the lens height of the preset standard component and the current lens height of the target camera module; Determine a pre-focus distance based on the target height difference and a ratio between pitches of threads in the target camera module; Determining a pre-focusing rotation angle and a rotation direction of the motor based on the pre-focusing distance and a unit step length of a motor included in the camera module; A prefocus torsion signal is sent to the motor based on the prefocus rotation angle and the rotation direction, so that the motor rotates according to the prefocus rotation angle and the rotation direction, thereby completing the prefocusing of the target camera module.
5. A camera module focusing system, characterized in that: The system comprises: A pre-focusing module, used for pre-focusing the target camera module based on the height difference between the lens height of the preset standard part and the current lens height of the target camera module; A calculation module, used to obtain an imaging quality evaluation value of the target camera module after pre-focusing as a first evaluation value; A focusing module, used for controlling the motor to rotate in a first preset direction by a first preset rotation angle, and calculating an imaging quality evaluation value of the target camera module after the rotation as a second evaluation value; In the case where the second evaluation value is greater than the first evaluation value, the second evaluation value is used as a new first evaluation value, and the control motor is returned to rotate in a first preset direction by a first preset rotation angle, and the imaging quality evaluation value of the target camera module after rotation is calculated as a second evaluation value step, until the second evaluation value is not greater than the first evaluation value; Controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the first current evaluation value; wherein the second preset direction is the opposite direction of the first preset direction, and the second preset rotation angle is less than the first preset rotation angle; When the first current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the third preset rotation angle is less than or equal to the second preset rotation angle; When the first current evaluation value is greater than the latest first evaluation value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
6. The system according to claim 5, characterized in that The focusing module is further configured to control the motor to rotate in the second preset rotation direction by a fourth preset rotation angle when the second evaluation value is not greater than the first evaluation value calculated after the pre-focusing is completed, and calculate the imaging quality evaluation value of the target lens module after rotation as the third evaluation value, wherein the fourth preset rotation angle is less than the first preset rotation angle; In the case where the third evaluation value is greater than the first evaluation value, the third evaluation value is used as a new first evaluation value, and the control motor is returned to rotate the fourth preset rotation angle in the second preset rotation direction, and the imaging quality evaluation value of the target lens module after rotation is calculated as the third evaluation value step, until the third evaluation value is not greater than the first evaluation value; Controlling the motor to rotate in the first preset direction by a fifth preset rotation angle, and calculating the imaging quality evaluation value of the target lens group after the rotation as the second current evaluation value; wherein the fifth preset rotation angle is smaller than the fourth preset rotation angle; When the second current evaluation value is less than or equal to the latest first evaluation value, after controlling the motor to rotate in the second preset direction by a sixth preset rotation angle, it is determined that the target camera module reaches the target focusing position, and the sixth preset rotation angle is less than or equal to the fifth preset rotation angle; When the second current evaluation value is greater than the latest first evaluation value, the control motor is returned to rotate to the first preset direction by a fifth preset rotation angle, and the imaging quality evaluation value of the target lens group after rotation is calculated as the second current evaluation value.
7. The system according to claim 5, characterized in that The focusing module is further used to update the maximum value of the imaging quality evaluation value after each rotation in the process of controlling the motor to rotate in the first preset direction by the first preset rotation angle; When the first current evaluation value is less than or equal to the maximum value, after controlling the motor to rotate in the first preset direction by a third preset rotation angle, determining that the target camera module reaches a target focusing position; When the first current evaluation value is greater than the maximum value, return to the step of controlling the motor to rotate in a second preset direction by a second preset rotation angle, and calculate the imaging quality evaluation value of the target lens group after rotation as the first current evaluation value.
8. The system according to claim 5, characterized in that The method of pre-focusing the target camera module based on the height difference between the lens height of the preset standard part and the current lens height of the target camera module includes: Calculating a target height difference between the lens height of the preset standard component and the current lens height of the target camera module; Determine a pre-focus distance based on the target height difference and a ratio between pitches of threads in the target camera module; Determining a pre-focusing rotation angle and a rotation direction of the motor based on the pre-focusing distance and a unit step length of a motor included in the camera module; A prefocus torsion signal is sent to the motor based on the prefocus rotation angle and the rotation direction, so that the motor rotates according to the prefocus rotation angle and the rotation direction, thereby completing the prefocusing of the target camera module.
9. An electronic device, comprising: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 4.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-4.
Citation Information
Patent Citations
Automatic focusing device
CN109765748A
Controller for adjusting industrial camera lens and control method
CN111031245A