FPGA-based optical imaging system fast focusing method, storage medium and terminal device

By proposing a fast focusing method for optical imaging systems based on FPGA, and utilizing a lookup table of pointing and focusing positions and image sharpness evaluation, the problem of excessively long focusing time is solved, achieving fast and accurate focusing results, which is suitable for deep space exploration and aerospace applications.

CN121008377BActive Publication Date: 2026-02-17XIAN INST OF OPTICS & PRECISION MECHANICS CHINESE ACAD OF SCI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511534667.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-27
Publication Date
2026-02-17
Estimated Expiration
2045-10-27

AI Technical Summary

Technical Problem

Existing focusing methods for optical imaging systems based on the depth-of-focus method suffer from excessively long focusing search times, which significantly impacts efficiency, especially in deep space exploration and aerospace applications.

Method used

A fast focusing method based on FPGA is adopted for optical imaging systems. By calibrating the pointing position and focusing position lookup table, and combining FPGA to realize motor step count search and image sharpness evaluation, the optimal focusing position is quickly determined.

Benefits of technology

It achieves fast and precise focusing, suitable for microscopic and long-distance focusing, reduces image buffering costs, and improves autofocus efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121008377B_ABST
    Figure CN121008377B_ABST
Patent Text Reader

Abstract

The application provides a kind of FPGA-based optical imaging system fast focusing method, storage medium and terminal equipment, to solve the technical problems that the existing optical imaging system focusing method based on focusing depth method has due to the time required to reach stability is too long, resulting in the focusing search time greatly increases.The FPGA-based optical imaging system fast focusing method provided by the application first calibrates and generates a lookup table for pointing position and focusing position to quickly determine the first round motor step search interval of the focusing motor;The focusing motor drives the focusing lens group to move to the corresponding focusing position in combination with the first round motor step search interval and the search strategy, and then determines whether to perform the next round of search according to the target image definition, so as to quickly find the best focusing position of the optical imaging system and realize fast focusing;The focusing method of the application has large focusing range, low complexity, high sensitivity, fast convergence speed and high focusing accuracy, and can be widely applied to various optical imaging systems.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to a focusing method of an optical imaging system, in particular to a fast focusing method of an optical imaging system based on FPGA, a storage medium and a terminal device. BACKGROUND

[0002] In an optical imaging system, it is essential to obtain a clear and high-quality image, and focusing is a key link to achieve this goal. Focusing refers to changing the distance between the lens optical center and the film plane, that is, changing the image distance v, so as to satisfy the formula 1 / u+1 / v=1 / f, where u is the object distance and f is the focal length, so as to clearly image on the film. The traditional focusing method of the optical imaging system mainly includes contrast detection method, phase detection method and ranging method. The contrast detection method has high precision and is suitable for static image focusing, but the speed is slow, the evaluation function has high complexity, and it is easy to fail in poor lighting conditions. The phase detection method is fast and suitable for dynamic image focusing, but it has high requirements for optical lenses. The ranging method needs to use tools such as laser or ultrasonic waves to measure the distance, and the measurement accuracy is low.

[0003] At present, in the field of deep space exploration and space application, the focusing depth method has become a commonly used focusing method for optical imaging systems. This focusing method continuously images through a set of compensation in the full stroke of the focusing mechanism, and then searches for the best imaging position from a series of continuous images. However, this focusing method takes too long to reach stability, resulting in a significant increase in focusing search time. SUMMARY

[0004] The present application aims to solve the technical problem of the existing focusing depth method-based optical imaging system focusing method, which takes too long to reach stability, resulting in a significant increase in focusing search time, and provides a fast focusing method of an optical imaging system based on FPGA, a storage medium and a terminal device.

[0005] In order to achieve the above-mentioned purpose, the technical solutions provided by the present application are as follows:

[0006] A fast focusing method of an optical imaging system based on FPGA, the optical imaging system comprising a focusing motor and a focusing lens group, characterized in that it is realized based on FPGA and comprises the following steps:

[0007] Step 1: According to the relationship between the pointing position and the focusing position of the optical imaging system at different target distances, calibrate and generate a pointing position and focusing position lookup table;

[0008] Step 2, when the optical imaging system receives the automatic focusing instruction, according to the initial pointing position of the optical imaging system, the pointing position and the focusing position lookup table obtained in step 1 are combined to find the focusing position corresponding to the initial pointing position; the motor steps required by the focusing motor when the focusing lens group moves to the focusing position are calculated, and then the first round motor step search interval of the focusing motor is determined according to the motor steps;

[0009] Step 3, zero calibration is performed on the focusing motor, after the zero calibration is completed, the focusing motor drives the focusing lens group to the corresponding focusing position according to the multiple motor steps in the current round motor step search interval; target images are collected at each focusing position respectively, and the clarity of the target images collected at each focusing position is calculated;

[0010] Step 4, the target image with the highest clarity is selected from the multiple target images, and the clarity of the target image is evaluated, if the clarity reaches the preset value, step 5 is executed, otherwise, the motor steps required by the focusing motor when the focusing lens group moves to the focusing position corresponding to the target image with the highest clarity in the current round is calculated, the i-th round motor step search interval of the focusing motor is determined according to the calculated motor steps, i=2,3,…, and step 3 is returned;

[0011] Step 5, the focusing position corresponding to the target image with the highest clarity is taken as the best imaging position of the optical imaging system; the focusing motor is re-zeroed, and after the zero calibration is completed, the focusing motor drives the focusing lens group to the best imaging position, and the automatic focusing is completed.

[0012] Further, the steps 1-5 are realized based on FPGA.

[0013] Further, in step 2, the first round motor step search interval is [Q1-a1, Q1+a1], Q1 is the motor steps required by the focusing motor when the focusing lens group moves to the focusing position corresponding to the initial pointing position of the optical imaging system, and a1 is the limited threshold corresponding to the first round motor step search interval;

[0014] In step 4, the i-th round motor step search interval is [Qi-ai, Qi+ai], Qi is the motor steps required by the focusing motor when the focusing lens group moves to the focusing position corresponding to the target image with the highest clarity in the last round, and ai is the limited threshold corresponding to the i-th round motor step search interval, i=2,3,…;

[0015] Wherein, the limited threshold corresponding to the next round motor step search interval is smaller than the limited threshold corresponding to the current round motor step search interval.

[0016] Further, in step 4, the limited threshold corresponding to the next round motor step search interval is 1 / 2 of the limited threshold corresponding to the current round motor step search interval.

[0017] Further, in step 3, five motor steps are selected uniformly in the current round motor step search interval, and the focusing motor drives the focusing lens group to the corresponding focusing position according to the five motor steps in the current round motor step search interval. The number of motor steps selected in the current round motor step search interval can be set according to specific needs.

[0018] Further, in step 4, the following function is used for sharpness evaluation:

[0019]

[0020] wherein G represents the sharpness of the selected target image, I(x, y) is the pixel gray value at the image coordinates (x, y), respectively, are four boundary values of the selected image focusing window.

[0021] In addition, the application also provides a computer readable storage medium, which stores a computer program, and the special feature is that the program is executed by the processor to realize the steps of the FPGA-based fast focusing method of the optical imaging system.

[0022] In addition, the application also provides a terminal device, which includes a memory, an FPGA, a processor, and a computer program stored in the memory and executable on the processor, and the special feature is that the processor executes the computer program to realize the steps of the FPGA-based fast focusing method of the optical imaging system.

[0023] Compared with the prior art, the application has the following advantages:

[0024] 1. The FPGA-based fast focusing method of the optical imaging system provided by the application first calibrates and generates a pointing position and focusing position lookup table, and then quickly determines the focusing position corresponding to the initial pointing position of the optical imaging system, and then quickly determines the first round motor step search interval of the focusing motor according to the motor steps required by the focusing motor when the focusing lens group moves to the focusing position; the focusing motor drives the focusing lens group to move to the corresponding focusing position in combination with the first round motor step search interval and the search strategy, and then determines whether to perform the next round of search according to the target image sharpness, so as to quickly find the best focusing position of the optical imaging system and realize fast focusing; the focusing method has a large focusing range, low complexity, high sensitivity, fast convergence speed, and high focusing accuracy, and can be used not only for microscopic focusing optical imaging systems but also for long-distance focusing optical imaging systems.

[0025] 2. The fast focusing method for optical imaging systems based on FPGA provided by this invention is implemented by FPGA. Since the control of the image sensor or CCD in the optical imaging system and image acquisition are both performed by FPGA, FPGA can directly perform automatic focusing based on the acquired image, effectively saving image buffering costs and improving the efficiency of automatic focusing. Attached Figure Description

[0026] Figure 1 This is a schematic diagram of the structure of the optical imaging system in an embodiment of the fast focusing method for an FPGA-based optical imaging system according to the present invention.

[0027] Figure 2 This is a flowchart illustrating the fast focusing method for an FPGA-based optical imaging system according to the present invention.

[0028] Figure 3 This is a schematic diagram showing the relationship between the imaging distance and the installation position of the optical imaging system in an embodiment of the present invention.

[0029] The specific labeling in the attached diagram is as follows:

[0030] 1-Pointing mirror; 2-Telescope objective lens; 3-Focusing group; 4-Image focal plane. Detailed Implementation

[0031] To make the advantages and features of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0032] like Figure 1 As shown, the optical imaging system in this embodiment is a microscopic focusing optical imaging system, which includes a pointing mirror 1, a telescope objective lens 2, a focusing group 3, and an imaging focal plane 4. During system operation, the field of view is adjusted primarily through the pointing mirror 1, and microscopic imaging and laser focusing are achieved through the focusing group 3 in conjunction with the telescope objective lens 2. Microscopic imaging is achieved through the imaging focal plane 4. The focusing group 3 includes a focusing motor and a focusing mirror group. The focusing motor drives the focusing mirror group to move; in this embodiment, a stepper motor is used as the focusing motor.

[0033] Based on the aforementioned optical imaging system, this invention provides a fast focusing method for an FPGA-based optical imaging system, as follows: Figure 2 As shown, the specific steps include:

[0034] 1. Generate a lookup table for pointing position and focusing position.

[0035] Figure 3 This diagram illustrates the relationship between the imaging distance and installation position of an optical imaging system. In the system, the height from the center of the pointing mirror 1 to the ground is H, the target distance is L (the distance from the imaging focal plane 4 to the detection point), the horizontal detection distance is R, and the elevation angle is θ. The relationship between these three is H.2 +R 2 =L 2 In this embodiment, the focusing range of the micro-focusing optical imaging system is 1.0m to 2.0m in front of the telescope objective lens 2. When the height H from the center of the pointing mirror 1 to the ground is 0.65m, the horizontal detection distance R is 0.76m to 1.89m, and the focusing movement of the focusing lens group is 17.39mm.

[0036] Therefore, based on the above conversion relationship, the present invention obtains the relationship between the pointing position and the focusing position of the optical imaging system at different target distances, and calibrates and generates a lookup table of the pointing position and focusing position of the optical imaging system.

[0037] In this embodiment, calibration was performed at 11 target distances: 1.0m, 1.1m, 1.2m, 1.3m, 1.4m, 1.5m, 1.6m, 1.7m, 1.8m, 1.9m, and 2.0m. Therefore, a total of 11 sets of corresponding data for pointing and focusing positions were obtained from the lookup table. The pointing position of the optical imaging system at a target distance of 1.0m is denoted as A1, and the focusing position as F1; the pointing position at a target distance of 1.1m is denoted as A2, and the focusing position as F2; ​​and so on, the pointing position at a target distance of 2.0m is denoted as A11, and the focusing position as F11, as detailed in Table 1.

[0038] Table 1. Lookup Table for Pointing Position and Focusing Position

[0039]

[0040] 2. Quickly focus by looking up the reference position and focus position table.

[0041] When the optical imaging system receives an autofocus command, it first determines the initial pointing position of the optical imaging system, and then quickly finds the focusing position corresponding to the initial pointing position according to the pointing position and focusing position lookup table; then it calculates the number of motor steps Q1 required by the focusing lens group to move to the focusing position, and then determines the first round of motor step search interval [Q1-40, Q1+40] based on the number of motor steps Q1.

[0042] The focusing motor is zeroed. After the zeroing is completed, the focusing motor drives the focusing lens group to the corresponding focusing position in sequence according to the five motor steps Q1-40, Q1-20, Q1, Q1+20, and Q1+40. Then, the target image is acquired at each focusing position, i.e., the image is captured, and the sharpness of the target image acquired at each focusing position is calculated.

[0043] Select the target image with the highest sharpness among the five target images and evaluate its sharpness. It is found that the target image with the highest sharpness among the five target images does not reach the preset sharpness value. At this time, calculate the number of motor steps Q2 required by the focusing motor when the focusing lens group moves to the focusing position corresponding to the target image with the highest sharpness. Then, determine the second round of motor step search interval [Q2-20, Q2+20] based on the calculated number of motor steps Q2.

[0044] The focusing motor is recalibrated. After the calibration is completed, the focusing motor drives the focusing lens group to the corresponding focusing position in sequence according to the five motor steps Q2-20, Q2-10, Q2, Q2+10, and Q2+20. At this time, the image plane will move to the corresponding position. The target image is acquired at each focusing position, and the sharpness of the target image acquired at each focusing position is calculated.

[0045] Select the target image with the highest sharpness among the five target images and evaluate its sharpness. It is found that the target image with the highest sharpness among the five target images still does not reach the preset sharpness value. At this time, calculate the number of motor steps Q3 required by the focusing motor when the focusing lens group moves to the focusing position corresponding to the target image with the highest sharpness. Then, determine the third round of motor step search interval [Q3-10, Q3+10] based on the calculated number of motor steps Q3.

[0046] The focusing motor is recalibrated. After calibration, the focusing motor drives the focusing lens group to the corresponding focusing position in sequence according to the five motor steps: Q3-10, Q3-5, Q3, Q3+5, and Q3+10. At each focusing position, the target image is acquired and the sharpness of the target image acquired at each focusing position is calculated.

[0047] Select the target image with the highest sharpness among the five target images and evaluate its sharpness. If the target image with the highest sharpness among the five target images has reached the preset sharpness value, then the focusing position corresponding to the target image with the highest sharpness among the five target images is taken as the optimal imaging position of the optical imaging system.

[0048] At this point, the focusing motor is recalibrated to zero. After the zeroing is completed, the focusing motor drives the focusing lens group to the optimal imaging position, and the autofocus ends.

[0049] Since current optical imaging systems are typically deep space exploration spaceborne equipment, which are resource-constrained and require high reliability, high sensitivity, and low computational complexity, this embodiment uses the following function as an image sharpness evaluation function to evaluate the sharpness of the target image:

[0050]

[0051] Where G represents the sharpness of the selected target image, and I(x,y) is the pixel grayscale value at image coordinates (x,y). These are the four boundary values ​​of the focus window for the selected image.

[0052] Meanwhile, in this invention, when determining the next round of motor step search interval, it is only necessary to ensure that the limit threshold of the next round of motor step search interval is less than the limit threshold of the current round of motor step search interval. There is no specific restriction on the limit threshold corresponding to each round of motor step search interval.

[0053] The above-mentioned fast focusing method can be stored as a computer program in a computer storage medium. When the computer program is executed by the processor, it implements each step of the above-mentioned fast focusing method for the FPGA-based optical imaging system.

[0054] Furthermore, the rapid focusing method of the present invention can also be applied to a terminal device. The terminal device includes a memory, an FPGA, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements each step of the rapid focusing method for the FPGA-based optical imaging system. The terminal device here can be a computer, laptop, PDA, or various cloud servers, etc., and the processor can be a general-purpose processor, digital signal processor, application-specific integrated circuit, or other programmable logic device.

[0055] The above description is only used to illustrate the technical solutions of the present invention, and is not intended to limit them. For those skilled in the art, modifications can be made to the specific technical solutions described in the above embodiments, or equivalent substitutions can be made to some of the technical features. However, these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions protected by the present invention.

Claims

1. A fast focusing method for an FPGA-based optical imaging system, the optical imaging system comprising a focusing motor and a focusing lens group, characterized in that, Includes the following steps: Step 1: Based on the relationship between the pointing position and the focusing position of the optical imaging system at different target distances, calibrate and generate a lookup table for the pointing position and the focusing position. Step 2: When the optical imaging system receives the autofocus command, based on the initial pointing position of the optical imaging system and the pointing position and focusing position lookup table obtained in Step 1, the focusing position corresponding to the initial pointing position is found; the number of motor steps required by the focusing lens group to move to the focusing position is calculated, and then the first round of motor step search interval of the focusing motor is determined. Step 3: Zero the focusing motor. After zeroing, the focusing motor drives the focusing lens group to the corresponding focusing position in sequence according to the number of motor steps in the current wheel motor step search interval. At each focusing position, the target image is acquired and the sharpness of the target image acquired at each focusing position is calculated. Step 4: Select the target image with the highest clarity among multiple target images and evaluate its clarity. If it reaches the preset clarity value, proceed to Step 5. Otherwise, calculate the number of motor steps required by the focusing motor when the focusing lens group moves to the focusing position corresponding to the target image with the highest clarity. Determine the search interval for the i-th round of motor steps of the focusing motor based on the calculated number of motor steps, i=2,3,…, and return to Step 3. Step 5: The focusing position corresponding to the target image with the highest clarity among multiple target images is taken as the optimal imaging position of the optical imaging system. The focusing motor is recalibrated to zero. After the zeroing is completed, the focusing motor drives the focusing lens group to the optimal imaging position, and the autofocus ends.

2. The fast focusing method for an FPGA-based optical imaging system according to claim 1, characterized in that: Steps 1 through 5 are all implemented using FPGA.

3. The fast focusing method for an FPGA-based optical imaging system according to claim 2, characterized in that: In step 2, the first round of motor step search range is [Q1-a1, Q1+a1], where Q1 is the number of motor steps required by the focusing motor when the focusing lens group moves to the focusing position corresponding to the initial pointing position of the optical imaging system, and a1 is the limit threshold corresponding to the first round of motor step search range. In step 4, the search range for the number of motor steps in the i-th round is [Qi-ai, Qi+ai], where Qi is the number of motor steps required by the focusing motor when the focusing lens group moves to the focusing position corresponding to the target image with the highest clarity in the previous round, and ai is the limit threshold corresponding to the search range for the number of motor steps in the i-th round, i=2,3,…; Among them, the threshold corresponding to the next round of motor step search interval is less than the threshold corresponding to the current round of motor step search interval.

4. The fast focusing method for an FPGA-based optical imaging system according to claim 3, characterized in that: In step 4, the threshold corresponding to the next round of motor step search interval is half of the threshold corresponding to the current round of motor step search interval.

5. The fast focusing method for an FPGA-based optical imaging system according to claim 4, characterized in that: In step 3, five motor steps are evenly selected within the current wheel motor step search range, and the focusing motor drives the focusing lens group to the corresponding focusing position in sequence according to the five motor steps within the current wheel motor step search range.

6. The fast focusing method for an FPGA-based optical imaging system according to claim 1 or 2, characterized in that: In step 4, the following function is used to evaluate sharpness: ; Where G represents the sharpness of the selected target image, and I(x,y) is the pixel grayscale value at image coordinates (x,y). These are the four boundary values ​​of the focus window for the selected image.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When executed by the processor, the program implements the steps of the fast focusing method for an FPGA-based optical imaging system as described in any one of claims 1-6.

8. A terminal device, comprising a memory, an FPGA, 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, it implements the steps of the fast focusing method for an FPGA-based optical imaging system as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Iris focusing method and device of slit lamp equipment, electronic equipment and storage medium

    CN118614863A

  • Autofocus method for endoscope, electronic device, and readable storage medium

    WO2025020895A1