Automatic focusing method and device based on image information entropy exponentiation and storage medium
Through the automatic focus method based on image information entropy power operation, combined with large and small steps mountain climbing search and polynomial fitting, the problem of insufficient fitting accuracy and search efficiency in the existing technology is solved, and high-precision automatic focus is achieved, which is suitable for fundus confocal system.
Patent Information
- Application Number
- CN202510091477.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2045-01-21
AI Technical Summary
The existing autofocus technology has shortcomings in fitting accuracy and search efficiency, especially when the image contrast is low, it is difficult to achieve high-precision focusing.
The automatic focus method based on image information entropy power operation is adopted to calculate the evaluation function value of the image through information entropy power operation, and focus is achieved through mountain climbing search of large and small steps combined with polynomial fitting.
It improves the sensitivity of the evaluation function and the accuracy of fitting, realizes high-precision autofocus, and is suitable for fundus confocal systems, which can effectively avoid the impact of refractive errors.
Smart Images

Figure CN119545177A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of biomedical imaging technology, and in particular to an autofocus method, device and storage medium based on image information entropy power calculation. Background Art
[0002] Camera focus refers to the process of adjusting the focal distance when using the camera so that the image of the object being photographed is clear. There are many ways to focus, including auto focus, manual focus and multi-focus. Manual focus is to adjust the lens by manually turning the focus ring, which is suitable for scenes that require precise control. Auto focus is the most commonly used method, which can help users quickly lock the focus in fast-changing scenes.
[0003] Autofocus is the most commonly used focusing method, which is divided into single autofocus (AF-S) and continuous autofocus (AF-C). Single autofocus is suitable for shooting still objects, while continuous autofocus is suitable for shooting moving subjects and can automatically adjust the focus distance as the picture changes.
[0004] During the autofocus process, the precision of fitting directly affects the accuracy of focusing. How to determine the appropriate fitting function has always been a difficult problem for focusing using fitting algorithms.
[0005] In the related art, for example, the Chinese patent application number CN202210249149.8, titled A camera autofocus method based on image information entropy, discloses that when the real-time image information entropy at a certain moment is equal to the maximum fitting value of the information entropy, the camera is in a quasi-focus state and stops focusing; otherwise, the camera continues to focus automatically. Due to the deviation between the fitting value and the true value, it is easy to enter an infinite loop and is difficult to apply in practice.
[0006] Another example is "Application of Hybrid Search Method in Microscope Autofocus", Optoelectronic Engineering, Jiang Minshan et al., in which a hybrid search method is used to achieve microscope autofocus. This method uses grayscale variance evaluation function and Laplacian function for focusing in the coarse and fine focusing process, and then uses multiple rounds of hill climbing search until the search interval is within the threshold range before using function approximation to fit the peak position. Therefore, the search efficiency is low, and due to the inconsistency of the shapes of the focus evaluation function and the approximation function, the fitting accuracy is not ideal.
[0007] Therefore, it is necessary to provide a new method to solve the above technical problems. Summary of the invention
[0008] In order to achieve the above-mentioned purpose and other advantages of the present invention, the first purpose of the present invention is to provide an auto-focusing method based on image information entropy power operation, comprising the following steps: Obtain an initial image acquired at the system zero position; Calculate the evaluation function value of the image through information entropy power operation; Using the evaluation function value of the initial image as the initial value, performing peak direction determination and hill climbing with a large step length; The evaluation function value of the peak position obtained by large step length hill climbing is used as the initial value for peak direction determination, and the moving step length is adjusted to a small step length, and the second peak direction determination and hill climbing are performed; The data of the second peak direction determination and small step length hill climbing are summarized and fitted to obtain the peak position as the ideal focus position; Drive the translation stage to the ideal focus position for imaging and complete autofocus.
[0009] Furthermore, the formula for the information entropy power operation is: ; in, is the number of possible pixel values in the image, is the probability of pixel value i appearing, is the base of the logarithm, The exponent of the power operation.
[0010] Furthermore, the steps of determining the peak direction and climbing the mountain with a large step length include: The evaluation function value obtained by judging the peak direction is used as the initial value of hill climbing. Hill climbing with large steps is started according to the judged direction to determine the peak position.
[0011] Furthermore, the second peak direction determination and mountain climbing step includes: The evaluation function value obtained by the second peak direction determination is used as the initial value of hill climbing. Hill climbing with small steps is started according to the determined direction to obtain a more accurate peak position.
[0012] Furthermore, the determination of the peak direction comprises the following steps: Drive the translation stage to move from an initial position along a positive and / or negative direction by a specified step length to collect images; Compare the evaluation function values of the images at each position before and after the movement; If the evaluation function value of the image at the initial position is the largest, then hill climbing is skipped and the peak position is obtained; If the evaluation function value of the image with the specified step length moved in the positive direction is the largest, the evaluation function value of the image collected by moving the specified step length in the positive direction is used as the initial value of hill climbing, and hill climbing begins in the positive direction; If the evaluation function value of the image acquired by moving the specified step length in the negative direction is the largest, the evaluation function value of the image acquired by moving the specified step length in the negative direction is used as the initial value of hill climbing, and hill climbing begins in the negative direction.
[0013] Further, the steps of climbing the mountain include: Taking the input value determined by the peak direction as the initial value, move forward in the specified direction and collect images; Compare the evaluation function value of the acquired image with the initial value; If it is greater than the initial value, the evaluation function value of the collected image is used as the initial value, and the cycle continues until the evaluation function value of the collected image is no greater than the initial value, and the maximum evaluation function value position is obtained, which is the current peak position.
[0014] Furthermore, the large step length is smaller than half of the half-height width of the focus function curve, and the small step length is smaller than 0.25 times of the large step length and is not divisible by the large step length.
[0015] Furthermore, the base of the logarithm is 2, the exponent of the power operation The value is 3.
[0016] Furthermore, the step of aggregating the data of the second peak direction determination and small step climbing for fitting includes: The data of the second peak direction determination and small step climbing are summarized and fitted with an m-order polynomial.
[0017] Furthermore, the method further comprises the steps of: When the number of summarized data is less than m, the more accurate peak position obtained from the second peak direction determination is moved by a small displacement in the positive and negative directions respectively, and the small displacement is smaller than the small step size, and the evaluation function of the small displacement position in the positive and negative directions is obtained, which is supplemented as the data involved in the fitting, and an m-order polynomial fitting is performed; If the number of data involved in the summary is still less than m, the more accurate peak position obtained from the second peak direction determination is moved by a small displacement of 2 times in the positive and negative directions respectively, and so on, until the number of data involved in the fitting is greater than or equal to m.
[0018] A second object of the present invention is to provide a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0019] A third object of the present invention is to provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0020] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides an autofocus method, device and storage medium based on image information entropy power operation. By performing power operation on information entropy, accurate judgment can be made under low image contrast conditions, thereby improving the sensitivity of an evaluation function and making the evaluation function have polynomial characteristics. Data points around a peak area are then extracted for polynomial fitting, thereby improving the accuracy of the fitting and thereby improving the accuracy of the autofocus. The device can realize autofocus without the need for an additional focusing mechanism, and high-precision autofocus can be achieved through only two hill climbing searches, with low cost and fast focusing speed. Compared with traditional fundus focusing systems that require the addition of special focusing targets, the present invention is particularly suitable for autofocusing of fundus confocal systems, and can effectively avoid the effects of refractive errors.
[0021] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present invention in conjunction with the accompanying drawings. The specific implementation of the present invention is given in detail by the following embodiments and their accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 The process of the automatic focusing method based on the image information entropy power calculation of Example 1 is as follows Figure 1 ; Figure 2 The process of the automatic focusing method based on the image information entropy power calculation of Example 1 is as follows Figure 2 ; Figure 3 The process of the automatic focusing method based on the image information entropy power calculation of Example 1 is as follows Figure 3 ; Figure 4 This is a peak direction determination flow chart of Example 1; Figure 5 This is a hill climbing flow chart of Example 1; Figure 6 This is a peak search schematic diagram of Example 1; Figure 7 This is a schematic diagram of a polynomial fitting curve of Example 1; Figure 8 This is a schematic diagram of the image acquisition of Example 1; Fig. 9 This is a schematic diagram of a computer device according to Embodiment 2; Fig.10 Schematic diagram of a computer-readable storage medium of Example 3. DETAILED DESCRIPTION
[0023] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. It should be noted that, under the premise of no conflict, the embodiments or technical features described below can be arbitrarily combined to form a new embodiment.
[0024] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making any creative work shall fall within the scope of protection of the present invention.
[0025] The figure numbers in this application are only used to distinguish the various steps in the scheme, and are not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.
[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention. Example 1
[0027] An auto-focus method based on image information entropy power operation, such as Figure 1-Figure 3 As shown, the following steps are included: S1, obtaining an initial image collected at the system zero position; In one implementation, the system first returns to a zero position and captures a first initial image.
[0028] S2, calculating the evaluation function value of the image by information entropy power operation; In one implementation, the formula for the information entropy power operation is: ; in, is the number of possible pixel values in the image, for example, for a grayscale image, it is usually 255; is the probability of pixel value i appearing, is the base of the logarithm, The exponent of the power operation.
[0029] Preferably, the base of the logarithm is 2, the exponent of the power operation The value is 3.
[0030] S3, taking the evaluation function value of the initial image as the initial value, and performing peak direction determination and hill climbing with a large step length a; In one implementation, the step of performing peak direction determination and hill climbing with a large step length a includes: The evaluation function value obtained by judging the peak direction is used as the initial value of hill climbing. Hill climbing with a large step length a is started according to the judged direction to determine the peak position.
[0031] After the mountain climbing with a large step length a is completed, S4, the evaluation function value of the peak position obtained by mountain climbing with a large step length a is used as the initial value for peak direction determination, and the moving step length is adjusted to a small step length c, and the second peak direction determination and mountain climbing are performed; In one implementation, the second peak direction determination and hill climbing step includes: The evaluation function value obtained by the second peak direction determination is used as the initial value of hill climbing. Hill climbing with a small step length c is started according to the determined direction. After the hill climbing is completed, a more accurate peak position is obtained.
[0032] Preferably, the large step length a is slightly smaller than half of the half-height width of the focus function curve to ensure that there are at least two sampling points in the peak area during the coarse focus stage. The small step length c is smaller than 0.25 times the large step length a and is not divisible by the large step length a.
[0033] The peak direction determination principle in step S3 and step S4 is the same. Figure 4 As shown, the determination of the peak direction includes the following steps: S300, driving the translation stage to move from an initial position along a positive and / or negative direction by a specified step length to collect images; S310, compare the evaluation function values of the images at each position before and after the movement; for example, the evaluation function value of the image at the initial position is represented as F0, the evaluation function value of the image moved along the positive direction with a specified step length is represented as F1, and the evaluation function value of the image moved along the negative direction with a specified step length is represented as F2.
[0034] S320, if the evaluation function value of the initial position image is the largest, skip the hill climbing and obtain the peak position; S330, if the evaluation function value of the image acquired by moving the specified step length in the positive direction is the largest, then taking the evaluation function value of the image acquired by moving the specified step length in the positive direction as the initial value of hill climbing, and starting hill climbing in the positive direction; S340, if the evaluation function value of the image acquired by moving the specified step length in the negative direction is the largest, the evaluation function value of the image acquired by moving the specified step length in the negative direction is used as the initial value of hill climbing, and hill climbing is started in the negative direction.
[0035] In one embodiment, if Figure 5 As shown, the steps of climbing a mountain include: Taking the input value determined by the peak direction as the initial value, move forward in the specified direction and collect images; Compare the evaluation function value of the acquired image with the initial value; If it is greater than the initial value, the evaluation function value of the collected image is used as the initial value, and the cycle continues until the evaluation function value of the collected image is no greater than the initial value, and the maximum evaluation function value position is obtained, which is the current peak position.
[0036] In an optional embodiment, the translation stage may be driven to move a specified step length in a positive or negative direction from an initial position to collect an image; for example, the translation stage may be driven to move a specified step length in a negative direction from an initial position to collect an image; Compare the evaluation function values of the initial position and the image after the movement; for example, compare the evaluation function values of the initial position and the image after the movement in the negative direction; If the evaluation function value of the image after moving is greater than the evaluation function value of the image at the initial position, then the evaluation function value of the image collected by moving the specified step length along the current direction is used as the initial value for hill climbing, and hill climbing begins along the current direction. The principle of hill climbing is the same as the principle of hill climbing mentioned above, and will not be repeated here. For example, if the evaluation function value of the image after moving along the negative direction is greater than the evaluation function value of the image at the initial position, it means that the searched peak direction is correct and it is necessary to continue searching along the current direction. Then, the evaluation function value of the image collected by moving the specified step length along the negative direction is used as the initial value for hill climbing, and one step is taken in the negative direction to collect images; the evaluation function value of the collected image is compared with the initial value; if it is greater than the initial value, the evaluation function value of the collected image is used as the initial value, and the cycle continues until the evaluation function value of the collected image after moving is not greater than the initial value, and the position with the maximum evaluation function value is obtained, which is the current peak position; If the evaluation function value of the image after the movement is not greater than the evaluation function value of the image at the initial position, the translation stage is driven to move the specified step length in the opposite direction from the initial position to collect the image; for example, if the evaluation function value of the image after the movement in the negative direction is not greater than the evaluation function value of the image at the initial position, it means that the searched peak direction is incorrect and it is necessary to change the direction and search again, then the translation stage is driven to move the specified step length in the positive direction from the initial position to collect the image; Then compare the evaluation function values of the initial position and the image after the current move; for example, compare the evaluation function values of the initial position and the image after moving in the positive direction; If the evaluation function value of the current image after movement is greater than the evaluation function value of the image at the initial position, then the evaluation function value of the image collected by moving the specified step length along the current direction is used as the initial value for hill climbing, and hill climbing begins along the current direction. The principle of hill climbing here is the same as the principle of hill climbing mentioned above, and will not be repeated here. For example, if the evaluation function value of the image after moving along the positive direction is greater than the evaluation function value of the image at the initial position, it means that the searched peak direction is correct and it is necessary to continue searching along the current direction. Then, the evaluation function value of the image collected by moving the specified step length along the positive direction is used as the initial value for hill climbing, and one step is taken in the positive direction to collect images; the evaluation function value of the collected image is compared with the initial value; if it is greater than the initial value, the evaluation function value of the collected image is used as the initial value, and the cycle continues until the evaluation function value of the collected image after movement is not greater than the initial value, and the position with the maximum evaluation function value is obtained, which is the current peak position; If the evaluation function value of the current moved image is not greater than the evaluation function value of the initial position image, the evaluation function value of the initial position image is determined to be the largest, and hill climbing is skipped to obtain the peak position. For example, if the evaluation function value of the image after moving in the positive direction is not greater than the evaluation function value of the initial position image, it means that the searched peak direction is incorrect, and the evaluation function value of the initial position image is determined to be the largest, and hill climbing is skipped to obtain the peak position.
[0037] In another optional embodiment, the translation stage may be driven to move from the initial position in the positive and negative directions by a specified step length to collect images; Compare the evaluation function values of the three position images; that is, compare the evaluation function value F0 of the initial position image, the evaluation function value F1 of the image moved along the positive direction with a specified step length, and the evaluation function value F2 of the image moved along the negative direction with a specified step length.
[0038] If the evaluation function value of the image at the initial position is the largest, then hill climbing is skipped and the peak position is obtained; If the evaluation function value of the image with the specified step length moved in the positive direction is the largest, the evaluation function value of the image collected by moving the specified step length in the positive direction is used as the initial value of hill climbing, and hill climbing begins in the positive direction; If the evaluation function value of the image acquired by moving the specified step length in the negative direction is the largest, the evaluation function value of the image acquired by moving the specified step length in the negative direction is used as the initial value of hill climbing, and hill climbing begins in the negative direction.
[0039] The principle of climbing here is the same as the principle of climbing mentioned above, so I will not repeat it here.
[0040] It should be noted that the specific implementation method of peak direction determination can be selected in combination with actual conditions or actual needs, and is not specifically limited here.
[0041] Examples, such as Figure 6As shown, the driving displacement stage first moves a large step length a from the initial position 0 along the negative direction to collect images, where the large step length a is 3 mm. The initial position is marked as 1, and the position moved from the initial position along the negative direction by a large step length a is marked as 2. The evaluation function values of the images at positions 1 and 2 are compared. The evaluation function value of the image at position 2 is less than the evaluation function value of the image at position 1, indicating that the peak direction of the current search is incorrect. The driving displacement stage then moves a large step length a from the initial position 0 along the positive direction to collect images, and the position moved from the initial position along the positive direction by a large step length a is marked as 3. The evaluation function values of the images at positions 1 and 3 are compared. The evaluation function value of the image at position 3 is greater than the evaluation function value of the image at position 1, indicating that the peak direction of the current search is correct and it is necessary to continue searching in the positive direction. The evaluation function value of the image at position 3 is taken as the initial value for hill climbing, and hill climbing is started in the positive direction. The driving displacement stage then moves a large step length a from position 3 along the positive direction to collect images, and the position moved from position 3 along the positive direction by a large step length a is marked as 4. The evaluation function values of the images at positions 3 and 4 are compared. The evaluation function value of is greater than the evaluation function value of the image at position 3, indicating that the peak direction of the current search is correct, and it is necessary to continue searching in the positive direction. The evaluation function value of the image at position 4 is used as the initial value for hill climbing, and hill climbing begins in the positive direction. The translation stage is driven to move a large step length a from position 4 in the positive direction to collect images, and the position where the position is moved by a large step length a from position 4 in the positive direction is marked as 5. The evaluation function values of the images at position 4 and position 5 are compared. The evaluation function value of the image at position 5 is greater than the evaluation function value of the image at position 4, indicating that the peak direction of the current search is correct, and it is necessary to continue searching in the positive direction. The evaluation function value of the image at position 5 is used as the initial value for hill climbing, and hill climbing begins in the positive direction. The translation stage is driven to move a large step length a from position 5 in the positive direction to collect images, and the position where the position is moved by a large step length a from position 5 in the positive direction is marked as 6. The evaluation function values of the images at position 5 and position 6 are compared. The evaluation function value of the image at position 6 is less than the evaluation function value of the image at position 5, indicating that position 5 is the position with the largest evaluation function value, that is, the current peak position. At this point, the hill climbing search process with a large step length a is completed.
[0042] The stage is driven to move from position 5 in the negative direction by a small step length c to collect images. Here, the small step length c is 0.54 mm. The position where the small step length c is moved from position 5 in the negative direction is marked as 7. The evaluation function values of the images at position 5 and position 7 are compared. The evaluation function value of the image at position 7 is less than the evaluation function value of the image at position 5, indicating that the peak direction of the current search is incorrect. The stage is driven to move from position 5 in the positive direction by a small step length c to collect images. The position where the small step length c is moved from position 5 in the positive direction is marked as 8. The evaluation function values of the images at position 5 and position 8 are compared. The evaluation function value of the image at position 8 is greater than The evaluation function value of the image at position 5 indicates that the peak direction of the current search is correct, and it is necessary to continue searching in the positive direction. The evaluation function value of the image at position 8 is used as the initial value for hill climbing, and hill climbing is started in the positive direction. The translation stage is driven to move from position 8 in a small step length c in the positive direction to collect images, and the position moved from position 8 in the positive direction by a small step length c is marked as 9. The evaluation function values of the images at position 8 and position 9 are compared. The evaluation function value of the image at position 8 is greater than that of the image at position 9, indicating that position 8 is the position with the largest evaluation function value, which is the current peak position. At this point, the hill climbing search process with a small step length c is completed.
[0043] The positions and evaluation function values of the images obtained by performing peak direction determination with a large step size a and a small step size c are shown in Table 1.
[0044] Table 1 Position and image evaluation function value table
[0045] S5, summarizing and fitting the data of the second peak direction determination and small step length mountain climbing to obtain the peak position as the ideal focus position; In one embodiment, the step of aggregating the data of the second peak direction determination and small step climbing for fitting includes: The data of the second peak direction determination and small step climbing are summarized and fitted with an m-order polynomial. Preferably, the order m of the m-order polynomial fitting is the same as the power operation exponent in the above information entropy power operation formula. Take the same value.
[0046] Combined with the above example, the data marked as 5, 7, 8, and 9 in Table 1 are aggregated and fitted with an m-order polynomial. The fitted curve is as follows: Figure 7 As shown in the figure, the peak position 9.34 is obtained as the ideal focus position. In this example, the image collected at each position is stored by multiplying its position value by 6400. The image collected at each position (including the obtained peak position 9.34) is as follows: Figure 8 As shown. Figure 8 It can be seen that the image captured at the peak position 9.34 has the highest clarity.
[0047] In some embodiments, the steps include: When the number of summarized data is less than m, the more accurate peak position (p0) obtained from the second peak direction determination is moved by a small displacement d in the positive and negative directions respectively, and the small displacement d is smaller than the small step size c, and the evaluation function of the small displacement position in the positive and negative directions is obtained, that is, the evaluation function of the position p0+d and p0-d is obtained, which is supplemented as the data involved in the fitting, and the m-order polynomial fitting is performed; If the number of data involved in the summary is still less than m, the more accurate peak position obtained from the second peak direction determination is moved by a small displacement of 2 times in the positive and negative directions, that is, the data of p0+2d and p0-2d are supplemented, and so on, until the number of data involved in the fitting is greater than or equal to m.
[0048] S6. Drive the translation stage to the ideal focus position for imaging and complete autofocus.
[0049] The present embodiment provides an autofocus method based on the power operation of image information entropy. By performing a power operation on the information entropy, it is possible to make accurate judgments when the image contrast is low, thereby improving the sensitivity of the evaluation function and making the evaluation function have a polynomial feature. Then, data points around the peak area are extracted for polynomial fitting, thereby improving the accuracy of the fitting and thus improving the accuracy of the autofocus. The method can realize the autofocus of the device without adding an additional focusing mechanism. High-precision autofocus can be achieved through two hill climbing searches, with low cost and fast focusing speed. Compared with the traditional fundus focusing system that needs to add a special focusing target, the present invention is particularly suitable for the autofocus of the fundus confocal system, and can effectively avoid the influence of refractive error. Example 2
[0050] A computer device 700, such as Fig. 9 As shown, it includes a memory 710, a processor 720, and a computer program 730 stored in the memory and executable on the processor. When the processor executes the computer program, the steps of an auto-focus method based on image information entropy power calculation are implemented. For a detailed description of the method, reference may be made to the corresponding description in the above method embodiment, which will not be repeated here. Example 3
[0051] A computer readable storage medium such as Fig.10 As shown, a computer program is stored thereon, and when the computer program is executed by the processor, the steps of an auto-focus method based on image information entropy power operation are implemented. For a detailed description of the method, reference may be made to the corresponding description in the above method embodiment, and no further description is given here.
[0052] The number of devices and processing scales described here are used to simplify the description of the present invention. Applications, modifications and variations of the present invention will be obvious to those skilled in the art.
[0053] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and implementation modes. They can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.
[0054] The apparatus, computer device, non-volatile computer storage medium and method provided in the embodiments of this specification correspond to each other, and therefore, the apparatus, computer device and non-volatile computer storage medium also have similar beneficial technical effects as the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the corresponding apparatus, computer device and non-volatile computer storage medium will not be repeated here.
[0055] Those skilled in the art also know that, in addition to implementing the controller in a purely computer-readable program code, the controller can be made to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software units for implementing the method and structures within the hardware component.
[0056] The systems, devices or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described separately by functions in various units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in the same or more software and / or hardware.
[0057] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0058] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0059] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0060] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0061] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0062] The specification may be described in the general context of computer-executable instructions executed by a computer, such as program units. Generally, program units include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program units may be located in local and remote computer storage media, including storage devices.
[0063] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0064] The above description is only an embodiment of this specification and is not intended to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of one or more embodiments of this specification.
Claims
1. An automatic focusing method based on image information entropy power operation, characterized in that: The following steps are involved: Obtain an initial image acquired at the system zero position; Calculate the evaluation function value of the image through information entropy power operation; Using the evaluation function value of the initial image as the initial value, performing peak direction determination and hill climbing with a large step length; The evaluation function value of the peak position obtained by large step length hill climbing is used as the initial value for peak direction determination, and the moving step length is adjusted to a small step length, and the second peak direction determination and hill climbing are performed; The data of the second peak direction determination and small step length hill climbing are summarized and fitted to obtain the peak position as the ideal focus position; Drive the translation stage to the ideal focus position for imaging and complete autofocus.
2. The automatic focusing method based on image information entropy power calculation as claimed in claim 1, characterized in that: The formula for the information entropy power operation is: ; in, is the number of possible pixel values in the image, is the probability of pixel value i appearing, is the base of the logarithm, The exponent of the power operation.
3. The automatic focusing method based on image information entropy power calculation as claimed in claim 1, characterized in that: The steps of determining the peak direction and climbing the mountain with a large step length include: The evaluation function value obtained by judging the peak direction is used as the initial value of hill climbing. Hill climbing with large steps is started according to the judged direction to determine the peak position.
4. The automatic focusing method based on image information entropy power calculation as claimed in claim 3, characterized in that: The second peak direction determination and mountain climbing steps include: The evaluation function value obtained by the second peak direction determination is used as the initial value of hill climbing. Hill climbing with small steps is started according to the determined direction to obtain a more accurate peak position.
5. The automatic focusing method based on image information entropy power calculation as claimed in claim 4, characterized in that: The determination of the peak direction comprises the following steps: Drive the translation stage to move from an initial position along a positive and / or negative direction by a specified step length to collect images; Compare the evaluation function values of the images at each position before and after the movement; If the evaluation function value of the image at the initial position is the largest, then hill climbing is skipped and the peak position is obtained; If the evaluation function value of the image with the specified step length moved in the positive direction is the largest, the evaluation function value of the image collected by moving the specified step length in the positive direction is used as the initial value of hill climbing, and hill climbing begins in the positive direction; If the evaluation function value of the image acquired by moving the specified step length in the negative direction is the largest, the evaluation function value of the image acquired by moving the specified step length in the negative direction is used as the initial value of hill climbing, and hill climbing begins in the negative direction.
6. The automatic focusing method based on image information entropy power calculation as claimed in claim 5, characterized in that: The steps to climb the mountain include: Taking the input value determined by the peak direction as the initial value, move forward in the specified direction and collect images; Compare the evaluation function value of the acquired image with the initial value; If it is greater than the initial value, the evaluation function value of the collected image is used as the initial value, and the cycle continues until the evaluation function value of the collected image is no greater than the initial value, and the maximum evaluation function value position is obtained, which is the current peak position.
7. The automatic focusing method based on image information entropy power calculation as claimed in claim 1, characterized in that: The large step length is smaller than half of the half-height width of the focus function curve, and the small step length is smaller than 0.25 times of the large step length and is not divisible by the large step length.
8. The automatic focusing method based on image information entropy power calculation as claimed in claim 2, characterized in that: The base of the logarithm 2, the exponent of the power operation The value is 3.
9. The automatic focusing method based on image information entropy power calculation as claimed in claim 4, characterized in that: The step of aggregating the data of the second peak direction determination and small step length mountain climbing for fitting comprises: The data of the second peak direction determination and small step climbing are summarized and fitted with an m-order polynomial.
10. The automatic focusing method based on image information entropy power calculation as claimed in claim 9, characterized in that: Also includes the steps: When the number of summarized data is less than m, the more accurate peak position obtained from the second peak direction determination is moved by a small displacement in the positive and negative directions respectively, and the small displacement is smaller than the small step size, and the evaluation function of the small displacement position in the positive and negative directions is obtained, which is supplemented as the data involved in the fitting, and an m-order polynomial fitting is performed; If the number of data involved in the summary is still less than m, the more accurate peak position obtained from the second peak direction determination is moved by a small displacement of 2 times in the positive and negative directions respectively, and so on, until the number of data involved in the fitting is greater than or equal to m.
11. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
A camera autofocus method based on image information entropy
CN114845042B
Automatic focusing searching algorithm
CN107509023A
Spacecraft optical load on-orbit adaptive focusing method and device, equipment and medium
CN112526705A
Camera automatic focusing method based on image information entropy
CN114845042A
Detector channel-based automatic focusing method and apparatus, device and storage medium
WO2023077675A1