In order to realize accurate focusing for thermal imaging system under different backgrounds, an adaptive auto-focusing algorithm of thermal imaging system is proposed. The optimal definition evaluation function based on maximal gradient summation is determined by comparing different evaluation function curves collected by the experiment system. Taking a complex scene as an example, the implementation schemes on searching of optimal focus position, selecting of focus window and evaluation of image definition are described. The auto focusing experiment results of thermal imaging system in multiple complex scenes show that the adaptive auto-focus algorithm of thermal imaging system can effectively solve the problem of accurate focusing foe targets in complex scenes.