The take pictures removal method of the hi-line in the image in the process of railway freight train
Technical field
The invention belongs to field of photoelectric technology, especially relate to the take pictures removal method of the hi-line in the image in the process of a kind of railway freight train.
Background technology
In existing technology; the railway freight train is taken pictures in the process; affected by the limitation of railway construction construction, often have the appearance of hi-line in the railway freight train top graph picture that collects, this has certain influence to eye-observation and other image-based Intelligent Recognition utensils.Unresolved above-mentioned technical matters is badly in need of a kind of method that can remove image mesohigh line, and the method can accurately be removed the demonstration of image mesohigh line, has guaranteed simultaneously naturality and the integrality of image.
Summary of the invention
The problem to be solved in the present invention provides the take pictures removal method of the hi-line in the image in the process of a kind of railway freight train, and the parameter that especially is fit to hi-line is known constant situation.
For solving the problems of the technologies described above, the technical solution used in the present invention is: the take pictures removal method of the hi-line in the image in the process of a kind of railway freight train is characterized in that: comprise the steps:
Step 1, obtain the hi-line parameter: the position of the Y-axis of hi-line in image and the width of hi-line;
The position of step 2, the Y-axis of hi-line in image obtained according to step 1 and the width of hi-line, it is pending area pixel that the location of pixels that need to process is set, and obtains the gray-scale pixels data of this pending area pixel;
Step 3, to image each row in pending area pixel, being that (A °-A °+180 °, B °-B °+180 °, C °-C °+180 °) three directions are laterally zygomorphic in its angle respectively gets 5~10 neighborhood territory pixels and analyzes, we obtain three groups of pixel set, i.e. C (P altogether like this
A, P
B, P
C);
Step 4, according to three groups of neighborhood territory pixels set that step 3 obtains, calculate respectively the Grad change curve in each pixel set, the formula of calculating is as follows:
If one group of set F is arranged
k(P
n), k=1 ... 3, n=1 ... 5~10; The Grad of F is calculated as follows so:
Step 5, according to the gradient that step 4 obtains, calculate the gradient absolute value sum of each pixel set according to following formula:
(w∈[0,1])
The Grad of X-direction during wherein the Lx representative is gathered, the Grad of Y direction in the Ly representative set, w represents weight;
Step 6, according to the gradient absolute value sum of each pixel set of step 5 gained, the set of pixels cooperation of getting gradient absolute value sum minimum is that the reference pixel of interpolation arithmetic is gathered, and described reference pixel set has comprised described pending area pixel removal and replaced becomes interpolation zone and each 5~10 neighborhood territory pixel of described pending area pixel front and back;
The reference pixel set of step 7, the pending area pixel of removal that obtains according to step 6 utilizes Cubic cubic spline interpolation algorithm, estimates to replace the pixel value in the interpolation zone in described pending zone, and inserts described interpolation zone;
Step 8, repeating step 3-7 finish until the pixel in whole pending zones is all replaced.
Further, the described hi-line parameter of step 1 is known constant.
Further, the preferred version of the described A of step 3, B, C is: A=45, B=90, C=135.
Further, the neighborhood territory pixel described in step 3 and the step 6 is preferably each 7 up and down.
Advantage and good effect that the present invention has are: owing to adopting technique scheme, the railway freight train hi-line in the image of taking pictures in the process can accurately be removed, and can guarantee naturality and the integrality of original other images simultaneously.
Description of drawings
Fig. 1 is FB(flow block) of the present invention
Fig. 2 is the image effect figure before hi-line of the present invention is removed
Fig. 3 is the image effect figure after hi-line of the present invention is removed
Fig. 4 is the gradient figure of the directions X described in the step 4 and Y-direction among the present invention
Among the figure:
1, hi-line 2, compartment 3, goods
Embodiment
As shown in Figure 1, the invention provides the take pictures removal method of the hi-line in the image in the process of a kind of railway freight train, it is characterized in that: comprise the steps:
Step 1, obtain the hi-line parameter: the position of the Y-axis of hi-line in image and the width of hi-line;
The position of step 2, the Y-axis of hi-line in image obtained according to step 1 and the width of hi-line, it is pending area pixel (such as the little square frame on the horizontal line in the following example) that the location of pixels that need to process is set, and obtains the gray-scale pixels data of this pending area pixel;
Step 3, to image each row in pending area pixel, being that (A °-A °+180 °, B °-B °+180 °, C °-C °+180 °) three directions are laterally zygomorphic in its angle respectively gets 5~10 neighborhood territory pixels and analyzes, we obtain three groups of pixel set, i.e. C (P altogether like this
A, P
B, P
C); The location of pixels in pending zone and the location of pixels of other angles relation can arrange position as shown in the table: (clockwise direction tendency)
45° |
90° |
135° |
0° |
Pending pixel |
180° |
315° |
270° |
225° |
Step 4, according to three groups of neighborhood territory pixels set that step 3 obtains, calculate respectively the Grad change curve in each pixel set, the formula of calculating is as follows:
If one group of set F is arranged
k(P
n), k=1 ... 3, n=1 ... 5~10; The Grad of F is calculated as follows so:
Returned the graded of each set X-direction and Y direction in the formula, its change curve as shown in Figure 4, three line representatives are gathered based on the pixel of three angles among the figure, (a) are X-direction gradient curve figure, (b) are Y direction gradient curve figure;
Step 5, according to the gradient that step 4 obtains, calculate the gradient absolute value sum of each pixel set according to following formula:
(w∈[0,1])
The Grad of X-direction during wherein the Lx representative is gathered, the Grad of Y direction in the Ly representative set, w represents weight;
Step 6, according to the gradient absolute value sum of each pixel set of step 5 gained, the set of pixels cooperation of getting gradient absolute value sum minimum is that the reference pixel of interpolation arithmetic is gathered, and described reference pixel set has comprised described pending area pixel removal and replaced becomes interpolation zone and each 5~10 neighborhood territory pixel of described pending area pixel front and back; When respectively getting 7 neighborhood territory pixels before and after us, the set of pixels of gradient absolute value sum minimum is combined into the following form of expression:
40 41 42 42 40 40 62 109 80 49 49 48 47 47 44
So, the reference pixel set is that 109 in the middle of removing and the pixel that replaces with empty interpolation zone (following square) are gathered, and its form of expression is as follows:
The reference pixel set of step 7, the pending area pixel of removal that obtains according to step 6 utilizes Cubic cubic spline interpolation algorithm, estimates to replace the pixel value in the interpolation zone in described pending zone, and inserts described interpolation zone;
Step 8, repeating step 3-7 finish until the pixel in whole pending zones is all replaced.
Further, the described hi-line parameter of step 1 is known constant.
Further, the preferred version of the described A of step 3, B, C is: A=45, B=90, C=135.
Further, the neighborhood territory pixel described in step 3 and the step 6 is preferably each 7 up and down.
The present invention relates to neighborhood territory pixel up and down symmetrical number choose, in the scope that pixel processing capability allows, can elect 5~10 in the present embodiment as for a plurality of, be preferably 7.
Above one embodiment of the present of invention are had been described in detail, but described content only is preferred embodiment of the present invention, can not be considered to be used to limiting practical range of the present invention.All equalizations of doing according to the present patent application scope change and improve etc., all should still belong within the patent covering scope of the present invention.