In this paper, a framework of obstacle avoidance algorithm applied to power line damage safety distance detection is constructed, and its overall architecture and key processes are described in detail. The system design covers three core modules: visual data acquisition and preliminary processing, accurate target recognition and distance measurement, and system error analysis and correction. In the visual data processing chain, we deeply analyze every step from image acquisition to preprocessing to feature extraction, aiming to enhance the adaptability of applications to complex scenes. The target recognition and distance estimation part integrates advanced technology of deep learning to improve the reliability of recognition accuracy and distance estimation. In addition, many common error sources, such as system bias, parallax discontinuity, fluctuation of illumination conditions, etc., are discussed in depth, and corresponding correction strategies are proposed to ensure the accuracy and stability of the system, which provides powerful technical support for achieving efficient and accurate safety monitoring. Specifically, by carefully adjusting the learning rate, convolution kernel size, batch size, pooling layer type, and number of hidden layer nodes, we succeeded in improving the overall accuracy from the initial average of 92.4–95%, and the error rate decreased accordingly.