Autofocus method, device, equipment, medium and system
By adjusting the amount of liquid in the liquid lens and adopting a specific search algorithm, the problem of inaccurate focusing caused by loss of the liquid lens is solved, achieving a wider zoom range and higher focusing accuracy.
Patent Information
- Application Number
- CN202510503927.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-04-22
AI Technical Summary
Thin-film liquid lenses experience liquid loss over long periods of use, resulting in inaccurate autofocus control.
By adjusting the amount of liquid in the liquid lens, iterative adjustments are made according to the image clarity of the initial image until the preset conditions are met. The focal position is found using the Fibonacci search method, rule search method, or hill climbing search method, and the driving module is used to achieve precise control of the liquid amount.
It achieves a wider zoom range and higher focus accuracy, reduces the impact of liquid loss on zoom control, and improves the accuracy and flexibility of autofocus.
Smart Images

Figure CN120178397B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to autofocus technology, and in particular to an autofocus method, device, equipment, 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 so that the photographed object is clearly imaged on the imaging plane. It is widely used in various optical equipment such as photography, microscopes, and telescopes.
[0003] Currently, known autofocus imaging systems use thin-film liquid lenses to circumvent the complex structures inherent in mechanical zoom systems. Due to their fast response capabilities, high-precision zoom control, and continuous stepless zoom characteristics, they provide a more flexible and efficient solution for zoom systems.
[0004] However, the above-mentioned thin film liquid lens will experience a certain amount of liquid loss when used for a long time, which is not conducive to achieving precise zoom control and accurate autofocus. Summary of the Invention
[0005] The present application provides an autofocus method, apparatus, device, medium and system for achieving more accurate autofocus.
[0006] In a first aspect, the present application provides an autofocus method, which is applied to an autofocus system based on a liquid lens, and the method comprises:
[0007] Focusing is achieved by adjusting the initial amount of liquid in the liquid lens according to the image clarity of the initial image;
[0008] The initial image is acquired when the liquid lens is in the initial liquid volume.
[0009] In one possible implementation, the adjustment of the liquid lens is achieved through at least one iterative process, and any iterative process includes:
[0010] 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 iteration process is the initial liquid volume, and the current image is the initial image;
[0011] If the image clarity of the target image acquired based on the adjusted liquid amount meets a preset condition, the adjustment is terminated.
[0012] In one possible implementation, adjusting the current liquid volume of the liquid lens according to the image clarity of the current image corresponding to the current liquid volume includes:
[0013] adjusting a current amount of liquid in the liquid lens according to a preset focus search algorithm and image clarity of the current image;
[0014] In one possible implementation, if the image clarity of the target image acquired based on the adjusted liquid amount meets a preset condition, then ending the adjustment includes:
[0015] 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.
[0016] In one possible implementation, adjusting the current amount of liquid in the liquid lens includes:
[0017] Adjust the current liquid volume of the liquid lens according to the adjustment requirements of the current iterative process; 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 obtained in the previous iterative process and the image clarity of the current image in the current iterative process.
[0018] In one possible implementation, the method further includes:
[0019] For a current iteration process, after adjusting the current amount of liquid in the liquid lens, obtaining a first image clarity of a target image of the current iteration process and a second image clarity of a target image obtained in a previous iteration process;
[0020] It is determined whether to readjust a current liquid volume of the liquid lens according to the first image definition and the second image definition.
[0021] In one possible implementation, determining whether to readjust a current amount of liquid in the liquid lens according to the first image clarity and the second image clarity includes:
[0022] If the difference between the first image clarity and the second image clarity is smaller than a preset difference threshold, the current liquid volume of the liquid lens is readjusted.
[0023] In one possible implementation, the readjusting the current liquid volume of the liquid lens includes:
[0024] determining an update adjustment requirement according to the adjustment requirement, wherein the update adjustment requirement is related to the first image definition and the second image definition;
[0025] According to the update adjustment requirement, the current liquid volume of the liquid lens is readjusted.
[0026] In one possible implementation, the method further includes:
[0027] If the image clarity of the target image obtained 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;
[0028] The liquid lens is adjusted from the current liquid volume to the target liquid volume to complete focusing.
[0029] In one possible implementation, when the preset focus search algorithm is the Fibonacci search method, the search termination condition is: during the current iteration, 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 during each iteration, the two search positions are determined based on the image clarity corresponding to the two search positions in the previous iteration.
[0030] In one possible implementation, determining the target liquid volume according to the current liquid volume of the liquid lens includes:
[0031] A target search position is determined according to the two search positions in the current iteration process to determine the target liquid amount.
[0032] In one possible implementation, when the preset focus search algorithm is a rule-based search method, the search end condition is: in a preset number of iterations after the current iteration, the image clarity corresponding to the search position becomes smaller; wherein, the amount of liquid in the liquid lens is different for different search positions; and in each iteration, the search step size is determined based on the image clarity of the current image in the previous iteration.
[0033] In one possible implementation, when the preset focus search algorithm is based on a hill climbing search method, the search end condition is: during the current iteration, within the neighborhood 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; during each iteration, the search step size is determined based on the image clarity corresponding to the search position and other search positions within the neighborhood.
[0034] In a possible implementation manner, the search position in the current iteration process is determined as the target search position to determine the target liquid amount.
[0035] In one possible implementation, the method further includes:
[0036] Predicting a target time for completing adjustment of the current liquid volume of the liquid lens according to the adjustment requirements;
[0037] The target image is acquired at the target moment, and the image clarity of the target image is calculated.
[0038] In one possible implementation, the autofocus system includes a driving module; and adjusting the current liquid amount of the liquid lens includes:
[0039] generating a control instruction according to the adjustment requirement;
[0040] The driving module is controlled according to the control instruction to adjust the current liquid amount of the liquid lens.
[0041] In one possible implementation, the driving module is a motor or a cylinder.
[0042] In one possible implementation, predicting a target time for completing adjustment of a current liquid amount of the liquid lens according to an adjustment requirement includes:
[0043] The target time is predicted 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, comprising:
[0045] A focusing module is used to achieve focusing by adjusting an initial liquid volume of the liquid lens according to the image clarity of an 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, comprising 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 as described in any one of the first aspects.
[0049] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method as described in any one of the first aspects.
[0050] In a fifth aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method as described in any one of the first aspects.
[0051] In a sixth aspect, the present application provides an autofocus system, which 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 the first aspects until focusing is completed.
[0052] In a seventh aspect, the present application provides a microscope system, which 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 the first aspects until focusing is achieved.
[0053] In an eighth aspect, the present application provides an automatic detection system for assembly line products, the system comprising 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 the first aspects until focusing is completed.
[0054] The present application provides an autofocus method, apparatus, device, medium and system for realizing autofocus of a liquid lens. The autofocus method of the present application can be executed by any electronic device. When the autofocus method of the present application is applied to realize autofocus, the electronic device completes focusing by adjusting the initial liquid amount 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 amount. In this process, the electronic device realizes zooming by changing the amount of liquid 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, which is conducive to improving the focusing accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0056] Figure 1A Schematic diagram 1 of an application scenario of an auto-focus method provided in an embodiment of the present application;
[0057] Figure 1B Schematic diagram 2 of an application scenario of an autofocus method provided in an embodiment of the present application;
[0058] Figure 2A Schematic diagram 1 of a flow chart of an auto-focusing method provided in an embodiment of the present application;
[0059] Figure 2B Schematic diagram 1 of a flow chart of an auto-focusing method provided in an embodiment of the present application;
[0060] Figure 3A Schematic diagram 1 of the relationship between an evaluation value and a search position provided in an embodiment of the present application;
[0061] Figure 3B A graph showing changes in evaluation values for the same search location at different times, provided in an embodiment of the present application;
[0062] Figure 3C A second schematic diagram of the relationship between an evaluation value and a search position provided in an embodiment of the present application;
[0063] Figure 3D Schematic diagram 2 of a flow chart of an auto-focusing method provided in an embodiment of the present application;
[0064] Figure 3E Schematic diagram 2 of a flow chart of an auto-focusing method provided in an embodiment of the present application;
[0065] Figure 4A Schematic diagram 3 of a flow chart of an auto-focusing method provided in an embodiment of the present application;
[0066] Figure 4B Schematic diagram 3 of a flow chart of an auto-focusing method provided in an embodiment of the present application;
[0067] Figure 5 A schematic structural diagram of an autofocus device provided in an embodiment of the present application;
[0068] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0069] Figure 7 A schematic structural diagram of an autofocus system provided in an embodiment of the present application.
[0070] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0071] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0072] An autofocus imaging system is a device or technical system that automatically adjusts the focal length of an optical system to produce a clear image of the subject on the imaging plane. It is widely used in a variety of optical devices, including photography, microscopes, and telescopes. Specifically, current optical autofocus systems primarily utilize liquid lenses and mechanical optical lens assemblies.
[0073] Among them, the automatic focusing technology of mechanical optical lens systems mainly changes the focal length of the entire lens system by moving one or more lenses in the lens system. 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 systems is relatively mature, its limitations are gradually becoming apparent with the development of science and technology and the continuous improvement of the performance requirements of optical instruments. For example, mechanical zoom requires a complex mechanical structure and control system, resulting in a large and heavy 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-immersion liquid lenses, to overcome the limitations of mechanical zoom.
[0074] An electrowetting liquid lens is a focus-adjustable lens based on the principle of electrowetting. Its operating 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, thereby achieving a change in refractive power, or focal length. This technology avoids the complexity and size limitations of traditional mechanical zoom systems, offering advantages such as fast response, high precision, and continuous zoom. Electrowetting liquid lens technology has made significant progress and has been applied in various fields, including mobile phone camera modules, industrial cameras, microscopes, micro-projectors, and AR / VR. However, it also has some significant drawbacks. First, its zoom range is limited: While electrowetting liquid lenses can achieve continuous focal length adjustment, this range can be limited by factors such as the liquid properties, dielectric layer material, and applied voltage. In some applications, it may not be able to meet the requirements of a wide zoom range. Second, its driving voltage requirement is high: to achieve an effective electrowetting effect, a high driving voltage is generally required. This not only increases system complexity and cost but also may affect the lifespan and stability of the lens. In addition, although the electro-immersion liquid lens has poor adaptability to the environment, its usage scenarios are limited.
[0075] Compared to electro-immersion liquid lenses, thin-film liquid lenses offer significant advantages, particularly in their significantly expanded achievable aperture range. Specifically, while electro-immersion liquid lenses struggle to achieve apertures exceeding 10mm, thin-film liquid lenses can achieve apertures of 100mm, significantly expanding the application scenarios of thin-film lenses.
[0076] Furthermore, thin-film liquid lenses not only offer a wider focal length adjustment range but also avoid the complex structures inherent in mechanical zoom systems. Their rapid response, high-precision zoom control, and continuous, stepless zoom capabilities provide a more flexible and efficient solution for zoom systems.
[0077] However, the above-mentioned thin-film liquid lens will experience a certain amount of liquid loss when used for a long time, which is not conducive to accurate autofocusing.
[0078] Therefore, the present application provides an autofocus method, apparatus, device, medium, and system for solving the above-mentioned problems. Specifically, the autofocus method of the present application can be performed by any electronic device, which achieves focusing by adjusting the initial amount of liquid in the liquid lens based on the image clarity of the initial image. It should be understood that the liquid lens referred to in the present application is specifically a thin-film liquid lens.
[0079] In the above process, the electronic device achieves zoom by changing the amount of liquid in the liquid lens under 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 the zoom control accuracy being affected by the loss of liquid in the liquid lens, which is conducive to accurate autofocus.
[0080] It is understandable that the method of the present application is applicable to any scenario where liquid lens focusing is required. For example, Figure 1A Schematic diagram 1 of an application scenario of an auto-focus method provided in an embodiment of the present application, such as Figure 1A As shown, the method of the present application can be used in the focusing scenario of a microscope system using 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 As 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 captures an image of the object on the stage and transmits the captured image to a computer. The computer calculates the image clarity and, based on the image clarity, transmits instructions to an electronic control device using the method of the present application for controlling a drive device to input or extract corresponding liquid into or from a liquid lens in the microscope, thereby continuously zooming until the object on the stage is in focus.
[0082] Through this process, the computer can adjust the amount of liquid in the microscope's liquid lens to achieve focus. This not only expands the zoom range and makes it more flexible, but also prevents the loss of liquid during the focusing process from affecting zoom control accuracy, thus facilitating precise focusing.
[0083] Figure 1B Schematic diagram 2 of an application scenario of an auto-focus method provided in an embodiment of the present application, such as Figure 1BAs shown, the method of the present application is applicable to an automated inspection 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, with the output of the electronic control device connected to the input of the drive device, which in turn is connected to the output of the computer, which in turn is connected to the output of an industrial camera using a liquid lens. The industrial camera in this automated inspection system for assembly line products is used to sequentially capture images of product 1, product 2, product 3, and so on, as they progress through a certain processing stage on the assembly line, for use in subsequent quality analysis and other processes.
[0084] On this basis, before an industrial camera captures an image of any product on the assembly line, it first transmits the captured image to a computer. The computer calculates the image clarity and, based on the image clarity, transmits instructions to an electronic control device using the method of the present application to control a drive device to input or extract corresponding liquid into or out of the liquid lens in the microscope, thereby continuously zooming until the product is in focus.
[0085] Through this process, a computer can adjust the amount of liquid in the industrial camera's liquid lens to achieve focus. This not only expands the zoom range and makes it more flexible, but also prevents loss of liquid during the focusing process from affecting zoom control accuracy, thus facilitating precise focusing.
[0086] It is understood that in the above examples, the electronic control device can be independently provided or integrated into the computer, and this is not limited in this embodiment. When the electronic control device is independently provided, it communicates with the computer via wireless or wired means. Similarly, the electronic control device communicates with the drive device via wireless or wired means.
[0087] This application provides an autofocus method for use in a liquid lens-based autofocus system, which can be performed by any electronic device. The following describes some implementations of the autofocus method of this application in detail, in conjunction with the accompanying drawings. The following embodiments and features thereof may be combined with each other unless they conflict.
[0088] This 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 by 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 captures an initial image of the liquid lens when it is at an initial liquid volume and calculates the image clarity of the initial image. Specifically, the initial image may be captured by the electronic device from an imaging module of an autofocus system. This initial image is image data directly captured by the imaging module's sensor without any post-processing (such as noise reduction, color correction, or sharpening). 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 or digital signal.
[0092] Furthermore, the electronic device may use an image clarity calculation method such as a gradient-based method, a frequency-domain-based method, an energy gradient-based method, or a wavelet transform-based method to calculate the image clarity of the initial image.
[0093] In practical applications, the initial image may also be obtained by the electronic device from the image acquisition module of the autofocus system, which is an image obtained by the sensor of the image acquisition module by photographing the object to be measured at that time. This is not limited in this embodiment.
[0094] It is 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 the present application, and it should be understood that the liquid volume is a non-zero value. The electronic device specifically starts to execute the autofocus method of the present application when it receives a focus instruction triggered by the user. For example, in a scenario where a sample is observed under a microscope, the user sends a focus instruction by operating the control button of the microscope; in a camera photo-taking scenario, the user half-presses the shutter button to trigger the camera's autofocus function and thereby sends a focus instruction; in an imaging system for industrial inspection, the user clicks a dedicated focus button on the control terminal to issue a focus instruction.
[0095] In actual applications, electronic devices can also automatically and timedly trigger focus instructions according to the configuration. For example, for industrial automation detection scenarios, electronic devices execute 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 amount state, if the image clarity of the image at this time meets the preset image clarity, or the corresponding image clarity is the optimal image clarity within the focusing range, or meets the specific requirements of the imaging system and other conditions of the application scenario, the focusing is considered to be completed.
[0097] Therefore, in this embodiment, the electronic device specifically determines whether the initial liquid volume of the liquid lens needs to be adjusted, and how to adjust the initial liquid volume of the liquid lens, by judging the image clarity of the initial image. More specifically, if the image clarity of the initial image does not meet the requirements and the initial liquid volume of the liquid lens is adjusted, it is necessary to obtain a new image and, based on the image clarity of the new image, determine whether the liquid volume of the liquid lens needs to be adjusted. If not, it is determined that focusing is complete.
[0098] As a possible implementation, in this embodiment, the adjustment of the liquid lens is achieved through at least one iterative process. Specifically, Figure 2B A flowchart of an automatic focusing method according to an embodiment of the present application is shown in FIG. Figure 2B As shown, in this embodiment, any iterative process includes:
[0099] The current liquid volume of the liquid lens is adjusted according to the image clarity of the current image corresponding to the current liquid volume; wherein, the current liquid volume of 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 obtained based on the adjusted liquid volume meets the preset conditions, the adjustment is ended.
[0100] Furthermore, when the image clarity of the target image obtained based on the adjusted liquid amount meets a preset condition, the electronic device determines a target liquid amount based on the current liquid amount in the liquid lens. Finally, the electronic device adjusts the liquid amount in the liquid lens to the target liquid amount and ends the adjustment.
[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 conditions, the electronic device executes the next iterative process until the image clarity of the target image obtained based on the adjusted liquid amount meets the preset conditions, and then ends the adjustment to complete the focusing.
[0102] In this embodiment, the electronic device adjusts the liquid lens through at least one iterative process, which automatically adjusts the amount of liquid in the liquid lens based on changes in the actual shooting scene. For example, when the distance to the subject changes or lighting conditions change, the iterative process can quickly adapt to these changes and readjust the amount of liquid required for focusing, ensuring that images with image clarity that meets preset conditions are always obtained, thereby enhancing the adaptability and robustness of the autofocus method of this application.
[0103] It should be understood that in this embodiment, for the first iteration, the current liquid volume specifically refers to the initial liquid volume mentioned above, and the current image specifically refers to the initial image mentioned above. For each iteration, if the image clarity of the current image corresponding to the current liquid volume does not meet a preset condition, the current liquid volume of the liquid lens is adjusted. If the image clarity of the current image corresponding to the current liquid volume meets a preset condition, a target liquid volume is determined based on the current liquid volume of the liquid lens, and the liquid volume of the liquid lens is adjusted to the target liquid volume before the adjustment is completed to achieve focusing.
[0104] The current image is obtained by the electronic device through 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 be referred to the description of the above content and will not be repeated here.
[0105] More specifically, in this embodiment, the electronic device adjusts the current liquid volume of the liquid lens based on a preset focus search algorithm and the image clarity of the current image. Accordingly, the electronic device ends the adjustment when the image clarity of the image acquired based on the adjusted liquid volume satisfies the end search condition of the preset focus search algorithm.
[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 amount meets the end search condition of the preset focus search algorithm, the focus position is considered to be 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] Based on this, as a design, in this embodiment, the preset focus search algorithm can be a Fibonacci search method. In this case, the search termination condition is: during the current iteration, the difference in image clarity between two search positions is less than a first preset threshold; different search positions correspond to different liquid volumes in the liquid lens; and during each iteration, the two search positions are determined based on the image clarity of the two search positions during the previous iteration. Accordingly, the electronic device determines the target search position based on the two search positions during the current iteration to determine the target liquid volume.
[0109] Specifically, for each iterative process, the electronic device first obtains the maximum search interval and the Fibonacci sequence corresponding to the maximum search interval, then determines the two search positions of the current iterative process based on the maximum search interval and the Fibonacci sequence, and adjusts the current liquid amount of the liquid lens according to the two search positions, and finally obtains the image clarity of the current image corresponding to the two adjustments. When the image clarity of the two current images meets the search end condition, the target search position is determined according to the corresponding two search positions to determine the target liquid amount; when the image clarity of the two current images does not meet the search end condition, the liquid amount of the liquid lens is adjusted according to the image clarity of the two current images and the current liquid amount of the liquid lens.
[0110] It should be understood that the maximum search interval of the first iteration process can be the maximum zoom range of the liquid lens, which is specifically determined by the maximum change in the liquid volume of the liquid lens. The maximum search interval 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, the two search positions are averaged 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. In this case, the search end condition is: in a preset number of iterations after the current iteration, the image clarity corresponding to the search position becomes smaller; wherein, the amount of liquid in the liquid lens is different for different search positions; in each iteration, the search step size is determined according to the image clarity of the current image in the previous iteration.
[0113] Accordingly, the electronic device determines the search position in the current iteration process as the target search position to determine the target liquid amount.
[0114] Specifically, for each iteration, the electronic device first obtains the image clarity of the current image from the previous iteration and determines the search step size for the current iteration accordingly. It then adjusts the current liquid volume of the liquid lens based on the determined search step size, changing its focal length to obtain the current image. Finally, it calculates the image clarity of the current image and determines whether the image clarity corresponding to the search position decreases over a preset number of iterations following the current iteration. If this search termination condition is met, focusing is considered complete, the search position in the current iteration 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 clarity of the current image obtained from the current iteration is used as the basis for determining the search step size for the next iteration, and the next iteration continues.
[0115] As another design, in this embodiment, the preset focus search algorithm can also be based on the hill climbing search method, and the search end 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; in each iteration process, the search step size is determined according to the image clarity corresponding to the search position and other search positions in the neighborhood range.
[0116] Specifically, for each iteration, the electronic device first determines the current search position and obtains the image clarity corresponding to the search position and other search positions within the neighborhood. This is used to determine the search step size for this iteration, that is, the amplitude of the change in the liquid volume of the liquid lens is determined based on the clarity of each position. Then, the current liquid volume of the liquid lens is adjusted based on the determined search step size, thereby changing its focal length, causing the focal position of the imaging system to change, and obtaining a new current image at this time. Finally, the image clarity of the newly obtained current image is calculated to determine whether the image clarity corresponding to the search position is the maximum within its neighborhood during the current iteration. If this search end condition is met, it can be considered that focus is achieved, the search position in the current iteration 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 clarity of the current search position and each position within the neighborhood is used as the basis for determining the search step size for the next iteration, and the next iteration is continued.
[0117] As can be seen from the above, this embodiment employs a preset focus search algorithm and utilizes liquid volume adjustment in the liquid lens to achieve autofocus. By dynamically adjusting the search strategy and step size, the optimal focus position can be quickly and accurately determined to ensure image clarity and focus accuracy. Furthermore, each iteration, based on the preset focus search algorithm, considers the image clarity of other images within the entire search range, reducing the requirements for variables other than focal length that can affect image clarity.
[0118] In addition, this embodiment provides a variety of preset focus search algorithms. The electronic device can choose to use any of the preset focus search algorithms to adjust the liquid amount of the liquid lens according to specific needs, thereby ensuring the flexibility and adaptability of the method.
[0119] In this embodiment, for each of the aforementioned iterations, the electronic device adjusts the current amount of liquid in the liquid lens based on the adjustment requirements of the current iteration. The adjustment requirements include the amount of adjustment change and the direction of adjustment, and the adjustment requirements are related to the image clarity of the image acquired in the previous iteration and the image clarity of the current image in the current iteration.
[0120] It's understandable that because image clarity is related to the focal length of the liquid lens, and the amount of liquid directly affects that focal length, by determining the adjustment requirements based on both the image clarity of the image acquired in the previous iteration and the image clarity of the current image in the current iteration, the electronic device can clearly determine whether to increase or decrease the liquid volume (i.e., the direction of adjustment) and the magnitude of the adjustment (i.e., the amount of change). This continuous iterative adjustment based on image clarity feedback can gradually optimize the focal length of the liquid lens, achieving precise focus and ultimately producing higher-definition, higher-quality images.
[0121] In practical applications, the electronic device can also be configured with an image clarity threshold. Based on this, the pre-set condition during the iteration process is that the image clarity is greater than the image clarity threshold. Specifically, during each iteration, 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 amount of liquid in the liquid lens.
[0122] It should be understood that the electronic device is configured with multiple image clarity thresholds obtained under different other variable conditions, including factors that affect image clarity, such as lighting conditions and image characteristics. When automatically focusing the liquid lens, the electronic device obtains the corresponding image clarity threshold based on the current other variable conditions and uses this image clarity threshold in each iteration.
[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 a preset adjustment requirement, or it can determine the adjustment requirement in this iteration process based on the image clarity of the image in the previous iteration process, and use it to adjust the liquid volume of the liquid lens to ensure adjustment flexibility. This is not limited in this embodiment.
[0124] It is understandable that, as another possible implementation method, the electronic device can also adjust the initial liquid volume of the liquid lens directly 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 state of the liquid lens under different liquid volumes, the imaging module is used to obtain corresponding images, and the image clarity of these images is calculated, while recording the liquid volume of the liquid lens during each measurement. By analyzing and arranging a large amount of experimental data, a mapping relationship between liquid volume and image clarity is established. The mapping relationship can be in a simple tabular form or a formula obtained by fitting a data function, which is not limited in this embodiment. On this basis, the electronic device first obtains the required image clarity, and then obtains the target liquid volume corresponding to the image clarity according to the mapping relationship.
[0125] As another possible implementation method, 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 the network model; specifically, when the network model is trained, when the parameters of the liquid lens are input, the corresponding target liquid volume is output as the training target.
[0126] It should be understood that the pre-set mapping relationship or network model used in the above process should ensure that other variables that may affect image clarity in the current adjustment process, such as lighting conditions, are consistent with other variables applied when obtaining the mapping relationship or network model to ensure the accuracy of the target liquid amount.
[0127] In the method provided in this embodiment, the electronic device captures an initial image when the liquid lens is at an initial liquid level and adjusts the liquid level based on the image clarity to achieve focusing. This method leverages the liquid lens's rapid response and high-precision adjustment characteristics while avoiding the inaccurate zoom control caused by liquid loss, thereby achieving efficient and accurate focusing. This method can rapidly adjust the focal length under varying initial conditions, ensuring optimized image clarity. This improves the speed and accuracy of the autofocus system, while simplifying the focusing mechanism and making it suitable for a variety of applications requiring fast focusing.
[0128] In addition, the method of this embodiment achieves zooming by adjusting the amount of liquid in the liquid lens, effectively improving the flexibility of the zoom range.
[0129] It is understandable that for the same search position, the electronic device controls the image acquisition module or imaging module to capture images at different times, which may be slightly different. This causes the image clarity to fluctuate slightly, thus affecting the accuracy of the focus search. The following will illustrate the specific situation with reference to the accompanying drawings, where: Figure 3AA schematic diagram of the relationship between evaluation value and search position provided in an embodiment of the present application is shown in FIG1 . Figure 3B This is a graph showing changes in evaluation values of the same search location at different times, provided in an embodiment of the present application. Figure 3C Schematic diagram 2 of the relationship between evaluation value and search position provided in an embodiment of the present application.
[0130] like Figure 3A As shown in FIG, in an ideal state, when the liquid lens is in different search positions, the image clarity of the corresponding image changes smoothly. However, in actual applications, for any focusing process, such as actual search process 1 or actual search process 2, the image clarity of the corresponding image does not change smoothly when the liquid lens is in different search positions. That is, the change in image clarity at different search positions fluctuates.
[0131] In addition, if Figure 3B As shown, for different focusing processes, such as actual search process 1 or actual search process 2, when the electronic device is at the same search position of the liquid lens, the image clarity of the image obtained may be different. Figure 3C As shown, for any focusing process, such as the actual search process 2, the image clarity of the image acquired by the electronic device when the liquid lens is at different search positions may be the same.
[0132] Therefore, the present application also provides a method embodiment for avoiding erroneous searches caused by the above-mentioned situation, thereby further improving focusing accuracy. Figure 3D This is a flow chart of an automatic focusing method provided in an embodiment of the present application. Based on the above embodiment, this embodiment of the present application further describes the iterative process in the above embodiment in detail. Figure 3D As shown, the method of this embodiment includes:
[0133] S301 , for a current iteration process, after adjusting the current liquid amount of the liquid lens, obtaining a first image clarity of a target image of the current iteration process and a second image clarity of a target image obtained in a previous iteration process.
[0134] S302: Determine whether to readjust the current liquid volume of the liquid lens according to the first image clarity and the second image clarity.
[0135] In this embodiment, for any iterative process, after adjusting the current liquid amount of the liquid lens, the electronic device compares the first image clarity of the target image obtained in the current iterative process with the second image clarity of the target image obtained in the previous iterative process to determine whether the current iterative process needs to be re-searched.
[0136] Through the above settings, this method can effectively avoid false searches when complex situations occur, such as slight fluctuations in image clarity caused by capturing images at different times at the same search position, uneven changes in image clarity at different search positions, different image clarity at the same search position in different focusing processes, and the same image clarity at different search positions in any focusing process.
[0137] Specifically, the first image clarity of the target image in the current iteration is compared with the second image clarity of the target image in the previous iteration. This allows the electronic device to determine whether the current adjustment direction and results are reasonable based on the image clarity change trend between the two consecutive iterations. If the change in clarity between the two iterations does not conform to the expected focus optimization direction, the electronic device can promptly detect possible mis-search and determine whether the current liquid level in the liquid lens should be readjusted.
[0138] This can avoid the mistaken assumption that the optimal focus position has been reached due to fluctuations and uncertainties in image clarity, thereby further improving focus accuracy and enabling the imaging module to focus more accurately, obtaining clearer, higher-quality images. It also enhances the stability and reliability of the imaging module in complex practical application scenarios, improves the imaging module's ability to resist interference from various interference factors, ensures the effectiveness and accuracy of the focus operation, and optimizes the entire focus process and imaging effect.
[0139] Specifically, when the difference between the clarity of the first image and the clarity of the second image is less than a preset threshold, it means that the fluctuation of the image clarity cannot be ignored, indicating that the current adjustment has not caused a significant and expected change in the diagonal effect, and there may be a misjudgment or an undesirable focusing state. Therefore, in this embodiment, the electronic device specifically readjusts the current liquid amount of the liquid lens when the difference between the clarity of the first image and the clarity of the second image is less than a preset difference threshold.
[0140] More specifically, the electronic device determines an update adjustment requirement based on the adjustment requirement; the update adjustment requirement is related to the first image clarity and the second image clarity; and the current liquid volume of the liquid lens is readjusted according to the update adjustment requirement.
[0141] In this embodiment, since the first image clarity and the second image clarity reflect the results of adjustments made during the current and previous iterations, analyzing the relationship between the two to determine the need for an update adjustment facilitates a more accurate understanding of the changing trend of image clarity and the current focus state. For example, if the clarity of the first image is not significantly improved compared to the clarity of the second image, and the difference is less than a preset difference threshold, the electronic device may determine that the current adjustment may be insufficient or that the adjustment direction is deviating. Based on this, the electronic device may determine the need for an update adjustment, which may include increasing or decreasing the amount of adjustment change, as well as changing the adjustment direction (e.g., from increasing the amount of liquid to decreasing the amount of liquid).
[0142] Furthermore, the electronic device readjusts 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 that is more likely to achieve precise focus, avoiding incorrect focus judgments due to fluctuations and subtle changes in image clarity.
[0143] Based on the method of this embodiment, Figure 3E A flowchart diagram of an automatic focusing method according to an embodiment of the present application is shown in FIG. Figure 3E As shown, for any iterative process, when the electronic device calculates the first image clarity of the target image of the current iterative process, it obtains the second image clarity of the target image of the previous iterative process and determines the difference between the two. When the difference is less than the preset difference threshold, it determines the update adjustment requirement and continues to adjust the liquid amount of the liquid lens according to the update adjustment requirement until the difference between the first image clarity of the target image of the current iterative process and the second image clarity of the target image of the previous iterative process is not less than the preset difference threshold. It is determined whether the search end condition is met. If so, the focusing is completed. Otherwise, the next iterative process is executed until the search end condition is met.
[0144] The present application also provides a method embodiment, which is applied to scenarios where the focus accuracy requirement is not high. Figure 4A This is a flow chart of an automatic focusing method provided in the embodiment of the present application. Based on the above embodiment, the embodiment of the present application explains in detail how to adjust the amount of liquid. Figure 4A As shown, the method of this embodiment includes:
[0145] S401 , predicting a target time for completing adjustment of the current liquid volume of the liquid lens according to adjustment requirements.
[0146] S402: Acquire a target image at a target time, and calculate the image clarity of the target image.
[0147] Specifically, during each iteration, the electronic device determines the target position according to the adjustment requirements, predicts the target moment when the current liquid amount of the liquid lens is adjusted to the liquid amount corresponding to the target position, and controls the image acquisition module or imaging module to obtain the target image at this time, and then calculates the image clarity of the target image.
[0148] The aforementioned setup of predicting the target moment before capturing images and calculating sharpness effectively improves focusing efficiency, reduces ineffective image acquisition and analysis, and optimizes the performance of the imaging module. Furthermore, by accurately calculating the target moment, focusing errors caused by improper image acquisition timing are effectively reduced, ensuring the stability and reliability of the method. This allows the imaging module to better adapt to different shooting scenarios and requirements, providing a strong guarantee for obtaining high-quality images.
[0149] It should be understood that the autofocus system described in this application includes a driver module. Based on this module, the electronic device generates control instructions based on the adjustment requirements when adjusting the liquid level in the liquid lens. The control instructions control the driver module to adjust the current liquid level in the liquid lens. Specifically, the driver module is a motor or a cylinder.
[0150] As can be seen from the above, in this embodiment, the electronic device achieves precise control of the liquid level in the liquid lens by controlling the driver module. The electronic device generates control instructions based on the adjustment requirements, and the driver module executes these instructions, thereby dynamically adjusting the liquid level in the liquid lens. This architecture enables the autofocus system to quickly respond to focusing requirements, providing highly precise and stable liquid level adjustment, thereby ensuring image clarity during use.
[0151] In addition, the driving module can specifically be a motor or a cylinder, that is, the method of this embodiment does not limit the structure of the autofocus system. As long as the amount of liquid in the liquid lens can be changed, flexible zooming can be achieved, which ensures the flexibility and wide application of the method of this embodiment.
[0152] More specifically, based on the aforementioned drive module, the electronic device, when predicting the target time, predicts the target time based on the adjustment requirements and the drive speed of the drive module. For example, when the drive module is a motor, the electronic device, when determining the target position, estimates the target time for reaching the target position based on the motor's speed and the relationship between the current position and the target position.
[0153] With this arrangement, during the focus position search process, the imaging module or image acquisition module no longer needs to wait for the driver module to come to a standstill before capturing an image. Instead, the image can be captured immediately upon reaching a target time determined based on the driver module's driving speed. When combined with the aforementioned preset focus search algorithm, this significantly reduces search time and improves search speed.
[0154] It is understandable that although the position accuracy obtained by calculation decreases, which may affect the accuracy of the final focus search, for autofocus systems with low precision requirements, such as autofocus systems with a large depth of field, the system's large depth of field can compensate for this loss of precision, so that the focusing effect is still good.
[0155] Based on the method of this embodiment, Figure 4B A flowchart diagram of an automatic focusing method provided in an embodiment of the present application is shown in FIG. Figure 4B As shown, for each iterative process, after determining the adjustment requirements, the electronic device predicts the target moment according to the adjustment requirements, obtains the image of the current iterative process at the target moment, and calculates the image clarity of the image. When the current image clarity does not meet the search end condition, it continues to predict the target moment of the next iterative process according to the adjustment requirements at this time, and obtains the image of the next iterative process at the target moment, until the image clarity of the image of a certain iterative process meets the search end condition. The focusing is completed.
[0156] As an example, when the method of the present application is applied to realize automatic focusing, for example Figure 1A In the application scenario shown, the computer uses the Fibonacci search method as a focus search algorithm. After the search begins, each iteration sends a control signal to the electronic control device based on the calculated adjustment requirements, causing it to control the drive device to adjust the liquid volume in the liquid lens of the microscope. When the computer obtains the image transmitted by the microscope, it uses the Laplace operator to calculate the image clarity. Then, based on this image clarity, the target liquid volume of the liquid lens is determined using the method of this application, and the drive device is controlled to adjust the liquid volume in the liquid lens of the microscope to the target liquid volume to complete the focusing process.
[0157] For Figure 1B In the application scenario shown, a computer uses a rule-based focus search algorithm. After the search begins, each iteration sends a control signal to the electronic control device based on the calculated adjustment requirements, causing it to control the drive device to adjust the liquid volume of the liquid lens in the industrial camera. When the computer acquires the image transmitted by the industrial camera, it uses the Laplace operator to calculate the image clarity. Based on this image clarity, the method of this application is then used to determine the target liquid volume of the liquid lens, and the drive 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 aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all optional embodiments, and the actions and modules involved are not necessarily required by this application.
[0159] It should be further noted that, although the various steps in the flowchart are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps may be performed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but may be performed at different times. The execution order of these sub-steps or stages is not necessarily to be performed in sequence, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0160] The above embodiments introduce an auto-focusing method from the perspective of method flow. The following embodiments introduce an auto-focusing device from the perspective of a virtual module or a virtual unit. Please refer to the following embodiments for details.
[0161] The embodiment of the present application also provides an autofocus device for implementing the method in the above method embodiment. Figure 5 This is a structural diagram of an auto-focusing device provided in an embodiment of the present application, such as Figure 5 As shown, in this embodiment, the automatic focusing device may include:
[0162] The focusing module 51 is used to achieve 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.
[0163] In a possible implementation of the embodiment of the present application, the adjustment of the liquid lens is achieved through at least one iterative process, and 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 iteration process is the initial liquid volume, and the current image is the initial image;
[0165] If the image clarity of the target image acquired based on the adjusted liquid amount meets a preset condition, the adjustment is terminated.
[0166] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0167] Adjusting the current liquid volume of the liquid lens according to a preset focus search algorithm and the image clarity of the current image;
[0168] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0169] 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.
[0170] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0171] 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 obtained in the previous iteration process and the image clarity of the current image in the current iteration process.
[0172] In a possible implementation 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 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;
[0174] It is determined whether to readjust a current liquid amount of the liquid lens according to the first image clarity and the second image clarity.
[0175] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0176] 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.
[0177] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0178] Determining an update adjustment requirement according to the adjustment requirement; the update adjustment requirement is related to the first image clarity and the second image clarity;
[0179] Readjust the current liquid volume of the liquid lens according to update and adjustment requirements.
[0180] In a possible implementation 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 amount meets a preset condition, determining the target liquid amount according to the current liquid amount 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 of an embodiment of the present application, when the preset focus search algorithm is the Fibonacci search method, the search termination condition is: during the current iteration, the difference in image clarity corresponding to the 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; during each iteration, the two search positions are determined based on the image clarity corresponding to the two search positions in the previous iteration.
[0184] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0185] A target search position is determined based on the two search positions of the current iteration process to determine the target liquid amount.
[0186] In a possible implementation of an embodiment of the present application, when the preset focus search algorithm is a rule-based search method, the search termination condition is: in a preset number of iterations after the current iteration, the image clarity corresponding to the search position becomes smaller; wherein, the amount of liquid in the liquid lens is different for different search positions; in each iteration, the search step size is determined based on the image clarity of the current image in the previous iteration.
[0187] In a possible implementation of an embodiment of the present application, when the preset focus search algorithm is based on the hill climbing search method, the search termination 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; during 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.
[0188] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0189] The search position in the current iteration process is determined as the target search position to determine the target liquid amount.
[0190] In a possible implementation of the embodiment of the present application, the focusing module 51 is further configured to:
[0191] According to the adjustment requirements, the target time for completing the adjustment of the current liquid volume of the liquid lens is predicted;
[0192] A target image is acquired at a target time, and the image clarity of the target image is calculated.
[0193] In a possible implementation of the embodiment of the present application, the focusing module 51 is specifically configured to:
[0194] Generate control instructions based on adjustment requirements;
[0195] The driving module is controlled according to the control instruction to adjust the current liquid amount of the liquid lens.
[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] The target time is predicted based on the adjustment requirements and the driving speed of the driving module.
[0199] It should be understood that the above-described device embodiments are merely illustrative, and the device of the present application may also be implemented in other ways. For example, the division of units / modules in the above-described embodiments is merely a logical functional division, and actual implementations may employ other division methods. For example, multiple units, modules, or components may be combined or integrated into another system, or some features may be omitted or not implemented.
[0200] An electronic device is provided in an embodiment of the present application. Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 6 As shown, Figure 6 The electronic device shown includes a processor 61 and a memory 62. The processor 61 and the memory 62 are connected, for example, via a bus 63. Optionally, the electronic device may further include a transceiver 64. It should be noted that in actual applications, the number of transceivers 64 is not limited to one, and the structure of the 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 may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this 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, and the like.
[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 or an Extended Industry Standard Architecture (EISA) bus. The bus 63 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this 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 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.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0204] The memory 62 is used to store application code for executing the solution of the present application, and the execution is controlled by the processor 61. The processor 61 is used to execute the application code stored in the memory 62 to implement the content shown in the above method embodiment.
[0205] The present application also provides a computer-readable storage medium, which may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes. Specifically, the computer-readable storage medium stores program instructions, and the program instructions are used to implement the service message processing methods in the above-mentioned embodiments.
[0206] A computer program product is also provided in an embodiment of the present application, including a computer program. When the computer program is executed by a processor, the technical solution of the above-mentioned method embodiment is implemented. Its implementation principle and technical effect are similar and will not be repeated here.
[0207] An embodiment of the present application also provides an autofocus system, Figure 7 A schematic diagram of the structure of an autofocus system provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, 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 aforementioned method embodiments until focusing is achieved.
[0208] Specifically, the system further includes a driving module, which is connected to the electronic device and is configured to receive a control instruction generated by the electronic device according to an adjustment requirement, and adjust the amount of liquid in the liquid lens in response to the control instruction.
[0209] In addition, the system also includes an image acquisition module, which 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, Figure 7 As shown, in this embodiment, the control instructions and the current image are both transmitted in the form of electrical signals. The electronic device is used to send a control instruction for instructing the driving module to inject or extract liquid into the liquid lens in the form of an electrical signal to the driving module. The electronic device is also used to send a control instruction for acquiring the current image to the image acquisition module in the form of an electrical signal. When the image acquisition module receives the light signal from the imaging module, it captures the current image and transmits the current image to the electronic device in the form of an electrical signal.
[0211] As a possible implementation method, the driving module may specifically include a power supply, a driving board, and a stepper motor, wherein the power supply is used to provide a stable DC voltage to the driving board as a working power supply. The driving board drives the stepper motor by controlling and adjusting the current or voltage, and the stepper motor controls the liquid volume of the liquid lens by sending and receiving pulse signals, thereby performing continuous and precise optical zoom.
[0212] In addition to the liquid lens, the imaging module may also include a fixed-focus optical lens group for optical imaging. The image acquisition module may specifically include an image sensor, ie, a camera, for receiving images from the imaging system.
[0213] Optionally, in addition to implementing autofocus control, the electronic device in this embodiment may also provide a graphical interface for the user to view real-time images to control the image sensor and the driving module, which is not limited in this embodiment.
[0214] In the autofocus system provided in the present application, the electronic device can adjust the liquid volume of the liquid lens based on the autofocus method, and combined with the precise control of the liquid volume by the driving module (such as precise adjustment of the liquid volume of the liquid lens through the power supply, driving board and stepping motor), it can achieve continuous and precise optical zoom, so that the imaging module can accurately focus on the target object and obtain 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, which includes a microscope using a liquid lens, and an electronic device for adjusting the amount of liquid in the liquid lens according to any of the aforementioned method embodiments until focusing is achieved. Figure 1A As shown, the electronic device is specifically a computer. In addition to the microscope using the liquid lens and the computer, the microscope system also includes modules such as an electronic control device and a driving device. This is not limited in this embodiment and will not be described in detail.
[0216] The present application also provides an automatic detection system for production line products, which includes an industrial camera using a liquid lens and an electronic device, which is used to adjust the amount of liquid in the liquid lens according to any of the above-mentioned method embodiments until the focus is achieved. Figure 1B As shown, the electronic device is specifically a computer. In addition to the industrial camera and computer using a liquid lens, the automatic detection system for assembly line products also includes modules such as an electronic control device and a drive device. This is not limited in this embodiment and will not be repeated.
[0217] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a particular embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined in any way. To keep the description concise, 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, they should be considered to be within the scope of this specification.
[0218] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0219] It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. An automatic focusing method, characterized in that: The method is applied to an autofocus system based on a liquid lens, and the method comprises: Focusing is achieved by adjusting the initial amount of liquid in the liquid lens according to the image clarity of the initial image; wherein the initial image is acquired when the liquid lens is in the initial liquid volume; The adjustment of the liquid lens is achieved through at least one iterative process, and any iterative process includes: 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 iteration process is the initial liquid volume, and the current image is the initial image; If the image clarity of the target image obtained based on the adjusted liquid amount meets a preset condition, the adjustment is terminated; Wherein, adjusting the current liquid amount of the liquid lens includes: Adjusting the current amount of liquid in the liquid lens according to an 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 clarity of the image acquired in the previous iteration process and the image clarity of the current image in the current iteration process; The method further comprises: For a current iteration process, after adjusting the current amount of liquid in the liquid lens, obtaining a first image clarity of a target image of the current iteration process and a second image clarity of a target image obtained in a previous iteration process; It is determined whether to readjust a current liquid volume of the liquid lens according to the first image definition and the second image definition.
2. The method according to claim 1, characterized in that The adjusting the current liquid amount of the liquid lens according to the image clarity of the current image corresponding to the current liquid amount includes: 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.
3. The method according to claim 2, characterized in that If the image clarity of the target image obtained based on the adjusted liquid amount meets a preset condition, then the adjustment is ended, comprising: 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.
4. The method according to any one of claims 1 to 3, characterized in that The determining whether to readjust the current liquid amount of the liquid lens according to the first image clarity and the second image clarity includes: If the difference between the first image clarity and the second image clarity is smaller than a preset difference threshold, the current liquid volume of the liquid lens is readjusted.
5. The method according to claim 4, characterized in that The readjusting of the current liquid volume of the liquid lens includes: determining an update adjustment requirement according to the adjustment requirement, wherein 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.
6. The method according to claim 3, characterized in that The method further comprises: If the image clarity of the target image obtained 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.
7. The method according to claim 6, characterized in that When the preset focus search algorithm is the Fibonacci search method, the search termination condition is: during the current iteration, 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 during each iteration, the two search positions are determined based on the image clarity corresponding to the two search positions in the previous iteration.
8. The method according to claim 7, characterized in that The step of determining a target liquid volume according to a current liquid volume of the liquid lens includes: A target search position is determined according to the two search positions in the current iteration process to determine the target liquid amount.
9. The method according to claim 6, characterized in that When the preset focus search algorithm is a rule-based search method, the search termination condition is: in a preset number of iterations after the current iteration, the image clarity corresponding to the search position decreases; wherein, the amount of liquid in the liquid lens is different for different search positions; and in each iteration, the search step size is determined based on the image clarity of the current image in the previous iteration.
10. The method according to claim 6, characterized in that When the preset focus search algorithm is based on the hill climbing search method, the end search condition is: during the current iteration, within the neighborhood 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; during each iteration, the search step size is determined based on the image clarity corresponding to the search position and other search positions within the neighborhood.
11. The method according to claim 9 or 10, characterized in that The search position in the current iteration process is determined as the target search position to determine the target liquid amount.
12. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Predicting a target time for completing adjustment of the current liquid volume of the liquid lens according to the adjustment requirements; The target image is acquired at the target moment, and the image clarity of the target image is calculated.
13. The method according to claim 12, characterized in that The autofocus system includes a driving module; the adjusting the current liquid amount 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 amount of the liquid lens.
14. The method according to claim 13, characterized in that The driving module is a motor or a cylinder.
15. The method according to claim 13, characterized in that The step of predicting a target time for completing adjustment of the current liquid amount 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.
16. 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, configured to achieve focusing by adjusting an initial liquid volume of the liquid lens according to image clarity of an initial image; wherein the initial image is acquired when the liquid lens is at the initial liquid volume; The adjustment of the liquid lens is achieved through at least one iterative process, and any iterative process includes: 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 iteration process is the initial liquid volume, and the current image is the initial image; If the image clarity of the target image obtained based on the adjusted liquid amount meets a preset condition, the adjustment is terminated; The focusing module is specifically configured to adjust the current amount of liquid in the liquid lens according to an adjustment requirement of a current iteration process; the adjustment requirement includes an adjustment change amount and an adjustment direction, and the adjustment requirement is 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; The focusing module is further configured to: for a current iteration process, after adjusting a current amount of liquid in the liquid lens, obtain a first image clarity of a target image of the current iteration process and a second image clarity of a target image obtained in a previous iteration process; It is determined whether to readjust a current liquid volume of the liquid lens according to the first image definition and the second image definition.
17. An electronic device, characterized in that: The electronic device includes 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 15.
18. 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 15 when executed by a processor.
19. A computer program product, characterized in that The method comprises a computer program, which implements the method according to any one of claims 1 to 15 when the computer program is executed by a processor.
20. 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 according to any one of claims 1 to 15 until focusing is achieved.
21. The system according to claim 20, wherein: The system further includes a driving module connected to the electronic device, configured to receive a control instruction generated by the electronic device according to an adjustment requirement, and adjust the amount of liquid in the liquid lens in response to the control instruction.
22. The system according to claim 20, wherein: The system further includes an image acquisition module, which is connected to the electronic device and is configured to acquire a current image after adjusting the amount of liquid in the liquid lens and transmit the current image to the electronic device.
23. 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 according to any one of claims 1 to 15 until focusing is achieved.
24. An automatic detection system for production 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 according to any one of claims 1 to 15 until focusing is achieved.
Citation Information
Patent Citations
Liquid membrane lens combined zoom optical system
CN110187418A