Infrared automatic focusing fast searching method

文档序号:566897 发布日期:2021-05-18 浏览:31次 中文

阅读说明:本技术 一种红外自动对焦快速搜索方法 (Infrared automatic focusing fast searching method ) 是由 杨鹏博 李洁 崔文楠 张涛 于 2021-01-18 设计创作,主要内容包括:本发明公开了一种红外自动对焦快速搜索方法。所述的搜索算法采用了一种具备变步长的爬山法,利用多次求图像清晰度取其中位数的方法保证清晰度评价的准确性,在粗对焦阶段,利用带动量和加速度的爬山法降低对焦过程中的不稳定性,减少了粗对焦过程所需的步数。本发明有效解决了传统自动对焦算法在红外望远镜上图像清晰度计算不准确,自动对焦失败率高和对焦速度慢的问题,在红外望远镜上实现了快速、准确的自动对焦。(The invention discloses an infrared automatic focusing fast searching method. The searching algorithm adopts a hill climbing method with variable step length, the accuracy of definition evaluation is ensured by a method of solving the definition of an image for multiple times and taking the number of digits, the instability in the focusing process is reduced by the hill climbing method with momentum and acceleration in the rough focusing stage, and the number of steps required in the rough focusing process is reduced. The method effectively solves the problems of inaccurate image definition calculation, high automatic focusing failure rate and low focusing speed of the traditional automatic focusing algorithm on the infrared telescope, and realizes quick and accurate automatic focusing on the infrared telescope.)

1. An infrared automatic focusing fast searching method is characterized by comprising the following steps:

1) initialization momentum m1=0,m2When the acceleration a is 0 and the focusing motor step direction d is randomly selected to be a forward direction or a reverse direction, and the image definition value f before the first focusing is calculated according to the formula (1)0

Wherein S (I, j) represents a convolution of a pixel at (I, j) in the image I and the Sobel operator, the expression is formula (2), formula (3) is the Sobel operator in the horizontal direction (left) and the vertical direction (right), and t represents the number of times of focusing;

setting the basic step length of automatic focusing to sbasicPerforming first focusing, calculating an image definition value each time, namely continuously acquiring K times by calculation, calculating a Tenengrad function value of the acquired image, and finally taking the median of the K values as a final image definition value, wherein K is determined according to the calculation power of a calculation platform, the larger the K value is, the more stable the K value is, but the longer the K value is, and generally, the K is 5;

2) calculating the image definition f after the first focusing1

3) Comparing the sharpness values of the two images, if f1<f0If the focusing direction is wrong, setting the focusing direction d as reverse;

4) calculating the momentum m of the image definition change after the first focusing according to the formula (4)1

Wherein f istThe image definition value after focusing at the time t, wherein t represents the focusing times;

5) in steps sbasicFocusing for the 2 nd time in the direction d;

6) calculating an image sharpness value ftIf f ist<ft-1Directly turning to the step 9 to carry out fine focusing, otherwise, calculating the momentum m of the image definition change after the t-th focusing according to the formulas (4), (5) and (6)tAcceleration a and focusing step s, noting that s has a limit if s<0 is set to 0, if s > sbasicThen, it is set to 2sbasic

a=mt-mt-1 (5)

s=sbasic+α·mt+β·a(0<s<2sbasic) (6)

7) Focusing in the step length s and the focusing direction d;

8) performing calculation state transition according to the formula (7), and turning to the step 6;

9) setting the stepping direction d to be reverse;

10) in steps sshortFocusing in the direction d, sshortFor fine focusing step, it can be generally set as the basic focusing stepJudging whether the image clarity value is smaller than the last image clarity value, i.e. ft<ft-1If so, the autofocus ends, otherwise, step 10) is repeated.

Technical Field

The invention belongs to the technical field of infrared detection imaging, and particularly relates to an infrared automatic focusing fast searching method which is suitable for the field of target detection and tracking.

Background

With the further development of economy and science and technology, the requirements on the infrared detection technology are continuously improved, the focal length of the infrared telescope is continuously increased, the aperture is continuously enlarged, the imaging quality and the detection and tracking capabilities of a target are also continuously improved, and the problems that the focusing range is widened, the depth of field is shortened, and the blur caused by defocusing is more severe are solved. The detection system detects and tracks the target successfully on the premise that a clear target image is obtained, the relative position and the relative distance between the target and the detection system may be constantly changed in the process of tracking the target, and if effective focusing operation is not performed, the target imaged by the detection system may be severely blurred, so that the tracking system cannot work normally or even loses the target. In order to obtain a clear infrared image in time, an automatic focusing algorithm is very important, and a rapid and effective automatic focusing algorithm can judge the out-of-focus condition of a lens in a short time and rapidly send a focusing instruction to complete a focusing task.

The method adopts a hill climbing method with variable step length, ensures the accuracy of definition evaluation by using a method of solving the definition of an image for multiple times and taking the number of digits of the image, reduces the instability in the focusing process by using the hill climbing method with momentum and acceleration, and reduces the steps required in the rough focusing process. The algorithm is applied to an actual medium wave infrared telescope system, and experimental results show that the focusing steps required by the algorithm in a coarse focusing stage are reduced by 12.8% compared with those required by a traditional hill climbing method, and the requirement of the infrared telescope system is met.

Disclosure of Invention

An automatic focusing algorithm with variable step length for an infrared telescope is characterized by comprising the following steps:

1. initialization momentum m1=0,m2When the acceleration a is 0 and the focusing motor step direction d is randomly selected to be a forward direction or a reverse direction, and the image definition value f before the first focusing is calculated according to the formula (1)0

Where S (I, j) represents a convolution of the pixel at (I, j) in the image I and the Sobel operator, the expression is expression (2), expression (3) is the Sobel operator in the horizontal direction (left) and the vertical direction (right), and t represents the number of times of focusing.

Setting the basic step length of automatic focusing to sbasicAnd performing primary focusing. Calculating an image definition value every time, namely calculating K times of continuously acquiring images continuously, calculating a Tenengrad function value of the acquired images, and finally taking the median of the K values as a final image definition value, wherein K is more stable and longer in consumed time according to the calculation power of a calculation platform, and generally taking K as 5;

2. calculating the image definition f after the first focusing1

3. Comparing the sharpness values of the two images, if f1<f0If the focusing direction is wrong, setting the focusing direction d as reverse;

4. calculating the momentum m of the image definition change after the first focusing according to the formula (4)1

Wherein f istThe image definition value after focusing at the time t, wherein t represents the focusing times.

5. In steps sbasicFocusing for the 2 nd time in the direction d;

6. calculating an image sharpness value ftIf f ist<ft-1Go directly to step 9 for fine focusing. Otherwise, calculating the momentum m of the image definition change after the t-th focusing according to the formulas (4), (5) and (6)tAcceleration a and focusing step s, noting that s has a limit if s<0 is set to 0, if s > sbasicThen, it is set to 2sbasic

a=mt-mt-1 (5)

s=sbasic+α·mt+β·a(0<s<2sbasic) (6)

7. Focusing in the step length s and the focusing direction d;

8. performing calculation state transition according to the formula (7), and turning to the step 6;

9. setting the stepping direction d to be reverse;

10. in steps sshortFocusing in the direction d, sshortFor fine focusing step, it can be generally set as the basic focusing stepJudging whether the image clarity value is smaller than the last image clarity value, i.e. ft<ft-1If so, the automatic focusing is finished, otherwise, the step 10 is repeated.

Drawings

FIG. 1 is a flow chart of the step-variable auto-focusing algorithm for the infrared telescope.

Fig. 2 is a simplified illustration of the respective parameters during focusing.

Detailed Description

The invention is described in detail below with reference to the following figures and examples:

1. calculating image sharpness

The TenenGrad function value uses Sobel operators to calculate the gradient values in the horizontal and vertical directions, and the gradient of the image edge is amplified using a squaring operation. The evaluation function f (i) is defined as the sum of the squares of the gradients, T is introduced to adjust the sensitivity of the evaluation function, and the expression is formula (1).

2. Automatic search algorithm

Initiating momentum m1=0,m2When the acceleration a is 0, the step direction d of the focusing motor is randomly selected to be a forward direction or a reverse direction, and the image definition value f before the first focusing is calculated0Setting the base step length of auto-focusing as s as shown in equation (1)basicAnd performing primary focusing. Each time the image definition value is calculated, representing that the image is continuously obtained by calculationAnd (3) performing image K times, calculating a Tenengrad function value of the acquired image, and finally removing the median of the K values to obtain a final image definition value, wherein the larger the K value is, the more stable the K value is, but the longer the consumed time is, and generally, the K is equal to 5.

Calculating the definition f of the image after the first focusing1

Comparing the two image definition values, if f1<f0If the focusing direction is wrong, setting the focusing direction d as reverse;

fourthly, calculating the momentum m of the image definition change after the first focusing according to the formula (4)1

Wherein ftThe image definition value after focusing at the time t, wherein t represents the focusing times.

By step size sbasicFocusing for the 2 nd time in the direction d;

seventhly, calculating the image definition value ftIf f ist<ft-1Go directly to step 9 for fine focusing. Otherwise, calculating the momentum m of the image definition change after the t-th focusing according to the formulas (4), (5) and (6)tAcceleration a and focusing step s, noting that s has a limit if s<0 is set to 0, if s > sbasicThen, it is set to 2sbasic

Focusing according to the step length s and the focusing direction d;

ninthly, calculating state transition according to the formula (7), and turning to the step 6;

the direction of step d is set to reverse in the R;

in steps sshortFocusing in the direction d, sshortFor fine focusing step, it can be generally set as the basic focusing stepJudging whether the image clarity value is smaller than the last image clarity value, i.e. ft<ft-1If so, the automatic focusing is finished, otherwise, the step 10 is repeated.

8页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种航天用光学镜头

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!