摘要:The influence of environment changing, e.g. background beam change, trees waggle, and rain or snow day brings More difficult for moving target detecting. A background dynamic generation algorithm is presented in the paper, and the background dynamic generation algorithm is used to dynamically construct background image, the impact of the environment change is reduced in a certain extent for the moving target detection. Secondly, the background difference method is used to detect the moving target, when the moving target exists, the direction and the coordinate of the moving target is determined according to the result of continuous 2 frame images subtract the background. Finally, an algorithm for calculating the rotation angle of the pan/tilt/zoom is presented, the horizontal rotation angle and the vertical rotation angle of the pan/tilt/zoom is calculated according to the pan/tilt/zoom rotation angle algorithm, and the moving target detection and automatic tracking function is realized.