CN111126431A - A Fast Screening Method for Massive Power Defect Photos Based on Template Matching - Google Patents
A Fast Screening Method for Massive Power Defect Photos Based on Template Matching Download PDFInfo
- Publication number
- CN111126431A CN111126431A CN201911108819.9A CN201911108819A CN111126431A CN 111126431 A CN111126431 A CN 111126431A CN 201911108819 A CN201911108819 A CN 201911108819A CN 111126431 A CN111126431 A CN 111126431A
- Authority
- CN
- China
- Prior art keywords
- image
- matching
- template
- layer
- point
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/757—Matching configurations of points or features
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/751—Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20016—Hierarchical, coarse-to-fine, multiscale or multiresolution image processing; Pyramid transform
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Databases & Information Systems (AREA)
- Artificial Intelligence (AREA)
- Health & Medical Sciences (AREA)
- Multimedia (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
本发明公开了一种基于模板匹配的海量电力缺陷照片快速筛选方法,通过对传统的归一化互相关算法进行改进,降低计算的复杂度,减少运算过程中的计算量;利用小波金字塔分层匹配的思想,分辨率由低到高,匹配由粗到细,提高图像匹配效率,改善匹配精度;实现缺陷图像的快速、准确匹配筛选,为智能缺陷识别提供重要的数据基础。
The invention discloses a rapid screening method for massive electric power defect photos based on template matching. By improving the traditional normalized cross-correlation algorithm, the complexity of calculation and the amount of calculation in the calculation process are reduced; the wavelet pyramid is used for layering The idea of matching, the resolution is from low to high, the matching is from coarse to fine, improves the image matching efficiency and improves the matching accuracy; realizes the fast and accurate matching and screening of defect images, and provides an important data basis for intelligent defect identification.
Description
技术领域technical field
本发明涉及图像处理技术领域,尤其是指一种基于模板匹配的海量电力缺陷照片快速筛选方法。The invention relates to the technical field of image processing, in particular to a method for quickly screening photos of massive power defects based on template matching.
背景技术Background technique
近年来,无人机技术的快速发展,高分辨率可见光照相机(摄像机)、高精度红外热像仪、激光雷达等检测装备丰富了输电线路巡视手段,利用无人机遥感技术进行输电线路的巡检能有效提高电力巡检的工作效率,减少人工巡检工作量,降低输电线路运维成本和压力。基于无人机的电力巡检获得的丰富输电线路设备数据进行系统分析和管理,能为电网防灾、管理和维护提供更多的数据支持。电网企业全面推行机巡作业模式,以南方电网公司为例,早于2004年即开展输电线路直升机巡检业务,2013年开始整体推进输电线路机巡工作,目标2020年底实现“机巡为主、人巡为辅”的输电线路精益化运维。In recent years, with the rapid development of UAV technology, detection equipment such as high-resolution visible light cameras (cameras), high-precision infrared thermal imagers, and lidars have enriched the means of inspection of transmission lines. UAV remote sensing technology is used to inspect transmission lines. Inspection can effectively improve the work efficiency of power inspection, reduce the workload of manual inspection, and reduce the cost and pressure of transmission line operation and maintenance. The system analysis and management of the abundant transmission line equipment data obtained from the power inspection based on the UAV can provide more data support for the power grid disaster prevention, management and maintenance. Power grid companies have fully implemented the machine patrol operation mode. Taking China Southern Power Grid Corporation as an example, the helicopter inspection business of transmission lines has been carried out as early as 2004. In 2013, the overall promotion of machine patrol work on transmission lines began. The lean operation and maintenance of transmission lines with human patrol as a supplement.
随着机巡业务的不断推进,输电线路机巡巡检数据处理与分析应用必将进入“大数据”时代。传统的机巡数据处理模式需要大量人工干预,缺陷识别主要依靠目视判读,手动以画图工具等标识缺陷位置,数据处理周期长,工作量大,据不完全统计,存在缺陷照片不到全部巡检照片的2%。同时,人工长时间作业易导致判断结果准确度下降,结果存在主观性、模糊性、不完全等问题,不利于及时发现设备缺陷,制约了数据的高效利用。With the continuous advancement of the machine patrol business, the data processing and analysis application of the machine patrol inspection of transmission lines will surely enter the era of "big data". The traditional machine patrol data processing mode requires a lot of manual intervention. Defect identification mainly relies on visual interpretation and manual use of drawing tools to identify the defect location. The data processing cycle is long and the workload is large. According to incomplete statistics, there are not all defects in photos. Check 2% of the photo. At the same time, the long-term manual operation can easily lead to a decrease in the accuracy of the judgment results, and the results have problems such as subjectivity, ambiguity, and incompleteness, which are not conducive to the timely detection of equipment defects and restrict the efficient use of data.
当前,机巡数据的处理正处于与人工智能、深度学习等新技术结合,迈向自动化、智能化的阶段。数据是人工智能的基础和血液。目前,电网企业累积的缺陷数据,基本全部是人工判读,用画图工具等框出缺陷位置的照片,这些照片由于存在标识框无法直接用于人工智能学习,需从原始的海量巡检数据中,找出未处理过的缺陷照片,为缺陷智能识别提供数据满足要求的数据基础。At present, the processing of machine patrol data is in the stage of automation and intelligence combined with new technologies such as artificial intelligence and deep learning. Data is the foundation and blood of artificial intelligence. At present, the defect data accumulated by power grid companies are basically all manually interpreted, and pictures of defect locations are framed by drawing tools, etc. These photos cannot be directly used for artificial intelligence learning due to the existence of identification frames. Find out the unprocessed defect photos, and provide the data basis for the data to meet the requirements for intelligent defect identification.
目前常用的基于灰度的图像匹配算法包括:ABS算法(Absolute BalanceSearch),序贯相似性检测算法(Similarity Sequential Detection Algorithm,SSDA)和归一化互相关算法(Normalized Cross Correlation,NCC)。Currently commonly used gray-based image matching algorithms include: ABS algorithm (Absolute BalanceSearch), Sequential Similarity Detection Algorithm (Similarity Sequential Detection Algorithm, SSDA) and Normalized Cross Correlation (Normalized Cross Correlation, NCC).
ABS算法是最早被提出来的匹配算法,是用模板图像与搜索图像上对应点像素灰度值的差值表示相关性。其计算过程可以描述为:设搜索图像为S,大小为M×N,模板图像为T,大小为m×n,则搜索图像中存在(M-m+1)×(N-n+1)个匹配点,而每个匹配点都会与一个m×n的搜索窗口对应。所以匹配的过程即为模板图像按照某一特定的顺序在搜索图像窗口上滑动,每滑动一次就进行一次计算,根据相关值判断当前搜索窗口是否与模板图像匹配。如果其差值小于预先设定的阈值,视为匹配成功,否则匹配失败。ABS值一般有三种计算方法,平均绝对差(MAD)法、绝对误差总和(SAD)法、平方差总和(SSD)法。The ABS algorithm is the earliest proposed matching algorithm, which uses the difference between the pixel gray value of the template image and the corresponding point pixel on the search image to represent the correlation. The calculation process can be described as: set the search image to be S, the size to be M×N, the template image to be T, and the size to be m×n, then there is (M-m+1)×(N-n+1) in the search image. matching points, and each matching point corresponds to an m×n search window. Therefore, the matching process is that the template image slides on the search image window according to a specific order, and a calculation is performed every time it slides, and whether the current search window matches the template image is judged according to the correlation value. If the difference is less than the preset threshold, the match is deemed successful, otherwise the match fails. There are generally three calculation methods for the ABS value, the mean absolute difference (MAD) method, the sum of absolute errors (SAD) method, and the sum of squared differences (SSD) method.
ABS算法虽然计算量较小,但只考虑像素值的距离,若待匹配图像的亮度变化较大则会对匹配结果造成较大影响。而且不同的图像及模板,都对应不同大小的搜索窗口和背景灰度值,所选取的阈值也不同,因此预先设定的阈值不能适合所有情况,最终造成误匹配率高。Although the calculation amount of the ABS algorithm is small, it only considers the distance of the pixel value. If the brightness of the image to be matched changes greatly, the matching result will be greatly affected. Moreover, different images and templates correspond to different sizes of search windows and background gray values, and the selected thresholds are also different. Therefore, the preset thresholds cannot be suitable for all situations, resulting in a high mismatch rate.
序列相似性检测算法(SSDA)是针对传统模板匹配算法提出的一种高效的图像匹配算法。其基本原理如下:Sequence Similarity Detection Algorithm (SSDA) is an efficient image matching algorithm proposed for traditional template matching algorithm. The basic principle is as follows:
模板图像T在搜索图像S上按每个像素点滑动并计算相关值,其相关值最大的位置即对应匹配最佳的位置。在这个过程中,SSDA算法仅计算部分匹配相关值,而没有计算全部像素灰度绝对值,因此减少了计算量,提高了运算速度。具体算法即先初步搜索,再精搜索,搜索的范围一步步减小。The template image T slides on the search image S at each pixel point and calculates the correlation value, and the position with the largest correlation value corresponds to the position with the best matching. In this process, the SSDA algorithm only calculates part of the matching correlation value, but does not calculate the absolute value of all pixel grayscales, thus reducing the amount of calculation and improving the operation speed. The specific algorithm is a preliminary search, and then a fine search, and the search range is gradually reduced.
SSDA算法的步骤:The steps of the SSDA algorithm:
Step1:定义绝对误差:Step1: Define the absolute error:
其中, in,
Step2:取固定阈值Tk;Step2: take a fixed threshold Tk ;
Step3:随机选取子图Si,j(x,y)中的像素值,计算其与模板图像T对应点的误差,并把此差值与其他点对产生的误差值累加起来。一旦累加后的误差超过Tk,则实验选择停止继续累加,同时记下累加次数r。序贯相似性检测算法SSDA的检测曲面可以定义为:Step3: Randomly select the pixel value in the sub-image Si, j(x, y), calculate the error between it and the corresponding point of the template image T, and accumulate this difference with the error values generated by other point pairs. Once the accumulated error exceeds T k , the experiment chooses to stop the accumulation and record the number of accumulation r at the same time. The detection surface of the sequential similarity detection algorithm SSDA can be defined as:
Step4:将I(i,j)值最大的点作为匹配点,原因是此点只有经过多次的累加才能满足总误差∑ε大于给定的阈值。Step4: The point with the largest I(i,j) value is used as the matching point, because this point can only satisfy the total error ∑ε greater than the given threshold after multiple accumulations.
SSDA算法的速度提高,但是以像素点选取个数大幅降低为基础的,其精度很低,匹配效果不好,容易受到噪声的干扰。尤其当算法进入信息贫乏的区域时,会导致误匹配率的明显上升。The speed of the SSDA algorithm is improved, but based on the significant reduction in the number of pixel points selected, its accuracy is very low, the matching effect is not good, and it is easily disturbed by noise. Especially when the algorithm enters the information-poor area, it will lead to a significant increase in the false matching rate.
归一化相关算法的定义如式:The definition of the normalized correlation algorithm is as follows:
其中,x、y为基准图大小,m、n为模板大小,A(i,j)为实时图像中匹配区域的像素的灰度值,x、y为匹配点,B(i-x,i-y)为模板中的像素灰度值,是模板的灰度均值,为图像中匹配区域的均值。C(x,y)的取值范围为-1~1,值越大表示相关程度越高。Among them, x and y are the size of the reference image, m and n are the size of the template, A(i, j) is the gray value of the pixel in the matching area in the real-time image, x and y are the matching points, and B(ix, iy) is the the pixel gray value in the template, is the grayscale mean of the template, is the mean of the matching regions in the image. The value range of C(x,y) is -1 to 1, and the larger the value, the higher the correlation degree.
NCC算法不仅在灰度变化和几何畸变不大时匹配精度高,而且抗白噪声能力也较强。但该算法需要把模板图像在源图像中逐一平移,并计算每个位置的相似度算子,算法复杂度高,匹配速度慢。The NCC algorithm not only has high matching accuracy when the grayscale change and geometric distortion are small, but also has strong anti-white noise ability. However, this algorithm needs to translate the template image one by one in the source image, and calculate the similarity operator of each position, the algorithm complexity is high, and the matching speed is slow.
发明内容SUMMARY OF THE INVENTION
针对上述背景技术中的问题,提供一种基于模板匹配的海量电力缺陷照片快速筛选方法。通过构建一种快速的归一化互相关图像模板匹配算法,实现从海量巡检中数据快速筛选缺陷照片。Aiming at the above problems in the background art, a method for quickly screening photos of massive power defects based on template matching is provided. By constructing a fast normalized cross-correlation image template matching algorithm, it can quickly filter defect photos from massive inspection data.
本发明所述的一种基于模板匹配的海量电力缺陷照片快速筛选方法,包括:A method for quickly screening photos of massive power defects based on template matching according to the present invention, comprising:
S1获取待匹配图像和模板图像;S1 obtains the image to be matched and the template image;
S2构建所述待匹配图像和模板图像的小波变换金字塔;S2 constructs the wavelet transform pyramid of the image to be matched and the template image;
S3对所述小波变换金字塔的每一层进行特征点提取,获得待匹配图像和模板图像的特征点金字塔;S3 performs feature point extraction on each layer of the wavelet transform pyramid, and obtains the feature point pyramid of the image to be matched and the template image;
S4对所述待匹配图像和模板图像的特征点金字塔顶层进行NCC算法匹配,获得顶层最佳匹配点;S4 performs NCC algorithm matching on the top layer of the feature point pyramid of the image to be matched and the template image to obtain the best matching point on the top layer;
S5将所述顶层最佳匹配点作为下层图像匹配的中心点,进行NCC算法匹配,逐步映射到最底层的最佳匹配点。S5 uses the top-level best matching point as the center point of the bottom-level image matching, performs NCC algorithm matching, and gradually maps to the bottom-level best matching point.
本发明提出一种基于小波金字塔搜索策略的快速归一化互相关图像匹配算法。该算法在传统NCC算法的基础上,采用和表法分别计算图像均值、图像方差来降低运算的复杂度,减少算法的计算量;同时改进搜索策略,构造图像小波金字塔结构,利用分层匹配来提高图像匹配的效率。The invention proposes a fast normalized cross-correlation image matching algorithm based on wavelet pyramid search strategy. On the basis of the traditional NCC algorithm, the algorithm uses the sum table method to calculate the image mean and image variance respectively to reduce the complexity of the operation and the calculation amount of the algorithm; at the same time, the search strategy is improved, the image wavelet pyramid structure is constructed, and the hierarchical matching is used to Improve the efficiency of image matching.
小波变换是一种变换分析方法,它继承和发展了短时傅立叶变换局部化的思想,同时又克服了窗口大小不随频率变化等缺点,能够提供一个随频率改变的"时间-频率"窗口,是进行信号时频分析和处理的理想工具。它的主要特点是通过变换能够充分突出问题某些方面的特征,能对时间(空间)频率的局部化分析,通过伸缩平移运算对信号(函数)逐步进行多尺度细化,最终达到高频处时间细分,低频处频率细分,能自动适应时频信号分析的要求,从而可聚焦到信号的任意细节,解决了Fourier变换的困难问题。Wavelet transform is a transform analysis method. It inherits and develops the idea of localization of short-time Fourier transform, and at the same time overcomes the shortcomings of window size that does not change with frequency. It can provide a "time-frequency" window that changes with frequency. The ideal tool for signal time-frequency analysis and processing. Its main feature is that it can fully highlight the characteristics of some aspects of the problem through transformation, can analyze the localization of temporal (spatial) frequencies, and gradually refine the signal (function) through scaling and translation operations. Time subdivision, frequency subdivision at low frequency, can automatically adapt to the requirements of time-frequency signal analysis, so that it can focus on any details of the signal and solve the difficult problem of Fourier transform.
特征点提取广泛应用到目标匹配、目标跟踪、三维重建等应用中,在进行目标建模时会对图像进行目标特征的提取,常用的有颜色、角点、特征点、轮廓、纹理等特征。Harris角点检测是特征点检测的基础,提出了应用邻近像素点灰度差值概念,从而进行判断是否为角点、边缘、平滑区域。Harris角点检测原理是利用移动的窗口在图像中计算灰度变化值,其中关键流程包括转化为灰度图像、计算差分图像、高斯平滑、计算局部极值、确认角点。Feature point extraction is widely used in target matching, target tracking, 3D reconstruction and other applications. During target modeling, target features are extracted from images. Commonly used features are color, corner, feature point, contour, texture and so on. Harris corner detection is the basis of feature point detection, and the concept of applying the grayscale difference of adjacent pixels is proposed to judge whether it is a corner, edge or smooth area. The Harris corner detection principle is to use the moving window to calculate the grayscale change value in the image. The key process includes converting to grayscale image, calculating difference image, Gaussian smoothing, calculating local extreme value, and confirming corner points.
具体地,所述待匹配图像为电力巡检拍摄的原始图像;所述模板图像为人工标注污染过的缺陷图像。Specifically, the to-be-matched image is an original image captured by electric power inspection; the template image is a manually marked contaminated defect image.
进一步地,构建所述待匹配图像和模板图像的小波变换金字塔的步骤包括:用Haar小波变换对图像进行两层分解,最小分辨率的子图作为金字塔的顶层,原图像作为金字塔最底层,构成三层金字塔图像。Further, the step of constructing the wavelet transform pyramid of the image to be matched and the template image comprises: using Haar wavelet transform to decompose the image in two layers, the sub-image of the minimum resolution is used as the top layer of the pyramid, and the original image is used as the bottom layer of the pyramid, forming Three-level pyramid image.
进一步地,所述构成三层金字塔图像的步骤包括:以L表示低通滤波器,H表示高通滤波器,分别对图像的行列进行卷积,并进行2取1的亚抽样,将原图像分解成4个子带LL1、LH1、HL1和HH1;其中LL1反应原图像的低频成分,是由水平和垂直两个方向的低通滤波器获得的子带;LH1反应原图像的水平边缘细节,是由水平方向低通滤波器和垂直方向的高通滤波器获得的子带;HL1为水平方向高频和垂直方向低频获得的子带;HH1是由水平方向高频和垂直方向高频获得的子带;将分辨率设为原图像的1/2,对子带LL1进行再一步分解,获得LL2、LH2、HL2和HH2共4个子带;将分辨率设为原图像的1/4,对子带LL2进行再一步分解,获得LL3、LH3、HL3和HH3共4个子带。Further, the step of forming a three-layer pyramid image includes: using L to represent a low-pass filter and H to represent a high-pass filter, respectively convolving the rows and columns of the image, and performing 2-to-1 subsampling to decompose the original image. into 4 sub-bands LL 1 , LH 1 , HL 1 and HH 1 ; LL 1 reflects the low-frequency components of the original image, which are sub-bands obtained by low-pass filters in both horizontal and vertical directions; LH 1 reflects the low-frequency components of the original image. The horizontal edge detail is the subband obtained by the horizontal low-pass filter and the vertical high-pass filter; HL 1 is the subband obtained by the horizontal high frequency and the vertical low frequency; HH 1 is the subband obtained by the horizontal high frequency and vertical low frequency The sub-band obtained at high frequency in the direction; set the resolution to 1/2 of the original image, and further decompose the sub-band LL 1 to obtain a total of 4 sub-bands of LL 2 , LH 2 , HL 2 and HH 2 ; Set as 1/4 of the original image, and further decompose the subband LL 2 to obtain a total of 4 subbands of LL 3 , LH 3 , HL 3 and HH 3 .
图像的高低频是对图像各个位置之间强度变化的一种度量方法。低频分量主要对整副图像的强度的综合度量。高频分量主要是对图像边缘和轮廓的度量。如果一副图像的各个位置的强度大小相等,则图像只存在低频分量,从图像的频谱图上看,只有一个主峰,且位于频率为零的位置。如果一副图像的各个位置的强度变化剧烈,则图像不仅存在低频分量,同时也存在多种高频分量,从图像的频谱上看,不仅有一个主峰,同时也存在多个旁峰。The high and low frequency of the image is a measure of the intensity change between the various positions of the image. The low-frequency components are mainly a comprehensive measure of the intensity of the entire image. High-frequency components are mainly measures of image edges and contours. If the intensity of each position of an image is equal, the image only has low-frequency components. From the spectrogram of the image, there is only one main peak, which is located at the position of zero frequency. If the intensity of each position of an image changes sharply, there are not only low-frequency components, but also a variety of high-frequency components in the image. From the spectrum of the image, there is not only one main peak, but also multiple side peaks.
进一步地,所述特征点提取是基于构建的小波变换金字塔,采用参数设置相同的Harris特征点检测算法对每一层金字塔图像进行提取,获得特征点金字塔。Further, the feature point extraction is based on the constructed wavelet transform pyramid, and the Harris feature point detection algorithm with the same parameter settings is used to extract each layer of pyramid images to obtain a feature point pyramid.
进一步地,对所述待匹配图像和模板图像的特征点金字塔顶层进行NCC算法匹配,即从子带LL1的低频分量图像开始匹配;所述NCC算法为:Further, perform NCC algorithm matching on the top layer of the feature point pyramid of the image to be matched and the template image, that is, start matching from the low-frequency component image of subband LL 1 ; the NCC algorithm is:
通过构建加和表计算待匹配的图像均值S1(x,y),待匹配的图像方差S2(x,y)来减少计算量;其中,x、y为基准图大小,m、n为模板大小,A(i,j)为实时图像中匹配区域的像素的灰度值,(x,y)为匹配点,B(i-x,i-y)为模板中的像素灰度值,是模板的灰度均值,为图像中匹配区域的均值;σB是模板图像的方差;By constructing a summation table, the mean value S 1 (x, y) of the image to be matched and the variance S 2 (x, y) of the image to be matched are calculated to reduce the amount of calculation; where x and y are the size of the reference image, and m and n are Template size, A(i, j) is the gray value of the pixel in the matching area in the real-time image, (x, y) is the matching point, B(ix, iy) is the gray value of the pixel in the template, is the grayscale mean of the template, is the mean value of the matching area in the image; σ B is the variance of the template image;
以模板图像的均值和方差、待匹配图像的累加和、平方累加和求得匹配度C(x,y)最高的点为顶层最佳匹配点。The point with the highest matching degree C(x, y) is obtained from the mean and variance of the template image, the accumulated sum of the images to be matched, and the squared accumulated sum as the top-level best matching point.
进一步地,将所述顶层最佳匹配点作为下层图像匹配的中心点,进行NCC算法匹配,逐步映射到最底层的最佳匹配点,其步骤包括:将上一层的最佳匹配点作为下层图像匹配的中心点,在待匹配图像和模板图像的中心点的邻域内重新搜索,进行NCC匹配计算,得到下层的最佳匹配点;逐步匹配至最底层,随着分辨率的提高,互相关匹配的搜索范围被逐步限定,匹配点的精度逐渐提高;最终得到待匹配图像上的最佳匹配点。Further, using the top-level best matching point as the center point of the lower-level image matching, performing NCC algorithm matching, and gradually mapping to the bottom-level best matching point, the steps include: using the best matching point of the upper layer as the lower layer. The center point of image matching is searched again in the neighborhood of the center point of the image to be matched and the template image, and the NCC matching calculation is performed to obtain the best matching point of the lower layer; it is gradually matched to the bottom layer, and as the resolution increases, the cross-correlation The search range for matching is gradually limited, and the accuracy of matching points is gradually improved; finally, the best matching point on the image to be matched is obtained.
为了能更清晰的理解本发明,以下将结合附图说明阐述本发明的具体实施方式。In order to understand the present invention more clearly, the specific embodiments of the present invention will be described below with reference to the accompanying drawings.
附图说明Description of drawings
图1为基于模板匹配的海量电力缺陷照片快速筛选方法的算法框架图;Fig. 1 is the algorithm frame diagram of the fast screening method of massive electric power defect photos based on template matching;
图2为本发明实施例的小波变换三级分解示意图;2 is a schematic diagram of three-level decomposition of wavelet transform according to an embodiment of the present invention;
图3为本发明实施例的小波金字塔搜索示意图。FIG. 3 is a schematic diagram of a wavelet pyramid search according to an embodiment of the present invention.
具体实施方式Detailed ways
请参阅图1,其为本发明实施例的基于模板匹配的海量电力缺陷照片快速筛选方法的算法框架图。Please refer to FIG. 1 , which is an algorithm framework diagram of a method for quickly screening photos of massive power defects based on template matching according to an embodiment of the present invention.
将电力巡检拍摄的原始图像作为待匹配图像,将人工标注污染过的缺陷图像作为模板图像,获取待匹配图像和模板图像后,首先对待匹配图像和模板图像进行Haar小波变换两层分解,最小分辨率的子图作为金字塔的顶层,原图像作为金字塔最底层,构成三层金字塔图像。The original image captured by the power inspection is used as the image to be matched, and the manually marked contaminated defect image is used as the template image. After obtaining the image to be matched and the template image, the image to be matched and the template image are first decomposed by Haar wavelet transform. The sub-image of the resolution is used as the top layer of the pyramid, and the original image is used as the bottom layer of the pyramid, forming a three-layer pyramid image.
如图2所示,以L表示低通滤波器,H表示高通滤波器,分别对图像的行列进行卷积,并进行2取1的亚抽样,将原图像分解成4个子带LL1、LH1、HL1和HH1;其中LL1反应原图像的低频成分,是由水平和垂直两个方向的低通滤波器获得的子带;LH1反应原图像的水平边缘细节,是由水平方向低通滤波器和垂直方向的高通滤波器获得的子带;HL1为水平方向高频和垂直方向低频获得的子带;HH1是由水平方向高频和垂直方向高频获得的子带;将分辨率设为原图像的1/2,对子带LL1进行再一步分解,获得LL2、LH2、HL2和HH2共4个子带;将分辨率设为原图像的1/4,对子带LL2进行再一步分解,获得LL3、LH3、HL3和HH3共4个子带。至此完成本实施例的小波变换三级分解。As shown in Figure 2, L represents the low-pass filter, H represents the high-pass filter, convolves the rows and columns of the image respectively, and performs sub-sampling of 2 out of 1, and decomposes the original image into 4 sub-bands LL 1 , LH 1. HL 1 and HH 1 ; LL 1 reflects the low-frequency components of the original image, which are sub-bands obtained by low-pass filters in both horizontal and vertical directions; LH 1 reflects the horizontal edge details of the original image, which is determined by the horizontal direction. The subband obtained by the low-pass filter and the high-pass filter in the vertical direction; HL 1 is the subband obtained by the high frequency in the horizontal direction and the low frequency in the vertical direction; HH 1 is the subband obtained by the high frequency in the horizontal direction and the high frequency in the vertical direction; Set the resolution to 1/2 of the original image, and further decompose the sub-band LL 1 to obtain 4 sub-bands of LL 2 , LH 2 , HL 2 and HH 2 in total; set the resolution to 1/4 of the original image , and further decompose the subband LL 2 to obtain a total of 4 subbands of LL 3 , LH 3 , HL 3 and HH 3 . So far, the three-level decomposition of the wavelet transform in this embodiment is completed.
然后基于构建的图像金字塔,采用参数设置相同的Harris特征点检测算法对每层金字塔图像进行特征点提取,获得待匹配图像和模板图像的特征点金字塔;Then, based on the constructed image pyramid, the Harris feature point detection algorithm with the same parameter settings is used to extract feature points from each layer of the pyramid image to obtain the feature point pyramid of the image to be matched and the template image;
对所述待匹配图像和模板图像的特征点金字塔顶层进行NCC算法匹配,即从子带LL1的低频分量图像开始匹配;所述NCC算法为:The top layer of the feature point pyramid of the image to be matched and the template image is matched with the NCC algorithm, that is, the matching starts from the low-frequency component image of the subband LL 1 ; the NCC algorithm is:
该算法为基于现有技术中NCC算法的进一步改进,通过构建加和表计算待匹配的图像均值S1(x,y),待匹配的图像方差S2(x,y)来减少计算量;其中,x、y为基准图大小,m、n为模板大小,A(i,j)为实时图像中匹配区域的像素的灰度值,(x,y)为匹配点,B(i-x,i-y)为模板中的像素灰度值,是模板的灰度均值,为图像中匹配区域的均值;σB是模板图像的方差;The algorithm is a further improvement based on the NCC algorithm in the prior art, and the calculation amount is reduced by constructing a summation table to calculate the mean value S 1 (x, y) of the images to be matched and the variance S 2 (x, y) of the images to be matched; Among them, x and y are the size of the reference image, m and n are the size of the template, A(i,j) is the gray value of the pixel in the matching area in the real-time image, (x,y) is the matching point, B(ix,iy) ) is the pixel gray value in the template, is the grayscale mean of the template, is the mean value of the matching area in the image; σ B is the variance of the template image;
以模板图像的均值和方差、待匹配图像的累加和、平方累加和求得匹配度C(x,y)最高的点为顶层最佳匹配点。The point with the highest matching degree C(x, y) is obtained from the mean and variance of the template image, the accumulated sum of the images to be matched, and the squared accumulated sum as the top-level best matching point.
获得顶层最佳匹配点后,将所述顶层最佳匹配点作为下层图像匹配的中心点,在待匹配图像和模板图像的中心点的邻域内重新搜索,进行NCC算法匹配,得到下层的最佳匹配点;逐步匹配至最底层,随着分辨率的提高,互相关匹配的搜索范围被逐步限定,匹配点的精度逐渐提高;逐步映射到最底层的最佳匹配点。上述匹配过程如图3所示。After obtaining the top-level best matching point, take the top-level best matching point as the center point of the lower layer image matching, re-search in the neighborhood of the center point of the image to be matched and the template image, and perform NCC algorithm matching to obtain the best matching point of the lower layer. Matching points; gradually match to the bottom layer. With the increase of resolution, the search range of cross-correlation matching is gradually limited, and the accuracy of matching points is gradually improved; it is gradually mapped to the best matching point at the bottom layer. The above matching process is shown in Figure 3.
图3中,标注原图像即为金字塔最底层图像,其分辨率最高,是本申请所述人工标注污染过的缺陷图像。标注最高层图像即为金字塔最高层图像,其分辨率最低,是本申请所述电力巡检拍摄的原始图像,小波变换金字塔的搜索过程是由最高层图像匹配到高层匹配位置(即本申请所述顶层的最佳匹配点),然后以该点为中心,在中层图像的对应高层匹配位置中匹配到中层匹配位置(即本申请所述下一层的最佳匹配点),再以该点为中心,在最底层图像的对应中层位置中匹配到最佳匹配位置,实现了由顶层金字塔逐步映射匹配到最底层金字塔的最佳匹配点的效果,由于最底层图像的分辨率最高,此过程中匹配点对的精度也在逐步提高,最后讲最佳匹配位置输出结果,把待匹配图像进行相应处理,完成匹配过程。在电力巡检中,本发明能实现把大分辨率的、经过人工标注的缺陷照片,在海量巡检拍摄的原始图像中匹配到小分辨率的对应线路段上,实现缺陷图像的快速、准确匹配筛选,为智能化缺陷识别提供了重要的数据基础。In FIG. 3 , the labeled original image is the image at the bottom of the pyramid, which has the highest resolution, and is the defect image that has been manually labeled and polluted as described in the present application. The top-level image marked is the top-level image of the pyramid, and its resolution is the lowest, which is the original image captured by the power inspection described in this application. The best matching point of the top layer described above), and then take this point as the center, match the middle-level matching position in the corresponding high-level matching position of the middle-level image (that is, the best matching point of the next layer described in this application), and then use this point As the center, the best matching position is matched in the corresponding middle-level position of the bottom-level image, and the effect of gradually mapping the top-level pyramid to the best matching point of the bottom-level pyramid is realized. Since the bottom-level image has the highest resolution, this process The accuracy of the matching point pairs is also gradually improving. Finally, the best matching position is output, and the images to be matched are processed accordingly to complete the matching process. In electric power inspection, the present invention can realize the matching of large-resolution, manually marked defect photos in the original images captured by mass inspections to corresponding line segments with small resolution, so as to realize fast and accurate defect images. Matching screening provides an important data basis for intelligent defect identification.
相对于现有技术,本申请在归一化互相关算法的基础上,采用和表法分别计算图像均值和图像方差降低运算的复杂度,减少算法的计算量;With respect to the prior art, on the basis of the normalized cross-correlation algorithm, the present application adopts the sum table method to calculate the image mean value and the image variance respectively to reduce the complexity of the operation and reduce the calculation amount of the algorithm;
在选择特征点匹配搜索策略时,构造图像小波金字塔结构,利用分层匹配,提高了图像匹配的效率;When choosing the feature point matching search strategy, the image wavelet pyramid structure is constructed, and the layered matching is used to improve the efficiency of image matching;
将归一化互相关模板匹配算法,引入机巡数据的清洗中,并通过优化相似度算子和改进搜索策略,构建一种快速的归一化互相关图像模板匹配算法,实现缺陷图像的快速、准确匹配筛选,为智能缺陷识别提供重要的数据基础。The normalized cross-correlation template matching algorithm is introduced into the cleaning of machine patrol data, and by optimizing the similarity operator and improving the search strategy, a fast normalized cross-correlation image template matching algorithm is constructed to realize the rapid detection of defective images. , accurate matching and screening, providing an important data basis for intelligent defect identification.
本申请在不仅能降低计算的复杂度,减少运算过程中的计算量,提高匹配速度,同时,还能改善匹配精度。The present application can not only reduce the complexity of calculation, reduce the amount of calculation in the operation process, improve the matching speed, but also improve the matching accuracy.
基于灰度相关的图像匹配算法是利用图像的灰度信息对源图像和模板图像建立起相似性度量,然后采用某种搜索方法寻找最优相似性度量值的位置作为匹配位置。本申请将人工标注污染过的缺陷影像作为匹配模板,原始巡检图像为待匹配模板,选用基于灰度相关的图像匹配算法,实现原始图像快速筛选。The image matching algorithm based on grayscale correlation uses the grayscale information of the image to establish a similarity measure between the source image and the template image, and then uses a certain search method to find the position of the optimal similarity measure as the matching position. In this application, the manually marked contaminated defect image is used as the matching template, the original inspection image is the template to be matched, and an image matching algorithm based on grayscale correlation is selected to realize rapid screening of the original image.
针对传统的归一化互相关算法(NCC)计算量庞大、运算速度慢、正确率较低等问题,本申请一方面对传统的归一化互相关算法进行改进,降低计算的复杂度,减少运算过程中的计算量;另一方面,改进搜索策略,利用小波金字塔分层匹配的思想,分辨率由低到高,匹配由粗到细,提高图像匹配效率,改善匹配精度。Aiming at the problems of the traditional normalized cross-correlation algorithm (NCC) with large amount of calculation, slow operation speed and low accuracy rate, on the one hand, the present application improves the traditional normalized cross-correlation algorithm to reduce the computational complexity and reduce the On the other hand, the search strategy is improved, and the idea of layered matching of wavelet pyramid is used, the resolution is from low to high, and the matching is from coarse to fine, which improves the efficiency of image matching and improves the matching accuracy.
本发明并不局限于上述实施方式,如果对本发明的各种改动或变形不脱离本发明的精神和范围,倘若这些改动和变形属于本发明的权利要求和等同技术范围之内,则本发明也一同包含这些改动和变形。The present invention is not limited to the above-mentioned embodiments. If various changes or deformations of the present invention do not depart from the spirit and scope of the present invention, and if these changes and deformations belong to the claims of the present invention and the equivalent technical scope, then the present invention is also These changes and variants are included together.
Claims (7)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911108819.9A CN111126431A (en) | 2019-11-13 | 2019-11-13 | A Fast Screening Method for Massive Power Defect Photos Based on Template Matching |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911108819.9A CN111126431A (en) | 2019-11-13 | 2019-11-13 | A Fast Screening Method for Massive Power Defect Photos Based on Template Matching |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN111126431A true CN111126431A (en) | 2020-05-08 |
Family
ID=70495616
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201911108819.9A Pending CN111126431A (en) | 2019-11-13 | 2019-11-13 | A Fast Screening Method for Massive Power Defect Photos Based on Template Matching |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111126431A (en) |
Cited By (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113102297A (en) * | 2021-04-09 | 2021-07-13 | 中国大恒(集团)有限公司北京图像视觉技术分公司 | Method for parallel robot to quickly sort defective workpieces |
| CN113569714A (en) * | 2021-07-24 | 2021-10-29 | 国网河南省电力公司检修公司 | Intelligent image recognition system of substation based on UAV inspection |
| CN113688828A (en) * | 2021-07-23 | 2021-11-23 | 山东云海国创云计算装备产业创新中心有限公司 | A kind of bad element identification method and related device |
| CN114049389A (en) * | 2021-10-15 | 2022-02-15 | 深圳市深视智能科技有限公司 | Method, device and measuring device for measuring height of shrapnel on the back of smart terminal |
| CN115908233A (en) * | 2022-05-09 | 2023-04-04 | 中国科学院微电子研究所 | Defect detection method, device, equipment and medium for extreme ultraviolet mask |
| CN116342912A (en) * | 2023-05-30 | 2023-06-27 | 中国铁路设计集团有限公司 | Heterogeneous remote sensing image matching method and system based on correlation peak analysis |
| CN116797806A (en) * | 2023-06-26 | 2023-09-22 | 同济大学 | Multi-source heterogeneous large-scene remote sensing image matching method of global optimal solution |
| CN117218388A (en) * | 2023-07-26 | 2023-12-12 | 江苏科技大学 | Template matching method integrating attention mechanism |
| CN119600005A (en) * | 2024-11-29 | 2025-03-11 | 青岛农业大学 | A method for detecting abnormal phenotype of ginkgo leaves |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2010140577A1 (en) * | 2009-06-02 | 2010-12-09 | 株式会社日立ハイテクノロジーズ | Defect image processing apparatus, defect image processing method, semiconductor defect classifying apparatus, and semiconductor defect classifying method |
| CN102253055A (en) * | 2011-04-27 | 2011-11-23 | 中国计量学院 | Device and method for detecting surface defects of surface with periodical patterns |
| US20120082385A1 (en) * | 2010-09-30 | 2012-04-05 | Sharp Laboratories Of America, Inc. | Edge based template matching |
| CN103076338A (en) * | 2012-05-31 | 2013-05-01 | 西南交通大学 | Rapid fuzzy matching method for testing bad conditions of high-speed rail catenary rod type insulators |
-
2019
- 2019-11-13 CN CN201911108819.9A patent/CN111126431A/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2010140577A1 (en) * | 2009-06-02 | 2010-12-09 | 株式会社日立ハイテクノロジーズ | Defect image processing apparatus, defect image processing method, semiconductor defect classifying apparatus, and semiconductor defect classifying method |
| JP2010283004A (en) * | 2009-06-02 | 2010-12-16 | Hitachi High-Technologies Corp | Defect image processing apparatus, defect image processing method, semiconductor defect classification apparatus, and semiconductor defect classification method |
| US20120082385A1 (en) * | 2010-09-30 | 2012-04-05 | Sharp Laboratories Of America, Inc. | Edge based template matching |
| CN102253055A (en) * | 2011-04-27 | 2011-11-23 | 中国计量学院 | Device and method for detecting surface defects of surface with periodical patterns |
| CN103076338A (en) * | 2012-05-31 | 2013-05-01 | 西南交通大学 | Rapid fuzzy matching method for testing bad conditions of high-speed rail catenary rod type insulators |
Non-Patent Citations (1)
| Title |
|---|
| 吴鹏 等: "结合小波金字塔的快速NCC图像匹配算法" * |
Cited By (12)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113102297A (en) * | 2021-04-09 | 2021-07-13 | 中国大恒(集团)有限公司北京图像视觉技术分公司 | Method for parallel robot to quickly sort defective workpieces |
| CN113102297B (en) * | 2021-04-09 | 2022-03-08 | 中国大恒(集团)有限公司北京图像视觉技术分公司 | Method for parallel robot to quickly sort defective workpieces |
| CN113688828A (en) * | 2021-07-23 | 2021-11-23 | 山东云海国创云计算装备产业创新中心有限公司 | A kind of bad element identification method and related device |
| CN113688828B (en) * | 2021-07-23 | 2023-09-29 | 山东云海国创云计算装备产业创新中心有限公司 | A bad element identification method and related devices |
| CN113569714A (en) * | 2021-07-24 | 2021-10-29 | 国网河南省电力公司检修公司 | Intelligent image recognition system of substation based on UAV inspection |
| CN114049389A (en) * | 2021-10-15 | 2022-02-15 | 深圳市深视智能科技有限公司 | Method, device and measuring device for measuring height of shrapnel on the back of smart terminal |
| CN115908233A (en) * | 2022-05-09 | 2023-04-04 | 中国科学院微电子研究所 | Defect detection method, device, equipment and medium for extreme ultraviolet mask |
| CN116342912A (en) * | 2023-05-30 | 2023-06-27 | 中国铁路设计集团有限公司 | Heterogeneous remote sensing image matching method and system based on correlation peak analysis |
| CN116342912B (en) * | 2023-05-30 | 2023-08-11 | 中国铁路设计集团有限公司 | Heterogeneous remote sensing image matching method and system based on correlation peak analysis |
| CN116797806A (en) * | 2023-06-26 | 2023-09-22 | 同济大学 | Multi-source heterogeneous large-scene remote sensing image matching method of global optimal solution |
| CN117218388A (en) * | 2023-07-26 | 2023-12-12 | 江苏科技大学 | Template matching method integrating attention mechanism |
| CN119600005A (en) * | 2024-11-29 | 2025-03-11 | 青岛农业大学 | A method for detecting abnormal phenotype of ginkgo leaves |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111126431A (en) | A Fast Screening Method for Massive Power Defect Photos Based on Template Matching | |
| CN112308832B (en) | Bearing quality detection method based on machine vision | |
| CN111080620B (en) | Road disease detection method based on deep learning | |
| CN106023185B (en) | A kind of transmission facility method for diagnosing faults | |
| CN109685728B (en) | Digital image processing method based on local time-frequency domain transformation | |
| CN105069807B (en) | A kind of stamped workpieces defect inspection method based on image procossing | |
| CN105740945B (en) | A kind of people counting method based on video analysis | |
| CN111784633A (en) | An automatic detection algorithm for insulator defects for power inspection video | |
| CN105976383A (en) | Power transmission equipment fault diagnosis method based on limit learning machine image recognition | |
| CN104048969A (en) | Tunnel defect recognition method | |
| CN109509163B (en) | A method and system for multi-focus image fusion based on FGF | |
| CN115601379B (en) | A precise surface crack detection technology based on digital image processing | |
| CN101329402A (en) | Multi-scale SAR image edge detection method based on improved Wedgelet | |
| CN114862889A (en) | Road edge extraction method and device based on remote sensing image | |
| CN112669265A (en) | Method for realizing surface defect detection based on Fourier transform and image gradient characteristics | |
| CN107977968A (en) | The building layer detection method excavated based on buildings shadow information | |
| CN115512310A (en) | Vehicle type recognition method and system based on face features under video monitoring | |
| CN117726537A (en) | SAR image denoising network method and system using adaptive multi-scale feature fusion AMFFD-Net | |
| CN115170520A (en) | Metal mesh defect detection method based on structure contrast information lamination | |
| CN112927169B (en) | A Noise Removal Method for Remote Sensing Image Based on Wavelet Transform and Improved Weighted Kernel Norm Minimization | |
| CN116862973A (en) | Underwater dam surface defect measurement method based on acoustics | |
| CN109064444B (en) | Track slab disease detection method based on significance analysis | |
| CN111027441B (en) | Road extraction method based on airborne hyperspectral remote sensing image | |
| Wu et al. | Research on crack detection algorithm of asphalt pavement | |
| CN114742968B (en) | A method for generating elevation map based on building elevation point cloud |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200508 |