A method and system for focusing an infrared camera
By utilizing the correspondence between encoder position and image sharpness in an infrared camera, an autofocus method was designed, which solves the problems of high labor costs, frequent misshoots, and low efficiency in existing technologies, and achieves efficient and accurate autofocus.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHANGCHUN TONGSHI PHOTOELECTRIC TECH CO LTD
- Filing Date
- 2025-12-19
- Publication Date
- 2026-05-12
AI Technical Summary
Existing infrared focusing methods suffer from high labor costs, are prone to incorrect shots, are inefficient, and are prone to focusing failures.
An infrared camera focusing method is proposed, which utilizes the correspondence between encoder position and image sharpness, combined with a system control module and motor driver, to achieve automatic focusing. The method includes steps S01 to S04, which utilize the correspondence between encoder position and image sharpness to design a focusing method, control image acquisition, reduce manual intervention, and improve efficiency.
Automatic focusing of the infrared camera was achieved, improving focusing efficiency and achieving a depth of focus accuracy of 1/8, meeting imaging requirements and reducing labor costs and incorrect shooting.
Smart Images

Figure CN121357418B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of motor control, and more specifically to the field of infrared cameras. Background Technology
[0002] In camera control, autofocus is an essential function. The sharp position of the camera lens is affected by external factors such as humidity, air pressure, and the relative mechanical angle of the imaging target, resulting in defocusing. Therefore, after image distortion, it is necessary to use a motor-driven focusing mechanism to correct the corresponding position of the lens and restore the image to sharpness.
[0003] While manual focus can correct for out-of-focus issues caused by environmental factors, it is not intelligent enough and requires human intervention. This means that the user must manually navigate the out-of-focus area step by step. Furthermore, relying on the human eye to determine the sharpness of the image reduces the utilization rate of the device and increases the corresponding labor costs during camera use.
[0004] Traditional infrared autofocus methods mainly rely on the correspondence between the sharpness value returned by the camera and the value of the lens encoder to perform peak searching and determine the position value corresponding to the sharpness value. The drawbacks of this method are that it is prone to misshooting, blind search strategy leading to low efficiency, and getting stuck in local extreme values, resulting in focusing failure.
[0005] In summary, existing infrared focusing methods suffer from high labor costs, a high risk of incorrect shots, low efficiency, and a tendency to fail to focus. Summary of the Invention
[0006] This invention alleviates the problems of high labor costs, easy shooting errors, low efficiency, and frequent focusing failures in existing infrared focusing methods. This invention provides the following solution:
[0007] Option 1: A focusing method for an infrared camera, comprising the following steps:
[0008] Step S01: When the target shooting position is received, a drive signal is sent to move the infrared lens to the forward maximum defocus position;
[0009] Step S02: Using the coarse depth of focus distance as the step size, a drive signal is sent to control the infrared lens to move towards the maximum defocus point in the opposite direction. For each step, the following operations are performed:
[0010] Send a trigger exposure signal and capture an image. At the same time, collect the encoder position fed back by the encoder to obtain a set of data, which includes: encoder position and image.
[0011] Based on all the currently obtained images, a peak search is performed according to the image sharpness value to obtain the maximum and second-highest sharpness values, and the corresponding encoder positions are obtained.
[0012] Step S03: Send a drive signal to control the infrared lens to move to the encoder position corresponding to the maximum sharpness value.
[0013] Using the fine depth of focus distance as the step size, a drive signal is sent to control the infrared lens to move multiple times toward the encoder position corresponding to the second sharpness value. Each time it moves, a trigger exposure signal is sent and an image is captured. At the same time, the encoder position is captured, and multiple sets of data are obtained. Each set of data includes an image and the encoder position.
[0014] Step S04: Sort all images obtained in step S03 from largest to smallest according to their sharpness value to obtain the maximum sharpness value; send a drive signal to control the infrared lens to move to the encoder position corresponding to the maximum sharpness value to complete the focusing.
[0015] Furthermore, in one embodiment of the present invention, the coarse depth of focus distance in step S02 is 1 to 5 depth of focus distances.
[0016] Furthermore, in one embodiment of the present invention, the fine depth of focus distance in step S03 is 1 / 8 to 1 / 2 of the coarse depth of focus distance.
[0017] Furthermore, in one embodiment of the present invention, the number of times mentioned in step S03 is 5 to 10.
[0018] Furthermore, in one embodiment of the present invention, the peak-finding search in step S02 is:
[0019] If the highest sharpness value among all obtained images has a decreasing relationship with the next two consecutive sharpness values, and the next sharpness value is less than half of the highest sharpness value, then the highest sharpness value is taken as the highest sharpness value, and the next sharpness value is taken as the second sharpness value, and the peak search ends.
[0020] If the infrared lens moves to the maximum defocus point in the opposite direction and the peak search is still not finished, then all the obtained images are sorted from largest to smallest. If the sharpness value of the third-ranked image is less than 0.5 of the sharpness value of the first-ranked image, then the sharpness value of the first-ranked image is taken as the maximum sharpness value, and the sharpness value of the second-ranked image is taken as the second sharpness value, and the peak search ends.
[0021] Option 2: A focusing system for an infrared camera, wherein the focusing method is the focusing method described in Option 1, characterized in that it includes an infrared detector, a system control module, a motor driver, and an encoder;
[0022] The encoder is used to send the encoder position to the system control module;
[0023] The system control module is used to send a trigger exposure signal to the infrared detector and a drive signal to the motor driver according to the focusing method.
[0024] The infrared detector is used to acquire images and to send the acquired images to the system control module.
[0025] The motor driver is used to control the movement of the infrared lens.
[0026] Furthermore, in one embodiment of the present invention, the focusing system further includes a left limit sensor and a right limit sensor;
[0027] The left limit sensor is used to send a left limit signal to the system control module when the infrared lens moves to the maximum defocus position in the positive direction;
[0028] The right limit sensor is used to send a right limit signal to the system control module when the infrared lens moves to the maximum defocus position in the opposite direction.
[0029] Furthermore, in one embodiment of the present invention, the focusing system further includes an infrared camera focusing motor, a cam, a guide pin, and a focusing assembly;
[0030] The motor driver is used to control the speed and direction of the infrared camera focusing motor according to the driving signal;
[0031] The infrared camera focusing motor is used to drive the cam to rotate;
[0032] The cam is used to drive the focusing assembly to move via the guide pin, thereby driving the infrared lens to move.
[0033] The focusing method and system for an infrared camera described in this invention effectively alleviate the problems of high labor costs, easy shooting errors, low efficiency, and frequent focusing failures. Specific beneficial effects include:
[0034] 1. The focusing method described in this invention addresses the issue that existing technologies do not establish a definite relationship between the image image used to calculate sharpness and the encoder position. This means that the movement of the infrared camera's focusing motor does not directly correlate with the acquired image, leading to mis-capture problems. This invention, during image acquisition, directly overlays the encoded position onto the image, establishing a correspondence between the encoded position and the image, and indirectly establishing a correspondence between the encoded position and the image sharpness. This solves the problem of mismatch between the actual image resolved by the camera and the encoder value, thus resolving mis-capture issues. Based on this correspondence, the focusing method controls image acquisition, enabling an external trigger model for the infrared camera, eliminating the need for manual focusing and improving focusing efficiency.
[0035] 2. The focusing system described in this invention clarifies the transmission correspondence between the motor, focusing group, cam structure, and guide pin. Combined with the focusing method of the focusing processing unit in the system control module, and the position loop control and speed loop control of the motor control unit, the PWM duty cycle is obtained. The required depth-of-focus movement is converted into an input quantity for the motor drive, thus quantifying the movement control of the camera's focal plane. Based on this quantization, the system can complete the calculation of the sharpness value with the fewest calculations, reducing focusing time and improving focusing efficiency. Through performance verification, this invention can complete the camera's automatic focusing function, restoring image sharpness. The automatic focusing accuracy can reach 1 / 8 of the depth of focus, meeting the camera's imaging requirements.
[0036] The method described in this invention is applicable to the field of automatic focusing in infrared cameras. Attached Figure Description
[0037] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0038] Figure 1 This is a flowchart of the focusing method described in Embodiment 1.
[0039] Figure 2 This is a schematic diagram of the focusing system described in Embodiment Six.
[0040] Figure 3 This is the motor control flowchart described in Implementation Method 3.
[0041] Figure 4 This is a diagram showing the correspondence between depth of focus and lens movement as described in Embodiment 4.
[0042] Figure label:
[0043] System control module 1; Infrared camera assembly 2; Industrial computer 3; Infrared detector 21; Infrared camera focusing mechanism 22; Motor driver 23; Focusing lens 221; Infrared camera focusing motor 222; Encoder 223; Left limit sensor 224; Right limit sensor 225. Detailed Implementation
[0044] Various embodiments of the present invention will now be clearly and completely described with reference to the accompanying drawings. The embodiments described with reference to the drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.
[0045] Implementation Method 1: The focusing method of the infrared camera described in this implementation method is as follows... Figure 1 As shown, it includes the following steps:
[0046] Step S01: When the target shooting position is received, a drive signal is sent to move the infrared lens to the forward maximum defocus position;
[0047] Step S02: Using the coarse depth of focus distance as the step size, a drive signal is sent to control the infrared lens to move towards the maximum defocus point in the opposite direction. For each step, the following operations are performed:
[0048] Send a trigger exposure signal and capture an image. At the same time, collect the encoder position fed back by the encoder to obtain a set of data, which includes: encoder position and image.
[0049] Based on all the currently obtained images, a peak search is performed according to the image sharpness value to obtain the maximum and second-highest sharpness values, and the corresponding encoder positions are obtained.
[0050] Step S03: Send a drive signal to control the infrared lens to move to the encoder position corresponding to the maximum sharpness value.
[0051] Using the fine depth of focus distance as the step size, a drive signal is sent to control the infrared lens to move multiple times toward the encoder position corresponding to the second sharpness value. Each time it moves, a trigger exposure signal is sent and an image is captured. At the same time, the encoder position is captured, and multiple sets of data are obtained. Each set of data includes an image and the encoder position.
[0052] Step S04: Sort all images obtained in step S03 from largest to smallest according to their sharpness value to obtain the maximum sharpness value; send a drive signal to control the infrared lens to move to the encoder position corresponding to the maximum sharpness value to complete the focusing.
[0053] In this embodiment, the depth of focus distance is obtained by actually testing the infrared camera to obtain the displacement of the infrared lens corresponding to one depth of focus, and this displacement is used as the depth of focus distance.
[0054] The depth of focus pass
[0055]
[0056] Obtain, among which, It is the reciprocal of the relative aperture. λ is the wavelength.
[0057] In this embodiment, if the peak search in step S02 does not obtain the maximum and second-highest sharpness values, the infrared lens is moved to the position calibrated at the factory.
[0058] In this embodiment, after the focusing is completed as described in step S04, the autofocus result is fed back to the host computer.
[0059] Implementation Method 2: This implementation method further defines the focusing method described in Implementation Method 1. In this implementation method, the coarse focal depth distance in step S02 is 1 to 5 focal depth distances.
[0060] In this embodiment, the coarse focal depth distance is preferably one focal depth distance.
[0061] Implementation Method 3: This implementation method further defines the focusing method described in Implementation Method 1. In this implementation method, the fine focal depth distance in step S03 is 1 / 8 to 1 / 2 of the coarse focal depth distance.
[0062] In this embodiment, the fine focal depth distance is preferably 1 / 8 of the focal depth distance.
[0063] Implementation Method 4: This implementation method further defines the focusing method described in Implementation Method 1. In this implementation method, the number of times mentioned in step S03 is 5 to 10.
[0064] In this embodiment, the multiple times are preferably 5 times.
[0065] In this embodiment, along with embodiments two and three, the number of times is five, the coarse focal depth distance is one focal depth distance, and the fine focal depth distance is 1 / 8 of the focal depth distance. The combined effect is better, which can achieve both rapid coverage and precise locking, thus completing precise focusing.
[0066] Implementation Method Five: This implementation method further defines the focusing method described in Implementation Method One. In this implementation method, the peak search in step S02 is:
[0067] If the highest sharpness value among all obtained images has a decreasing relationship with the next two consecutive sharpness values, and the next sharpness value is less than half of the highest sharpness value, then the highest sharpness value is taken as the highest sharpness value, and the next sharpness value is taken as the second sharpness value, and the peak search ends.
[0068] If the infrared lens moves to the maximum defocus point in the opposite direction and the peak search is still not finished, then all the obtained images are sorted from largest to smallest. If the sharpness value of the third-ranked image is less than 0.5 of the sharpness value of the first-ranked image, then the sharpness value of the first-ranked image is taken as the maximum sharpness value, and the sharpness value of the second-ranked image is taken as the second sharpness value, and the peak search ends.
[0069] In this embodiment, when the infrared lens moves to the maximum defocus point in the opposite direction, all the obtained images are sorted from largest to smallest. If the clarity value of the third-ranked image is greater than or equal to 0.5 of the clarity value of the first-ranked image, the peak search ends, and the maximum and second-highest clarity values are not obtained.
[0070] Implementation method six: The focusing system of the infrared camera described in this implementation method uses the focusing method described in implementation method one or two. In this implementation method, the focusing system is as follows: Figure 2 As shown, it includes an infrared detector, a system control module, a motor driver, and an encoder;
[0071] The encoder is used to send the encoder position to the system control module;
[0072] The system control module is used to send a trigger exposure signal to the infrared detector and a drive signal to the motor driver according to the focusing method.
[0073] The infrared detector is used to acquire images and to send the acquired images to the system control module.
[0074] The motor driver is used to control the movement of the infrared lens.
[0075] In this embodiment, the system control module is implemented using an FPGA chip.
[0076] In this embodiment, such as Figure 3 The diagram shows the motor control flowchart, where the drive signal is obtained by the system control module based on the current encoder position and the target encoder position; the position deviation is passed through the position loop, and the speed deviation is obtained based on the output of the position loop and the actual speed; the speed deviation is passed through the speed loop to obtain the duty cycle of the PWM, and the drive signal is obtained based on the duty cycle of the PWM.
[0077] In this embodiment, the focusing system further includes a DC regulated power supply, an industrial control computer, and a power management module;
[0078] The DC regulated power supply is 220V to 28V / 6A and is used to provide DC power to the entire system.
[0079] The industrial control computer is used to provide automatic focusing command input and status feedback display;
[0080] The power management module includes two DC-DC components. One DC-DC component converts 28V power to 5V power, which can be implemented using a CJU30-28S5-AG chip. The other DC-DC component converts 5V power to 3.3V, 1.8V, 1.2V and 1.0V power simultaneously to provide operating power for components with different power supply voltage requirements, which can be implemented using an LTM4644 chip.
[0081] The left limit sensor 224 and right limit sensor 225 can be implemented using Hall elements. They are fixedly installed at the two extreme positions where the focusing lens can move within the lens structure, corresponding to the maximum forward defocusing point and the maximum reverse defocusing point in the design. These sensors are used to detect whether the position of the focusing lens in the lens structure has reached these extreme positions. A YS1138 unipolar Hall effect sensor can be used. This sensor operates at a voltage of 3.8V~40V, has a sampling period of 50ms, a standard Gaussian quantity of 250 Gauss at the operating point, a standard Gaussian quantity of 200 Gauss at the release point, a hysteresis of 50 Gauss, and an operating temperature of ~40℃~150℃.
[0082] In this embodiment, the core component of the motor driver 23 can be implemented using the DC motor driver chip RYH8870. The RYH8870 chip includes two H-bridge drive circuits, with a logic input level of 0~5V, a drive level of 6~45V, and a maximum drive current of 3.6A. It can realize the forward and reverse drive of the DC motor and can meet the drive capability requirements of the DC motor of this system.
[0083] In this embodiment, the infrared camera focusing motor 222 is a DC torque motor, which can be implemented using 7J40LYX05Z. This model of DC torque motor has a rated voltage of DC28.0 V, an ideal no-load speed of 2100 rpm, and an electrical time constant of ≤0.25 ms.
[0084] Implementation Method Seven: This implementation method further defines the focusing method described in Implementation Method Six. In this implementation method, the focusing system further includes a left limit sensor and a right limit sensor.
[0085] The left limit sensor is used to send a left limit signal to the system control module when the infrared lens moves to the maximum defocus position in the positive direction;
[0086] The right limit sensor is used to send a right limit signal to the system control module when the infrared lens moves to the maximum defocus position in the opposite direction.
[0087] In this embodiment, when the system control module receives the left limit signal or the right limit signal, it sends a stop signal to the motor driver, and the electrical driver stops the infrared lens from moving.
[0088] Implementation Method 8: This implementation method further defines the focusing method described in Implementation Method 6. In this implementation method, the focusing system further includes an infrared camera focusing motor, a cam, a guide pin, and a focusing assembly.
[0089] The motor driver is used to control the speed and direction of the infrared camera focusing motor according to the driving signal;
[0090] The infrared camera focusing motor is used to drive the cam to rotate;
[0091] The cam is used to drive the focusing assembly to move via the guide pin, thereby driving the infrared lens to move.
[0092] Implementation Method Nine: This implementation method verifies the effectiveness of the focusing system of an infrared camera described in Implementation Method Six.
[0093] The focusing system of the infrared camera used in this embodiment is based on the focusing system described in Embodiment Six, combined with the optimized left and right limit sensors in Embodiment Seven, and the optimized infrared camera focusing motor, cam, guide pin, and focusing assembly in Embodiment Eight. The flowchart is as follows. Figure 3 As shown.
[0094] In this embodiment, through theoretical analysis and actual testing, the image sharpness value and the lens defocus amount are related as follows:
[0095] Ideal focus (0% defocus): Sharpness reaches its peak.
[0096] Slight defocusing within a depth of focus range of 0.8: Sharpness value decreases slowly;
[0097] Defocusing within the depth of focus range of 0.8 to 1.2: Sharpness value decreases significantly;
[0098] When out of focus for more than 1.2 depths of focus: the sharpness value drops sharply (loss of high-frequency information, blur diffusion).
[0099] In summary, as long as the defocus of the lens is less than 0.8 depths of focus, the image quality is almost unaffected; beyond 0.8 depths of focus, the image quality begins to decline significantly; once it exceeds 1.2 depths of focus, the sharpness, contrast, and signal-to-noise ratio will drop in a Gaussian avalanche manner, accompanied by irreversible artifacts and diffraction limits.
[0100] In this embodiment, the focusing system of the infrared camera can achieve a movement of 0.8 to 1.2 depths of focus. The focusing lens is a focusing group lens. The following description takes achieving a movement of 1 depth of focus as an example:
[0101] The reciprocal of the relative aperture of the infrared lens, F = 3.84, is used to determine the wavelength. It is 4.5 ,pass
[0102]
[0103] Obtain the depth of focus of the infrared lens ;
[0104] The encoder uses an encoder with a maximum resolution of 22 bits and an actual resolution of 18 bits;
[0105] Infrared focusing gear transmission ratio configured on the output shaft of the infrared camera focusing motor ,
[0106] In the above structure, when the encoder rotates 1°, the photoelectric encoder rotates 728 codes, the infrared camera focusing motor rotates 1°, and the cam rotates 0.33°.
[0107] Based on actual testing of the relationship between depth of focus and infrared lens displacement, and the relationship between depth of focus and the distance the focusing lens moves, as follows: Figure 4 As shown,
[0108] For every 90° rotation of the cam, the focusing lens shifts axially by 6mm.
[0109] The focusing lens moves by 0.01mm, and the focal plane moves by approximately 0.0139mm.
[0110] The cam rotation step size is obtained by calculating the cam transmission ratio. °, so a 1° rotation of the encoder corresponds to the theoretical step size of the axial displacement of the focusing lens. = ;
[0111] The focal plane displacement is Theoretically, 1 / 8 of the focal depth is 265.4 / 8 = 33.175. The minimum movement is less than 1 / 8 of the focal depth, meaning that the system described in this embodiment can support lens movement of 1 / 8 of the focal depth.
[0112] Focusing lens movement = focal plane displacement * (ratio of focusing lens movement to focal plane movement) = focal plane displacement * (0.01 / 0.0139);
[0113] Cam movement = Focusing lens movement / 6000 * 90°;
[0114] The angle to which the infrared camera's focusing motor rotates is equal to the angle of cam movement / cam transmission ratio = cam movement / 0.33;
[0115] Encoder rotation angle = motor rotation angle;
[0116] Encoder change code value = encoder rotation angle * 728.
[0117] In practical applications, the encoder resolution, infrared focusing gear ratio, and cam transmission ratio can be appropriately selected based on the minimum focusing distance required during the focusing process.
Claims
1. A focusing method for an infrared camera, characterized in that, Includes the following steps: Step S01: When the target shooting position is received, a drive signal is sent to move the infrared lens to the forward maximum defocus position; Step S02: Using the coarse depth of focus distance as the step size, a drive signal is sent to control the infrared lens to move towards the maximum defocus point in the opposite direction. For each step, the following operations are performed: Send a trigger exposure signal and capture an image. At the same time, collect the encoder position fed back by the encoder to obtain a set of data, which includes: encoder position and image. Based on all the currently obtained images, a peak search is performed according to the image sharpness value to obtain the maximum and second-highest sharpness values, and the corresponding encoder positions are obtained. Step S03: Send a drive signal to control the infrared lens to move to the encoder position corresponding to the maximum sharpness value. Using the fine depth of focus distance as the step size, a drive signal is sent to control the infrared lens to move multiple times toward the encoder position corresponding to the second sharpness value. Each time it moves, a trigger exposure signal is sent and an image is captured. At the same time, the encoder position is captured, and multiple sets of data are obtained. Each set of data includes an image and the encoder position. Step S04: Sort all images obtained in step S03 from largest to smallest according to their sharpness value to obtain the maximum sharpness value; send a drive signal to control the infrared lens to move to the encoder position corresponding to the maximum sharpness value to complete the focusing; The coarse depth of focus distance mentioned in step S02 is 1 to 5 depth of focus distances; The fine depth of focus distance mentioned in step S03 is 1 / 8 to 1 / 2 of the coarse depth of focus distance; The number of times mentioned in step S03 is 5 to 10 times; The peak search described in step S02 is as follows: If the highest sharpness value among all obtained images has a decreasing relationship with the next two consecutive sharpness values, and the next sharpness value is less than half of the highest sharpness value, then the highest sharpness value is taken as the highest sharpness value, and the next sharpness value is taken as the second sharpness value, and the peak search ends. When the infrared lens moves to the maximum defocus point in the opposite direction, and the peak search is still not over, all the obtained images are sorted from largest to smallest. The third-ranked image has a sharpness value that is less than 0.5 times the sharpness value of the first-ranked image. The first-ranked image is then taken as the maximum sharpness value, and the second-ranked image is taken as the second sharpness value. The peak search ends. The depth of focus distance is obtained by conducting actual tests on the infrared camera, which yields the displacement of the infrared lens corresponding to one depth of focus, and this displacement is used as the depth of focus distance.
2. A focusing system for an infrared camera, wherein the focusing method is the focusing method described in claim 1, characterized in that, Includes infrared detectors, system control modules, motor drivers, and encoders; The encoder is used to send the encoder position to the system control module; The system control module is used to send a trigger exposure signal to the infrared detector and a drive signal to the motor driver according to the focusing method. The infrared detector is used to capture images; It is also used to send the obtained images to the system control module; The motor driver is used to control the movement of the infrared lens.
3. The focusing system according to claim 2, characterized in that, The focusing system also includes a left limit sensor and a right limit sensor; The left limit sensor is used to send a left limit signal to the system control module when the infrared lens moves to the maximum defocus position in the positive direction; The right limit sensor is used to send a right limit signal to the system control module when the infrared lens moves to the maximum defocus position in the opposite direction.
4. The focusing system according to claim 2, characterized in that, The focusing system also includes an infrared camera focusing motor, a cam, guide pins, and a focusing assembly; The motor driver is used to control the speed and direction of the infrared camera focusing motor according to the driving signal; The infrared camera focusing motor is used to drive the cam to rotate; The cam is used to drive the focusing assembly to move via the guide pin, thereby driving the infrared lens to move.