High-voltage line image detecting method based on local auto-adaptive Threshold Segmentation Algorithm
Technical field
The present invention relates to image processing field, more particularly to a kind of high-voltage line based on local auto-adaptive Threshold Segmentation Algorithm
Image detecting method and system.
Background technology
First,《Modern radar》Magazine 2011 year 2 months the 2nd interim ' helicopter collision avoidance radar key technology and development trend '
One text describes one group of data about helicopter accident, represents to count according to external associated mechanisms in text, per 10000h in-flight,
10 accidents can averagely occur for helicopter, and this numeral of fixed wing aircraft is only 0.3.In all kinds of accidents, because flying with low latitude
Ratio caused by the culture such as natural forms and power line, electric pole, the building collision such as massif, trees on walking corridor is about
Account for 35%;In disastrous accident, this ratio is higher.
Secondly, helicopter usually needs nap of the earth flight in the task of execution, therefore easily bumps against with the high-voltage line in low latitude.
Also,《Shandong Electric Power Group technology》Magazine 2012 01 is interim, and ' the power-line patrolling depopulated helicopter obstacle avoidance system text of ' one describes
China formed North China, northeast, East China, Central China, northwest and south electric network totally 6 transprovincially area's power networks at present, by 2010 110
(66) kV and above transmission line of electricity are more than 700,000 km.500kV circuits as each large power system skeleton and transprovincially, across ground
The interconnection in area.When solving the contradiction of power network development hysteresis, the threat to helicopter flight safety is also increasing.
Meanwhile the observation of human eye is limited, high-voltage line can be recognized when closer to the distance, but for remote high-voltage line,
Pilot is easy to fail to judge or erroneous judgement high-voltage line.In atrocious weather or " dirt fan " phenomenon or night, naked eyes are only relied on
Identification is impossible at all, there is the danger for knocking high-voltage line at any time.
Moreover, not exclusively helicopter needs to recognize high-voltage line, power department similarly needs.In the inspection of high-voltage line
Cheng Zhong, just needs that high-voltage line is identified first, replaces artificial detection using machine, not only reduces testing cost, simultaneously
Also mitigate the intensity of inspection operation, improve the quality of inspection operation.
Therefore, the detection for studying high-voltage line is highly significant.
China Patent Publication No. CN101806888B, publication date September in 2012 5 days, describe and a kind of " be based on image procossing
High-tension line identification method ", its core concept be using radar plot figure be input and found according to the distribution character of high voltage transmission line tower
High voltage transmission line tower is the resolving power to radar so as to obtain electric force lines distribution region using priori searching method, the advantages of this method
It is required that it is relatively low, longer-distance target can be detected, and amount of calculation is small, but this method can only detect the distribution of high-voltage line,
The particular location of high-voltage line can not be shown, so as to can not directly provide flying instruction.
China Patent Publication No. CN102930280A, publication date 2013 year 2 month 13 days, one kind is described " from infrared image
The method of middle automatic identification overhead high-voltage wire ", its core concept are to find high-voltage line by extracting the multiple characteristics of image
And realize detection to high-voltage line pixel with random Hough transformation (RHT) method, it is by multiple means the advantages of this method
Detect high-voltage line, improve the accuracy of identification, but this method can not also avoid parameter excessive simultaneously, it is computationally intensive the shortcomings that.
The content of the invention
The technical problem to be solved in the present invention is to be directed to drawbacks described above of the prior art, there is provided a kind of amount of calculation is small,
Speed is fast, can effectively remove background and noise obtains the high-tension line graph based on local auto-adaptive Threshold Segmentation Algorithm of candidate target
As detection method and system.
The technical solution adopted for the present invention to solve the technical problems is:
A kind of high-voltage line image detecting method based on local auto-adaptive Threshold Segmentation Algorithm is provided, comprised the following steps:
Step 1:Image is read in, coloured image is converted into gray level image, and carry out image enhaucament;
Step 2:Background, rim detection and image local auto-thresholding algorithm are removed to enhanced image
Processing, obtains object candidate area;Wherein, image local auto-thresholding algorithm, which is handled, is specially:Utilize presetted pixel
The window of size slides pixel-by-pixel in the picture, until traveling through whole image, in image region corresponding to each window, and meter
The summation sum of all pixels in window is calculated, if sum is more than or equal to threshold value, then the value for making window middle is 1, is otherwise made
The value of window middle is 0, wherein, 0 represents background, and 1 represents target;
Step 3:To object candidate area progress denoising, the high-voltage line pixel set finally detected, and in artwork
Indicate the position where high-voltage line.
Coloured image is converted into gray level image in method of the present invention, in step 1 according to image conversion formula to be turned
Change, image enhaucament uses linear transformation method.
In method of the present invention, remove the algebraic operation addition of the specifically used image of background in step 2 or multiplication is looked for
To image background:Image and its own are subjected to add operation, i.e., each pixel of image is carried out multiplying 2 operations, obtains image
Background;If result of calculation exceeds gray value maximum, it is gray value maximum to make result of calculation;If result of calculation is less than gray scale
It is worth minimum value, then it is gray value minimum value to make result of calculation;
The algebraic operation division and subtraction for reusing image remove image background:First will be after algebraic operation add operation
Image divided by 2, then the enhanced image obtained by step 1 is subtracted into the image, obtains removing the image after background;If calculate
As a result gray value maximum is exceeded, then it is gray value maximum to make result of calculation;If result of calculation is less than gray value minimum value,
It is gray value minimum value to make result.
In method of the present invention, rim detection specifically uses the horizontal sobel operators templates of 3x3 in step 2, make its with
Remove the image after background and carry out convolution, realize the rim detection of image, the position of prominent high-voltage line.
In method of the present invention, in step 2, the threshold value in the processing of image local auto-thresholding algorithm uses
Maximum variance between clusters calculate;
If image has L gray level, gray value is that i pixel count is ni, then total pixel count beEach gray scale
The probability that value occurs is pi=ni/N.Obviously,
If threshold value is t, 2 regions are divided the image into, i.e., gray level are divided into two classes, background classes A=(0,1 ... ...,
And target class B=(t+1, t+2 ... ..., L-1) t);
Two classes occur probability be respectively:
A, the gray average of the classes of B two is respectively:
The total gray average of image is:
It is hereby achieved that the inter-class variance in the region of A, B two:
σ2=pA(ωA-ω0)2+pB(ωB-ω0)2;
Inter-class variance is bigger, and two class gray scale difference are bigger, then causes inter-class variance σ2Maximum t* is required optimal
Threshold value:
In method of the present invention, step 3 specifically removes the noise to object candidate area using medium filtering.
The present invention also provides a kind of high-voltage line image detecting system based on local auto-adaptive Threshold Segmentation Algorithm, including:
Image preliminary treatment module, for reading in image, coloured image is converted into gray level image, and carry out image increasing
By force;
Background module is removed, for being removed background process to enhanced image;
Edge detection module, edge detection process is carried out to the image after removal background;
Local auto-adaptive Threshold segmentation processing module, for carrying out local auto-adaptive threshold value point to the image after rim detection
Algorithm process is cut, obtains object candidate area;Specially:Slided pixel-by-pixel in the picture using the window of presetted pixel size,
Until traveling through whole image, in image region corresponding to each window, the summation sum of all pixels in calculation window, if
Sum is more than or equal to threshold value, then and the value for making window middle is 1, and the value for otherwise making window middle is 0, wherein, 0 represents
Background, 1 represents target;
Denoising module, for carrying out denoising, the high-voltage line pixel set finally detected to object candidate area;
Indicate module:According to the high-voltage line pixel set finally detected, the position where high-voltage line is indicated in artwork.
In system of the present invention, the removal background module is specifically used for:
First image background is found using the algebraic operation addition or multiplication of image:Image and its own are subjected to add operation,
Each pixel of image is carried out multiplying 2 operations, obtain image background;If result of calculation exceeds gray value maximum, make
Result of calculation is gray value maximum;If result of calculation is less than gray value minimum value, it is gray value minimum value to make result of calculation;
The algebraic operation division and subtraction for reusing image remove image background:First will be after algebraic operation add operation
Image divided by 2, then the enhanced image obtained by step 1 is subtracted into the image, obtains removing the image after background;If calculate
As a result gray value maximum is exceeded, then it is gray value maximum to make result of calculation;If result of calculation is less than gray value minimum value,
It is gray value minimum value to make result.
In system of the present invention, the sign module specifically indicates high-voltage line institute using red pixel in artwork
Position.
In system of the present invention, the edge detection module is specifically used for, using the horizontal sobel operators templates of 3x3,
It is carried out convolution with the image after removal background, realize the rim detection of image, the position of prominent high-voltage line.
The beneficial effect comprise that:The present invention uses local auto-adaptive Threshold Segmentation Algorithm method, point of image
Cutting algorithm is carried out in local window, the Hough transform method larger compared to amount of calculation, and the present invention is small with amount of calculation,
And the noise of background in image can be effectively removed, while object candidate area can also be obtained.
Further, image enhancement processing is carried out using linear transformation method, carried out using the algebraic operation method of image
Background is removed, and background is removed using gray level image characteristic, there is that amount of calculation is smaller, quick advantage, and this method can effectively be gone
Except the background in image, the complexity of subsequent treatment is reduced.
Finally, the position where high-voltage line is indicated in artwork using red pixel, this can make pilot more clearly high
Do not ignore while position where line ball influences caused by other barriers.The present invention is adapted to be applied to aircraft identification height
Line ball, the inspection for also being adapted for high-voltage line are technical.
Brief description of the drawings
Below in conjunction with drawings and Examples, the invention will be further described, in accompanying drawing:
Fig. 1 is the high-voltage line image detecting method based on local auto-adaptive Threshold Segmentation Algorithm of one embodiment of the invention
Flow chart;
Fig. 2 is the used horizontal sobel operators templates of 3x3 in rim detection;
Fig. 3 is the structural representation of the high-voltage line image detecting system of the invention based on local auto-adaptive Threshold Segmentation Algorithm
Figure;
Fig. 4 is the used horizontal Prewitt operators templates of 3x3 in rim detection;
Fig. 5 is the used horizontal Robert operators templates of 3x3 in rim detection.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples
The present invention is further elaborated.It should be appreciated that specific embodiment described herein is only to explain the present invention, not
For limiting the present invention.
The high-voltage line image detecting method based on local auto-adaptive Threshold Segmentation Algorithm of the invention, it is mainly suitable for being applied to winged
Row device recognizes high-voltage line, and the inspection for also being adapted for high-voltage line is technical.The present invention replaces artificial detection using machine, not only reduces
Testing cost, while also mitigate the intensity of inspection operation, improve the quality of inspection operation.
Identification of the pilot to high-voltage line can be helped by the method for the present invention, especially in atrocious weather or " dirt
When fan " phenomenon or night, avoid knocking the danger of high-voltage line.
The high-voltage line image detecting method of the embodiment of the present invention mainly includes the following steps that:
Step 1:Image is read in, coloured image is converted into gray level image, and carry out image enhaucament;
Step 2:Background, rim detection and image local auto-thresholding algorithm are removed to enhanced image
Processing, obtains object candidate area;Wherein, image local auto-thresholding algorithm, which is handled, is specially:Utilize presetted pixel
The window (such as 3*3) of size slides pixel-by-pixel in the picture, until traveling through whole image, in image subsection corresponding to each window
In domain, the summation sum of all pixels in calculation window, if sum is more than or equal to threshold value, then the value for making window middle is 1,
Otherwise the value for making window middle is 0, wherein, 0 represents background, and 1 represents target.The partitioning algorithm of image is in local window
Carry out, the Hough transform method larger compared to amount of calculation, the present invention is small with amount of calculation, and can effectively remove image
The noise of middle background, while object candidate area can also be obtained.
Step 3:To object candidate area progress denoising, the high-voltage line pixel set finally detected, and in artwork
Indicate the position where high-voltage line.
In another embodiment of the present invention, as shown in figure 1, mainly including the following steps that:
S1, read in the image that collection comes;
S2, gradation conversion is carried out to image, coloured image can be converted to by gray level image using image conversion formula,
Pixel of the average value of 3 passages in each pixel as gray level image is can use, or only takes green channel as gray level image
Pixel.Specific formula is as follows, and wherein R represents red channel, and G represents green channel, and B represents blue channel;
Image conversion formula is:
Gray=R*0.299+G*0.587+B*0.114;
Mean value method formula is:
Gray=(R+G+B)/3.
S3, image enhancement processing, image enhaucament can use linear transformation method, will obtain the gray scale after image enhaucament afterwards
Image.
S4, background process is removed to the image after image enhaucament;In presently preferred embodiments of the present invention, image removes the back of the body
Scape method is described as follows:Background is removed using the algebraic operation of image, figure is found using the algebraic operation addition or multiplication of image
As background, the background of image is removed using the algebraic operation division and subtraction of image.
Algebraic operation addition or multiplication find being summarized as follows for image background:Image and its own are subjected to add operation, i.e.,
Each pixel of image is carried out multiplying 2 operations, you can obtain image background.If result of calculation exceeds gray value maximum,
It is gray value maximum to make result of calculation;If result of calculation is less than gray value minimum value, make result of calculation minimum for gray value
Value;
Being summarized as follows for image background is removed using the algebraic operation division and subtraction of image:First transported above-mentioned by algebraically
The image divided by 2 after add operation is calculated, then step 1 acquired results image is subtracted into the image, as removes the image after background;
If result of calculation exceeds gray value maximum, it is gray value maximum to make result of calculation;If result of calculation is less than gray value most
Small value, then it is gray value minimum value to make result of calculation;
The addition of image, subtraction, the formula of multiplication and division are as follows:
C (x, y)=A (x, y)+B (x, y), C (x, y)=A (x, y)-B (x, y),
C (x, y)=A (x, y) * n, C (x, y)=A (x, y)/m.
S5, rim detection is carried out to the image after removal background.Rim detection can use in one embodiment of the present of invention
The horizontal sobel operators templates of 3x3, it is carried out convolution with image, realize the rim detection of image, so as to the position of prominent high-voltage line
Put.Fig. 2 is the horizontal sobel operators templates of 3x3.Meanwhile can also use Prewitt operators template as shown in Figure 4 and Figure 5 or
Robert operators template carries out convolution with image.
S6, image local auto-thresholding algorithm processing is carried out to the image after rim detection, obtain target
Candidate region;In the specific embodiment of the present invention, the partitioning algorithm method of image is described as follows:Utilize 3*3 pixel sizes
Window slide pixel-by-pixel in the picture, until travel through whole image, in image region corresponding to each window, calculate window
The summation sum of intraoral all pixels, if sum is more than or equal to threshold value, then the value for making window middle is 1, is otherwise making window just
Middle value is 0, wherein, 0 represents background, and 1 represents target.
The threshold value of image can be calculated using maximum variance between clusters:
If image has L gray level, gray value is that i pixel count is ni, then total pixel count beEach gray scale
The probability that value occurs is pi=ni/N.Obviously,
If threshold value is t, 2 regions are divided the image into, i.e., gray level are divided into two classes, background classes A=(0,1 ... ...,
And target class B=(t+1, t+2 ... ..., L-1) t);
Two classes occur probability be respectively:
A, the gray average of the classes of B two is respectively:
The total gray average of image is:
It is hereby achieved that the inter-class variance in the region of A, B two:
σ2=pA(ωA-ω0)2+pB(ωB-ω0)2;
Inter-class variance is bigger, and two class gray scale difference are bigger, then causes inter-class variance σ2Maximum t* is required optimal
Threshold value:
The threshold value of image can also be calculated using maximum entropy threshold values:
If image is divided into target class A and the classes of background classes B two by threshold value s, their probability distribution is respectively:
A:p0/ps, p1/ps..., ps/ps;
B:ps+1/(1-ps), ps+2/(1-ps) ..., pL-1/(1-ps);
Two distribution corresponding to entropy be respectively:
HA(s)=InPs+Hs/PsAnd HB(s)=In (1-Ps)+(H-Hs)/(1-Ps);
Wherein:
The entropy of image is:
H (s)=HA(s)+HB(s)=InPs(1-Ps)+Hs/Ps+(H-Hs)/(1-Ps);
The maximum s for obtaining H (s), is exactly segmentation object and the optimal threshold s of background.
S7, intermediate value denoising is carried out to object candidate area;
S8, the target after denoising is indicated in artwork, that is, indicate the position of high-voltage line.Red pixel can be used in original
The position that chart display goes out where high-voltage line, this can make not ignore other while the position where the clearer and more definite high-voltage line of pilot
Influenceed caused by barrier.
High-voltage line image detecting system of the embodiment of the present invention based on local auto-adaptive Threshold Segmentation Algorithm, for realization
The method for stating embodiment, as shown in figure 3, including:
Image preliminary treatment module, for reading in image, coloured image is converted into gray level image, and carry out image increasing
By force;
Background module is removed, for being removed background process to enhanced image;
Edge detection module, edge detection process is carried out to the image after removal background;
Local auto-adaptive Threshold segmentation processing module, for carrying out local auto-adaptive threshold value point to the image after rim detection
Algorithm process is cut, obtains object candidate area;Specially:Slided pixel-by-pixel in the picture using the window of presetted pixel size,
Until traveling through whole image, in image region corresponding to each window, the summation sum of all pixels in calculation window, if
Sum is more than or equal to threshold value, then and the value for making window middle is 1, and the value for otherwise making window middle is 0, wherein, 0 represents
Background, 1 represents target;
Denoising module, for carrying out denoising, the high-voltage line pixel set finally detected to object candidate area;
Indicate module:According to the high-voltage line pixel set finally detected, the position where high-voltage line is indicated in artwork.
The removal background module is specifically used for:
First image background is found using the algebraic operation addition or multiplication of image:Image and its own are subjected to add operation,
Each pixel of image is carried out multiplying 2 operations, obtain image background;If result of calculation exceeds gray value maximum, make
Result of calculation is gray value maximum;If result of calculation is less than gray value minimum value, it is gray value minimum value to make result of calculation;
The algebraic operation division and subtraction for reusing image remove image background:First will be after algebraic operation add operation
Image divided by 2, then the enhanced image obtained by step 1 is subtracted into the image, obtains removing the image after background;If calculate
As a result gray value maximum is exceeded, then it is gray value maximum to make result of calculation;If result of calculation is less than gray value minimum value,
It is gray value minimum value to make result.
Sign module specifically indicates the position where high-voltage line using red pixel in artwork.
The edge detection module is specifically used for, using the horizontal sobel operators templates of 3x3, after making it and removing background
Image carries out convolution, realizes the rim detection of image, the position of prominent high-voltage line.
It should be appreciated that for those of ordinary skills, can according to the above description be improved or converted,
And all these modifications and variations should all belong to the protection domain of appended claims of the present invention.