| With the rapid development of quad-rotor UAV,UAV and related technologies have been widely used in street view shooting,monitoring and inspection,rescue and relief and other fields.The development of UAV has gradually attracted people’s attention,and has become the forefront and hotspot of relevant research in recent years.When the UAV relies on GPS for positioning in some occasions,the accuracy of UAV positioning is greatly affected due to the absence or poor GPS signal,and the use of optical flow technology for non-gps positioning has become one of the popular technologies.Based on the flight principle and structural characteristics of UAV,the attitude mathematical modeling is carried out in this paper,and the improved optical flow algorithm is compiled and applied to the UAV.The main work is as follows:Firstly,several common optical flow algorithms are analyzed,including Lukas-Kanade optical flow method,Horn-Schunck optical flow method and block matching method.For the block matching method,the following improvements are made:(1)median filtering to remove noise;(2)the proportion of gradual elimination of the influence of frequency flash universality(3)in view of the fixed threshold method is not strong,the adaptive threshold segmentation method and treatment of poor low pixel area of this problem,an improved adaptive threshold segmentation method:1)in each of the n*n small set two thresholds,if small variance between two thresholds,the discriminant for the pending area;2)judge whether the eight neighborhoods of the region to be processed contain target region or background region by the number of target region or background region;3)recalculate the threshold value for the remaining areas to be processed and conduct pixel processing again.Secondly,to verify the practicality of the improved optical flow algorithm in UAV.Firstly,the UAV flight control system is designed.Secondly,through the comparison of components and selection of materials,several modules of UAV flight control hardware system are designed:main control module,attitude sensor module,air pressure sensor module,optical flow sensor module,motor and drive module,and power supply module.Finally,the flight control software system writes the UAV control algorithm,sensor data acquisition algorithm and data processing algorithm,and writes the main program,cascade PID algorithm program and attitude solving program.Finally,MATLAB/SIMULINK simulation results show that under the original optical flow algorithm,the UAV has a large drift after reaching the preset position,while the simulation results of the improved optical flow algorithm show that the UAV has a slight drift after reaching the preset position.Real flight experiments show that the improved optical flow algorithm is better than the original optical flow algorithm in three different flight environments.In conclusion,the flight attitude of UAV under the improved optical flow algorithm is greatly improved. |