Follow us :

The Parfocal Calibration and Fast Compensation of High Zoom Ratio Infrared Continuous Zoom Lens-Software Control System Design

time2021/10/15

In order to achieve the parfocality of the infrared continuous zoom lens with a large zoom ratio. This article will specifically introduce another parfocal method-software control system design.


In the previous article, we have introduced in detail a parfocality method of continuous zoom infrared lens with large zoom ratio-hardware circuit design. This article will specifically introduce another effective parfocality method-software control system design. Both of these two parfocal methods make the large zoom ratio continuous zoom infrared lens can effectively parfocal the target.


In order to quickly realize the parfocality compensation in the zooming process, the zooming process and the parfocality compensation are separated and controlled by two MCUs, so as to reduce the closed-loop control time and increase the sampling during the synchronous movement of the zooming and parfocal compensation. Accuracy meets the real-time compensation requirements for parfocality.


In addition, in order to improve the reliability of temperature compensation, it is necessary to use the image gray gradient for verification, and at the same time collect the current compensation position value for the synchronization signal of each frame.


Parfocal Calibration


The parfocality calibration adopts the double-line interpolation method. In order to facilitate the search and interpolation, the following data structure is adopted:


typedef struct


{U16 bianj_v[2][26]; //The zoom position of a specific temperature point, using double-column data


s16 tiaoj_v[2][26]; //corresponding to the compensation value at the zoom position, using double-column data


s16 zxtiaoj_v; //compensation value at the minimum focal length


s16 zdtiaoj_v; //The compensation value at the maximum focal length


u8 mark_v[2][26]; //The sequence number corresponding to each position, easy to find


u8 coef1[2]; //Linear fitting scale proportionality coefficient


u8 coef2[2]; //Linear fitting scale proportionality coefficient


}buchangvalue;


buchangvalue xdata ybdwdata[25];//Select 25 temperature points within the working temperature


Because the path of the spatial zoom cam from short focal length too long focal length and the hysteresis processing curve from long focal length to short focal length have machining errors. The cam curve is shown in Figure 1. At the same position, the morphological error of the forward and reverse curves causes the width of the cam to be different.


When the forward and reverse are at the same position, the actual position is slightly different, resulting in inconsistent parfocality. The double-line compensation method can effectively eliminate the hysteresis error of the machining and assembly adjustment of the space cam.

(a) theoretical space cam curve
(b) actual machining space cam curve

Fig. 1  Space cam curve

The calibration process adopts the online calibration method, from -45 ℃ to 75℃, calibration once every 5 ℃, a total of 25 temperature calibrations point, other temperature segments are fitted by interpolation. This method is not only convenient for temperature point setting in the temperature box but also can filter out singular change points in different temperature sections as much as possible.

Each temperature segment can store up to 26 points, double-line storage can store 52 points (not including the two endpoints), for (50 times continuous zoom lens 13.2~660) normally, you can set 10~16 points per column. Fit the curve accurately.

The data of each structure is arranged in the order of the zoom focal length value from small to large, which can save search time during compensation, and the compensation can be completed faster in the process of zooming. The compensation fitting line is shown in Figure 2.

(a) second-order polynomial compensation fitting curve at -30℃

(b) straight line compensation fitting curve at -30℃

Fig.2 Compensation fitting

Figure 2(a) uses the least-squares method to fit the second-order polynomial, and the accuracy is relatively higher. Figure 2(b) uses straight-line fitting, which has slightly worse accuracy, but it can be compensated by increasing the insertion point.

In order to reduce the calculation, direct stimulation is used to fit the compensation curve, and the scale coefficient of each segment is stored in the scale coefficient variable in the data structure. coef1[0][ ] stores the positive sequence integer value, coef2[0][ ]Stores positive-order decimal values, coef1[1][ ]stores reverse-order integer values, coef2[1][ ]stores reverse-order decimal values, this method can save more storage space than storing floating-point numbers.

The compensation value adopts the combination of the reference value and the signed compensation value, which is convenient to align the compensation table by changing the reference value after replacing the encoder or potentiometer.

The setpoint is replaced by the following three methods

(1) For the short focal position point (less than 250 focal length value), the setpoint is within ±8; for the middle focal position point (250-550 focal length value), the setpoint is within ±4; the far focal position point (greater than 450 focal length value), set within ±2. Points in this range are directly substituted.

(2) All data uses the first-in-first-out method. If the subsequent setpoints are greater than 26, the first set value will be popped out in order. This method is used to reset the value after the lens is worn out.

(3) The compensation value curve is a continuously changing curve, and there are few sudden changes. After the compensation point is set, there are two fitting methods, one is to fit strictly according to the setpoint, and the other is to filter out the singular change point fitting, which can eliminate the wrong point in the setting.

When the temperature compensation point is set, each inserted set point is stored in the internal RAM of the chip. Only after all the points are set at this temperature and the calibration curve is normal can they be stored in FLASH. 

When the power is turned on, then read into RAM, can speed up the search of compensation table, interpolation calculation, and compensation motion control. The temperature set points are arranged in the order of the focal length value from small to large. If the number of set points can meet the full-stroke parfocality of the continuous zoom lens, there is no need to set more points.

Parfocality Rapid Compensation

During the zooming process, the auxiliary control MCU (GD32E103T) feeds back the current zoom value to the main control MCU (GD32F450I) in real-time.

The main controller determines the position of the compensation point according to the calibrated temperature value and the focal length value.

If the current temperature is 27℃ and the focal length value is 70 mm, since only the compensation points of 25±1℃ and 30±1℃ are stored, first use single-line interpolation to calculate the compensation value of point M at the focal length of 30℃70 mm, and then calculate the compensation value of the interpolation point N of the focal length at 25℃70 mm, and finally calculate the compensation value of the P point through M and N.

If the current temperature is near the setpoint (for example, 30±1℃), single-line interpolation compensation will be used directly.

During the zooming process, according to the current zooming feedback value, the compensation control part needs to preprocess and adjust the compensation motor position. By cooperating with the zooming motor, it can ensure that the point that is far from the focus can be called back in time. The output image is relatively clear during the magnification process.

According to the stored position points of each segment and the proportional coefficient of the fitting straight line of the position point, the compensation value of the next position point is determined in advance through the method of y=a*x+b.

In the process of zooming from 82 mm focal length to 510 mm focal length, the compensation passes through 4 fitting straight lines, and the compensation value is determined according to the motion equation of each straight line. For example, in section AB, the zoom path is AK, and the compensation path is KB.

The compensation motor adopts a dual-loop control algorithm, in which the position loop is the main one, and the speed loop is beneficial to compensate the motor speed and drive at high and low temperatures power.

Since the continuous zoom lens has a larger operating temperature range, especially at low temperatures, the viscosity of the low-temperature lubricating oil becomes larger, and a greater motor driving force is required to drive the load.

Therefore, the position loop can be used to quickly adjust the compensation position at room temperature. At high and low temperatures, a speed loop is required to adjust the PID parameters, so as to ensure that the motor will not jam at low temperatures and overshoot at high temperatures, thereby controlling the time of motor adjustment.

Because of the sampling delay error, there is a systematic error between the compensation position and the actual position. In order to eliminate this error, a pulsation control method needs to be added at the end of the dual-loop control, this method is a transient stop. When the sampling is stopped, it can be eliminated dynamic sampling error.

Parfocality Check

In the compensation process, in addition to the processing of digital images, the FPGA circuit also needs to output the current improved gray gradient value according to the frame. According to the frame synchronization signal, the main control chip saves the corresponding zoom position value and different compensation values with frame frequency at the same time. The data structure adopted is as follows:

typedef struct

{U16 bianj_v[2]; //Zoom value

U16 buchang_v[2][100]; //Corresponding to the compensation value at the zoom position, using double-column data

U32 tidu_v[2][100]; //Gray gradient value

}Jiaoyianvalue;

jiaoyianvalue xdata jydata;//Select 25 temperature points within the working temperature

For the gray gradient value, two columns of data are also used to represent the positive sequence (from short focal length to long focal length) and reverse sequence (from long focal length to short focal length) respectively. If the compensation fails, the position of the current compensation value can be determined according to the corresponding gray gradient value.

Corresponding to a frame of the image, during the compensation process, the gray gradient value increases monotonously, and when the compensation stops, the gray gradient value is near the maximum gray gradient, which means that the compensation is normal.

If the gray gradient value does not change according to the above The regular change, indicates that the target is not within the imaging range of the lens (the target is too close to the lens).

Under this condition, if you want a clear image, you need to adjust the compensation motor for position compensation, and the compensated position is inconsistent with the normal calibrated position. At this time, if the monotonic maximum position can be found in the corresponding gray gradient value, then the motor will be directly controlled to go to the specified value position in a dual-loop control mode.

If there is no monotonous maximum position in the gray gradient value, the hill-climbing algorithm can be used to complete the subsequent parfocal compensation. The check method based on the image gray gradient can be turned off, and the branch code of this part will not be calculated after it is turned off.

The parfocality of a large zoom ratio infrared continuous zoom lens consists of three parts, namely online parfocal setting, fast parfocal compensation, and parfocal verification. During parfocal calibration, the temperature is the core element, so ensure The temperature value is constant, and the multi-point collection method is adopted to reduce the error of temperature collection.

Parfocality compensation is based on the set position method, and autofocus is based on the image gray gradient method. Each of the large zoom ratio continuous zoom infrared lenses is very close to the focal point. The auto-focusing algorithm is adopted, and the focusing time is between 1.2 and 2 s. Since auto-focusing has commutation overshoot, the commutation time cannot be avoided. Therefore, the auto-focusing time is difficult to be less than 1.2 s.

Parfocal compensation has no commutation adjustment. For the position close to the focus, the compensation time is very short, basically between 0.3~0.7 s.

The compensation accuracy (temperature calibration position accuracy meets 98%) is similar to that of autofocus. The temperature parfocal compensation can effectively and quickly compensate the image blur caused by mechanical parts processing, assembly adjustment errors, and temperature changes during the zooming process.

When the ambient temperature is basically stable (35°C), test the compensation time experiment at different zoom positions. Since the measured value is related to the current position and the previous position, if the difference between the two positions is small, the compensation time is shorter, and vice versa. The compensation time is relatively long.

It can be seen from the results of the above experiments that in this mode, the compensation accuracy can be controlled within ±2 codes, which is insignificant for the focus accuracy.

As long as the calibration point meets the accuracy requirements, the compensation can accurately achieve lens parfocality under different temperature conditions. The compensation time is reduced from 1.2~2 s for autofocus to about 0.575 s, which can meet user tracking requirements.

Parfocal calibration and parfocal compensation can ensure the parfocality of a continuous zoom infrared lens with a large zoom ratio at different temperatures, and ensure that the lens can perform continuous operations such as tracking and searching for the target.

This technology has been verified on many products, has high reliability, and has good application prospects in large zoom ratio infrared continuous zoom lenses. In addition, the coordinated work algorithm of the zoom and compensation motor is still being improved.

The infrared continuous zoom lens designed and manufactured by Quanhom can achieve effective focusing targets under different environmental conditions. In addition, if you want to learn more about infrared thermal imaging lenses after reading the above, Quanhom will provide you with a professional and comprehensive answer.

As a professional manufacturer of Opto-electromechanical components, we are committed to producing various infrared thermal imaging lenses (including LWIR, MWIR, and SWIR). We have an experienced production team and a strict quality inspection system to conduct strict tests and inspections on the quality of our products, which has won unanimous praise from many customers. We always put the needs of customers in the first place and can provide customers with effective solution technology and thoughtful one-stop service, If you are interested in our infrared continuous zoom lens, please contact us immediately!