Based on the research of four-rotor flight characteristics, in order to ensure a stable four-rotor taking off and landing in a simple background track line, and the ability to track a lines and steer the flight, the algorithm uses a combination of median filter and partition statistics based on statistical algorithms to let the flight control chip to autonomous decision-making flight with the image captured by camera. Finally, the use of MATLAB software and based on STM32 chip four-rotor aircraft are simulated and tested experimental results show that this algorithm can track line successfully in simple background.