Target detection and tracking method for high-speed railway contact network
1. A target detection and tracking method for a high-speed railway contact network is characterized by comprising the following steps:
s1: collecting a sample infrared video;
s2: carrying out frame processing on the sample infrared video in the S1 to obtain a sample image;
s3: preprocessing the sample image in S2;
s4: for the image obtained in S3, connecting the edges of the catenary and the wire in the sample image using Hough transform;
s5: determining a tracking strategy of the stressed contact wire and tracking the stressed contact wire;
s6: and predicting the motion trail of the target contact wire based on Kalman filtering, and correcting the tracking result under the condition of missing detection or error detection.
2. The method for detecting and tracking the target of the overhead line system of the high-speed railway according to claim 1, wherein the preprocessing of the step S3 at least comprises graying and region-of-interest extraction.
3. The method for detecting and tracking the target of the overhead line system of the high-speed railway according to claim 2, wherein the graying is performed on the infrared image, and then the edge feature information of the overhead line system is extracted directly by adopting a prewitt edge detection algorithm.
4. The method for detecting and tracking the target of the overhead contact line system of the high-speed railway according to claim 1, wherein the step S4 specifically comprises the following steps:
s41: recording pixel point coordinates of the edge of the candidate target straight line, and storing the pixel point coordinates into a two-dimensional array;
s42: carrying out Hough transformation on edge pixel points in the two-dimensional array point by point according to the formula rho ═ xcos theta + ysin theta to obtain a parameter matrix [ rho, theta ] and storing the parameter matrix [ rho, theta ] in an accumulated Hough matrix;
s43: carrying out peak value detection in the Hough matrix, finding out a maximum value point in the Hough matrix, recording the value of the maximum value point, storing the position of the maximum value point, and carrying out zero clearing on the peak value point and values of points in surrounding small fields;
s44: eliminating the cross-connection straight line and the pseudo straight line;
s45: and (6) merging and fitting straight lines.
5. The method for detecting and tracking the target of the overhead contact line system of the high-speed railway according to claim 4, wherein the S43 is required to circularly calculate the maximum point: and after the first peak value detection is finished and the zero clearing is carried out, solving a second maximum value point in the Hough matrix and carrying out the same subsequent steps until all the maximum value points meeting the conditions are detected.
6. The method for detecting and tracking the target of the overhead line system of the high-speed railway according to claim 4, wherein the S45 combines and fits straight lines by a least square method according to an included angle between the straight lines, and corrects the accuracy of extracting the straight lines by a Hough transformation method.
7. The method for detecting and tracking the target of the overhead contact line system of the high-speed railway according to claim 1, wherein the step S5 specifically comprises the following steps:
s51, detecting the contact wire in the region of interest by using a Hough transformation method;
s52: assigning the detected characteristic values of the contact wires to the respective trackers;
s53: and determining a tracking strategy of the stressed contact wire based on the characteristic parameters, and tracking the stressed contact wire.
8. The method for detecting and tracking the target of the overhead contact line system of the high-speed railway according to claim 7, wherein the tracking strategy in the S53 is divided into two main cases:
(1) only one catenary and one contact wire:
a. no miscellaneous line state:
if the characteristic parameter values of the contact wire and the messenger in the local peaks of the accumulator are both between the maximum threshold and the minimum threshold, and all the characteristic parameter values of the accumulator are compared:
if the characteristic parameter value of the lead is greater than that of the carrier cable, the detection line with the maximum characteristic parameter is a stressed contact lead;
otherwise, the characteristic parameter value of the catenary is greater than that of the lead, and the detection line with the maximum characteristic parameter is the catenary.
b. The state of the wire is:
if the characteristic parameter values of the contact wire, the catenary and the stray wire are all between the maximum threshold and the minimum threshold in the local peaks of the accumulator, and all the characteristic parameter values of the accumulator are compared:
the characteristic parameter value of the contact wire is greater than the characteristic parameter value of the carrier cable and greater than the characteristic parameter value of the miscellaneous wire, and the detection line with the largest characteristic parameter is the stressed contact wire;
otherwise, the characteristic parameter value of the catenary is greater than the characteristic parameter value of the contact wire and greater than the characteristic parameter value of the miscellaneous wire, and the detection line with the largest characteristic parameter is the catenary;
otherwise, the characteristic parameter value of the miscellaneous line is greater than the characteristic parameter value of the contact wire and greater than the characteristic parameter value of the carrier cable, and the detection line with the maximum characteristic parameter is the miscellaneous line;
(2) there are multiple carrier cables and contact wires:
a. no miscellaneous line state:
if the characteristic parameter values of both the wire and the messenger are between the maximum threshold and the minimum threshold in the local peaks of the accumulator, and all the characteristic parameter values of the accumulator are compared:
the characteristic parameter value of the stressed contact wire is greater than that of the carrier cable and greater than that of the unstressed contact wire, and the detection line with the largest characteristic parameter is the stressed contact wire;
otherwise, the characteristic parameter value of the unstressed contact wire is greater than the characteristic parameter value of the carrier cable and greater than the characteristic parameter value of the stressed contact wire, and the detection line with the largest characteristic parameter is the unstressed contact wire;
otherwise, the characteristic parameter value of the catenary is greater than the characteristic parameter value of the stressed contact wire and greater than the characteristic parameter value of the unstressed contact wire, and the detection line with the largest characteristic parameter is the catenary;
b. the state of the wire is:
if the characteristic parameter values of the contact wire, the catenary and the stray wire are all between the maximum threshold and the minimum threshold in the local peaks of the accumulator, and all the characteristic parameter values of the accumulator are compared:
the characteristic parameter value of the stressed contact wire is greater than that of the carrier cable, greater than that of the unstressed contact wire and greater than that of the miscellaneous wires, and the detection line with the largest characteristic parameter is the stressed contact wire;
otherwise, the characteristic parameter value of the unstressed contact wire is greater than that of the carrier cable, greater than that of the stressed contact wire and greater than that of the miscellaneous wire, and the detection line with the maximum characteristic parameter is the unstressed contact wire;
otherwise, if the characteristic parameter value of the catenary is greater than the characteristic parameter value of the unstressed contact wire, greater than the characteristic parameter value of the stressed contact wire and greater than the characteristic parameter value of the miscellaneous wire, the detection line with the maximum characteristic parameter is the catenary;
otherwise, the characteristic parameter value of the miscellaneous line is greater than the characteristic parameter value of the non-stressed contact wire, greater than the characteristic parameter value of the stressed contact wire and greater than the characteristic parameter value of the carrier cable, and the detection line with the maximum characteristic parameter is the miscellaneous line.
9. The method for detecting and tracking the target of the overhead contact line system of the high-speed railway according to claim 8, wherein the judgment basis of the tracking strategy comprises the following steps:
(1) the carrier cable with a certain slope and the contact line are in a first quadrant in a characteristic vector [ rho, theta ] corresponding to a polar coordinate system parameter space;
(2) the characteristic vectors [ rho, theta ] corresponding to the approximate horizontal straight line, namely the horizontal straight line of the upper edge and the lower edge of the sliding plate are all in the third quadrant;
(3) the characteristic parameter value of the contact wire is larger than that of the carrier cable;
(4) the characteristic parameter value of the stressed contact wire is larger than that of the unstressed contact wire.
10. The method for detecting and tracking the target of the overhead line system of the high-speed railway according to claim 1, wherein the step S6 is to estimate the trajectory position of the target contact line by predicting the parameters of the contact line through a kalman filter, correct the obtained parameter data, and then enter the next iteration process.
Background
With the continuous development of the electrified railway in China in the high-speed and heavy-load directions, the contact net-pantograph is more and more concerned in the high-speed operation working state. Because the contact net keeps contacting with the pantograph slide plate for a long time, the contact net is worn constantly in the running process of the locomotive, so that a plurality of unreliable factors are brought to the electricity taking performance of the locomotive, the running state of the locomotive is directly influenced, and safety accidents can be caused in serious conditions. Therefore, the running state of the contact network needs to be detected in real time so as to ensure the safe running of the locomotive.
At present, real-time monitoring data of a contact network mainly come from monitoring images of a camera at the top of a high-speed rail carriage. Because the situation such as tunnel, bridge, hard horizontal bracket and contact net line change can appear in the high-speed railway operation in-process, therefore unpredictable sudden change and interference can appear in the video image, for example illumination changes, indoor straight line shadow interference, shelters from straight line background interference, mixed and disorderly line interference etc.. The detection and tracking of the contact line mainly takes two problems into consideration: the contact state of the bow net, namely the contact between the sliding plate and the contact wire is good or bad; and performing a line changing mode at the turnout junction. From the scene analysis, there are two kinds of scenes, including the station and the station. Under the environment in a station, because the contact network circuit is simple and only comprises a catenary wire and a contact network wire, the target and the background have larger discrimination, and the target detection and tracking are easier; due to interference of illumination change, shadow, shielding, line changing and the like, detection and tracking of the contact network in the environment outside the station become difficult.
The traditional target detection method generally comprises a background modeling method, a frame difference method, an optical flow method and the like. However, in a high-speed rail contact network system, due to the particularity of the problems of detecting the target of the lead and the carrier cable, the effect of the traditional detection algorithm is not ideal, so the next idea is to acquire the target motion trend by means of characteristic parameter tracking so as to optimize the target detection effect. For example, in 2009, "research on railway catenary detection system based on image processing" paper by john of university of great continental workers, a traditional contact line identification algorithm, namely, an algorithm for identifying a contact line based on gray information, is mainly used for detecting a certain line of pixels of an image in advance to perform rough search by using gray information of the contact line, and then, the contact line is distinguished and positioned according to the position and width of the contact line and a catenary. Although the method can effectively and accurately identify the contact line, the method cannot accurately detect the contact line in the line changing process, only can be suitable for the simple line condition with only one contact line and one catenary, and cannot realize real-time processing.
In the practical environment of the application, the wire and the carrier cable have no obvious visual characteristics, so that the discriminability is weak when the linear interference occurs, and the tracking of the wire and the carrier cable is difficult to achieve.
Disclosure of Invention
Aiming at the existing technical problems, the invention provides a high-speed railway contact net target detection and tracking method, which overcomes the defect that a contact line and a catenary have no visual obvious characteristics, overcomes the problem of complex situation that a plurality of similar moving targets move simultaneously, can accurately detect and track the contact line in real time under most situations, solves the safety accident caused by bow net separation in the driving process to a certain extent, and provides guarantee for safe operation of urban rails.
The invention adopts the following specific technical scheme:
a high-speed railway contact network target detection and tracking method comprises the following steps:
s1: collecting a sample infrared video;
s2: carrying out frame processing on the sample infrared video in the S1 to obtain a sample image;
s3: preprocessing the sample image in S2;
s4: for the image obtained in S3, connecting the edges of the catenary and the wire in the sample image using Hough transform;
s5: determining a tracking strategy of the stressed contact wire and tracking the stressed contact wire;
s6: and predicting the motion trail of the target contact wire based on Kalman filtering, and correcting the tracking result under the condition of missing detection or error detection.
Preferably, the preprocessing of S3 includes at least graying and region of interest extraction.
Preferably, the graying is performed on the infrared image, and then the edge feature information of the overhead line system is extracted by directly adopting a prewitt edge detection algorithm.
Preferably, the S4 specifically includes the following steps:
s41: recording pixel point coordinates of the edge of the candidate target straight line, and storing the pixel point coordinates into a two-dimensional array;
s42: carrying out Hough transformation on edge pixel points in the two-dimensional array point by point according to the formula rho ═ xcos theta + ysin theta to obtain a parameter matrix [ rho, theta ] and storing the parameter matrix [ rho, theta ] in an accumulated Hough matrix;
s43: carrying out peak value detection in the Hough matrix, finding out a maximum value point in the Hough matrix, recording the value of the maximum value point, storing the position of the maximum value point, and carrying out zero clearing on the peak value point and values of points in surrounding small fields;
s44: eliminating the cross-connection straight line and the pseudo straight line;
s45: and (6) merging and fitting straight lines.
Preferably, the S43 loop requires a maximum point: and after the first peak value detection is finished and the zero clearing is carried out, solving a second maximum value point in the Hough matrix and carrying out the same subsequent steps until all the maximum value points meeting the conditions are detected.
Preferably, the S45 combines and fits the straight lines by a least square method according to an included angle between the straight lines, and corrects the accuracy of extracting the straight lines by the Hough transform method.
Preferably, the S5 specifically includes the following steps:
s51, detecting the contact wire in the region of interest by using a Hough transformation method;
s52: assigning the detected characteristic values of the contact wires to the respective trackers;
s53: and determining a tracking strategy of the stressed contact wire based on the characteristic parameters, and tracking the stressed contact wire.
Preferably, the tracking strategy in S53 is divided into two main cases:
(1) only one catenary and one contact wire:
a. no miscellaneous line state:
if the characteristic parameter values of the contact wire and the messenger in the local peaks of the accumulator are both between the maximum threshold and the minimum threshold, and all the characteristic parameter values of the accumulator are compared:
if the characteristic parameter value of the lead is greater than that of the carrier cable, the detection line with the maximum characteristic parameter is a stressed contact lead;
otherwise, the characteristic parameter value of the catenary is greater than that of the lead, and the detection line with the maximum characteristic parameter is the catenary.
b. The state of the wire is:
if the characteristic parameter values of the contact wire, the catenary and the stray wire are all between the maximum threshold and the minimum threshold in the local peaks of the accumulator, and all the characteristic parameter values of the accumulator are compared:
the characteristic parameter value of the contact wire is greater than the characteristic parameter value of the carrier cable and greater than the characteristic parameter value of the miscellaneous wire, and the detection line with the largest characteristic parameter is the stressed contact wire;
otherwise, the characteristic parameter value of the catenary is greater than the characteristic parameter value of the contact wire and greater than the characteristic parameter value of the miscellaneous wire, and the detection line with the largest characteristic parameter is the catenary;
otherwise, the characteristic parameter value of the miscellaneous line is greater than the characteristic parameter value of the contact wire and greater than the characteristic parameter value of the carrier cable, and the detection line with the maximum characteristic parameter is the miscellaneous line;
(2) there are multiple carrier cables and contact wires:
a. no miscellaneous line state:
if the characteristic parameter values of both the wire and the messenger are between the maximum threshold and the minimum threshold in the local peaks of the accumulator, and all the characteristic parameter values of the accumulator are compared:
the characteristic parameter value of the stressed contact wire is greater than that of the carrier cable and greater than that of the unstressed contact wire, and the detection line with the largest characteristic parameter is the stressed contact wire;
otherwise, the characteristic parameter value of the unstressed contact wire is greater than the characteristic parameter value of the carrier cable and greater than the characteristic parameter value of the stressed contact wire, and the detection line with the largest characteristic parameter is the unstressed contact wire;
otherwise, the characteristic parameter value of the catenary is greater than the characteristic parameter value of the stressed contact wire and greater than the characteristic parameter value of the unstressed contact wire, and the detection line with the largest characteristic parameter is the catenary;
b. the state of the wire is:
if the characteristic parameter values of the contact wire, the catenary and the stray wire are all between the maximum threshold and the minimum threshold in the local peaks of the accumulator, and all the characteristic parameter values of the accumulator are compared:
the characteristic parameter value of the stressed contact wire is greater than that of the carrier cable, greater than that of the unstressed contact wire and greater than that of the miscellaneous wires, and the detection line with the largest characteristic parameter is the stressed contact wire;
otherwise, the characteristic parameter value of the unstressed contact wire is greater than that of the carrier cable, greater than that of the stressed contact wire and greater than that of the miscellaneous wire, and the detection line with the maximum characteristic parameter is the unstressed contact wire;
otherwise, if the characteristic parameter value of the catenary is greater than the characteristic parameter value of the unstressed contact wire, greater than the characteristic parameter value of the stressed contact wire and greater than the characteristic parameter value of the miscellaneous wire, the detection line with the maximum characteristic parameter is the catenary;
otherwise, the characteristic parameter value of the miscellaneous line is greater than the characteristic parameter value of the non-stressed contact wire, greater than the characteristic parameter value of the stressed contact wire and greater than the characteristic parameter value of the carrier cable, and the detection line with the maximum characteristic parameter is the miscellaneous line.
Preferably, the judgment basis of the tracking policy includes:
(1) the carrier cable with a certain slope and the contact line are in a first quadrant in a characteristic vector [ rho, theta ] corresponding to a polar coordinate system parameter space;
(2) the characteristic vectors [ rho, theta ] corresponding to the approximate horizontal straight line, namely the horizontal straight line of the upper edge and the lower edge of the sliding plate are all in the third quadrant;
(3) the characteristic parameter value of the contact wire is larger than that of the carrier cable;
(4) the characteristic parameter value of the stressed contact wire is larger than that of the unstressed contact wire.
Preferably, in S6, the kalman filter is used to predict the parameters of the contact line to estimate the trajectory position of the target contact line, and modify the obtained parameter data, and then enter the next iteration process.
The invention has the beneficial effects that:
the invention provides a method for extracting parameters of a contact line by using the advantage of detecting straight lines through Hough transformation in each frame of an infrared video, and further realizes continuous tracking of the parameters of the contact line by one frame through Kalman filtering, thereby making up the defect that the contact line and a carrier cable have no obvious characteristics visually. Therefore, the contact line tracking can be converted into parameter tracking in Hough transformation space, the running speed is improved, the problem of complex situation that a plurality of similar moving targets move simultaneously is solved, Kalman filtering of a target tracking method is introduced, and the position of a next frame of contact line which possibly occurs is predicted under the conditions of contact line detection error or shielding and the like, so that the deviation of contact line tracking is corrected.
Drawings
Fig. 1 is a flowchart of a target detection and tracking step of an infrared video contact network according to a preferred embodiment of the present invention;
FIG. 2 is a flow chart of a high speed railway contact target detection and tracking method in accordance with a preferred embodiment of the present invention;
FIG. 3 is a schematic diagram of a region of interest extracted by pre-processing a sample image according to a preferred embodiment of the present invention;
FIG. 4 is a flow chart of a contact line edge attachment method according to a preferred embodiment of the present invention;
FIG. 5 is an enlarged view of the layout corresponding to FIG. 4 with the edges unconnected;
FIG. 6 is a partial enlarged view of the edge joint corresponding to FIG. 4;
FIG. 7 is a diagram illustrating the one-to-one correspondence of straight lines in image space to points in parameter space;
fig. 8 shows that in the parameter spaces k, q, the only common point of the two straight lines is on the straight line representing the only existence of the connection points a and B in the original image space fig. 7;
FIG. 9 is a schematic diagram of image space coordinates in rectangular coordinate space;
FIG. 10 is a schematic diagram of the transformation of the rectangular space coordinates to polar parameter space of FIG. 9;
FIG. 11 is a schematic diagram showing the positive and negative values of the slope of a straight line in a given rectangular coordinate system;
FIG. 12 is a flow chart of the contact line characteristic parameter predictive tracking based on Kalman filtering in accordance with the preferred embodiment of the present invention.
Detailed Description
The invention is further illustrated by the following specific examples. The invention uses the actually observed data set as a sample set to verify the effectiveness of the target detection and tracking method. The data set covers the interference of external illumination change, shadow, line change and the like appearing in the contact net observation image in the high-speed rail driving process. The region of interest is an image region selected from the image, and is a key point needed to be focused by image analysis so as to carry out further processing; passing through a connecting straight line: connecting line segments which are not the same straight line into a straight line; the pseudo straight line is marked by setting a threshold value on a line segment which does not need to pay attention to, so that the target is disturbed.
Example 1
Fig. 1 is a flowchart of a step of detecting and tracking an infrared video catenary target, and fig. 2 is a flowchart of a method for detecting and tracking a contact target of a high-speed railway. The embodiment discloses a Kalman filtering-based high-speed railway contact network target detection and tracking method, which comprises the following steps of:
s1: and collecting a sample infrared video. In the step, a contact network video acquired by an infrared camera in the train running process is sampled according to a certain frame rate to obtain a sample image, so as to form a sample set, wherein the sample set comprises indoor (only a contact network simple line of a contact line and a catenary cable) and outdoor (a bridge, a hard transverse support part and a contact line complex line such as line changing and the like) sample images, and the tracking of a target outside a platform is easily interfered by illumination change, shadow, shielding, disordered lines and the like.
S2: and performing frame processing on the sample infrared video in the S1 to obtain a sample image.
S3: the sample image in S2 is preprocessed.
The preprocessing at least comprises graying and region-of-interest extraction, and due to the installation position of a train camera, the imaging angle and other reasons, a pantograph and a contact network lead are generally positioned at the upper part of an observation image, so that a sample image needs to be segmented, the region-of-interest is segmented, and then a target is detected in the region-of-interest. Based on the grayed sample images, the interested areas of the sample images can be obtained in batch to form an operation area set for subsequent target detection and tracking.
For convenience of calculation, the present embodiment intercepts the region of interest of each frame of sample image from the original sample image, where the region of interest includes all information of the object to be detected, and avoids interference caused by most of noise existing in the global image, for example, for the original captured image, the size of the region of interest is 640 × 480, and the size of the extracted region of interest (as shown in fig. 3, an example of the region of interest) is also unified to 640 × 480.
S4: for the image obtained in S3, the edges of the catenary and the wire in the sample image are connected using Hough transform (Hough transform). Firstly, recording pixel points of the edge of a candidate straight line and storing the pixel points into a two-dimensional array, then performing Hough transformation point by point and storing the pixel points into an accumulation matrix (Hough matrix), then performing peak value detection in the Hough matrix, then eliminating an over-connection straight line and a pseudo straight line, and finally combining, fitting and outputting the straight line, wherein the specific flow is shown in fig. 4, and the front and back effects are shown in fig. 5 and 6.
The detailed steps are as follows:
s41: recording pixel point coordinates of the edge of the candidate target straight line on the binarized edge image, and storing the pixel point coordinates into a two-dimensional array;
s42: carrying out Hough transformation on edge pixel points in the two-dimensional array point by point according to the formula rho ═ xcos theta + ysin theta to obtain a parameter matrix [ rho, theta ] and storing the parameter matrix [ rho, theta ] in an accumulated Hough matrix;
s43: carrying out peak value detection in the Hough matrix, finding out a maximum value point in the Hough matrix, recording the value of the maximum value point, storing the position of the maximum value point, and carrying out zero clearing on the peak value point and values of points in surrounding small fields; and after the first peak value detection is finished and the zero clearing is carried out, solving a second maximum value point in the Hough matrix and carrying out the same subsequent steps until all the maximum value points meeting the conditions are detected.
S44: eliminating the cross-connection straight line and the pseudo straight line; by setting a suitable threshold, the problem of bridging points that are far apart and mistaking short lines or discrete points for a detected straight line can be avoided.
S45: and (6) merging and fitting straight lines. And fitting and merging the straight lines by using a least square method according to the included angle between the straight lines, and extracting the precision of the straight lines by using a modified Hough transformation method.
In this embodiment, a coordinate rule is agreed, as shown in fig. 7 to 11, to be unified with the coordinate rule in the Matlab image processing toolbox.
Fig. 7 and 8 show that straight lines in the image space correspond to points in the parameter space one to one; FIGS. 9 and 10 illustrate the conversion process from image space to polar parameter space; fig. 11 shows the positive and negative values of the linear slope value in the conventional rectangular coordinate system. In FIG. 7, all straight lines passing through point A are represented by y1=k*x1+ q denotes that k and q are constants, which means that the same equation can be interpreted as an equation for the parameter space k, q. The required straight line through point a can therefore be expressed by the equation q ═ x1*k+y1Similarly, a straight line passing through point B may be represented as q ═ x2*k+y2. As shown in fig. 8, in the parameter spaces k and q, the only common point of the two straight lines is the straight line representing the only existence of the connection points a and B in the original image space.
In fig. 9 and 10, r is xcos θ + ysin θ, y is kx + b, where r is a radius in a polar coordinate system, θ is an angle in a polar coordinate system, x is an abscissa in a rectangular coordinate system, y is an ordinate in the rectangular coordinate system, k is a slope in the rectangular coordinate system, and b is an intercept in the rectangular coordinate system. After Hough transform, each point (x, y) in the image space is mapped to a sinusoid in an (r, theta) polar coordinate space; points on the same straight line have the same r and theta, and the (r, theta) corresponding to the collinear points in the image space is that the sine curve in the space intersects at one point (r ', theta'), namely the coordinates corresponding to the intersection points of the curve are the polar coordinate parameters of the straight line passing through all the points.
Step S5: and determining a tracking strategy of the stressed contact wire, and tracking the stressed contact wire.
In this step, the preset rule includes: r1: the single-wire rule is that if only two straight lines of a carrier cable and a contact wire are detected, the current detection can be only distributed to one tracker, and the detection of other targets is discarded; r2: a multi-line rule that if multiple lines are detected, only one line is assigned to the tracker, and other line detections are considered as interference lines; r3: in the hopping rule, generally speaking, characteristic parameters [ rho, theta ] of a wire have large hopping when the wire is changed, wherein rho is the radius of a detection line in a polar coordinate, and theta is the angle of the detection line in the polar coordinate.
The assumption premises above include: (1) the carrier cable and the contact line with certain slope are in the first quadrant (positive values in polar coordinate system) in the characteristic vector [ rho, theta ] corresponding to the polar coordinate system parameter space; (2) the characteristic vectors [ rho, theta ] corresponding to the approximate horizontal straight line, namely the horizontal straight line of the upper edge and the lower edge of the sliding plate are all in the third quadrant (both are negative values); (3) under normal circumstances, the characteristic parameter value of the contact wire is greater than that of the catenary wire; (4) in most wire-changing situations, the characteristic parameter value of the stressed contact wire is larger than that of the unstressed contact wire.
S5 specifically includes the following steps:
s51, detecting the contact wire in the region of interest by using a Hough transformation method;
wherein, for each detected line, its full feature vector can be represented as: [ rho, theta, tangent, intersection, gray, saliency ], wherein rho, theta are roman letters indicating the radius and angle of the target wire in polar coordinates; the tandent is the slope of a straight line under a rectangular coordinate system, and the intercept is the intercept of the straight line under the rectangular coordinate system; gray represents the gray value and saliency represents the significance. The feature vector of the line target can be abbreviated as [ ρ, θ ], where ρ is the radius of the detection line in polar coordinates, and θ is the angle of the detection line in polar coordinates.
S52: assigning the detected characteristic values of the contact wires to the respective trackers;
the tracker may be characterized by a position state value [ p, θ ], where p is the radius of the detected contact wire in polar coordinates and θ is the angle of the detected contact wire in polar coordinates.
S53: determining a tracking strategy of the stressed contact wire based on the characteristic parameters, and tracking the stressed contact wire;
analyzing rho and theta of the characteristic parameters of the candidate straight lines, and finding out that points [ rho, theta ] corresponding to the straight lines in the interested region of the image are all in the first quadrant (both positive values) in a parameter space (polar coordinate system); the characteristic parameter value of the stressed contact wire is larger than that of the carrier cable, the characteristic parameter value of the stressed contact wire is larger than that of the miscellaneous wire, and the characteristic parameter value of the stressed contact wire is larger than that of the unstressed contact wire, namely the characteristic parameter value of the stressed contact wire is the maximum value in the first quadrant.
One core problem in implementing data correlation in this step is how to determine characteristic parameters of the stressed contact conductor, where the specified conductor target is characterized by [ ρ, θ ], and ρ and θ should be constrained to each other to determine a tracking scheme for the stressed contact conductor. Therefore, the embodiment proposes a tracking strategy of the stressed contact conductor, and can be divided into two main cases of only one catenary cable, one contact conductor and a plurality of catenary cable contact conductors according to different actual conditions. The first type can be divided into three conditions of no crossing of carrier cable wires, crossing of carrier cable wires and crossing of wires and hybrid wires, and the second type can be divided into three conditions of no crossing of stressed contact wires, crossing of stressed contact wires and crossing of wires and hybrid wires.
1. Under the condition that the contact net only has one catenary cable and one contact wire:
(1) the carrier cable and the lead are not crossed: the candidate targets detected in the last step are easily distinguished and marked based on the prior knowledge, so that the tracking is easy to realize.
(2) The carrier cable and the lead are crossed: in most cases the characteristic parameter values of the carrier wire and the contact wire are positive in the polar coordinate system, and in general the characteristic parameter value of the contact wire is greater than the characteristic parameter value of the carrier wire, and the cross section of the contact wire is wider than the carrier wire. There are three possibilities for the candidate targets detected in this case: firstly, a carrier cable; secondly, the wire is contacted under stress; ③ miscellaneous threads.
(3) And (3) crossing and shielding the conducting wires and the miscellaneous wires: the parasitic lines displayed in the image are mainly partially shielded by the hard transverse support and the bridge, and the value ranges of rho and theta in the transformation space are limited by using the prior knowledge, so that partial parasitic lines can be removed. In most cases, the value of the characteristic parameter of the contact wire is greater than the value of the characteristic parameter of the parasitic wire. There are three possibilities for the candidate targets detected in this case: firstly, a carrier cable; secondly, the wire is contacted under stress; ③ miscellaneous threads.
2. Under the condition that the contact net has a plurality of carrier cables and contact wires:
(1) the stressed contact wire and the unstressed contact wire are not crossed: the candidate targets detected in the last step are easily distinguished and marked based on priori knowledge, and the characteristic parameter value of the stressed contact wire is larger than that of the unstressed contact wire. There are four possibilities for the candidate targets detected in this case: firstly, a carrier cable; secondly, the wire is contacted under stress; contacting the wire without stress; and fourthly, miscellaneous threads.
(2) The stressed contact wires and the unstressed contact wires are crossed: in most cases, the characteristic parameter values of the carrier cable and the contact wire are positive values in a polar coordinate system; in most cases of wire changes, the value of the characteristic parameter of the stressed contact wire is greater than that of the unstressed contact wire, and the stressed contact wire has a wider cross section than that of the unstressed contact wire. There are four possibilities for the candidate targets detected in this case: firstly, a carrier cable; secondly, the wire is contacted under stress; contacting the wire without stress; and fourthly, miscellaneous threads.
(3) And (3) crossing and shielding the conducting wires and the miscellaneous wires: the parasitic lines displayed in the image are mainly partially shielded by the hard transverse support and the bridge, and the value ranges of rho and theta in the transformation space are limited by using the prior knowledge, so that partial parasitic lines can be removed. In most cases, the characteristic parameter value of a stressed contact wire is greater than that of an unstressed contact wire, and the characteristic parameter value of a contact wire is greater than that of a parasitic wire. There are four possibilities for the candidate targets detected in this case: firstly, a carrier cable; secondly, the wire is contacted under stress; contacting the wire without stress; and fourthly, miscellaneous threads.
In the above six cases, the specific steps of the tracking strategy at this time are listed as a), b), c), d):
a) a discrete parameter space is established between the radius p and the appropriate maximum and minimum values of the angle theta, as well as an accumulator a (p, theta) and each element is set to 0.
b) The value ranges of rho and theta in a transformation space are limited by using priori knowledge, Hough transformation is carried out on pixel points meeting conditions on a binary image, namely, the corresponding curve of the pixel points on each rho-theta grid is calculated, and 1 is added to a corresponding accumulator, namely: a (ρ, θ) ═ a (ρ, θ) + 1.
c) Traversing the binary image, and finding out a local peak value peak (rho, theta) of an accumulator corresponding to the collinear point of the image plane;
d) and assigning the detection line with the largest characteristic parameter value. It should be noted that, in this case, it is necessary to set a maximum threshold and a minimum threshold of a characteristic parameter value in advance empirically, and then optimize the maximum threshold and the minimum threshold step by step according to experimental conditions.
In summary, the two major types of situations specifically operable tracking strategies are:
(1) only one catenary and one contact wire:
a. no miscellaneous line state:
if the characteristic parameter values of the contact wire and the messenger in the local peaks of the accumulator are both between the maximum threshold and the minimum threshold, and all the characteristic parameter values of the accumulator are compared:
if the characteristic parameter value of the lead is greater than that of the carrier cable, the detection line with the maximum characteristic parameter is a stressed contact lead;
otherwise, the characteristic parameter value of the catenary is greater than that of the lead, and the detection line with the maximum characteristic parameter is the catenary.
b. The state of the wire is:
if the characteristic parameter values of the contact wire, the catenary and the stray wire are all between the maximum threshold and the minimum threshold in the local peaks of the accumulator, and all the characteristic parameter values of the accumulator are compared:
the characteristic parameter value of the contact wire is greater than the characteristic parameter value of the carrier cable and greater than the characteristic parameter value of the miscellaneous wire, and the detection line with the largest characteristic parameter is the stressed contact wire;
otherwise, the characteristic parameter value of the catenary is greater than the characteristic parameter value of the contact wire and greater than the characteristic parameter value of the miscellaneous wire, and the detection line with the largest characteristic parameter is the catenary;
otherwise, the characteristic parameter value of the miscellaneous line is greater than the characteristic parameter value of the contact wire and greater than the characteristic parameter value of the carrier cable, and the detection line with the maximum characteristic parameter is the miscellaneous line;
(2) there are multiple carrier cables and contact wires:
a. no miscellaneous line state:
if the characteristic parameter values of both the wire and the messenger are between the maximum threshold and the minimum threshold in the local peaks of the accumulator, and all the characteristic parameter values of the accumulator are compared:
the characteristic parameter value of the stressed contact wire is greater than that of the carrier cable and greater than that of the unstressed contact wire, and the detection line with the largest characteristic parameter is the stressed contact wire;
otherwise, the characteristic parameter value of the unstressed contact wire is greater than the characteristic parameter value of the carrier cable and greater than the characteristic parameter value of the stressed contact wire, and the detection line with the largest characteristic parameter is the unstressed contact wire;
otherwise, the characteristic parameter value of the catenary is greater than the characteristic parameter value of the stressed contact wire and greater than the characteristic parameter value of the unstressed contact wire, and the detection line with the largest characteristic parameter is the catenary;
b. the state of the wire is:
if the characteristic parameter values of the contact wire, the catenary and the stray wire are all between the maximum threshold and the minimum threshold in the local peaks of the accumulator, and all the characteristic parameter values of the accumulator are compared:
the characteristic parameter value of the stressed contact wire is greater than that of the carrier cable, greater than that of the unstressed contact wire and greater than that of the miscellaneous wires, and the detection line with the largest characteristic parameter is the stressed contact wire;
otherwise, the characteristic parameter value of the unstressed contact wire is greater than that of the carrier cable, greater than that of the stressed contact wire and greater than that of the miscellaneous wire, and the detection line with the maximum characteristic parameter is the unstressed contact wire;
otherwise, if the characteristic parameter value of the catenary is greater than the characteristic parameter value of the unstressed contact wire, greater than the characteristic parameter value of the stressed contact wire and greater than the characteristic parameter value of the miscellaneous wire, the detection line with the maximum characteristic parameter is the catenary;
otherwise, the characteristic parameter value of the miscellaneous line is greater than the characteristic parameter value of the non-stressed contact wire, greater than the characteristic parameter value of the stressed contact wire and greater than the characteristic parameter value of the carrier cable, and the detection line with the maximum characteristic parameter is the miscellaneous line.
Preferably, in S6, the kalman filter is used to predict the parameters of the contact line to estimate the trajectory position of the target contact line, and modify the obtained parameter data, and then enter the next iteration process.
S6: and predicting the motion trail of the target contact wire based on Kalman filtering, and correcting the tracking result under the condition of missing detection or error detection.
In the step, the position state vector [ rho, theta ] of the catenary wire is predicted through Kalman filtering to estimate the track position of the target contact line. In the collected infrared video frame, a target contact line is understood as a vector containing a lower radius and an angle of a parameter space, and a position parameter predicted value of a next frame is estimated from a current frame through a covariance matrix, namely the track position of the contact line in the next video frame is estimated. And determining a Kalman gain coefficient to correct the estimated value of the position parameter and the covariance of the prediction error, and then entering the next iteration process. The characteristic parameter prediction algorithm flow is shown in fig. 12.
Suppose that the position parameter of the target contact line in the infrared video in s frames can be represented by a vector Peak (s,: where rho _ max represents the maximum radius value in the polar coordinate system of the contact line parameter, and theta _ max represents the maximum angle value in the polar coordinate system of the contact line parameter.
Peak(s,:)=[rho_max,theta_max]
The target may also have noise interference w, which is equivalent to a variable of the target contact line motion in the infrared video. If the position parameter prediction matrix of the target contact line in the previous frame s-1 is known, the position track of the target contact line of the current video frame, i.e. the position parameter observation matrix, can be represented by the following formula
x1(s,:)=A*x(s-1,:)+B*w (1)
In the formula: x is the number of1And (s,: is a prediction matrix of contact line position parameters in the s-th frame, A represents a position parameter observation matrix for deducing the contact line locus of the s-th frame from the optimal estimation x (s-1) of the previous frame, w is process noise of the prediction model, and B is a control matrix which represents how the control quantity w acts on the current state. Because the target contact line position parameter in the infrared video is predicted, the error generated in the prediction is simulated by Gaussian noise with the average value of 0. The uncertainty of each frame in the video is represented by a state noise covariance matrix, the position parameter of the target contact line is necessarily inaccurate when being predicted, the error generated in the prediction process is represented by a state noise covariance matrix Q in the embodiment, the error comprises some uncertain factors, and the prediction error covariance matrix is
p1(s,:)=A2*p(s-1,:)+Q (2)
In the formula: p is a radical of1(s:) is the prediction error covariance matrix of the position parameters of the contact line of the next frame, p (s-1:) is the observation error covariance matrix of the optimal estimation of the position parameters of the previous frame, and A is the transpose matrix of the position parameter transfer matrix of the optimal estimation prediction of the contact line trajectory of the s-th frame of the previous frame. In infrared video, the contact line can not avoid errors in actual detection anyway, and the contact line detected through Hough transformation is strictly speaking only prediction estimation of the position parameters of the contact line. The Kalman consists of a prediction process and a measurement correction process, wherein the estimation process comprises prediction of the current position parameter of the contact line and prediction of the error covariance. The filter correction part mainly updates the prediction state, including Kalman filtering gain, and corrects the position parameter value and covariance by using K(s).
The kalman gain expression is:
in the formula: k(s) is a Kalman filtering constant of the s-th frame, R is a position parameter observation noise covariance matrix, namely a measurement error of the position parameter, and H is a position parameter transfer matrix from the real position parameter to the estimated observation value of the predicted position parameter.
The mathematical expression for deducing the best estimated value of the next frame position parameter of the contact line is
x(s,:)=x1(s,:)+k(s)*(y(s,:)-H*x1(s,:)) (4)
In the formula: x is the number of1(s,: is a presumed value of the position parameter of the actual trajectory of the contact line at the s-th frame, and y (s,: is a parameter observed value, which is an actual measured value of the position parameter of the contact line at the s-th frame.
Finally, the error covariance matrix between the actual position parameters and the detected position parameters of the contact line in the infrared video image is updated, namely, the prediction error covariance matrix is updated, and the mathematical expression is as follows
p(s,:)=(1-k(s))*p1(s,:) (5)
As can be seen from the above analysis, the estimated value x (s,: for the characteristic parameter in the next frame) presumed above is directly matched with the Peak (s-1:) for the characteristic parameter of the contact line in the current frame, and the difference between the parameters in the two frames is calculated respectively, and a proper threshold is set. If the difference is smaller than the set threshold, the characteristic parameters are successfully matched, and the matched contact line is replaced by the contact line track position estimated by the Kalman filter. The problem that one or more frames of images in a complex environment are missed or not detected is solved, the estimated value is used for replacing the detection value, the stability of contact line tracking is improved, when the contact line detection fails in a plurality of sequence images, the estimated value of the characteristic parameter can still be used for replacing the detection value to output, and the operation safety of the electric locomotive is improved.
According to the experimental result of the tracking of the stressed contact wire, the embodiment mainly tracks the contact wire outside the station, and no matter under the background that the contact net only has one wire and one catenary or under the background of a plurality of wires, the embodiment can obtain a more accurate tracking result, so that the method has certain supplementary significance for the research vacancy in the field at present.
In summary, for the situation that the background environment is complex and the target characteristics of the high-speed rail contact network are not obvious, and due to the fact that the turnout junction needs frequent wire replacement, the hard cross support needs to be partially shielded and other interferences in the actual running process of the locomotive, false detection is easy to occur in target detection. The method is based on the Kalman filtering principle, and predicts the target state value in the s frame through the target observation value in the s-1 frame, so that the tracking algorithm is more robust to the interference of shadow, line change and the like, and the problems of false detection and missed detection can be effectively solved. The test example shows that the method is obviously superior to other tracking algorithms in accuracy for tracking the high-speed rail contact net lead and the catenary under the complex background.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.