Automatic focusing method, device, equipment, medium and system
By adjusting the liquid volume of the liquid lens according to the image clarity of the initial image and dynamically adjusting the liquid volume through the iterative process, the problem of precise zoom control difficulties caused by liquid loss of the thin-film liquid lens is solved, and high-precision and flexible automatic focus are achieved.
Patent Information
- Application Number
- CN202510503927.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2045-04-22
AI Technical Summary
Thin film liquid lenses will suffer from liquid loss during long-term use, resulting in difficulty in precise zoom control and affecting the accuracy of autofocus.
By adjusting the initial liquid volume of the liquid lens according to the image sharpness of the initial image, the liquid volume is dynamically adjusted using the iterative process until the preset conditions are met to complete the focus.
It effectively reduces the impact of liquid loss on zoom control accuracy, improves the accuracy and flexibility of autofocus, and expands the zoom range.
Smart Images

Figure CN120178397A_ABST
Abstract
Description
Technical Field
[0001] This application relates to autofocus technology, and in particular, to an autofocus method, apparatus, device, medium, and system. Background Art
[0002] An autofocus imaging system is a device or technical system that can automatically adjust the focal length of an optical system to make the object to be photographed clearly imaged on the imaging plane, and is widely used in various optical devices such as photography, microscopes, and telescopes.
[0003] Currently, in the known technology, the autofocus imaging system uses a thin-film liquid lens to avoid problems inherent in mechanical zoom systems such as complex structures, and due to its fast response ability, high-precision zoom control, and continuous stepless zoom characteristics, it provides a more flexible and efficient solution for the zoom system.
[0004] However, the above-mentioned thin-film liquid lens will have a certain amount of liquid loss during long-term use, which is not conducive to achieving precise zoom control and is not conducive to accurately achieving autofocus. Summary of the Invention
[0005] This application provides an autofocus method, apparatus, device, medium, and system to achieve more accurate autofocus.
[0006] In a first aspect, this application provides an autofocus method, which is applied to an autofocus system based on a liquid lens. The method includes:
[0007] Complete focusing by adjusting the initial liquid volume of the liquid lens according to the image sharpness of the initial image;
[0008] Wherein, the initial image is obtained when the liquid lens is at the initial liquid volume.
[0009] In a possible implementation manner, the adjustment of the liquid lens is achieved through at least one iterative process. Any iterative process includes:
[0010] Adjust the current liquid volume of the liquid lens according to the image sharpness of the current image corresponding to the current liquid volume; wherein, the current liquid volume in the first iterative process is the initial liquid volume, and the current image is the initial image;
[0011] If the image sharpness of the target image obtained based on the adjusted liquid volume meets the preset condition, end the adjustment.
[0012] In a possible implementation manner, the adjusting the current liquid volume of the liquid lens according to the image sharpness of the current image corresponding to the current liquid volume includes:
[0013] Adjust the current liquid volume of the liquid lens according to a preset focus search algorithm and the image sharpness of the current image;
[0014] In a possible implementation manner, the ending of the adjustment if the image sharpness of the target image obtained based on the adjusted liquid volume meets a preset condition includes:
[0015] If the image sharpness of the image obtained based on the adjusted liquid volume meets the ending search condition of the preset focus search algorithm, end the adjustment.
[0016] In a possible implementation manner, the adjustment of the current liquid volume of the liquid lens includes:
[0017] Adjust the current liquid volume of the liquid lens according to the adjustment requirement of the current iteration process; the adjustment requirement includes an adjustment change amount and an adjustment direction, and the adjustment requirement is related to the image sharpness of the image obtained in the previous iteration process and the image sharpness of the current image in the current iteration process.
[0018] In a possible implementation manner, the method further includes:
[0019] For the current iteration process, after adjusting the current liquid volume of the liquid lens, obtain the first image sharpness of the target image in the current iteration process and the second image sharpness of the target image obtained in the previous iteration process;
[0020] Determine whether to readjust the current liquid volume of the liquid lens according to the first image sharpness and the second image sharpness.
[0021] In a possible implementation manner, the determining whether to readjust the current liquid volume of the liquid lens according to the first image sharpness and the second image sharpness includes:
[0022] If the difference between the first image sharpness and the second image sharpness is less than a preset difference threshold, readjust the current liquid volume of the liquid lens.
[0023] In a possible implementation manner, the readjusting of the current liquid volume of the liquid lens includes:
[0024] Determine an updated adjustment requirement according to the adjustment requirement; the updated adjustment requirement is related to the first image sharpness and the second image sharpness;
[0025] Readjust the current liquid volume of the liquid lens according to the updated adjustment requirement.
[0026] In a possible implementation manner, the method further includes:
[0027] If the image clarity of the target image obtained based on the adjusted liquid volume meets the preset condition, determine the target liquid volume according to the current liquid volume of the liquid lens;
[0028] Adjust the liquid lens from the current liquid volume to the target liquid volume to complete focusing.
[0029] In a possible implementation manner, when the preset focus search algorithm is the Fibonacci search method, the end search condition is: in the current iteration process, the difference between the image clarities corresponding to two search positions is less than the first preset threshold; wherein, different search positions correspond to different liquid volumes of the liquid lens; in each iteration process, the two search positions are determined according to the image clarities corresponding to the two search positions in the previous iteration process.
[0030] In a possible implementation manner, the determining the target liquid volume according to the current liquid volume of the liquid lens includes:
[0031] Determine the target search position according to the two search positions in the current iteration process to determine the target liquid volume.
[0032] In a possible implementation manner, when the preset focus search algorithm is the rule-based search method, the end search condition is: in a preset number of iteration processes after the current iteration process, the image clarity corresponding to the search position becomes smaller; wherein, different search positions correspond to different liquid volumes of the liquid lens; in each iteration process, the search step size is determined according to the image clarity of the current image in the previous iteration process.
[0033] In a possible implementation manner, when the preset focus search algorithm is the hill climbing search method, the end search condition is: in the current iteration process, within the neighborhood range corresponding to the search position, the image clarity corresponding to the search position is the largest; wherein, different search positions correspond to different liquid volumes of the liquid lens; in each iteration process, the search step size is determined according to the image clarities corresponding to the search position and other search positions within the neighborhood range.
[0034] In a possible implementation manner, determine the search position in the current iteration process as the target search position to determine the target liquid volume.
[0035] In a possible implementation manner, the method further includes:
[0036] Predict the target time to complete the adjustment of the current liquid volume of the liquid lens according to the adjustment requirement;
[0037] Obtain the target image at the target moment and calculate the image sharpness of the target image.
[0038] In a possible implementation manner, the autofocus system includes a driving module; adjusting the current liquid volume of the liquid lens includes:
[0039] Generate a control instruction according to the adjustment requirement;
[0040] Control the driving module to adjust the current liquid volume of the liquid lens according to the control instruction.
[0041] In a possible implementation manner, the driving module is a motor or a cylinder.
[0042] In a possible implementation manner, predicting the target moment for completing the adjustment of the current liquid volume of the liquid lens according to the adjustment requirement includes:
[0043] Predict the target moment according to the adjustment requirement and the driving speed of the driving module.
[0044] In a second aspect, the present application provides an autofocus device, and the device includes:
[0045] A focusing module, configured to complete focusing by adjusting the initial liquid volume of the liquid lens according to the image sharpness of the initial image; wherein, the initial image is obtained when the liquid lens is at the initial liquid volume.
[0046] In a third aspect, the present application provides an electronic device, including a processor and a memory communicatively connected to the processor;
[0047] The memory stores computer-executable instructions;
[0048] The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of the first aspect.
[0049] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the method according to any one of the first aspect.
[0050] In a fifth aspect, the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the method according to any one of the first aspect.
[0051] In a sixth aspect, the present application provides an autofocus system, and the system includes a liquid lens and an electronic device; the electronic device is configured to adjust the liquid lens according to the method according to any one of the first aspect until focusing is completed.
[0052] In a seventh aspect, the present application provides a microscope system, which includes a microscope applying a liquid lens and an electronic device; the electronic device is configured to adjust the liquid amount of the liquid lens according to the method described in any one of the first aspect until focusing is completed.
[0053] In an eighth aspect, the present application provides an automatic detection system for pipeline products, which includes an industrial camera applying a liquid lens and an electronic device; the electronic device is configured to adjust the liquid amount of the liquid lens according to the method described in any one of the first aspect until focusing is completed.
[0054] The present application provides an automatic focusing method, device, equipment, medium and system for realizing automatic focusing of a liquid lens. Among them, the automatic focusing method of the present application can be executed by any electronic device. When realizing automatic focusing by applying the automatic focusing method of the present application, the electronic device completes focusing by adjusting the initial liquid amount of the liquid lens according to the image clarity of the initial image, where the initial image is obtained when the liquid lens is at the initial liquid amount. In this process, the electronic device realizes zooming by changing the liquid amount in the liquid lens. On the one hand, it can make the zoom range wider, and on the other hand, it will not affect the zoom control accuracy due to liquid loss, thus facilitating the improvement of focusing accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The accompanying drawings herein are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application and, together with the specification, are used to explain the principles of the present application.
[0056] Figure 1A FIG. 1 is a schematic diagram of an application scenario of an automatic focusing method provided by an embodiment of the present application;
[0057] Figure 1B FIG. 2 is a schematic diagram of an application scenario of an automatic focusing method provided by an embodiment of the present application;
[0058] Figure 2A FIG. 3 is a schematic flowchart of an automatic focusing method provided by an embodiment of the present application;
[0059] Figure 2B FIG. 4 is a schematic block diagram of an automatic focusing method provided by an embodiment of the present application;
[0060] Figure 3A FIG. 5 is a schematic diagram of the relationship between an evaluation value and a search position provided by an embodiment of the present application;
[0061] Figure 3B FIG. 6 is a diagram of the change of the evaluation value at the same search position at different times provided by an embodiment of the present application;
[0062] Figure 3C Schematic Diagram II of the Relationship between Evaluation Value and Search Position Provided by an Embodiment of the Present Application
[0063] Figure 3D Schematic Flowchart II of an Auto - Focusing Method Provided by an Embodiment of the Present Application
[0064] Figure 3E Schematic Block Diagram II of an Auto - Focusing Method Provided by an Embodiment of the Present Application
[0065] Figure 4A Schematic Flowchart III of an Auto - Focusing Method Provided by an Embodiment of the Present Application
[0066] Figure 4B Schematic Block Diagram III of an Auto - Focusing Method Provided by an Embodiment of the Present Application
[0067] Figure 5 Schematic Structural Diagram of an Auto - Focusing Device Provided by an Embodiment of the Present Application
[0068] Figure 6 Schematic Structural Diagram of an Electronic Device Provided by an Embodiment of the Present Application
[0069] Figure 7 Schematic Structural Diagram of an Auto - Focusing System Provided by an Embodiment of the Present Application
[0070] Through the above - mentioned drawings, specific embodiments of the present application have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed Embodiments
[0071] Here, the exemplary embodiments will be described in detail, and their examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0072] An auto - focusing imaging system is a device or technical system that can automatically adjust the focal length of an optical system to make the object to be photographed clearly imaged on the imaging plane, and is widely used in various optical devices such as photography, microscopes, and telescopes. Specifically, from the perspective of the optical elements used, current optical auto - focusing systems mainly use liquid lenses and mechanical optical lens groups.
[0073] Among them, the automatic focusing technology of mechanical optical lens groups mainly changes the focal length of the entire lens group by moving one or more lenses in the lens group. This technology relies on precise mechanical structures and complex control systems to achieve precise adjustment of the focal length. Although the automatic focusing technology of mechanical optical lens groups is relatively mature, with the development of technology and the continuous improvement of the performance requirements for optical instruments, its limitations have gradually emerged. For example, mechanical zoom requires complex mechanical structures and control systems, resulting in a large volume and increased weight of the entire system; at the same time, mechanical movement may also cause vibration and wear, affecting the stability and reliability of the system. Therefore, in recent years, people have begun to explore new automatic focusing technologies, such as electro-wetting liquid lenses, etc., to overcome the limitations of mechanical zoom.
[0074] Electro-wetting liquid lenses are adjustable-focus lenses based on the principle of electro-wetting. Their working principle is to change the wetting angle between the liquid and the dielectric layer by applying a voltage, thereby changing the curvature of the liquid interface, and thus achieving a change in diopter, that is, adjustment of the focal length. This technology avoids the complexity and volume limitations of traditional mechanical zoom and has advantages such as fast response, high precision, and continuous zoom. Electro-wetting liquid lens technology has made significant progress and has been applied in many fields. For example, in mobile phone camera modules, industrial cameras, microscopes, micro-projections, and AR / VR and other fields. However, it also has some obvious disadvantages. First, its zoom range is limited: Although electro-wetting liquid lenses can achieve continuous adjustment of the focal length, their zoom range may be limited by factors such as liquid properties, dielectric layer materials, and applied voltage. In some application scenarios, it may not be able to meet the large-range zoom requirements. Second, it requires a relatively high driving voltage: To achieve an effective electro-wetting effect, a relatively high driving voltage usually needs to be applied. This not only increases the complexity and cost of the system but may also have a certain impact on the life and stability of the lens. In addition, electro-wetting liquid lenses have poor adaptability to the environment and limited usage scenarios.
[0075] Compared with electro-wetting liquid lenses, thin-film liquid lenses show significant advantages, specifically reflected in the significantly expanded aperture range that can be achieved. Specifically, in the case where the aperture of electro-wetting liquid lenses is difficult to exceed the 10 mm level, the aperture of thin-film liquid lenses can reach the 100 mm level, and this characteristic greatly broadens the application scenarios of thin-film lenses.
[0076] In addition, thin-film liquid lenses not only have a wider focal length adjustment range but also avoid problems such as the complex structure inherent in mechanical zoom systems. Their fast response ability, high-precision zoom control, and continuous stepless zoom characteristics provide a more flexible and efficient solution for zoom systems.
[0077] However, for the above-mentioned thin-film liquid lens, there will be a certain amount of liquid loss during long-term use, which is not conducive to accurately achieving autofocus.
[0078] Therefore, the present application provides an autofocus method, device, equipment, medium and system to solve the above problems. Specifically, the autofocus method in the present application can be executed by any electronic device. The electronic device completes focusing by adjusting the initial liquid volume of the liquid lens according to the image clarity of the initial image. It should be understood that the liquid lens mentioned in the present application is specifically a thin-film liquid lens.
[0079] In the above process, the electronic device realizes zooming by changing the liquid volume of the liquid lens on the premise of referring to the image clarity. On the one hand, it can make the zoom range more flexible, and on the other hand, it effectively reduces the risk of affecting the zoom control accuracy due to the liquid loss of the liquid lens, which is conducive to accurately achieving autofocus.
[0080] It can be understood that the method of the present application is applicable to any scenario where liquid lens focusing needs to be achieved. Exemplarily, Figure 1A FIG. 1 is a schematic diagram of an application scenario of an autofocus method provided by an embodiment of the present application. As Figure 1A shown, the method of the present application can be used in the focusing scenario of a microscope system applying a liquid lens. Specifically, the method of the present application can be executed by a computer connected to the microscope system. More specifically, as Figure 1A shown, the output end of the electronic control device is connected to the input end of the driving device, the input end of the electronic control device is connected to the output end of the computer, and the input end of the computer is connected to the output end of the microscope.
[0081] On this basis, the microscope collects an image of an object on the stage and transmits the collected image to the computer. The computer calculates the image clarity of the image and, through the method of the present application, according to the image clarity of the image, transmits an instruction for controlling the driving device to input or extract corresponding liquid into the liquid lens in the microscope to continuously zoom until the focusing on the object on the stage is completed.
[0082] Through the above process, the computer can realize zooming by changing the liquid volume of the liquid lens of the microscope until focusing is completed. On the one hand, it makes the zoom range larger and more flexible, and on the other hand, the zoom control accuracy will not be affected by liquid loss during the focusing process, which is conducive to achieving accurate focusing.
[0083] Figure 1B FIG. 2 is a schematic diagram of an application scenario of an autofocus method provided by an embodiment of the present application. As Figure 1BAs shown, the method of the present application is applicable to an automatic detection system for assembly line products using a liquid lens. Specifically, the method of the present application is executed by a computer connected to the system, the output end of the electric control device is connected to the input end of the drive device, the input end of the electric control device is connected to the output end of the computer, and the input end of the computer is connected to the output end of an industrial camera using a liquid lens. The industrial camera of the automatic detection system for assembly line products is used to sequentially capture images of product 1, product 2, product 3...product n in a certain processing process on the assembly line, which are used in subsequent quality analysis and other processes.
[0084] On this basis, before the industrial camera captures an image of any product on the assembly line, it first transmits the captured image to the computer. The computer calculates the image clarity, and through the method of the present application, transmits to the electronic control device an instruction for controlling the drive device to input or extract the corresponding liquid into the liquid lens in the microscope according to the image clarity, so as to continuously zoom until the product is focused.
[0085] Through the above process, the computer can achieve zoom by changing the amount of liquid in the liquid lens of the industrial camera until the focus is completed. On the one hand, the zoom range is larger and more flexible, and on the other hand, the zoom control accuracy will not be affected by liquid loss during the focusing process, which is conducive to achieving precise focus.
[0086] It is understandable that in the above examples, the electric control device can also be independently provided or integrated into a computer, which is not limited in this embodiment. When the electric control device is independently provided, it communicates with the computer by wireless or wired means, and similarly, the electric control device communicates with the drive device by wireless or wired means.
[0087] The present application provides an autofocus method, which is applied to an autofocus system based on a liquid lens and is executed by any electronic device. Some implementation methods of the autofocus method of the present application are described in detail below in conjunction with the accompanying drawings. In the case where the embodiments do not conflict with each other, the following embodiments and the features in the embodiments can be combined with each other.
[0088] The present application provides a method embodiment, Figure 2A A flowchart of an automatic focusing method provided in an embodiment of the present application is shown in FIG. Figure 2A As shown, an automatic focusing method provided in an embodiment of the present application includes the following contents:
[0089] S201, focusing is completed by adjusting the initial liquid amount of the liquid lens according to the image clarity of the initial image.
[0090] The initial image is acquired when the liquid lens is in an initial liquid volume.
[0091] In this embodiment, the electronic device acquires an initial image of the liquid lens when it is in the initial liquid volume and calculates the image sharpness of the initial image. Specifically, the initial image can be acquired by the electronic device from the imaging module of the autofocus system and is the image data directly captured by the sensor of the imaging module without any post-processing (such as noise reduction, color correction, sharpening, etc.). It is a direct digital record of the optical image formed by the liquid lens and exists in the sensor in the form of an electrical signal or a digital signal.
[0092] Furthermore, the electronic device can use image sharpness calculation methods such as the gradient-based method, the frequency-domain-based method, the energy-gradient-based method, the wavelet-transform-based method, etc. to calculate the image sharpness of the initial image.
[0093] In practical applications, the initial image can also be acquired by the electronic device from the image acquisition module of the autofocus system and is the image obtained by the sensor of the image acquisition module by photographing the object to be measured at this time. This embodiment does not limit this.
[0094] It can be understood that the initial liquid volume is the liquid volume of the liquid lens when the electronic device starts to execute the autofocus method of this application. It should be understood that the liquid volume is a non-zero value. The electronic device specifically starts to execute the autofocus method of this application when it receives a focus trigger instruction from the user. For example, in the scenario of observing a sample with a microscope, the user sends a focus instruction by operating the control button of the microscope; in the scenario of taking a photo with a camera, the user half-presses the shutter button to trigger the autofocus function of the camera and thus sends a focus instruction; in the imaging system for industrial inspection, the user clicks a dedicated focus button on the control terminal to issue a focus instruction.
[0095] In practical applications, the electronic device can also automatically and regularly trigger a focus instruction according to the configuration. For example, in the scenario of industrial automation inspection, the electronic device executes the focus method of this application at different time points according to the configuration to ensure accurate image acquisition at the correct time point.
[0096] It should be understood that during the focusing process, when the liquid lens is in a certain liquid volume state, if the image sharpness of the image at this time meets the preset image sharpness, or the corresponding image sharpness is the best image sharpness within the focusing range, or meets other conditions of the specific requirements of the imaging system and the application scenario, it is considered that the focusing is completed.
[0097] Therefore, in this embodiment, the electronic device determines whether to adjust the initial liquid amount of the liquid lens and how to adjust the initial liquid amount of the liquid lens by judging the image clarity of the initial image. More specifically, after the image clarity of the initial image does not meet the requirements and the initial liquid amount of the liquid lens is adjusted, it is necessary to obtain the image at this time and determine whether to adjust the liquid amount of the liquid lens according to the image clarity of the image at this time. If not, it is determined that the focusing is completed.
[0098] As a possible implementation manner, in this embodiment, the adjustment of the liquid lens is implemented through at least one iteration process. Specifically, Figure 2B FIG. 1 is a schematic flowchart of an autofocus method provided by an embodiment of the present application. As Figure 2B shown, in this embodiment, any iteration process includes:
[0099] Adjust the current liquid amount of the liquid lens according to the image clarity of the current image corresponding to the current liquid amount; wherein, the current liquid amount in the first iteration process is the initial liquid amount, and the current image is the initial image; if the image clarity of the target image obtained based on the adjusted liquid amount meets the preset condition, the adjustment ends.
[0100] Further, when the image clarity of the target image obtained based on the adjusted liquid amount meets the preset condition, the electronic device determines the target liquid amount according to the current liquid amount of the liquid lens. Finally, the electronic device ends the adjustment after adjusting the liquid amount of the liquid lens to the target liquid amount.
[0101] It should be understood that when the image clarity of the target image obtained based on the adjusted liquid amount does not meet the preset condition, the electronic device executes the next iteration process until the image clarity of the target image obtained based on the adjusted liquid amount meets the preset condition, and then ends the adjustment to complete the focusing.
[0102] In this embodiment, the electronic device adjusts the liquid lens through at least one iteration process, and the at least one iteration process can automatically adjust the liquid amount of the liquid lens according to the change of the actual shooting scene. For example, when the distance of the shooting object changes or the light condition changes, the iteration process can quickly adapt to these changes and readjust to the liquid amount state required for focusing, ensuring that an image with image clarity meeting the preset condition can always be obtained, enhancing the adaptability and robustness of the autofocus method of the present application.
[0103] It should be understood that in this embodiment, for the first iteration process, the current liquid volume is specifically the initial liquid volume in the foregoing content, and the current image is specifically the initial image in the foregoing content. For each iteration process, when the image clarity of the current image corresponding to the current liquid volume does not meet the preset condition, the current liquid volume of the liquid lens is adjusted. When the image clarity of the current image corresponding to the current liquid volume meets the preset condition, the target liquid volume is determined according to the current liquid volume of the liquid lens, and the adjustment is ended after adjusting the liquid volume of the liquid lens to the target liquid volume to complete focusing.
[0104] Among them, the current image is obtained by the sensor of the imaging module or the sensor of the image acquisition module when the liquid lens is in the current liquid volume. The specific preset conditions can refer to the description in the foregoing content and will not be elaborated here.
[0105] More specifically, in this embodiment, the electronic device adjusts the current liquid volume of the liquid lens according to the preset focus search algorithm and the image clarity of the current image. Correspondingly, when the image clarity of the image obtained based on the adjusted liquid volume meets the end search condition of the preset focus search algorithm, the adjustment ends.
[0106] In this embodiment, the electronic device uses a preset focus search algorithm to find the focus position. The preset focus search algorithm corresponds to a unique end search condition. When the image clarity of the image obtained based on the adjusted liquid volume meets the end search condition of the preset focus search algorithm, it is considered that the focus position is found.
[0107] It should be understood that each search position involved in the preset focus search algorithm corresponds to a unique volume of liquid, and the focus position found by the preset focus search algorithm corresponds to a unique target liquid volume.
[0108] On this basis, as a design, in this embodiment, the preset focus search algorithm can be the Fibonacci search method. At this time, the end search condition is: in the current iteration process, the difference between the image clarities corresponding to the two search positions is less than the first preset threshold; among them, different search positions correspond to different liquid volumes of the liquid lens; in each iteration process, the two search positions are determined according to the image clarities corresponding to the two search positions in the previous iteration process. Correspondingly, at this time, the electronic device determines the target search position according to the two search positions in the current iteration process to determine the target liquid volume.
[0109] Specifically, for each iteration process, the electronic device first obtains the maximum search range and the Fibonacci sequence corresponding to the maximum search range, then determines two search positions for the current iteration process based on the maximum search range and the Fibonacci sequence, and adjusts the current liquid volume of the liquid lens according to the two search positions respectively. Finally, the image sharpness of the current image corresponding to the two adjustments is obtained. When the image sharpness of the two current images meets the search end condition, the target search position is determined based on the corresponding two search positions to determine the target liquid volume; when the image sharpness of the two current images does not meet the search end condition, the liquid volume of the liquid lens is adjusted according to the image sharpness of the two current images and the current liquid volume of the liquid lens.
[0110] Among them, it should be understood that the maximum search range of the first iteration process can be the maximum zoom range of the liquid lens, which is specifically determined by the maximum change amount of the liquid volume of the liquid lens. The maximum search range of the second iteration process is determined by the result of the first iteration process.
[0111] In this embodiment, when the electronic device determines the target search position based on the two search positions, specifically, an average process is performed on the two search positions to obtain the target search position, and the liquid volume corresponding to the target search position is the target liquid volume.
[0112] As another design, in this embodiment, the preset focus search algorithm can also be a rule-based search method. At this time, the end search condition is that in a preset number of iteration processes after the current iteration process, the image sharpness corresponding to the search position becomes smaller; among them, different search positions correspond to different liquid volumes of the liquid lens; in each iteration process, the search step size is determined according to the image sharpness of the current image in the previous iteration process.
[0113] Correspondingly, the electronic device determines the search position in the current iteration process as the target search position to determine the target liquid volume.
[0114] Specifically, for each iteration process, the electronic device first obtains the image sharpness of the current image in the previous iteration process, and determines the search step size for this iteration accordingly; then adjusts the current liquid volume of the liquid lens according to the determined search step size, changes its focal length, and obtains the current image; finally, calculates the image sharpness of the current image, and determines whether the image sharpness corresponding to the search position becomes smaller in a preset number of iteration processes after the current iteration process. If this end search condition is met, it is considered that the focusing is completed, the search position in the current iteration process is determined as the target search position, and the liquid volume corresponding to the target search position is used as the target liquid volume. If not, the image sharpness of the current image obtained in this iteration process is used as the basis for determining the search step size in the next iteration, and the next iteration process is continued.
[0115] As another design, in this embodiment, when the preset focus search algorithm is based on the hill climbing search method, the end search condition is: in the current iteration process, within the neighborhood range corresponding to the search position, the image sharpness corresponding to the search position is the largest; wherein, different search positions correspond to different liquid amounts of the liquid lens; in each iteration process, the search step size is determined according to the search position and the image sharpness corresponding to other search positions within the neighborhood range.
[0116] Specifically, for each iteration process, the electronic device first determines the current search position, and obtains the image sharpness corresponding to this search position and other search positions within the neighborhood range, so as to determine the search step size of this iteration process, that is, determine the change range of the liquid amount of the liquid lens according to the sharpness of each position; then adjusts the current liquid amount of the liquid lens according to the determined search step size, thereby changing its focal length, causing the focal position of the imaging system to change, and obtaining the new current image at this time; finally, calculates the image sharpness of the newly obtained current image, and determines whether the image sharpness corresponding to this search position is the largest within its neighborhood range in the current iteration process. If this end search condition is met, it can be considered that the focusing is completed, the search position in the current iteration process is determined as the target search position, and the liquid amount corresponding to the target search position is used as the target liquid amount. If not, the search position and the image sharpness of each position within the neighborhood in this iteration are used as the basis for determining the search step size in the next iteration, and the next iteration process is continued.
[0117] As can be seen from the above, this embodiment adopts a preset focus search algorithm, and uses the adjustment of the liquid amount of the liquid lens to achieve autofocus. By dynamically adjusting the search strategy and step size, it can quickly and accurately determine the optimal focus position to ensure image sharpness and focusing accuracy. At the same time, in each iteration process, according to the preset focus search algorithm, since the image sharpness of other images in the entire search range is referred to, the requirements for other variables that affect image sharpness except the focal length can be reduced during the entire focusing process.
[0118] In addition, multiple preset focus search algorithms are provided in this embodiment, and the electronic device can select any preset focus search algorithm according to specific requirements to adjust the liquid amount of the liquid lens, thereby ensuring the flexibility and adaptability of the method.
[0119] In this embodiment, for each of the foregoing iteration processes, the electronic device adjusts the current liquid amount of the liquid lens according to the adjustment requirements of the current iteration process. Among them, the adjustment requirements include the adjustment change amount and the adjustment direction, and the adjustment requirements are related to the image sharpness of the image obtained in the previous iteration process and the image sharpness of the current image in the current iteration process.
[0120] It can be understood that since the image clarity is related to the focal length of the liquid lens, and the liquid volume directly affects the focal length, by making the adjustment requirement determined jointly by the image clarity of the image obtained in the previous iteration and the image clarity of the current image in the current iteration process, the electronic device can clarify whether to increase or decrease the liquid volume (i.e., the adjustment direction) and the adjustment amplitude (i.e., the adjustment change amount). By continuously performing iterative adjustment based on the image clarity feedback, the focal length of the liquid lens can be gradually brought to the optimal state, achieving precise focusing, and thus obtaining an image with higher clarity and better quality.
[0121] In practical applications, the electronic device can also configure an image clarity threshold. On this basis, the preset condition in the iterative process is that the image clarity is greater than the image clarity threshold. Specifically, in each iterative process, when the electronic device obtains the image clarity of the current image, it compares the image clarity of the current image with the image clarity threshold. If the image clarity of the current image is greater than the image clarity threshold, the iteration ends; otherwise, the electronic device adjusts the liquid volume of the liquid lens.
[0122] It should be understood that the electronic device configures multiple image clarity thresholds obtained under different other variable conditions, and the other variables include factors that affect image clarity such as lighting conditions and image features. When performing autofocus on the liquid lens, the electronic device obtains the corresponding image clarity threshold according to the current other variable conditions and uses this image clarity threshold in each iterative process.
[0123] Optionally, when the image clarity of the current image is not greater than the image clarity threshold, the electronic device can adjust the liquid volume of the liquid lens according to the preset adjustment requirement, or combine the image clarity of the image in the previous iterative process to determine the adjustment requirement in the current iterative process for adjusting the liquid volume of the liquid lens to ensure adjustment flexibility. This is not limited in this embodiment.
[0124] It can be understood that, as another possible implementation, the electronic device can also directly adjust the initial liquid volume of the liquid lens according to the target liquid volume after determining the target liquid volume by means of a pre-set mapping relationship. Exemplarily, when determining the target liquid volume by means of a pre-set mapping relationship, specifically in the development or initialization stage, a series of experiments and measurements are carried out, that is, for the states of the liquid lens at different liquid volumes, the imaging module is used to obtain corresponding images, and the image sharpness of these images is calculated, while recording the liquid volume of the liquid lens at each measurement. Through the analysis and collation of a large amount of experimental data, a mapping relationship between the liquid volume and the image sharpness is established. The mapping relationship can specifically be in the form of a simple table or a formula obtained by data function fitting, and this embodiment does not limit this. On this basis, the electronic device first obtains the required image sharpness, and then obtains the target liquid volume corresponding to this image sharpness according to the mapping relationship.
[0125] As yet another possible implementation, the electronic device can also directly adjust the initial liquid volume of the liquid lens according to the target liquid volume after determining the target liquid volume through a network model; specifically, when the network model is trained, taking the input parameters of the liquid lens and outputting the corresponding target liquid volume as the training target.
[0126] It should be understood that the pre-set mapping relationship or network model used in the above process should make other variables that affect the image sharpness, such as the lighting conditions, in the current adjustment process consistent with the other variables applied when obtaining the mapping relationship or network model, so as to ensure the accuracy of the target liquid volume.
[0127] In the method provided in this embodiment, the electronic device obtains an initial image when the liquid lens is at the initial liquid volume, and adjusts the liquid volume according to its image sharpness to complete focusing. It utilizes the fast response and high-precision adjustment characteristics of the liquid lens, and avoids the problem of inaccurate zoom control caused by liquid volume loss, thus realizing an efficient and accurate focusing process. This method can quickly adjust the focal length under different initial conditions, ensure the optimization of image sharpness, improve the speed and accuracy of the autofocus system, and at the same time simplify the focusing mechanism, and is applicable to various application scenarios that require fast focusing.
[0128] In addition, the method of this embodiment realizes zooming by adjusting the liquid volume of the liquid lens, effectively improving the flexibility of the zoom range.
[0129] It can be understood that for the same search position, there will be slightly differences in the images collected by the electronic device controlling the image acquisition module or the imaging module at different times, which results in a slight fluctuation in the image sharpness, thus affecting the accuracy of focus search. The specific situation will be described below with reference to the accompanying drawings, where Figure 3AA schematic diagram I showing the relationship between evaluation values and search positions provided by an embodiment of the present application Figure 3B A graph showing the change in evaluation values of the same search position at different times provided by an embodiment of the present application Figure 3C A schematic diagram II showing the relationship between evaluation values and search positions provided by an embodiment of the present application
[0130] As Figure 3A shown, in an ideal state, when the liquid lens is at different search positions, the change in the image sharpness of the corresponding images is smooth. However, in actual applications, for any focusing process, such as actual search process 1 or actual search process 2, when the liquid lens is at different search positions, the change in the image sharpness of the corresponding images is not smooth, that is, the change in the image sharpness at different search positions is fluctuating.
[0131] In addition, as Figure 3B shown, for different focusing processes, such as actual search process 1 or actual search process 2, when the liquid lens is at a certain same search position, the image sharpness of the images obtained by the electronic device may be different. As Figure 3C shown, for any focusing process, such as actual search process 2, when the liquid lens is at different search positions, the image sharpness of the images obtained by the electronic device may be the same.
[0132] Therefore, the present application also provides a method embodiment to avoid missearches caused by the above situations, thereby further improving the focusing accuracy. Figure 3D A schematic flowchart II of an autofocus method provided by an embodiment of the present application. Based on the foregoing embodiment, the iteration process in the foregoing embodiment is further described in detail. As Figure 3D shown, the method of this embodiment includes:
[0133] S301, for the current iteration process, after adjusting the current liquid volume of the liquid lens, obtain the first image sharpness of the target image of the current iteration process and the second image sharpness of the target image obtained in the previous iteration process.
[0134] S302, determine whether to readjust the current liquid volume of the liquid lens according to the first image sharpness and the second image sharpness.
[0135] In this embodiment, for any iteration process, after the electronic device adjusts the current liquid volume of the liquid lens, it compares the first image sharpness of the target image obtained in the current iteration process with the second image sharpness of the target image obtained in the previous iteration process to determine whether a re-search is required in the current iteration process.
[0136] With the above settings, in the case of complex situations such as small fluctuations in image clarity caused by collecting images at the same search position at different times, uneven changes in image clarity at different search positions, possible differences in image clarity during different focusing processes at the same search position, and possible same image clarity during any focusing process at different search positions, this method can effectively avoid false searches.
[0137] Specifically, compare the first image clarity of the target image in the current iteration process with the second image clarity of the target image in the previous iteration process, so that the electronic device can judge whether the current adjustment direction and result are reasonable based on the change trend of image clarity in two consecutive iterations. If the change in clarity between the two times does not conform to the expected focusing optimization direction, it can promptly detect possible false search situations, and then determine whether to readjust the current liquid volume of the liquid lens.
[0138] This can avoid wrongly thinking that the best focusing position has been reached due to fluctuations and uncertainties in image clarity, thereby further improving the focusing accuracy, enabling the imaging module to focus more accurately, obtaining clearer and higher-quality images, enhancing the stability and reliability of the imaging module in complex actual application scenarios, improving the anti-interference ability of the imaging module to various interference factors, ensuring the effectiveness and accuracy of the focusing operation, and optimizing the entire focusing process and imaging effect.
[0139] Specifically, when the difference between the first image clarity and the second image clarity is less than a preset threshold, it means that the fluctuation of image clarity cannot be ignored, indicating that the current adjustment has not caused an obvious and expected change in the diagonal effect, and there may be misjudgment or the device has fallen into an unsatisfactory focusing state. Therefore, in this embodiment, the electronic device specifically readjusts the current liquid volume of the liquid lens when the difference between the first image clarity and the second image clarity is less than the preset difference threshold.
[0140] More specifically, the electronic device determines an updated adjustment requirement according to the adjustment requirement; the updated adjustment requirement is related to the first image clarity and the second image clarity; and according to the updated adjustment requirement, the current liquid volume of the liquid lens is readjusted.
[0141] In this embodiment, since the first image sharpness and the second image sharpness reflect the adjustment results in the current iteration process and the previous iteration process, by analyzing the relationship between the two to determine the update adjustment requirements, it is beneficial to more accurately grasp the change trend of the image sharpness and the current focusing state. For example, if the improvement of the first image sharpness compared to the second image sharpness is not obvious and the difference is less than the preset difference threshold, the electronic device can determine that the current adjustment amplitude may be insufficient or the adjustment direction is deviated, and thus determine the update adjustment requirements according to this situation, which may include increasing or decreasing the adjustment change amount, and changing the adjustment direction (such as changing from increasing the liquid volume to decreasing the liquid volume).
[0142] Furthermore, the electronic device re-adjusts the current liquid volume of the liquid lens according to the update adjustment requirements, so that the focal length of the liquid lens can be adjusted in a direction more likely to achieve accurate focusing, avoiding falling into an incorrect focusing judgment due to the fluctuation and insignificant change of the image sharpness.
[0143] Based on the method of this embodiment, Figure 3E is a schematic flowchart diagram II of an autofocus method provided by an embodiment of the present application. As Figure 3E shown, for any iteration process, when the electronic device calculates the first image sharpness of the target image in the current iteration process, it obtains the second image sharpness of the target image in the previous iteration process, determines the difference between the two, and when the difference is less than the preset difference threshold, determines the update adjustment requirements, and continues to adjust the liquid volume of the liquid lens according to the update adjustment requirements until the difference between the first image sharpness of the target image in the current iteration process and the second image sharpness of the target image in the previous iteration process is not less than the preset difference threshold, determines whether the search end condition is satisfied. If satisfied, the focusing is completed; otherwise, the next iteration process is executed until the search end condition is satisfied.
[0144] The present application also provides a method embodiment, which is applied to scenarios with low requirements for focusing accuracy. Figure 4A is a schematic flowchart III of an autofocus method provided by an embodiment of the present application. Based on the foregoing embodiment, the present application embodiment details how to adjust the liquid volume. As Figure 4A shown, the method of this embodiment includes:
[0145] S401, according to the adjustment requirements, predict the target time when the current liquid volume of the liquid lens is adjusted to completion.
[0146] S402, obtain the target image at the target time and calculate the image sharpness of the target image.
[0147] Specifically, in each iteration, after the electronic device determines the target position according to the adjustment requirement, it predicts the target time to complete the adjustment of the current liquid volume of the liquid lens to the liquid volume corresponding to the target position, and controls the image acquisition module or the imaging module to obtain the target image at this time at the target time, and then calculates the image sharpness of the target image.
[0148] Through the above setting of predicting the target time first, then acquiring the image and calculating the sharpness, the focusing efficiency can be effectively improved, the invalid image acquisition and analysis can be reduced, and the performance of the imaging module can be optimized. At the same time, by accurately calculating the target time, the focusing error caused by improper image acquisition time can also be effectively reduced, ensuring the stability and reliability of the method, enabling the imaging module to better adapt to different shooting scenarios and requirements, and providing a strong guarantee for obtaining high-quality images.
[0149] It should be understood that the automatic focusing system described in this application includes a driving module. On this basis, when the electronic device adjusts the liquid volume of the liquid lens, it generates a control command according to the adjustment requirement; and controls the driving module to adjust the current liquid volume of the liquid lens according to the control command. Specifically, the driving module is a motor or a cylinder.
[0150] As can be seen from the above, in this embodiment, the electronic device realizes the precise control of the liquid volume of the liquid lens by controlling the driving module. The electronic device generates a control command according to the adjustment requirement and executes these commands through the driving module, thereby dynamically adjusting the liquid volume of the liquid lens. This architecture enables the automatic focusing system to quickly respond to the focusing requirement, provides high-precision and stable liquid volume adjustment, and thus ensures the image sharpness during use.
[0151] In addition, the driving module can specifically be a motor or a cylinder, that is, the structure of the automatic focusing system is not limited in the method of this embodiment, as long as it can realize the change of the liquid volume of the liquid lens, so as to realize flexible zooming, ensuring the application flexibility and universality of the method of this embodiment.
[0152] More specifically, based on the above driving module, when the electronic device predicts the target time, it predicts the target time according to the adjustment requirement and the driving speed of the driving module. Exemplarily, when the driving module is a motor, when the electronic device determines the target position, it estimates the target time to reach the target position according to the rotation speed of the motor and the relationship between the current position and the target position.
[0153] Through the above setting, during the focus position search process, when the imaging module or the image acquisition module captures an image, it no longer needs to wait for the driving module to stop to cooperate, but can capture the image when the target time obtained based on the driving speed of the driving module arrives. In combination with the foregoing preset focus search algorithm, the search time can be significantly reduced and the search speed can be improved.
[0154] It can be understood that although the positional accuracy obtained by calculation decreases, which may affect the accuracy of the final search focus, for an autofocus system with low accuracy requirements, such as an autofocus system with a large depth of field, the large depth of field of the system can compensate for this loss of accuracy, making the focusing effect still good.
[0155] Based on the method of this embodiment, Figure 4B FIG. 3 is a schematic flowchart of an autofocus method provided by an embodiment of the present application. As Figure 4B shown, for each iteration process, after the electronic device determines the adjustment requirement, it predicts the target time according to the adjustment requirement, obtains the image of the current iteration process at the target time, and calculates the image sharpness of the image. When the image sharpness of the current image does not meet the search end condition, it continues to predict the target time in the next iteration process according to the adjustment requirement at this time, and obtains the image of the next iteration process at the target time, until the image sharpness of the image in a certain iteration process meets the search end condition to complete the focusing.
[0156] As an example, when applying the method of the present application to achieve autofocus, for the Figure 1A application scenario shown in FIG., the computer uses the Fibonacci search method as the focus search algorithm. After the search starts, each iteration process will send a control signal to the electronic control device according to the calculated adjustment requirement, so that it controls the driving device to adjust the liquid volume of the liquid lens in the microscope. When the computer obtains the image transmitted by the microscope, it uses the Laplace operator to calculate the image sharpness. Then, based on the image sharpness, the target liquid volume of the liquid lens is found through the method of the present application, and the driving device is controlled to adjust the liquid volume of the liquid lens in the microscope to the target liquid volume to complete the focusing process.
[0157] For the Figure 1B application scenario shown in FIG., the computer uses a rule-based focus search algorithm. After the search starts, each iteration process will send a control signal to the electronic control device according to the calculated adjustment requirement, so that it controls the driving device to adjust the liquid volume of the liquid lens in the industrial camera. When the computer obtains the image transmitted by the industrial camera, it uses the Laplace operator to calculate the image sharpness. Then, based on the image sharpness, the target liquid volume of the liquid lens is found through the method of the present application, and the driving device is controlled to adjust the liquid volume of the liquid lens in the industrial camera to the target liquid volume to complete the focusing process.
[0158] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0159] Furthermore, it should be noted that although the steps in the flowchart are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same moment, but can be executed at different moments. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.
[0160] The above embodiments introduce an autofocus method from the perspective of the method flow. The following embodiments introduce an autofocus device from the perspective of virtual modules or virtual units. For details, see the following embodiments.
[0161] The embodiments of this application also provide an autofocus device for implementing the method in the above method embodiments. Figure 5 The following is a schematic structural diagram of an autofocus device provided by the embodiments of this application, as Figure 5 shown. In this embodiment, the autofocus device may include:
[0162] A focusing module 51, configured to complete focusing by adjusting the initial liquid volume of the liquid lens according to the image clarity of the initial image; wherein, the initial image is obtained when the liquid lens is in the initial liquid volume.
[0163] In a possible implementation manner of the embodiments of this application, the adjustment of the liquid lens is implemented through at least one iterative process. Any iterative process includes:
[0164] Adjusting the current liquid volume of the liquid lens according to the image clarity of the current image corresponding to the current liquid volume; wherein, the current liquid volume in the first iterative process is the initial liquid volume, and the current image is the initial image;
[0165] If the image clarity of the target image obtained based on the adjusted liquid volume meets the preset condition, end the adjustment.
[0166] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0167] Adjust the current liquid volume of the liquid lens according to a preset focus search algorithm and the image sharpness of the current image;
[0168] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0169] If the image sharpness of the image obtained based on the adjusted liquid volume satisfies the end search condition of the preset focus search algorithm, end the adjustment.
[0170] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0171] Adjust the current liquid volume of the liquid lens according to the adjustment requirement of the current iteration process; the adjustment requirement includes an adjustment change amount and an adjustment direction, and the adjustment requirement is related to the image sharpness of the image obtained in the previous iteration process and the image sharpness of the current image in the current iteration process.
[0172] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is further configured to:
[0173] For the current iteration process, after adjusting the current liquid volume of the liquid lens, obtain the first image sharpness of the target image in the current iteration process and the second image sharpness of the target image obtained in the previous iteration process;
[0174] Determine whether to readjust the current liquid volume of the liquid lens according to the first image sharpness and the second image sharpness.
[0175] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0176] If the difference between the first image sharpness and the second image sharpness is less than a preset difference threshold, readjust the current liquid volume of the liquid lens.
[0177] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0178] Determine an updated adjustment requirement according to the adjustment requirement; the updated adjustment requirement is related to the first image sharpness and the second image sharpness;
[0179] Readjust the current liquid volume of the liquid lens according to the updated adjustment requirement.
[0180] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is further configured to:
[0181] If the image clarity of the target image obtained based on the adjusted liquid volume meets the preset condition, determine the target liquid volume according to the current liquid volume of the liquid lens;
[0182] Adjust the liquid lens from the current liquid volume to the target liquid volume to complete the focusing.
[0183] In a possible implementation manner of the embodiment of the present application, when the preset focus search algorithm is the Fibonacci search method, the end search condition is: in the current iteration process, the difference between the image clarities corresponding to the two search positions is less than the first preset threshold; wherein, the search positions are different, and the liquid volumes of the liquid lens are different; in each iteration process, the two search positions are determined according to the image clarities corresponding to the two search positions in the previous iteration process.
[0184] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0185] Determine the target search position according to the two search positions in the current iteration process to determine the target liquid volume.
[0186] In a possible implementation manner of the embodiment of the present application, when the preset focus search algorithm is the rule-based search method, the end search condition is: in a preset number of iteration processes after the current iteration process, the image clarity corresponding to the search position becomes smaller; wherein, the search positions are different, and the liquid volumes of the liquid lens are different; in each iteration process, the search step size is determined according to the image clarity of the current image in the previous iteration process.
[0187] In a possible implementation manner of the embodiment of the present application, when the preset focus search algorithm is the hill climbing search method, the end search condition is: in the current iteration process, within the neighborhood range corresponding to the search position, the image clarity corresponding to the search position is the largest; wherein, the search positions are different, and the liquid volumes of the liquid lens are different; in each iteration process, the search step size is determined according to the image clarities corresponding to the search position and other search positions within the neighborhood range.
[0188] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0189] Determine the search position in the current iteration process as the target search position to determine the target liquid volume.
[0190] In a possible implementation manner of the embodiment of the present application, the focusing module 51 is further configured to:
[0191] Predict the target time to complete the adjustment of the current liquid volume of the liquid lens according to the adjustment requirement;
[0192] Obtain the target image at the target time and calculate the image clarity of the target image.
[0193] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0194] Generate a control instruction according to the adjustment requirement;
[0195] Control the driving module to adjust the current liquid volume of the liquid lens according to the control instruction.
[0196] In a possible implementation of the embodiment of the present application, the driving module is a motor or a cylinder.
[0197] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0198] Predict the target time according to the adjustment requirement and the driving speed of the driving module.
[0199] It should be understood that the above device embodiments are illustrative, and the devices of the present application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0200] An electronic device is provided in the embodiment of the present application. Figure 6 As shown in the structural schematic diagram of an electronic device provided in the embodiment of the present application, Figure 6 as shown, Figure 6 The electronic device shown includes a processor 61 and a memory 62. Among them, the processor 61 and the memory 62 are connected, such as connected through a bus 63. Optionally, the electronic device may further include a transceiver 64. It should be noted that in actual applications, the transceiver 64 is not limited to one, and the structure of this electronic device does not constitute a limitation on the embodiments of the present application.
[0201] The processor 61 may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logical blocks, modules, and circuits described in connection with the disclosure of the present application. The processor 61 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0202] The bus 63 may include a path for transmitting information between the above components. The bus 63 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus 63 may be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, Figure 6 only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0203] The memory 62 may be a Read Only Memory (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, or may also be an Electrically Erasable Programmable Read Only Memory (EEPROM), a Compact Disc Read Only Memory (CD-ROM), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0204] The memory 62 is used to store the application program code for implementing the solution of this application, and is controlled by the processor 61 for execution. The processor 61 is used to execute the application program code stored in the memory 62 to implement the content shown in the foregoing method embodiments.
[0205] This application also provides a computer-readable storage medium, which may include: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program code. Specifically, the computer-readable storage medium stores program instructions for implementing the service message processing method in the above embodiments.
[0206] In an embodiment of the present application, a computer program product is further provided, including a computer program, which implements the technical solutions of the foregoing method embodiments when executed by a processor. The implementation principle and technical effects are similar and will not be elaborated here.
[0207] In an embodiment of the present application, an autofocus system is further provided. Figure 7 As shown in the structure schematic diagram of an autofocus system provided by an embodiment of the present application, Figure 7 the system includes an imaging module, the imaging module includes the aforementioned liquid lens, and an electronic device; the electronic device is used to adjust the liquid lens according to the method in any of the foregoing method embodiments until focusing is completed.
[0208] Specifically, the system further includes a driving module, the driving module is connected to the electronic device, and is used to receive a control instruction generated by the electronic device according to the adjustment requirement, and adjust the liquid amount of the liquid lens in response to the control instruction.
[0209] In addition, the system further includes an image acquisition module, the image acquisition module is connected to the electronic device, and is used to acquire the current image after adjusting the liquid amount of the liquid lens, and transmit the current image to the electronic device.
[0210] More specifically, as Figure 7 shown, in this embodiment, both the control instruction and the current image are transmitted in the form of electrical signals. The electronic device is used to send, in the form of electrical signals, a control instruction to the driving module for instructing the driving module to inject or extract liquid into the liquid lens, and the electronic device is also used to send, in the form of electrical signals, a control instruction to the image acquisition module for acquiring the current image. When the image acquisition module receives the optical signal of the imaging module, it captures the current image and transmits the current image to the electronic device in the form of electrical signals.
[0211] As a possible implementation manner, the driving module may specifically include a power supply, a driving board, and a stepping motor. Among them, the power supply is used to provide a stable DC voltage as the working power supply for the driving board. The driving board drives the stepping motor to work by controlling and adjusting the current or voltage, and the stepping motor realizes the liquid amount control of the liquid lens by receiving and transmitting pulse signals, so as to perform continuous and precise optical zoom.
[0212] In addition to the above-mentioned liquid lens, the imaging module may further include a fixed-focus optical lens group for optical imaging. The image acquisition module may specifically include an image sensor, that is, a camera, for receiving the image of the imaging system.
[0213] Optionally, in addition to implementing autofocus control, the electronic device in this embodiment may further provide a graphical interface for the user to view the real-time image to control the image sensor and the driving module, which is not limited in this embodiment.
[0214] In the autofocus system provided by the present application, the electronic device can adjust the liquid volume of the liquid lens based on the autofocus method. Combining the precise control of the liquid volume by the driving module (such as achieving precise adjustment of the liquid volume of the liquid lens through a power supply, a driving board, and a stepping motor), continuous and precise optical zoom can be achieved, enabling the imaging module to accurately focus on the target object, obtaining a clear image, effectively improving the accuracy and precision of focusing, and meeting the high requirements for imaging quality.
[0215] The present application also provides a microscope system. The microscope system includes a microscope applying a liquid lens and an electronic device. The electronic device is used to adjust the liquid volume of the liquid lens according to the method in any of the foregoing method embodiments until focusing is completed. Specifically, as Figure 1A shown, the electronic device is specifically a computer. In addition to the microscope applying the liquid lens and the computer, the microscope system also includes modules such as an electric control device and a driving device. These are not limited in this embodiment and will not be elaborated further.
[0216] The present application also provides an automatic detection system for pipeline products. The automatic detection system for pipeline products includes an industrial camera applying a liquid lens and an electronic device. The electronic device is used to adjust the liquid volume of the liquid lens according to the method in any of the foregoing method embodiments until focusing is completed. Specifically, as Figure 1B shown, the electronic device is specifically a computer. In addition to the industrial camera applying the liquid lens and the computer, the automatic detection system for pipeline products also includes modules such as an electric control device and a driving device. These are not limited in this embodiment and will not be elaborated further.
[0217] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as within the scope described in this specification.
[0218] Those skilled in the art will readily think of other implementation schemes of the present application after considering the specification and practicing the invention disclosed herein. The present application aims to cover any variations, uses, or adaptive changes of the present application. These variations, uses, or adaptive changes follow the general principles of the present application and include common general knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present application are pointed out by the following claims.
[0219] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.
Claims
1. An automatic focusing method, characterized in that: The method is applied to an automatic focusing system based on a liquid lens, and the method comprises: According to the image clarity of the initial image, focusing is completed by adjusting the initial liquid amount of the liquid lens; Wherein, the initial image is acquired when the liquid lens is in the initial liquid volume.
2. The method according to claim 1, characterized in that The adjustment of the liquid lens is achieved through at least one iterative process, and any iterative process includes: According to the image clarity of the current image corresponding to the current liquid volume, the current liquid volume of the liquid lens is adjusted; wherein the current liquid volume in the first iteration process is the initial liquid volume, and the current image is the initial image; If the image clarity of the target image acquired based on the adjusted liquid amount meets the preset condition, the adjustment is ended.
3. The method according to claim 2, characterized in that The step of adjusting the current liquid volume of the liquid lens according to the image clarity of the current image corresponding to the current liquid volume comprises: The current amount of liquid in the liquid lens is adjusted according to a preset focus search algorithm and the image clarity of the current image.
4. The method according to claim 3, characterized in that If the image clarity of the target image acquired based on the adjusted liquid amount meets a preset condition, then the adjustment is ended, including: If the image clarity of the image acquired based on the adjusted liquid amount meets the end search condition of the preset focus search algorithm, the adjustment is ended.
5. The method according to any one of claims 2 to 4, characterized in that: The adjusting the current amount of liquid in the liquid lens comprises: According to the adjustment requirements of the current iteration process, the current liquid volume of the liquid lens is adjusted; the adjustment requirements include the adjustment change amount and the adjustment direction, and the adjustment requirements are related to the image clarity of the image acquired in the previous iteration process and the image clarity of the current image in the current iteration process.
6. The method according to claim 5, characterized in that The method further comprises: For the current iteration process, after adjusting the current liquid amount of the liquid lens, obtaining a first image clarity of the target image of the current iteration process and a second image clarity of the target image obtained in the previous iteration process; According to the first image definition and the second image definition, it is determined whether to readjust the current liquid volume of the liquid lens.
7. The method according to claim 6, characterized in that The step of determining whether to readjust the current liquid volume of the liquid lens according to the first image clarity and the second image clarity comprises: If the difference between the first image clarity and the second image clarity is less than a preset difference threshold, the current liquid volume of the liquid lens is readjusted.
8. The method according to claim 7, characterized in that The step of re-adjusting the current liquid volume of the liquid lens comprises: Determining an update adjustment requirement according to the adjustment requirement; the update adjustment requirement is related to the first image definition and the second image definition; According to the update adjustment requirement, the current liquid volume of the liquid lens is readjusted.
9. The method according to any one of claims 2 to 4, characterized in that: The method further comprises: If the image clarity of the target image acquired based on the adjusted liquid amount meets a preset condition, determining the target liquid amount according to the current liquid amount of the liquid lens; The liquid lens is adjusted from the current liquid volume to the target liquid volume to complete focusing.
10. The method according to claim 9, characterized in that When the preset focus search algorithm is the Fibonacci search method, the end search condition is: in the current iteration process, the difference in image clarity corresponding to two search positions is less than a first preset threshold; wherein, the amount of liquid in the liquid lens is different for different search positions; and in each iteration process, the two search positions are determined based on the image clarity corresponding to the two search positions in the previous iteration process.
11. The method according to claim 10, characterized in that The step of determining a target liquid volume according to a current liquid volume of the liquid lens comprises: The target search position is determined according to the two search positions of the current iteration process to determine the target liquid amount.
12. The method according to claim 9, characterized in that When the preset focus search algorithm is a rule-based search method, the end search condition is: in a preset number of iterations after the current iteration, the image clarity corresponding to the search position becomes smaller; wherein the search position is different and the amount of liquid in the liquid lens is different; in each iteration, the search step is determined according to the image clarity of the current image in the previous iteration.
13. The method according to claim 9, characterized in that When the preset focus search algorithm is based on the hill climbing search method, the end search condition is: in the current iteration process, within the neighborhood range corresponding to the search position, the image clarity corresponding to the search position is the largest; wherein the amount of liquid in the liquid lens is different for different search positions; and in each iteration process, the search step size is determined based on the image clarity corresponding to the search position and other search positions within the neighborhood range.
14. The method according to claim 12 or 13, characterized in that The search position in the current iteration process is determined as the target search position to determine the target liquid amount.
15. The method according to any one of claims 2 to 4, characterized in that: The method further comprises: According to the adjustment requirements, predicting the target time for completing the adjustment of the current liquid volume of the liquid lens; The target image is acquired at the target time, and the image clarity of the target image is calculated.
16. The method according to claim 15, characterized in that The autofocus system includes a driving module; the adjusting the current liquid volume of the liquid lens includes: generating a control instruction according to the adjustment requirement; The driving module is controlled according to the control instruction to adjust the current liquid volume of the liquid lens.
17. The method according to claim 16, characterized in that The driving module is a motor or a cylinder.
18. The method according to claim 16, characterized in that The step of predicting a target time for completing the adjustment of the current liquid volume of the liquid lens according to the adjustment requirement includes: The target time is predicted according to the adjustment requirement and the driving speed of the driving module.
19. An automatic focusing device, characterized in that: The device is applied to an automatic focusing system based on a liquid lens, and the device comprises: A focusing module is used to complete focusing by adjusting the initial liquid volume of the liquid lens according to the image clarity of the initial image; wherein the initial image is obtained when the liquid lens is at the initial liquid volume.
20. An electronic device, characterized in that: The electronic device comprises a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 18.
21. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 18 when executed by a processor.
22. A computer program product, characterized in that The method comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 18.
23. An automatic focusing system, characterized in that: The system includes a liquid lens and an electronic device; the electronic device is used to adjust the liquid lens according to the method described in any one of claims 1 to 18 until focusing is achieved.
24. The system according to claim 23, characterized in that The system further comprises a driving module, which is connected to the electronic device and is used to receive a control instruction generated by the electronic device according to an adjustment requirement, and adjust the liquid amount of the liquid lens in response to the control instruction.
25. The system according to claim 23, characterized in that The system further comprises an image acquisition module, which is connected to the electronic device and is used to acquire a current image after adjusting the amount of liquid in the liquid lens, and transmit the current image to the electronic device.
26. A microscope system, characterized in that: The system includes a microscope using a liquid lens, and an electronic device; the electronic device is used to adjust the amount of liquid in the liquid lens according to the method described in any one of claims 1 to 18 until focusing is achieved.
27. An automatic detection system for assembly line products, characterized in that: The system includes an industrial camera using a liquid lens, and an electronic device; the electronic device is used to adjust the amount of liquid in the liquid lens according to the method described in any one of claims 1 to 18 until focusing is achieved.
Citation Information
Patent Citations
Automatic focusing optical system for bionic human eyes
CN109870750A
Liquid membrane lens combined zoom optical system
CN110187418A
Liquid lens intelligent focusing method and system based on deep reinforcement learning
CN118075611A
Focal length adjusting method and device of electro-hydraulic focusable lens, equipment and medium
CN119136052A