Study on key algorithm for Thermal Imaging System Simulation

With the fast development of the armored equipment, the new thermal imaging devices are more and more complex, but the army guaranteeing personnel is lack of the basic training means, which can not provide the technical guarantee for the new thermal imaging equipment effectively and timely. To solve the difficult problem on maintenance training on the thermal image system, semi-physical simulation system for the thermal system is used in maintenance training instead of the real equipment to improve the support capability to the thermal equipment. The fast algorithm about the main functions of the thermal image system is researched in this paper, which established the foundation of the simulation of the thermal image system. The principle of focusing、the view switch and image adjustment function in thermal imaging system are researched in this paper, which is the foundation of how to simulate the thermal


Introduction
As one of the most important part of the observing and sighting system, the thermal image system provides an important means for the crew of the armored vehicle to observe, search, aim and fire to the target at night and rain, snow, fog, haze and other bad weather conditions by translating the infrared radiation spatial distribution due to the different temperature and emissivity into a thermal image.At present, the troops of thermal equipment maintenance training is widely used the mode of theory teaching and the practical training, and the practical training is effective which can help the user master the method of application quickly, but having the disadvantages of high training cost limited training time and place and hard to set fault to the equipment [1] .Using the semi-physical simulation technology in the thermal equipment maintenance training is one of the most effective method to form fighting capacity and support capability.Based on the principle of the thermal imaging system, a series of algorithms to focusing, view and image adjustment of the thermal image system are established, which is the foundation to the simulation for the thermal image system.

The function of thermal imaging system
The thermal imaging system collects and detects the target radiation within the waveband, and forms the thermal image corresponding to the radiation distribution of the target scene by rearranging the signals from the detector，and this thermal image recreates the radiation changes of each part of the target scene, so it can show the characteristics of the target scene.The thermal imaging system is a device that converts invisible infrared radiation into visible images, which extends the visual range of human eyes to the far infrared region.
The main function of the thermal image system included view switch, image adjustment and focusing [2].In dual field infrared telescope, the wide view (6°×6°) is used to detecting and searching targets and the narrow view(3°×3°)is used to identifying and aiming at targets.Image adjustment includes brightness adjustment, contrast adjustment and the polarity switch, changing the brightness is to change the temperature of the center of the target object，changing the contrast is to change the width of the temperature window (temperature difference between the highest and the lowest temperature)， polarity switch is to choice displaying in incandesce or black favor according to the observer's visual sensitivity, the environment of target and the temperature of the targets.Focusing is used to obtain the clear image of the target by changing the adjustment amount when the infrared telescope is switched to narrow-field-view.

The simulation algorithm of focusing
The method of focusing simulation for the thermal image system is realized by image processing technology with the defocusing parameter.

The reason of the phenomenon of defocus fuzzy
The ideal optical system is the imaging of a pair of conjugate planes, that is, in the object space, only the point on the object plane conjugate with the image plane can form a point image.In Fig. 1.，F is the focal point，H is the principal point，point A is the image point of point A ，the plane where point A located is the image plane, and the conjugate plane is the object plane where the point A located.The limit resolution of infrared detector in thermal image system, so to a point A in the object plane，the diameter of the diffuse spot 1 z 、 2 z are less than z (limit resolution)，that means it also can get a clear image of point A when the image plane is moving in the range   .The process of adjusting the position of the image plane according to the position of the optical object is called focusing, which can get a clear image, and the unfocused fuzzy is caused by inaccurate focusing.As an optical system, the result of the unfocused fuzzy can be described by information transform，and supposed the optical system is liner.According to convolution imaging principle of optical system，image function ( , )  f y z is the convolution by object function ( , ) f y z and the point diffusion function ( , )  h y z ，an  

   f y z T f y z f y z h y z
(1) Specially, the transform in Eq.1，when the object plane is conjugating with the image plane ， here is image；when it is defocus, ( , ) h y z is a diffuse spot with special shape，here is ( , ) ( , ) h y z y z   ，there is defocus fuzzy [3] 。There are two templates for the point diffusion function which are circle type and Gaussian type in the research on defocus fuzzy now .

The algorithm of defocus fuzzy
In order to get the template of point diffusion function, circle type point diffusion function is approximated to a rectangle type point diffusion function.Rectangle and Gaussian type point diffusion function can be decomposed into one-dimensional component in horizontal and vertical， which are shown in  The simulation results show that the decomposable template convolution algorithm can simulate the phenomenon of defocus fuzzy well, and the phenomenon of fuzzy is more clear by using rectangle template.

The simulation algorithm of image adjustment function
Image adjustment includes brightness adjustment、 contrast adjustment and polarity switch.

The principle of image adjustment
(1)The principle of brightness adjustment The brightness of the infrared features image of the targets refers to the center temperature of the object，and the contrast refers to the width of the temperature window ， the adjustment of the brightness and the contrast can be realized by the brightness and the contrast transform function.( ) (2)The principle of contrast adjustment The contrast transform function in Eq.3 shows that the part of the input image which the brightness value is less than m will be compressed to a narrower and darker range， by contrast, the part of the input image which the brightness value is more than m will be compressed to a wider and brighter range.Finally， we can get a high contrast output image which the bright part of the image became more brighter and the dark part became more darker： 1 ( ) 1 ( / ) According to the definition of the contrast of the infrared features image of the targets, the transform function of the contrast shown in Eq.3 can be approximated to piecewise function shown in Eq.4，and the value of the contrast is unchanged when C =0， increased when C >0 and reduced when C <0。 ( ) ( ) (3)The principle of polarity switch The polarity of the infrared features image of the targets can be candescence image and black thermal image，which the thermal target is white(high grayscale value) in candescence and the thermal target is black (low grayscale value) in black thermal image.The simulation of polarity switch can be realized by image reversal when the value of greyscale of an image between [0，L-1]，as the Eq.6，in which r and s are the value of pixel before processing and after processing.。 ( )

The algorithm of image adjustment
The simulation of image adjustment is processing every pixel one after another from the first pixel of the original image，we use a 8 bits grayscale image which is 256×256 pixels to verify the correctness of the algorithm of image adjustment，and the MATLAB simulation results are shown in

The simulation algorithm of view switch
The method of view switch simulation is realized by processing the infrared feature image of the targets from wide-field-of-view to narrow-field-of-view when receiving the command of view switch.

The principle of view switch
The function of view switch is realized by switching the objective lens of the dual field infrared telescope，the wide-filed-view and narrow-filed-view are 6°×6° and 3°×3° respectively.The relationship between visual magnification and the view angle is shown in Eq.7， which the visual magnification is the ratio of the tangent function of the view angle from telescope and direct observation， f  物 and f  目 are the focal length of the objective lens and eyepiece respectively.tan tan The focal length of the eyepiece is unchanged when the view switched, and the reactions between the focal length of the objective lens and the view angle is shown in Eq.8 ， we can get the conclusion that the visual magnification of the narrow-filed-view is 4 times to the wide-filed-view by putting 2  3 Eq.8，that means the optical effect of view switch can be realized by magnifying the center of the infrared feature image of the targets 2×2=4 times and outputting with the original resolution. (8)

The algorithm of view switch
The typical image magnification algorithm includes nearest neighbor interpolation、bilinear interpolation and trilinear interpolation [4] 。Considering the amplification effect、 the complexity of the algorithm、 the speed of calculation and so on，the method of bilinear interpolation is used to simulate the phenomenon of the view switch.x y   by interpolation(Eq.9).
The method of bilinear interpolation needs lots of data in three lines of the image and takes a lot of storage space, so it is so complexed to achieve the instantaneity and continuity，so an improvement is made to the method of bilinear interpolation which is realized the view switch by 3 steps， the results of the simulation by a 8×8 image are shown in Fig. 9..
(1)To reset the position of all of the pixels that in the area want to magnify of the original image in order to get the first image； In order to verify the correctness of the algorithm of the view switch function, we do the interpolation operation following the above steps using a 256×256 pixels gray image，and the Fig. 10.showed that the algorithm can simulate the optical effect of the view switch well.

Conclusion
The application of virtual simulation technology gives a convenient、efficient and low cost method in maintenance teaching and training for the thermal equipment，which is out of the dependent of the complex equipment mounting.This paper gave the simulation algorithms of the main function of the thermal system by MATLAB，including focusing、image adjustment and polarity switch function.The research in this paper established the foundation using the scientific training methods in the maintenance teaching of the thermal image system in school and troops.

Fig. 1 .
Fig. 1.The principle of focusing in the optical system

Fig. 3 .Fig. 4 .
Fig. 3.(d).In the convolution operation, the template rotation can be ignored because of the templates of rectangular and Gaussian types point diffusion functions are horizontal and vertical symmetry。 The brightness transform function is shown in Eq.2，Y i is the brightness value of a point in the input image ， and Y o is the brightness value of the corresponding point in the output image， T refers to the transform function, which adjusts the brightness of the image by add the regulated value Y  on the original brightness value.
So，the transform function of the brightness and the contrast of the image can be shown in Eq.5 finally，and change the value of Y  and C to adjust the brightness and contrast of the infrared features image.

Fig. 8 .
Fig. 8.The method of bilinear interpolation The principle of bilinear interpolation is shown in Fig. 8. (a) ， the grayscale value ( , ) g x y   of the interpolation point ( , ) x y   is weighted calculated by the grayscale value of the 4 points around it.Known from the front section, it need to magnify 2 times in the horizontal and vertical of the thermal feature image of the targets, so the interpolation point is just at the center of the 4 points，the hardware bilinear interpolation algorithm became Fig. 8. (b)， which is getting the greyscale value of the point E、F、H、I and ( , ) x y   by

( 2 )Fig. 9 .
Fig. 9.The algorithm of the view switch by hardware

Fig. 10 .
Fig. 10.The MATLAB simulation results for view switch