An autofocusing method and system for a handheld fundus camera
By improving the focus position search strategy and adaptive step size optimization, the problem of local extrema caused by noise and shaking during the autofocus process of handheld fundus cameras is solved, thereby improving focusing efficiency and accuracy.
Patent Information
- Application Number
- CN202310807254.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2043-07-03
AI Technical Summary
Existing hill-climbing methods and improved search algorithms based on hill-climbing methods are easily affected by noise and shaking during autofocusing of handheld fundus cameras, which can lead to local extrema and low focusing efficiency.
An improved focus position search strategy is adopted. By calculating the difference, gradient and moment estimation of image sharpness evaluation index, an adaptive step size gain coefficient and learning rate are introduced to optimize the focus position search.
It improves the efficiency of autofocus and resistance to local extrema of handheld fundus cameras, reduces the requirements for image sharpness evaluation functions, and achieves fast focusing.
Smart Images

Figure CN116803336B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical fundus imaging autofocus technology, specifically relating to an autofocus method and system for a handheld fundus camera. Background Technology
[0002] Handheld fundus cameras are commonly used as auxiliary tools for examining fundus diseases or screening for other diseases. Their autofocus efficiency and focusing accuracy greatly affect the accuracy of examination results and the user experience of medical staff.
[0003] The most commonly used algorithms for finding the focus point in camera autofocus are currently hill climbing or improved versions of it. Hill climbing offers advantages such as speed and ease of engineering implementation. However, if the image quality evaluation curve exhibits multiple peaks, it can easily get trapped in local extrema. When the imaging system is affected by noise or camera shake, these local extrema may be mistakenly identified as the focus point, causing the hill climbing search to fail. Therefore, when applying hill climbing for focus point search, high performance is required in terms of the unimodality and anti-interference capabilities of the image sharpness evaluation function. Furthermore, during the search process, the hill climbing algorithm requires multiple comparisons to slowly approach the optimal position, resulting in low focusing efficiency.
[0004] Improved search algorithms based on hill climbing generally employ a variable step-size search strategy, typically consisting of two stages: coarse adjustment and fine adjustment. The coarse adjustment stage uses a larger step size to find an extreme point, avoiding the problem of getting trapped in local optima caused by using small step sizes. Fine adjustment is performed within a certain range around the extreme point obtained in the coarse adjustment, searching for the extreme position with smaller step sizes. While improved search algorithms based on hill climbing avoid getting trapped in local optima, they still require multiple comparisons to slowly approach the optimal position, resulting in relatively low focusing efficiency. Summary of the Invention
[0005] To address the issues of high requirements for the unimodality and anti-interference performance of the image sharpness evaluation function in the commonly used hill-climbing method for focusing position search, its susceptibility to local extrema caused by imaging system noise and operator hand tremors, and the low focusing efficiency of hill-climbing methods or improved hill-climbing-based search algorithms which require multiple comparisons to slowly approach the optimal position, this invention proposes an autofocus device, system, and method for a handheld fundus camera. By improving the focusing position search strategy, this invention enhances the autofocus efficiency of the handheld fundus camera and reduces the requirements for the image sharpness evaluation function during the autofocus process.
[0006] To solve the above problems, the present invention adopts the following technical solution:
[0007] An autofocus method for a handheld fundus camera, the handheld fundus camera including an imaging system and an illumination system, the method comprising the following steps:
[0008] S1: In the near-infrared illumination mode of the illumination system, the imaging system performs imaging at the current focusing position P0 and calculates the image sharpness evaluation index Q corresponding to the current focusing position P0 using the image sharpness evaluation function.
[0009] S2: Select the focusing amount ΔP, and control the focusing mechanism to move to the first focusing position P+ΔP and the second focusing position P-ΔP respectively, and the imaging system performs imaging. Then, use the image sharpness evaluation function to calculate the image sharpness evaluation index Q corresponding to the first focusing position P+ΔP and the second focusing position P-ΔP respectively. + and Q - ;
[0010] S3: Calculate the difference in image sharpness evaluation index between the first focusing position P+ΔP and the second focusing position P-ΔP: ΔQ = Q + -Q - ;
[0011] S4: Calculate the gradient g1 of the image sharpness evaluation function corresponding to the first focusing position P+ΔP and the second focusing position P-ΔP using the difference ΔQ in the image sharpness evaluation index and the focusing amount ΔP. The calculation formula is as follows:
[0012]
[0013] S5: Calculate the first moment estimate m1 and the second moment estimate v1 of the gradient g1 of the image sharpness evaluation function;
[0014] S6: The ratio of the square root of the first-moment estimate m1 to the square root of the second-moment estimate v1 is used as the adaptive step-size gain coefficient K. adaptive ;
[0015] S7: Select the learning rate α and use the adaptive step size gain coefficient K adaptive The new focusing position is determined by the learning rate α: P1 = P0 + α*K adaptive ;
[0016] S8: Take the new focusing position P1 as the current focusing position of the imaging system in near-infrared illumination mode, repeat the above steps S1 to S7, continuously calculate and obtain the new focusing position and its corresponding image sharpness evaluation index, until the difference between the image sharpness evaluation index corresponding to the new focusing position and the adjacent previous focusing position is less than a set threshold, take the focusing position corresponding to the maximum value of the image sharpness evaluation index as the searched optimal focusing position, control the focusing mechanism to move to the optimal focusing position, and complete the automatic focusing.
[0017] Accordingly, the present invention also provides an autofocus system for a handheld fundus camera, the handheld fundus camera including an imaging system, an illumination system, and the autofocus system, the autofocus system comprising:
[0018] An autofocus control module is used to control the imaging system to image at the current focusing position P0 under the near-infrared illumination mode of the illumination system, calculate the image sharpness evaluation index Q corresponding to the current focusing position P0 using an image sharpness evaluation function, select the focusing amount ΔP, and control the focusing mechanism to move to the first focusing position P+ΔP and the second focusing position P-ΔP respectively, and the imaging system to image, and calculate the image sharpness evaluation index Q corresponding to the first focusing position P+ΔP and the second focusing position P-ΔP respectively using the image sharpness evaluation function. + and Q - ;
[0019] The index difference calculation module is used to calculate the difference in image sharpness evaluation index between the first focusing position P+ΔP and the second focusing position P-ΔP: ΔQ=Q + -Q - ;
[0020] The gradient calculation module is used to calculate the gradient g1 of the image sharpness evaluation function corresponding to the first focus position P+ΔP and the second focus position P-ΔP using the difference ΔQ in the image sharpness evaluation index and the focus adjustment amount ΔP. The calculation formula is as follows:
[0021]
[0022] The first and second moment calculation module is used to calculate the first moment estimate m1 and the second moment estimate v1 of the gradient g1 of the image sharpness evaluation function.
[0023] The gain coefficient calculation module is used to calculate the adaptive step-size gain coefficient K based on the ratio of the square root of the first-order moment estimate m1 to the square root of the second-order moment estimate v1. adaptive ;
[0024] The focus position determination module is used to select the learning rate α and utilize the adaptive step size gain coefficient K. adaptive The new focusing position is determined by the learning rate α: P1 = P0 + α*K adaptive ;
[0025] The autofocus control module takes the new focusing position P1 as the current focusing position of the imaging system in near-infrared illumination mode, and re-controls the focusing mechanism movement and the index difference calculation module, the gradient calculation module, the first moment and second moment calculation module, the gain coefficient calculation module, and the focusing position determination module to continuously calculate and obtain the new focusing position and its corresponding image sharpness evaluation index. When the difference between the image sharpness evaluation index corresponding to the new focusing position and the adjacent previous focusing position is less than a set threshold, the focusing position corresponding to the maximum value of the image sharpness evaluation index is taken as the searched optimal focusing position. After controlling the focusing mechanism to move to the optimal focusing position, autofocus is completed.
[0026] The beneficial effects of this invention are as follows: The autofocus method and system for a handheld fundus camera proposed in this invention improves the focusing position search strategy and introduces the first and second moments of the gradient during the search process to accelerate the search. By utilizing past and current gradient information, it improves the convergence speed while resisting getting trapped in local extrema, thereby enhancing the effectiveness and efficiency of autofocus in handheld fundus cameras and reducing the requirements of the image sharpness evaluation function during autofocus. This invention is applicable to fast autofocus in handheld fundus cameras and helps improve their autofocus efficiency. Attached Figure Description
[0027] Figure 1 This is a flowchart illustrating an autofocus method for a handheld fundus camera according to an embodiment of the present invention.
[0028] Figure 2 This is a schematic diagram of a handheld fundus camera, which includes an autofocus system for a handheld fundus camera as described in another embodiment of the present invention. Detailed Implementation
[0029] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and preferred embodiments.
[0030] In one embodiment, an autofocus method for a handheld fundus camera is provided. The control strategy of this autofocus method is to calculate the image sharpness evaluation index of the focusing mechanism (e.g., voice coil motor) at different focusing positions, use a search algorithm to search for the optimal focusing position, and the optimal focusing position is the relative position between the image detector and the lens group when the obtained image sharpness evaluation index reaches its maximum value. Then, the focusing mechanism is driven to move to the optimal focusing position, thereby completing the autofocus of the handheld fundus camera.
[0031] A handheld fundus camera comprises an imaging system and an illumination system. The imaging system includes a lens group, an image detector, an imaging circuit, and an image acquisition system. The lens group focuses reflected light from the fundus onto the image detector; the image detector receives the reflected light and converts the optical signal into an electrical signal; the imaging circuit provides the driving signals and timing pulses required for the image detector to operate; the image acquisition system acquires image data from the imaging circuit, arranges the digital image and its related parameters in an orderly manner, and outputs a data stream with a specific format. The illumination system has two operating modes: near-infrared illumination mode and white light illumination mode. In near-infrared illumination mode, the near-infrared illumination source provides illumination for the fundus camera's autofocus process; in white light illumination mode, the white light illumination source provides illumination for the fundus camera's image capture process.
[0032] Specifically, such as Figure 1 As shown, the autofocus process of the handheld fundus camera autofocus method in this embodiment is completed in near-infrared illumination mode, and the method includes the following steps:
[0033] S1: The illumination system is set to near-infrared illumination mode. The imaging system of the handheld fundus camera performs imaging at the current focusing position P0 under near-infrared illumination mode, and calculates the image sharpness evaluation index Q corresponding to the current focusing position P0 using the image sharpness evaluation function.
[0034] The image sharpness evaluation function can be implemented using any existing image sharpness evaluation function, and this invention is not limited thereto. Preferably, in this embodiment, the image sharpness evaluation function uses the Tenengrad evaluation function. The Tenengrad evaluation function uses the Sobel operator to extract the horizontal and vertical gradients of the image respectively, and calculates their sum of squares as the evaluation function. The Tenengrad evaluation function has the characteristics of fast processing speed, and by setting a threshold, it can effectively suppress noise interference.
[0035] Specifically, in this embodiment, the Tenengrad evaluation function is used to calculate the image sharpness evaluation index Q using the following formula:
[0036]
[0037] Where T is the set edge detection threshold, and G(x,y) is the gradient at pixel (x,y). G x (x,y) and G y (x,y) represent the gradient values of pixel (x,y) in the horizontal and vertical directions, respectively.
[0038] S2: A small focusing amount ΔP is selected. In this embodiment, the maximum focusing amount of the voice coil motor is 0.6mm, so ΔP can be set to 0.02mm. The focusing mechanism is then controlled to move to the first focusing position P+ΔP and the second focusing position P-ΔP, respectively, and the imaging system performs imaging. In this embodiment, a voice coil motor is used for focusing. The voice coil motor adjusts the relative position between the image detector and the lens group according to the control strategy of the autofocus method. Further, the voice coil motor adjusts the relative position between the image detector and the lens group by adjusting the position of the image detector.
[0039] Next, the image sharpness evaluation function is used to calculate the image sharpness evaluation index at the first focusing position P+ΔP and the second focusing position P-ΔP, respectively, which are Q + and Q - .
[0040] S3: Calculate the difference in image sharpness evaluation index between the first focusing position P+ΔP and the second focusing position P-ΔP: ΔQ = Q + -Q - .
[0041] S4: Calculate the gradient g1 of the image sharpness evaluation function corresponding to the first focus position P+ΔP and the second focus position P-ΔP using the difference ΔQ between the image sharpness evaluation index of the first focus position P+ΔP and the second focus position P-ΔP, and the focusing amount ΔP. The calculation formula is as follows:
[0042]
[0043] S5: Introduce the idea of adaptive step size adjustment into the autofocus control strategy, use the momentum term to accelerate the convergence speed of the autofocus algorithm, and calculate the first moment estimate m1 of gradient g1 and the second moment estimate v1 of gradient g1.
[0044] Specifically, the formula for estimating the first moment of gradient g1 is: m1 = β1m0 + (1-β1)f1, and the formula for estimating the second moment of gradient f1 is: Wherein, β1 and β2 are the hyperparameters controlling the estimation of the first and second moments, respectively. In this embodiment, β1 = 0.99 and β2 = 0.9 are taken. m0 and v0 are the first and second moment components of the gradient obtained in the previous focusing process, respectively. For the first focusing, m0 and v0 can be randomly set. For example, in this embodiment, m0 = 0 and v0 = 0 are set.
[0045] S6: Use the square root of the first moment estimate m1 of gradient g1 divided by the second moment estimate v1 of gradient g1 as the adaptive step size gain coefficient K. adaptive The calculation formula is: To ensure the denominator is not zero, the adaptive step-size gain coefficient is used in this embodiment. In this embodiment, ∈ = 10 -8 .
[0046] S7: In this embodiment, the learning rate α = 0.1 is selected, and the adaptive step size gain coefficient K is used. adaptive Together with the learning rate α, the new focusing position P1 is determined, and the new focusing position P1 is:
[0047] P1=P0+α*K adaptive
[0048] S8: The new focusing position P1 is taken as the current focusing position of the imaging system of the handheld fundus camera in near-infrared illumination mode. The above steps S1 to S7 are repeated at the new focusing position P1. The new focusing position and the image sharpness evaluation index corresponding to the new focusing position are continuously calculated until the difference between the image sharpness evaluation index corresponding to the new focusing position and the image sharpness evaluation index corresponding to the adjacent previous focusing position is less than a set threshold (e.g., 0.05). At this time, it is considered that the optimal focusing position has been found. The optimal focusing position is the focusing position corresponding to the maximum value of the image sharpness evaluation index corresponding to the new focusing position and the adjacent previous focusing position. The focusing mechanism is controlled to move to the optimal focusing position. At this time, the autofocus function of the handheld fundus camera is completed.
[0049] Corresponding to the autofocus method for a handheld fundus camera described in the foregoing embodiments, in another embodiment, the present invention also provides an autofocus system for a handheld fundus camera. The handheld fundus camera includes an imaging system, an illumination system, and the autofocus system of this embodiment. Specifically, the autofocus system of this embodiment includes:
[0050] The autofocus control module is used to control the imaging system to image at the current focusing position P0 in the near-infrared illumination mode of the illumination system, and to calculate the image sharpness evaluation index Q corresponding to the current focusing position P0 using an image sharpness evaluation function. It is also used to select a small focusing amount ΔP, and control the focusing mechanism to move to the first focusing position P+ΔP and the second focusing position P-ΔP respectively, and for the imaging system to image, and to calculate the image sharpness evaluation index Q corresponding to the first focusing position P+ΔP and the second focusing position P-ΔP respectively using the image sharpness evaluation function. + and Q - .
[0051] The image sharpness evaluation function can be implemented using any existing image sharpness evaluation function, and this invention is not limited thereto. Preferably, in this embodiment, the image sharpness evaluation function uses the Tenengrad evaluation function. The Tenengrad evaluation function uses the Sobel operator to extract the horizontal and vertical gradients of the image respectively, and calculates their sum of squares as the evaluation function. The Tenengrad evaluation function has the characteristics of fast processing speed, and by setting a threshold, it can effectively suppress noise interference.
[0052] Specifically, in this embodiment, the Tenengrad evaluation function is used to calculate the image sharpness evaluation index Q using the following formula:
[0053]
[0054] Where T is the set edge detection threshold, and G(x,y) is the gradient at pixel (x,y). G x (x,y) and G y (x,y) represent the gradient values of pixel (x,y) in the horizontal and vertical directions, respectively.
[0055] Optionally, the focusing motor in this embodiment is a voice coil motor. Under the control of the autofocus control module, the voice coil motor adjusts the relative position between the image detector and the lens group. Further, the voice coil motor adjusts the relative position between the image detector and the lens group by adjusting the position of the image detector.
[0056] The index difference calculation module is used to calculate the difference in image sharpness evaluation index between the first focusing position P+ΔP and the second focusing position P-ΔP: ΔQ=Q + -Q - .
[0057] The gradient calculation module is used to calculate the gradient g1 of the image sharpness evaluation function corresponding to the first focus position P+ΔP and the second focus position P-ΔP using the difference ΔQ of the image sharpness evaluation index between the first focus position P+ΔP and the second focus position P-ΔP and the focus amount ΔP. The calculation formula is as follows:
[0058]
[0059] The first and second moment calculation module is used to calculate the first moment estimate m1 and the second moment estimate v1 of the gradient g1 of the image sharpness evaluation function.
[0060] Specifically, the formula for estimating the first moment of gradient g1 is: m1 = β1m0 + (1-β1)g1, and the formula for estimating the second moment of gradient g1 is: Wherein, β1 and β2 are the hyperparameters controlling the estimation of the first and second moments, respectively. In this embodiment, β1 = 0.99 and β2 = 0.9 are taken. m0 and v0 are the first and second moment components of the gradient obtained in the previous focusing process, respectively. For the first focusing, m0 and v0 can be randomly set. For example, in this embodiment, m0 = 0 and v0 = 0 are set.
[0061] The gain coefficient calculation module is used to calculate the adaptive step-size gain coefficient K based on the ratio of the square root of the first-order moment estimate m1 to the square root of the second-order moment estimate v1. adaptive The calculation formula is: To ensure the denominator is not zero, the adaptive step-size gain coefficient is used in this embodiment. In this embodiment, ∈ = 10 -8 .
[0062] The focus position determination module is used to select the learning rate α. In this embodiment, the learning rate α = 0.1 is selected, and the adaptive step size gain coefficient K is used. adaptive The new focusing position is determined by the learning rate α: P1 = P0 + α*K adaptive .
[0063] The autofocus control module uses the new focusing position P1 as the current focusing position of the imaging system in near-infrared illumination mode. It then continuously calculates and obtains new focusing positions and their corresponding image sharpness evaluation indicators (ESIs) until the difference between the ESI at the new focusing position and the ESI at the previous focusing position is less than a set threshold (e.g., 0.05). At this point, the optimal focusing position is considered to have been found. This optimal focusing position is the focusing position corresponding to the maximum value of the ESI between the new focusing position and the previous focusing position. After the autofocus control module moves the focusing mechanism to the optimal focusing position, the handheld fundus camera completes autofocus.
[0064] The imaging system includes a lens group, an image detector, an imaging circuit, and an image acquisition system. The lens group focuses the reflected light from the fundus onto the image detector. In this embodiment, the lens group includes an eyepiece objective, an imaging objective, an illumination objective, and a beam splitter. The image detector can be a CCD image detector or a CMOS image detector; in this embodiment, a CMOS image detector is used. The CMOS image detector receives the reflected light from the fundus and converts the optical signal into an electrical signal. The imaging circuit provides the driving signals and timing pulses required for the CMOS image detector to operate. Optionally, in this embodiment, the imaging circuit includes an FPGA module. The FPGA module generates the timing pulses required by the CMOS image detector and sets different imaging parameters for the CMOS image detector according to actual needs. Imaging parameters include, but are not limited to, exposure time, frame rate, and gain. The image acquisition system acquires the image data from the imaging circuit, arranges the digital image and its imaging parameters in an orderly manner, and outputs a data stream with a certain format.
[0065] The illumination system includes a near-infrared illumination source and a white light illumination source, thus having two operating modes: infrared illumination mode and white light illumination mode. In near-infrared illumination mode, the near-infrared illumination source provides illumination for the fundus camera's autofocus process; in white light illumination mode, the white light illumination source provides illumination for the fundus camera's imaging process. Optionally, in this embodiment, the white light illumination source is designed as a ring light source, consisting of eight LEDs arranged in a ring. The ring light source can avoid the influence of corneal stray light on image quality during fundus imaging.
[0066] According to the specific embodiments of the present invention described above, the autofocus method and system for a handheld fundus camera proposed in this invention improves the focusing position search strategy and introduces the first and second moments of the gradient during the search process to accelerate the search. By utilizing past and current gradient information, it improves the convergence speed while resisting getting trapped in local extrema, thereby improving the effectiveness and efficiency of autofocus in handheld fundus cameras and reducing the requirements of the image sharpness evaluation function in the autofocus process of handheld fundus cameras. This invention is applicable to fast autofocus in handheld fundus cameras and helps to improve the autofocus efficiency of handheld fundus cameras.
[0067] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.
[0068] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. An autofocus method for a handheld fundus camera, the handheld fundus camera comprising an imaging system and an illumination system, characterized in that, Includes the following steps: S1: In the near-infrared illumination mode of the illumination system, the imaging system performs imaging at the current focusing position P0 and calculates the image sharpness evaluation index Q corresponding to the current focusing position P0 using the image sharpness evaluation function. S2: Select the focusing amount ΔP, and control the focusing mechanism to move to the first focusing position P+ΔP and the second focusing position P-ΔP respectively, and the imaging system performs imaging. Then, use the image sharpness evaluation function to calculate the image sharpness evaluation index Q corresponding to the first focusing position P+ΔP and the second focusing position P-ΔP respectively. + and Q - ; S3: Calculate the difference in image sharpness evaluation index between the first focusing position P+ΔP and the second focusing position P-ΔP: ΔQ = Q + -Q - ; S4: Calculate the gradient g1 of the image sharpness evaluation function corresponding to the first focusing position P+ΔP and the second focusing position P-ΔP using the difference ΔQ in the image sharpness evaluation index and the focusing amount ΔP. The calculation formula is as follows: S5: Calculate the first moment estimate m1 and the second moment estimate v1 of the gradient g1 of the image sharpness evaluation function; S6: The ratio of the square root of the first-moment estimate m1 to the square root of the second-moment estimate v1 is used as the adaptive step-size gain coefficient K. adaptive ; S7: Select the learning rate α and use the adaptive step size gain coefficient K adaptive The new focusing position is determined by the learning rate α: P1 = P0 + α*K adaptive ; S8: Take the new focusing position P1 as the current focusing position of the imaging system in near-infrared illumination mode, repeat the above steps S1 to S7, continuously calculate and obtain the new focusing position and its corresponding image sharpness evaluation index, until the difference between the image sharpness evaluation index corresponding to the new focusing position and the adjacent previous focusing position is less than a set threshold, take the focusing position corresponding to the maximum value of the image sharpness evaluation index as the searched optimal focusing position, control the focusing mechanism to move to the optimal focusing position, and complete the automatic focusing.
2. The autofocus method for a handheld fundus camera according to claim 1, characterized in that, The image sharpness evaluation function adopts the Tenengrad evaluation function, and the calculation formula for the image sharpness evaluation index Q is as follows: Where T is the set edge detection threshold, and G(x,y) is the gradient at pixel (x,y). G x (x,y) and G y (x,y) represent the gradient values of pixel (x,y) in the horizontal and vertical directions, respectively.
3. The autofocus method for a handheld fundus camera according to claim 1, characterized in that, The formulas for calculating the first-moment estimate m1 and the second-moment estimate v1 of the gradient g1 of the image sharpness evaluation function are as follows: m1=β1m0+(1-β1)g1 Wherein, β1 and β2 are the hyperparameters controlling the estimation of the first and second moments, respectively, and m0 and v0 are the first and second moment components of the gradient obtained in the previous focusing process, respectively. For the first focusing, m0 and v0 can be set randomly.
4. The autofocus method for a handheld fundus camera according to claim 1, characterized in that, The threshold is 0.
05.
5. An autofocus system for a handheld fundus camera, the handheld fundus camera comprising an imaging system, an illumination system, and the autofocus system, characterized in that, The autofocus system includes: An autofocus control module is used to control the imaging system to image at the current focusing position P0 under the near-infrared illumination mode of the illumination system, calculate the image sharpness evaluation index Q corresponding to the current focusing position P0 using an image sharpness evaluation function, select the focusing amount ΔP, and control the focusing mechanism to move to the first focusing position P+ΔP and the second focusing position P-ΔP respectively, and the imaging system to image, and calculate the image sharpness evaluation index Q corresponding to the first focusing position P+ΔP and the second focusing position P-ΔP respectively using the image sharpness evaluation function. + and Q - ; The index difference calculation module is used to calculate the difference in image sharpness evaluation index between the first focusing position P+ΔP and the second focusing position P-ΔP: ΔQ=Q + -Q - ; The gradient calculation module is used to calculate the gradient g1 of the image sharpness evaluation function corresponding to the first focus position P+ΔP and the second focus position P-ΔP using the difference ΔQ in the image sharpness evaluation index and the focus adjustment amount ΔP. The calculation formula is as follows: The first and second moment calculation module is used to calculate the first moment estimate m1 and the second moment estimate v1 of the gradient g1 of the image sharpness evaluation function. The gain coefficient calculation module is used to calculate the adaptive step-size gain coefficient K based on the ratio of the square root of the first-order moment estimate m1 to the square root of the second-order moment estimate v1. adaptive ; The focus position determination module is used to select the learning rate α and utilize the adaptive step size gain coefficient K. adaptive The new focusing position is determined by the learning rate α: P1 = P0 + α*K adaptive ; The autofocus control module takes the new focusing position P1 as the current focusing position of the imaging system in near-infrared illumination mode, and re-controls the focusing mechanism movement and the index difference calculation module, the gradient calculation module, the first moment and second moment calculation module, the gain coefficient calculation module, and the focusing position determination module to continuously calculate and obtain the new focusing position and its corresponding image sharpness evaluation index. When the difference between the image sharpness evaluation index corresponding to the new focusing position and the adjacent previous focusing position is less than a set threshold, the focusing position corresponding to the maximum value of the image sharpness evaluation index is taken as the searched optimal focusing position. After controlling the focusing mechanism to move to the optimal focusing position, autofocus is completed.
6. The autofocus system for a handheld fundus camera according to claim 5, characterized in that, The lighting system includes a near-infrared lighting source and a white light lighting source, wherein the white light lighting source consists of eight LED beads arranged in a ring.
7. The autofocus system for a handheld fundus camera according to claim 5, characterized in that, The imaging system includes a lens group, an image detector, an imaging circuit, and an image acquisition system; The lens group focuses the reflected light from the fundus onto the image detector; the image detector receives the reflected light from the fundus and converts the optical signal into an electrical signal; the imaging circuit provides the driving signal and timing pulse required for the image detector to operate; the image acquisition system acquires the image data from the imaging circuit and arranges the digital image and its imaging parameters in an orderly manner to form a data stream output.
8. The autofocus system for a handheld fundus camera according to claim 7, characterized in that, The image detector is a CCD image detector or a CMOS image detector.
9. The autofocus system for a handheld fundus camera according to claim 8, characterized in that, The imaging circuit includes an FPGA module, which generates timing pulses required by the CMOS image detector and sets different imaging parameters for the CMOS image detector according to actual needs. The imaging parameters include exposure time, frame rate, and gain.
10. The autofocus system for a handheld fundus camera according to claim 5, characterized in that, The focusing mechanism is a voice coil motor.
Citation Information
Patent Citations
Automatic focusing method based on liquid lens as well as system
CN109451244A
Focusing method and device, electronic equipment and storage medium
CN111432125A