Based on the hi-line image detecting method of local auto-adaptive Threshold Segmentation Algorithm
Technical field
The present invention relates to image processing field, particularly relate to a kind of hi-line image detecting method based on local auto-adaptive Threshold Segmentation Algorithm and system.
Background technology
First, " modern radar " magazine February the 2nd in 2011 is interim, and ' helicopter collision avoidance radar gordian technique and development trend ' one literary composition describes one group of data about helicopter accident, represent in literary composition and to add up according to external associated mechanisms, every 10000h in-flight, on average can there are 10 accidents in helicopter, and this numeral of fixed wing aircraft is only 0.3.In all kinds of accident, account for 35% because colliding with cultures such as natural forms and line of electric force, electric pole, buildings such as the massif on low-latitude flying corridor, trees the ratio caused; In disastrous accident, this ratio is higher.
Secondly, helicopter usually needs nap of the earth flight when executing the task, and therefore easily bumps against with the hi-line being in low latitude.And, " Shandong Electric Power Group technology " magazine 2012 01 is interim, and ' power-line patrolling depopulated helicopter obstacle avoidance system ' one literary composition describes China and has formed North China, northeast, East China, Central China, northwest and south electric network totally 6 transprovincially district's electrical networks at present, by 110 (66) kV in 2010 and above transmission line of electricity more than 700,000 km.500kV circuit become each large power system skeleton and transprovincially, trans-regional interconnection.When the contradiction that solution power network development is delayed, also increasing to the threat of helicopter flight safety.
Meanwhile, the observation of human eye is limited, the energy identification hi-line when close together, but for remote hi-line, pilot is easy to fail to judge or judge hi-line by accident.When atrocious weather or " dirt fan " phenomenon or night, it is impossible for only relying on naked eyes identification at all, has the danger knocking hi-line at any time.
And be not only that helicopter needs identification hi-line, power department needs too.Patrol and examine in process at hi-line, first just need to identify hi-line, adopt machine to replace manual detection, not only reduce testing cost, also alleviate the intensity of patrolling and examining operation simultaneously, improve the quality of patrolling and examining operation.
Therefore, the detection studying hi-line is highly significant.
China Patent Publication No. CN101806888B, publication date on September 5th, 2012, describe one " high-tension line identification method based on image procossing ", its core concept is input with radar plot figure and finds high-tension line tower according to the distribution character of high-tension line tower thus utilize priori searching method to obtain electric force lines distribution region, the advantage of the method is the resolving power requirement of radar lower, longer-distance target can be detected, and calculated amount is little, but the method can only detect the distribution of hi-line, the particular location of hi-line can not be shown, thus directly can not provide flying instruction.
China Patent Publication No. CN102930280A, publication date on February 13rd, 2013, describe one and " from infrared image, automatically identify the method for overhead high-voltage wire ", its core concept is that the multiple characteristics by extracting image also realizes the detection to hi-line pixel by random Hough transformation (RHT) method in order to find hi-line, the advantage of the method is to detect hi-line by multiple means, improve the degree of accuracy of identification, but the method also cannot avoid parameter too much, the shortcoming that calculated amount is large simultaneously.
Summary of the invention
The technical problem to be solved in the present invention is for above-mentioned defect of the prior art, there is provided that a kind of calculated amount is little, speed is fast, effectively can remove the hi-line image detecting method based on local auto-adaptive Threshold Segmentation Algorithm and system that background and noise obtain candidate target.
The technical solution adopted for the present invention to solve the technical problems is:
A kind of hi-line image detecting method based on local auto-adaptive Threshold Segmentation Algorithm is provided, comprises the following steps:
Step 1: read in image, is converted to gray level image by coloured image, and carries out image enhaucament;
Step 2: removal background, rim detection and the process of image local auto-thresholding algorithm are carried out to the image after strengthening, obtains object candidate area; Wherein, the process of image local auto-thresholding algorithm is specially: utilize the window of presetted pixel size to slide by pixel in the picture, until travel through whole image, in the image region that each window is corresponding, the summation sum of all pixels in calculation window, if sum is more than or equal to threshold value, so make the value of window middle be 1, otherwise make the value of window middle be 0, wherein, 0 represents background, and 1 represents target;
Step 3: carry out denoising to object candidate area, obtains the final hi-line pixel set detected, and goes out the position at hi-line place at former chart display.
In method of the present invention, in step 1, coloured image is converted to gray level image according to the conversion of image conversion formula, image enhaucament adopts linear transformation method.
In method of the present invention, remove background in step 2 and specifically use the algebraic operation addition of image or multiplication to find image background: image and it self are carried out add operation, namely 2 operations is taken advantage of to each pixel of image, obtain image background; If result of calculation exceeds gray-scale value maximal value, then result of calculation is made to be gray-scale value maximal value; If result of calculation is less than gray-scale value minimum value, then result of calculation is made to be gray-scale value minimum value;
Re-use the algebraic operation division of image and subtraction removes image background: first by the image after algebraic operation add operation divided by 2, then by this image of figure image subtraction after the enhancing of step 1 gained, obtain the image after removing background; If result of calculation exceeds gray-scale value maximal value, then result of calculation is made to be gray-scale value maximal value; If result of calculation is less than gray-scale value minimum value, then result is made to be gray-scale value minimum value.
In method of the present invention, in step 2, rim detection specifically adopts 3x3 horizontal sobel operator template, and the image after making it and removing background carries out convolution, realizes the rim detection of image, the position of outstanding hi-line.
In method of the present invention, in step 2, the threshold value in the process of image local auto-thresholding algorithm adopts maximum variance between clusters to calculate;
If image has L gray level, gray-scale value is the pixel count of i is n
i, then total pixel count is
the probability that each gray-scale value occurs is p
i=n
i/ N.Obviously,
If threshold value is t, Iamge Segmentation is become 2 regions, namely gray level is divided into two classes, background classes A=(0,1 ..., t) and target class B=(t+1, t+2 ..., L-1);
The probability that two classes occur is respectively:
A, B two the gray average of class be respectively:
The total gray average of image is:
A, B two inter-class variance in region can be obtained thus:
σ
2=p
A(ω
A-ω
0)
2+p
B(ω
B-ω
0)
2;
Inter-class variance is larger, and two class gray scale difference are larger, then make inter-class variance σ
2maximum t* is required optimal threshold:
In method of the present invention, step 3 specifically adopts the noise of medium filtering removal to object candidate area.
The present invention also provides a kind of hi-line image detecting system based on local auto-adaptive Threshold Segmentation Algorithm, comprising:
Image rough handling module, for reading in image, is converted to gray level image by coloured image, and carries out image enhaucament;
Remove background module, for carrying out removal background process to the image after enhancing;
Edge detection module, carries out edge detection process to the image after removing background;
Local auto-adaptive Threshold segmentation processing module, carries out the process of local auto-adaptive Threshold Segmentation Algorithm for the image after edge detects, obtains object candidate area; Be specially: utilize the window of presetted pixel size to slide by pixel in the picture, until travel through whole image, in the image region that each window is corresponding, the summation sum of all pixels in calculation window, if sum is more than or equal to threshold value, so makes the value of window middle be 1, otherwise make the value of window middle be 0, wherein, 0 represents background, and 1 represents target;
Denoising module, for carrying out denoising to object candidate area, obtains the final hi-line pixel set detected;
Indicate module: according to the final hi-line pixel set detected, go out the position at hi-line place at former chart display.
In system of the present invention, described removal background module specifically for:
The algebraic operation addition of image or multiplication is first used to find image background: image and it self to be carried out add operation, namely takes advantage of 2 operations to each pixel of image, obtain image background; If result of calculation exceeds gray-scale value maximal value, then result of calculation is made to be gray-scale value maximal value; If result of calculation is less than gray-scale value minimum value, then result of calculation is made to be gray-scale value minimum value;
Re-use the algebraic operation division of image and subtraction removes image background: first by the image after algebraic operation add operation divided by 2, then by this image of figure image subtraction after the enhancing of step 1 gained, obtain the image after removing background; If result of calculation exceeds gray-scale value maximal value, then result of calculation is made to be gray-scale value maximal value; If result of calculation is less than gray-scale value minimum value, then result is made to be gray-scale value minimum value.
In system of the present invention, described sign module specifically adopts red pixel to go out the position at hi-line place at former chart display.
In system of the present invention, described edge detection module specifically for, adopt 3x3 horizontal sobel operator template, the image after making it and removing background carries out convolution, realizes the rim detection of image, the position of outstanding hi-line.
The beneficial effect that the present invention produces is: the present invention adopts local auto-adaptive Threshold Segmentation Algorithm method, the partitioning algorithm of image carries out in local window, the Hough transform method larger compared to calculated amount, it is little that the present invention has calculated amount, and effectively can remove the noise of background in image, can also object candidate area be obtained simultaneously.
Further, linear transformation method is adopted to carry out image enhancement processing, the algebraic operation method of image is adopted to carry out removal background, and utilize gray level image characteristic to remove background, have that calculated amount is less, advantage fast, and the method effectively can remove the background in image, reduces the complexity of subsequent treatment.
Finally, use red pixel to go out the position at hi-line place at former chart display, this does not ignore the impact that other barriers bring while making the position at the clearer and more definite hi-line place of pilot.The present invention is applicable to being applied to aircraft identification hi-line, is also applicable to patrolling and examining technically of hi-line.
Accompanying drawing explanation
Below in conjunction with drawings and Examples, the invention will be further described, in accompanying drawing:
Fig. 1 is the process flow diagram of the hi-line image detecting method based on local auto-adaptive Threshold Segmentation Algorithm of one embodiment of the invention;
Fig. 2 is 3x3 horizontal sobel operator template used in rim detection;
Fig. 3 is the structural representation of the hi-line image detecting system that the present invention is based on local auto-adaptive Threshold Segmentation Algorithm;
Fig. 4 is 3x3 horizontal Prewitt operator template used in rim detection;
Fig. 5 is 3x3 horizontal Robert operator template used in rim detection.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
The present invention is based on the hi-line image detecting method of local auto-adaptive Threshold Segmentation Algorithm, be mainly applicable to being applied to aircraft identification hi-line, be also applicable to patrolling and examining technically of hi-line.The present invention adopts machine to replace manual detection, not only reduces testing cost, also alleviates the intensity of patrolling and examining operation simultaneously, improves the quality of patrolling and examining operation.
Pilot can be helped the identification of hi-line by method of the present invention, especially when atrocious weather or " dirt fan " phenomenon or night, avoid the danger knocking hi-line.
The hi-line image detecting method of the embodiment of the present invention mainly comprises the following steps:
Step 1: read in image, is converted to gray level image by coloured image, and carries out image enhaucament;
Step 2: removal background, rim detection and the process of image local auto-thresholding algorithm are carried out to the image after strengthening, obtains object candidate area; Wherein, the process of image local auto-thresholding algorithm is specially: utilize the window (as 3*3) of presetted pixel size to slide by pixel in the picture, until travel through whole image, in the image region that each window is corresponding, the summation sum of all pixels in calculation window, if sum is more than or equal to threshold value, so make the value of window middle be 1, otherwise make the value of window middle be 0, wherein, 0 represents background, and 1 represents target.The partitioning algorithm of image carries out in local window, the Hough transform method larger compared to calculated amount, and it is little that the present invention has calculated amount, and effectively can remove the noise of background in image, can also obtain object candidate area simultaneously.
Step 3: carry out denoising to object candidate area, obtains the final hi-line pixel set detected, and goes out the position at hi-line place at former chart display.
In another embodiment of the present invention, as shown in Figure 1, mainly comprise the following steps:
S1, read in gather come image;
S2, carry out gradation conversion to image, can adopt image conversion formula that coloured image is converted to gray level image, also in desirable each pixel, the mean value of 3 passages, as the pixel of gray level image, or only gets the pixel of green channel as gray level image.Concrete 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 adopt linear transformation method, will obtain the gray level image after image enhaucament afterwards.
S4, removal background process is carried out to the image after image enhaucament; In preferred embodiment of the present invention, image is removed background method and is described below: adopt the algebraic operation of image to remove background, use the algebraic operation addition of image or multiplication to find image background, uses the algebraic operation division of image and subtraction to remove the background of image.
Algebraic operation addition or multiplication find being summarized as follows of image background: image and it self are carried out add operation, namely takes advantage of 2 operations to each pixel of image, can obtain image background.If result of calculation exceeds gray-scale value maximal value, then result of calculation is made to be gray-scale value maximal value; If result of calculation is less than gray-scale value minimum value, then result of calculation is made to be gray-scale value minimum value;
Use the algebraic operation division of image and subtraction to remove being summarized as follows of image background: first by above-mentioned image after algebraic operation add operation divided by 2, then by this image of step 1 acquired results figure image subtraction, be the image after removing background; If result of calculation exceeds gray-scale value maximal value, then result of calculation is made to be gray-scale value maximal value; If result of calculation is less than gray-scale value minimum value, then result of calculation is made to be gray-scale value minimum value;
The formula of the addition of image, subtraction, multiplication and division is 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, carry out rim detection to removing the image after background.In one embodiment of the present of invention, rim detection can adopt 3x3 horizontal sobel operator template, makes itself and image carry out convolution, realizes the rim detection of image, thus the position of outstanding hi-line.Fig. 2 is 3x3 horizontal sobel operator template.Meanwhile, Prewitt operator template as shown in Figure 4 and Figure 5 or Robert operator template and image also can be adopted to carry out convolution.
S6, the process of image local auto-thresholding algorithm is carried out to the image after rim detection, obtain object candidate area; In a specific embodiment of the present invention, the partitioning algorithm method of image is described below: utilize the window of 3*3 pixel size to slide by pixel in the picture, until travel through whole image, in the image region that each window is corresponding, the summation sum of all pixels in calculation window, if sum is more than or equal to threshold value, so make the value of window middle be 1, otherwise make the value of window middle be 0, wherein, 0 represents background, and 1 represents target.
The threshold value of image can adopt maximum variance between clusters to calculate:
If image has L gray level, gray-scale value is the pixel count of i is n
i, then total pixel count is
the probability that each gray-scale value occurs is p
i=n
i/ N.Obviously,
If threshold value is t, Iamge Segmentation is become 2 regions, namely gray level is divided into two classes, background classes A=(0,1 ..., t) and target class B=(t+1, t+2 ..., L-1);
The probability that two classes occur is respectively:
A, B two the gray average of class be respectively:
The total gray average of image is:
A, B two inter-class variance in region can be obtained thus:
σ
2=p
A(ω
A-ω
0)
2+p
B(ω
B-ω
0)
2;
Inter-class variance is larger, and two class gray scale difference are larger, then make inter-class variance σ
2maximum t* is required optimal threshold:
The threshold value of image also can adopt maximum entropy threshold values to calculate:
If image is divided into target class A and background classes B two class by threshold value s, their probability distribution is respectively:
A:p
0/p
s,p
1/p
s,...,p
s/p
s;
B:p
s+1/(1-p
s),p
s+2/(1-p
s),...,p
L-1/(1-p
s);
The entropy of two distribution correspondences is respectively:
H
a(s)=InP
s+ H
s/ P
sand H
b(s)=In (1-P
s)+(H-H
s)/(1-P
s);
Wherein:
The entropy of image is:
H(s)=H
A(s)+H
B(s)=InP
s(1-P
s)+H
s/P
s+(H-H
s)/(1-P
s);
Making the maximal value s that H (s) obtains, is exactly the optimal threshold s of segmentation object and background.
S7, intermediate value denoising is carried out to object candidate area;
S8, in former figure, indicate denoising after target, namely indicate the position of hi-line.Red pixel can be adopted to go out the position at hi-line place at former chart display, and this does not ignore the impact that other barriers bring while making the position at the clearer and more definite hi-line place of pilot.
The embodiment of the present invention, based on the hi-line image detecting system of local auto-adaptive Threshold Segmentation Algorithm, for realizing the method for above-described embodiment, as shown in Figure 3, comprising:
Image rough handling module, for reading in image, is converted to gray level image by coloured image, and carries out image enhaucament;
Remove background module, for carrying out removal background process to the image after enhancing;
Edge detection module, carries out edge detection process to the image after removing background;
Local auto-adaptive Threshold segmentation processing module, carries out the process of local auto-adaptive Threshold Segmentation Algorithm for the image after edge detects, obtains object candidate area; Be specially: utilize the window of presetted pixel size to slide by pixel in the picture, until travel through whole image, in the image region that each window is corresponding, the summation sum of all pixels in calculation window, if sum is more than or equal to threshold value, so makes the value of window middle be 1, otherwise make the value of window middle be 0, wherein, 0 represents background, and 1 represents target;
Denoising module, for carrying out denoising to object candidate area, obtains the final hi-line pixel set detected;
Indicate module: according to the final hi-line pixel set detected, go out the position at hi-line place at former chart display.
Described removal background module specifically for:
The algebraic operation addition of image or multiplication is first used to find image background: image and it self to be carried out add operation, namely takes advantage of 2 operations to each pixel of image, obtain image background; If result of calculation exceeds gray-scale value maximal value, then result of calculation is made to be gray-scale value maximal value; If result of calculation is less than gray-scale value minimum value, then result of calculation is made to be gray-scale value minimum value;
Re-use the algebraic operation division of image and subtraction removes image background: first by the image after algebraic operation add operation divided by 2, then by this image of figure image subtraction after the enhancing of step 1 gained, obtain the image after removing background; If result of calculation exceeds gray-scale value maximal value, then result of calculation is made to be gray-scale value maximal value; If result of calculation is less than gray-scale value minimum value, then result is made to be gray-scale value minimum value.
Indicating module specifically adopts red pixel to go out the position at hi-line place at former chart display.
Described edge detection module specifically for, adopt 3x3 horizontal sobel operator template, the image after making it and removing background carries out convolution, realizes the rim detection of image, the position of outstanding hi-line.
Should be understood that, for those of ordinary skills, can be improved according to the above description or convert, and all these improve and convert the protection domain that all should belong to claims of the present invention.