This paper presents a real-time optical flow algorithm for a vision-based guidance of an unmanned aerial vehicle (UAV). The optical flow algorithm detects a moving target, and obtains the optical position and optical flow vectors of the target from the image sequence. Then, a vision-based guidance of the UAV is designed to follow the moving target. Additionally, the control law of the imaging seeker uses visual information from the image sequence for target tracking. The method was tested on a 3 degree of freedom (3DOF) dual-rotor UAV with a video camera and the result proved the effectiveness of this method.