﻿ 基于无人机图像的输电线检测方法
 计算机系统应用  2019, Vol. 28 Issue (2): 233-239 PDF

1. 国网浙江省电力有限公司 杭州供电公司, 杭州 310000;
2. 国网浙江省电力有限公司 杭州市余杭区供电公司, 杭州 310000

Power Line Detection Method Based on UAV Image
WANG Jian-Jun1, ZHANG Wei1, LOU Hua-Hui2, ZHENG Wei-Yan1, ZHU Jie2
1. Zhejiang Hangzhou Power Supply Company, Hangzhou 310000, China;
2. Yuhang Branch, Zhejiang Hangzhou Power Supply Company, Hangzhou 310000, China
Abstract: In the background of the application of UAV to the power line inspection, a new power line detection method based on UAV image is proposed in order to convenient analyzing the power line. First, an adaptive threshold Canny edge detection method based on Otsu is proposed, which is used to detect the edge of the power line. Then, the binary images obtained by the edge detection are processed by mathematical morphology, and the line segment detection is carried out by Hough transform improved by fractional look-up table method. Finally, a method based on line to line spatial information analysis is proposed to screen and fit the line segments. The experimental results on UAV images show that the proposed power line detection method is a well performance power lines detection method, which is based on UAV images.
Key words: UAV images     power line detection     adaptive threshold     fractional look-up table method Hough transform     line to line spatial information analysis

1 引言

1) 通过Otsu获取高低阈值的方法改进Canny边缘检测算法, 有效避免人工调参, 大大提升了效率和为软件自动化提供有力保障.

2) 使用分式查表法改进Hough变换, 大大减小检测时间.

3) 提出线-线空间信息分析方法, 能够有效的对Hough变换所检测的直线段进行筛选和拟合.

4) 提出完整的基于无人机图像的输电线检测方法, 为后续的输电线破损、断股等故障诊断提供便利.

2 本文算法

2.1 自适应阈值Canny边缘检测

Canny边缘检测的主要步骤: 首先, 使用高斯低通滤波器对输电线图像滤波, 达到平滑降噪的目的. 然后, 计算输电线图像的梯度大小和方向, 并用非极大值抑制方法抑制梯度幅值. 最后, 采用高低阈值消除伪边缘和边缘连接. 本文的高低阈值通过Otsu方法获取, 具体流程如图2所示.

 图 1 本文算法的整体流程

 图 2 自适应阈值Canny边缘检测流程图

2.1.1 滤波消除噪声

 $G\left( {{{x}},y,\sigma } \right) = \frac{1}{{2\pi \sigma }}\exp \left( {\frac{1}{{2\sigma }}\left( {{x^2} + {y^2}} \right)} \right)$ (1)

 $\nabla G = \left[ {\frac{{\partial G/\partial x}}{{\partial G/\partial y}}} \right]$ (2)

 $\frac{{\partial G}}{{\partial x}} = kx\exp \left( { - \frac{{{x^2}}}{{2{\sigma ^2}}}} \right)\exp \left( { - \frac{{{y^2}}}{{2{\sigma ^2}}}} \right)$ (3)
 $\frac{{\partial G}}{{\partial y}} = ky\exp \left( { - \frac{{{x^2}}}{{2{\sigma ^2}}}} \right)\exp \left( { - \frac{{{y^2}}}{{2{\sigma ^2}}}} \right)$ (4)

2.1.2 计算梯度值

 ${P_{{0^\circ }}} = I\left( {i + 1,j} \right) - I\left( {i - 1,j} \right)$ (5)
 ${P_{{{45}^\circ }}} = I\left( {i - 1,j + 1} \right) - I\left( {i + 1,j - 1} \right)$ (6)
 ${P_{{{90}^\circ }}} = I\left( {i,j + 1} \right) - I\left( {i,j - 1} \right)$ (7)
 ${P_{{{135}^\circ }}} = I\left( {i + 1,j + 1} \right) - I\left( {i + 1,j - 1} \right)$ (8)

 ${P_{x'}} = \left( {\sqrt 2 - 1} \right){P_{{0^\circ }}} + \frac{{\left( {2 - \sqrt 2 } \right)\left( {{P_{{{45}^\circ }}} + {P_{{{135}^\circ }}}} \right)}}{2}$ (9)
 ${P_{y'}} = \left( {\sqrt 2 - 1} \right){P_{{{90}^\circ }}} + \frac{{\left( {2 - \sqrt 2 } \right)\left( {{P_{{{45}^\circ }}} + {P_{{{135}^\circ }}}} \right)}}{2}$ (10)

 $M\left( {x,y} \right) = \sqrt {{P_{x'}}^2 + {P_{y'}}^2}$ (11)
 $\theta (x,y) = \arctan \left( {\frac{{{P_{x'}}}}{{{P_{y'}}}}} \right)$ (12)
2.1.3 Otsu法选取阈值

Otsu是简单高效的自适应阈值选取方法. 其主要思想是通过最大化类间方差来选取出实现最佳分割的阈值.

 $\Pr \left( {{r_q}} \right) = \frac{{{n_q}}}{n} \;\;\; q = 0,1,2,\cdots,l - 1$ (12)

km表示高低阈值, 那么第一类的像素灰度级为[0, 1, 2, …, k], 第二类的像素灰度级为[k+1, k+2, …, m], 第三类的像素灰度级为[m+1, m+2, …, l–1], 可定义类间方差函数为:

 ${\sigma _B}^2 = {\omega _0}{\sigma _0}^2 + {\omega _1}{\sigma _1}^2 + {\omega _2}{\sigma _2}^2$ (13)

 ${\omega _0} = \sum\nolimits_{q = 0}^k {{P_r}} ({r_q}),$
 ${\mu _0} = \sum\nolimits_{q = 0}^k {q{P_r}} ({r_q})/{\omega _0},$
 ${\omega _1} = \sum\nolimits_{q = k + 1}^m {{P_r}} ({r_q}),$
 ${\mu _1} = \sum\nolimits_{q = k + 1}^m {q{P_r}} ({r_q})/{\omega _1},$
 ${\omega _2} = \sum\nolimits_{q = m + 1}^{l - 1} {{P_r}} ({r_q}),$
 ${\mu _2} = \sum\nolimits_{q = m + 1}^{l - 1} {q{P_r}} ({r_q})/{\omega _2},$
 ${\sigma _0}^2 = \sum\nolimits_{q = 0}^k {{{\left( {q - {\mu _0}} \right)}^2}} /{\omega _0},$
 ${\sigma _1}^2 = \sum\nolimits_{q = k + 1}^m {{{\left( {q - {\mu _1}} \right)}^2}} /{\omega _1},$
 ${\sigma _2}^2 = \sum\nolimits_{q = m + 1}^{l - 1} {{{\left( {q - {\mu _2}} \right)}^2}} /{\omega _2},$

 $\frac{{\partial {\sigma _B}^2}}{{\partial x}} = {\left( {k - {\mu _0}} \right)^2}{P_k} - {\left( {k - {\mu _1}} \right)^2}{P_k}$ (14)
 $\frac{{\partial {\sigma _B}^2}}{{\partial m}} = {\left( {m - {\mu _1}} \right)^2}{P_m} - {\left( {m - {\mu _2}} \right)^2}{P_m}$ (15)

 $2k - {\mu _0} - {\mu _1} = 0$ (16)
 $2m - {\mu _1} - {\mu _2} = 0$ (17)

2.1.4 确定边缘

1) 若像素幅值大于高阈值, 则判定为边缘像素.

2) 若像素幅值小于低阈值, 则判定为非边缘像素.

3) 若像素幅值在高、低阈值之间, 且该像素连接到边缘像素时, 判定为边缘像素, 否则判定为非边缘像素.

2.2 形态学处理

 $A'\left( {x,y} \right) = \mathop {\max }\limits_{ - \frac{{sizeB}}{2} < i,j < \frac{{sizeB}}{2}} A\left( {x + i,y + i} \right)$ (18)

 $A'\left( {x,y} \right) = \mathop {\min }\limits_{ - \frac{{sizeB}}{2} < i,j < \frac{{sizeB}}{2}} A\left( {x + i,y + i} \right)$ (19)
2.3 Hough变换直线段检测 2.3.1 概述

Hough变换实现了图像空间到参数空间得映射关系, 被广泛应用于直线检测.

 图 3 Hough变换图解

2.3.2 对偶性分析

 $y = kx + b$ (20)

 $y = \left( { - \frac{{\cos \theta }}{{\sin \theta }}} \right)x + \frac{\rho }{{\sin \theta }}$ (21)

 $\left\{ {_{b = \dfrac{\rho }{{\sin \theta }}}^{k = - \dfrac{{\cos \theta }}{{\sin \theta }}}} \right.$ (22)

 $A\left( {x - {x_0}} \right) + B\left( {y - {y_0}} \right) = 0$ (23)

 $\rho = {x_0}\cos \theta + {y_0}\sin \theta$ (24)

2.3.3 分式查表法改进Hough

2.4 直线段筛选拟合 2.4.1 直线段分析

1) 如图4所示, 分段直线段, 但它们属于同一条输电线.

 图 4 直线段属于同一直线

2) 如图5所示, 相互交叠的直线段, 但是它们属于同一条输电线.

 图 5 直线段交叠

3) 如图6所示, 存在误检的直线段, ${A_1}{B_1}$ 是输电线, 而 ${A_2}{B_2}$ 是误检的直线段.

 图 6 存在误检直线段

2.4.2 线-线空间信息分析

 $r\left( {{s_1},{s_2}} \right) = \frac{{\left| {\overrightarrow {{B_1}{A_2}} } \right|}}{{\left| {\overrightarrow {{A_1}{B_1}} } \right| + \left| {\overrightarrow {{B_1}{A_2}} } \right| + \left| {\overrightarrow {{A_2}{B_2}} } \right|}}$ (25)
 \begin{aligned} u\left( {{s_1},{s_2}} \right) & =\left| {\arctan \left( {\dfrac{{{y_{{B_1}}} - {y_{{A_1}}}}}{{{x_{{B_1}}} - {x_{{A_1}}}}}} \right) - \arctan \left( {\dfrac{{{y_{{B_1}}} - {y_{{A_2}}}}}{{{x_{{B_1}}} - {x_{{A_2}}}}}} \right)} \right|\\ & + \left| {\arctan \left( {\dfrac{{{y_{{B_1}}} - {y_{{A_2}}}}}{{{x_{{B_1}}} - {x_{{A_2}}}}}} \right) - \arctan \left( {\dfrac{{{y_{{A_2}}} - {y_{{B_2}}}}}{{{x_{{A_2}}} - {x_{{B_2}}}}}} \right)} \right| \end{aligned} (26)

3 实验结果与分析

3.1 Canny阈值自适应的便利性

 图 7 手动阈值和Otsu自适应阈值处理结果

3.2 分式查表法改进Hough变换的高效性

3.3 线线空间信息分析方法的良好性能

 图 8 实验结果对比

3.4 算法综合评价

4 总结

 [1] 李建峰, 段宇涵, 王仓继, 等. 无人机在输电线路巡检中的应用. 电网与清洁能源, 2017, 33(8): 62-65, 70. DOI:10.3969/j.issn.1674-3814.2017.08.011 [2] 王亚先, 韩军, 赵庆喜, 等. 关于无人机自动巡检方法的研究. 计算机仿真, 2017, 34(3): 56-61, 160. DOI:10.3969/j.issn.1006-9348.2017.03.013 [3] 吴立远, 毕建刚, 常文治, 等. 配网架空输电线路无人机综合巡检技术. 中国电力, 2018, 51(1): 97-101, 138. [4] Menendez OA, Perez M, Cheein FAA. Vision based inspection of transmission lines using unmanned aerial vehicles. Proceedings of 2016 IEEE International Conference on Multisensor Fusion and Integration for Intelligent Systems. Baden-Baden, Germany. 2016. 412–417. [5] Liao JH, Zhang QY, Su YX, et al. Design of small four-rotor UAV transmission line inspection systems. Proceedings of the 2nd International Conference on Machinery, Materials Engineering, Chemical Engineering and Biotechnology. Chongqing, China. 2015. [6] 余明扬, 朱齐果, 王一军. 基于Canny算子和Radon变换的轨道图像校正方法. 计算机应用, 2017, 37(S2): 92-94, 133. [7] 李亚娣, 黄海波, 李相鹏, 等. 基于Canny算子和Hough变换的夜间车道线检测. 科学技术与工程, 2016, 16(31): 234-237, 242. DOI:10.3969/j.issn.1671-1815.2016.31.045 [8] Wang HJ. Edge detection of axis parts via combining canny operator with Hough transformation. Mechanical & Electrical Engineering Technology, 2016, 45(9): 27-30, 47. [9] 王英, 向碧群, 黄颖. 基于Canny理论的多方向角边缘检测算法. 计算机工程, 2007, 33(23): 211-212. DOI:10.3321/j.issn:1002-8331.2007.23.065 [10] 董晶, 杨夏, 于起峰. 基于边缘连接的快速直线段检测算法. 光学学报, 2013, 33(3): 0315003. [11] 李芳, 董振华, 水宜水. 随机Hough变换在高压输电线检测中的应用. 软件导刊, 2014(9): 155-157. [12] 黄东芳. 基于一种改进的Hough变换的输电线路图像中导线识别研究[硕士学位论文]. 南宁: 广西大学, 2016. [13] 孙实超. 无人机航拍图像的输电线识别方法[硕士学位论文]. 南宁: 广西大学, 2016. [14] Yan GJ, Li CY, Zhou GQ, et al. Automatic extraction of power lines from aerial images. IEEE Geoscience and Remote Sensing Letters, 2007, 4(3): 387-391. DOI:10.1109/LGRS.2007.895714 [15] Baker L, Mills S, Langlotz T, et al. Power line detection using Hough transform and line tracing techniques. Proceedings of 2016 International Conference on Image and Vision Computing. Palmerston North, New Zealand. 2016. 1–6.