Power line detection plays an important role in automatic power inspection systems based on the vision sensor and unmanned aerial vehicle (UAV). The positioning of the power line is essential to assist in planning and navigation along the power line during the UAV-based power inspection process. For the along-line inspection problem of UAV power inspection, we developed a power line extraction (PLE) algorithm based on parallel line detection and straight line stretching. The proposed algorithm first extracts the image edges by the Canny algorithm and then constructs criterion functions for PLE based on power line feature information, e.g., length, width, and direction. Finally, the information on power line location, direction, width, and so on will be combined to get the exact power line regions. In order to effectively evaluate the accuracy and efficiency of the PLE algorithm, we constructed a power line dataset for UAV inspection and proposed a PLE effect evaluation method. The experimental results demonstrate that the proposed method can effectively reduce the influence of ground environment and other interference factors. Compared with other methods, the proposed algorithm is significantly better than the comparison methods in detecting power lines for the constructed dataset. Moreover, it is still a higher detection accuracy than the comparison methods when the power line is far away from UAV.