Disclosure of Invention
The invention aims to solve the technical problem of how to design a high-speed target tracking method aiming at a 1-bit special pulse data format of a pulse array image sensor, reduce the data processing time and improve the real-time property and the precision of an algorithm.
The invention solves the technical problems through the following technical scheme:
the high-speed target tracking method based on the pulse array image sensor comprises the following steps:
firstly, traversing rows and columns of single-frame pulse data of a pulse array image sensor by a frame according to a 1-bit pulse data format of the pulse array image sensor, inputting two paths of adjacent LVDS pulse data of the pulse array image sensor, processing the LVDS pulse data, starting accumulation, and counting to obtain a single-channel accumulation maximum value;
step two, according to the step one, two paths of adjacent LVDS pulse data of the input pulse array image sensor of 8 channels are processed in parallel to obtain the accumulated maximum value of each channel, the maximum value in the 8 channels is taken as the maximum value of single frame pulse data statistics, and the position of the maximum value of the statistics is taken as a positioning coordinate;
and step three, calculating to obtain the image trailing length, adding the image trailing length to the positioning coordinate obtained in the step two for coordinate compensation, and outputting the compensated positioning coordinate.
The invention provides a pulse positioning algorithm aiming at a 1-bit special pulse data format of a pulse array image sensor, traverses rows and columns of single-frame pulse data of the pulse array image sensor by a frame, positions an area with the most dense pulse distribution in the single-frame pulse data, receives LVDS (Low-Voltage Differential Signaling) data of the pulse array image sensor, and performs data processing in a pipeline form, thereby greatly reducing data processing time and improving the real-time property of the algorithm. By using the tailing compensation algorithm, the positioning accuracy of the algorithm is improved, the target can be positioned in a short time, and the high-speed target tracking under the condition of 40Kfps can be realized.
As a further improvement of the technical solution of the present invention, the process of processing LVDS pulse data in the step one specifically includes:
(1) Converting a differential signal of the input single-channel LVDS pulse data into a single-ended signal by utilizing a Xilinx FPGA device primitive IBUFDS;
(2) Performing serial-parallel conversion on the converted single-ended signal through data shift, outputting pulse data of X rows of pixels by using the single-channel LVDS, taking the frame effective signal as a starting node, and taking every X pulse data as one line;
(3) After LVDS data are converted, two paths of adjacent converted LVDS data are spliced together, and the spliced data are pulse data of adjacent 2X pixels on the same row, wherein X is a positive integer.
As a further improvement of the technical solution of the present invention, the obtaining of the accumulated maximum value of each channel in step two specifically includes:
after the splicing data is input, accumulating the adjacent N data: m is to be E-mailThe cumulative sum of (N + m-1) (m =1,2, …, X) is recorded as a m (m=1,2,…,X);
Wherein the parameter c M For storing the accumulated result of the input concatenated data, c M Is 0, where M denotes the mth row of the box;
after the single-frame data output by the pulse array image sensor is positioned, all parameters in the algorithm are reset, so that the accuracy of positioning of each frame of data is ensured; c. C M The expression of (a) is as follows:
c M =(a 1 ,a 2 ,...,a X ) (1)
when c is M When collecting new accumulation results, parameter c j ' (j = 2.. Multidot.M) for saving c j Data before data change, and c j ' previously saved data transfer to c j-1 (ii) a So when c is j When a change occurs, the data will move by:
c j-1 =c′ j (2)
wherein, c j (a m ) For indicating storage in c j In the accumulated result a m The data of (a); path1 output c 1 Path 2 output a m (m=1,2,…,X),c 1 (a m ) A representing delay of M line periods m A value of (d);
b i =b i +a i -c 1 (a i )(i=1,2,...,X) (3)
wherein, the formula (3) is used for calculating the number of pulses in the frame, and after the calculation of the first M rows is completed, the number of pulses in the X frames of the first M rows is obtained, namely b i A value of (d); in the calculation of b i (i =1,2, …, X), and then b is compared i A value in between.
As a further improvement of the technical solution of the present invention, the maximum value in the 8 channels in step three is taken as the maximum value of the single frame pulse data statistics, specifically:
(1) Presetting single-channel statistical maximum b max Is 0,b i Maximum value of (b) i_max And b max Comparing;
(2) If b is i_max Greater than b max Then b is i_max Is assigned to b max And recording the coordinate information at the moment;
(3) After M lines, each line will calculate a new b i And performing a previous comparison;
(4) Finally, when the whole frame data transmission is finished, each channel has only one b max ;
(5) By comparing b of the respective channels max And obtaining the maximum value b _ max of the single frame statistics.
As a further improvement of the technical scheme of the present invention, the image trailing length obtained by the calculation in step three is specifically:
suppose the current frame is Nth e Frame, target at N e Distance moved within a frame divided by N e Obtaining the average speed v of the target in the interval 0 (ii) a Before starting to perform high-speed target tracking, the positions of the target and the background are determined by performing a frame difference between two frames spaced by 64 frames, and the pulse interval N of the background light can be obtained b And the pulse interval N of the target light e (ii) a In the process of real-time target tracking, the speed of the current moment is represented by the position difference between two coordinate vectors with an interval of 7 frames, and then the length of image tailing is calculated according to the following formula (4):
after the image trailing length is obtained through calculation, the image trailing length is added to the output coordinate of the algorithm to perform coordinate compensation; finally, outputting the compensated positioning coordinates, wherein N 0 Is the number of pixel cells passed by the movement in unit time.
A high-speed target tracking system applying the high-speed target tracking method based on the pulse array image sensor comprises the following steps:
the single-channel maximum value calculation module is used for traversing rows and columns of single-frame pulse data of the pulse array image sensor by a frame according to a 1-bit pulse data format of the pulse array image sensor, inputting two paths of adjacent LVDS pulse data of the pulse array image sensor, processing the LVDS pulse data, starting accumulation, and counting to obtain a single-channel accumulated maximum value;
the 8-channel maximum value calculating module is used for parallelly processing two paths of adjacent LVDS pulse data of the input pulse array image sensor of 8 channels to obtain the accumulated maximum value of each channel, the maximum value in the 8 channels is taken as the maximum value of single-frame pulse data statistics, and the position where the maximum value is counted is taken as a positioning coordinate;
and the compensation positioning module is used for calculating to obtain the image trailing length, adding the image trailing length to the positioning coordinates obtained in the second step to perform coordinate compensation, and outputting the compensated positioning coordinates.
As a further improvement of the technical solution of the present invention, the process of processing the LVDS pulse data in the single-channel maximum value calculation module specifically includes:
(1) Converting a differential signal of the input single-channel LVDS pulse data into a single-ended signal by utilizing a Xilinx FPGA device primitive IBUFDS;
(2) Performing serial-parallel conversion on the converted single-ended signal through data shift, outputting pulse data of X rows of pixels by using the single-channel LVDS, taking the frame effective signal as a starting node, and taking every X pulse data as one line;
(3) After LVDS data are converted, two paths of adjacent converted LVDS data are spliced together, and the spliced data are pulse data of adjacent 2X pixels on the same row, wherein X is a positive integer.
As a further improvement of the technical solution of the present invention, the obtaining of the cumulative maximum value of each channel in the 8-channel maximum value calculation module specifically includes:
after the splicing data is input, accumulating the adjacent N data: recording the cumulative sum of m- (N + m-1) (m =1,2, …, X) as a m (m=1,2,…,X);
Wherein the parametersc M For storing the accumulated result of the input concatenated data, c M Is 0, where M denotes the mth row of the box;
after the single-frame data output by the pulse array image sensor is positioned, all parameters in the algorithm are reset, so that the accuracy of positioning of each frame of data is ensured; c. C M The expression of (c) is as follows:
c M =(a 1 ,a 2 ,...,a X ) (1)
when c is going to M When collecting new accumulation results, parameter c j ' (j = 2.. Multidot.M) for saving c j Data before data change, and c j ' previously saved data transfer to c j-1 (ii) a So when c is j When a change occurs, the data will move by:
c j-1 =c′ j (2)
wherein, c j (a m ) For indicating storage in c j In the accumulated result a m The data of (a); path1 output c 1 Path 2 output a m (m=1,2,…,X),c 1 (a m ) A representing delay of M line periods m A value of (d);
b i =b i +a i -c 1 (a i )(i=1,2,...,X) (3)
wherein, the formula (3) is used for calculating the number of pulses in the frame, and after the calculation of the first M rows is completed, the number of pulses in the X frames of the first M rows is obtained, namely b i A value of (d); in the calculation of b i (i =1,2, …, X), and then b is compared i A value in between.
As a further improvement of the technical solution of the present invention, the maximum value of the 8 channels in the compensation positioning module is taken as the maximum value of the single frame pulse data statistics, and specifically:
(1) Presetting single-channel statistical maximum b max Is 0,b i Maximum value of (b) i_max And b max Comparing;
(2) If it is notb i_max Greater than b max Then b is i_max Is assigned to b max And recording the coordinate information at the moment;
(3) After M lines, each line will calculate a new b i And performing a previous comparison;
(4) Finally, when the whole frame data transmission is finished, each channel has only one b max ;
(5) By comparing b of the respective channels max And obtaining the maximum value b _ max of the single frame statistics.
As a further improvement of the technical solution of the present invention, the calculating in the compensation positioning module to obtain the image trailing length specifically includes: suppose the current frame is Nth e Frame, target at N e Distance moved within a frame divided by N e Obtaining the average speed v of the target in the interval 0 (ii) a Before starting to perform high-speed target tracking, the positions of the target and the background are determined by performing a frame difference between two frames spaced by 64 frames, and the pulse interval N of the background light can be obtained b And the pulse interval N of the target light e (ii) a In the process of real-time target tracking, the speed of the current moment is represented by the position difference between two coordinate vectors with an interval of 7 frames, and then the length of image tailing is calculated according to the following formula (4):
after the image trailing length is obtained through calculation, the image trailing length is added to the output coordinate of the algorithm to perform coordinate compensation; finally, outputting the compensated positioning coordinate, wherein N 0 Is the number of pixel cells passed by the movement in unit time.
The invention has the advantages that:
the invention provides a pulse positioning algorithm aiming at a 1-bit special pulse data format of a pulse array image sensor, traverses rows and columns of single-frame pulse data of the pulse array image sensor by a frame, positions an area with the most dense pulse distribution in the single-frame pulse data, receives LVDS (Low-Voltage Differential Signaling) data of the pulse array image sensor, and performs data processing in a pipeline form, thereby greatly reducing data processing time and improving the real-time property of the algorithm. By using the tailing compensation algorithm, the positioning accuracy of the algorithm is improved, the target can be positioned in a short time, and the high-speed target tracking under the condition of 40Kfps can be realized.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The technical scheme of the invention is further described by combining the drawings and specific embodiments in the specification:
example one
As shown in fig. 1, after data is input, accumulation is started, pulse statistics of the first 50 blocks is performed first, and after the statistics is completed, comparison is performed to obtain a statistical maximum value of the 50 blocks. And in the process of inputting data line by line, comparing statistical data, and obtaining the maximum value of single-channel statistics when the single-frame data statistics is finished. And comparing the 8 channels to obtain the position with the maximum single-frame pulse statistics. And finally, eliminating tailing influence to obtain a positioning result of the algorithm and outputting the positioning result.
As shown in fig. 2, the input of the single-channel pulse statistics is two adjacent LVDS (Low-Voltage Differential Signaling) pulse data output by the sensor; the serial input data of LVDS needs to be converted into parallel data: firstly, converting differential signals into single-ended signals, and converting the input differential signals into the single-ended signals by utilizing Xilinx FPGA device primitive IBUFDS. And performing serial-parallel conversion on the converted single-ended signal through data shifting, and outputting pulse data of 50 columns of pixels by the single-channel LVDS. The frame valid signal is pulled high as a starting node, and data is in a row every 50 pulses. After LVDS data is converted, it is passed to the next module. Next, two adjacent converted LVDS data paths are spliced together. The data after stitching is the impulse data of the adjacent 100 pixels on the same line.
And after splicing data are input, accumulating the N adjacent data. Recording the cumulative sum of m (N + m-1) (m =1,2, …, 50) as a m (m =1,2, …, 50). Parameter c M For storing the accumulated result of the input concatenated data, c M Is 0, where M denotes the mth row of the block. After the single-frame data output by the pulse array image sensor is positioned, all parameters in the algorithm are reset, so that the accuracy of positioning of each frame of data is ensured; c. C M The expression of (c) is as follows:
c M =(a 1 ,a 2 ,...,a 50 ) (1)
when c is going to M When collecting new accumulation results, parameter c j ' (j = 2.. Multidot.M) for saving c j Data before data change, and c j ' previously saved data transfer to c j-1 . So when c is j When a change occurs, the data will move by:
c j-1 =c′ j (2)
c j (a m ) For indicating storage in c j In the accumulated result a m The data of (1). Equation (3) is used to calculate the number of pulses in the box.As shown in FIG. 2, path1 outputs c 1 Path 2 output a m (m=1,2,…,50)。c 1 (a m ) A representing delay of M line periods m The value of (c). For example, when path 2 outputs a for row M +1 m When a value of (c) 1 (a m ) Keep a of row 1 m The value of (c). b i (i =1,2, …, 50) is used to represent the value of the pulse statistics in 50 boxes.
b i =b i +a i -c 1 (a i )(i=1,2,...,50) (3)
After the calculation of the first M lines is completed, the number of pulses in the 50 boxes of the first M lines, i.e., b, can be obtained i The value of (c). In the calculation of b i (i =1,2, …, 50), and then b is compared i A value in between.
B to be calculated as shown in FIG. 3 i Are compared with each other to obtain a maximum value b therebetween i_max . Presetting single-channel statistical maximum b max Is 0,b i Maximum value of (b) i_max And b max A comparison is made. If b is i_max Greater than b max Then b is i_max Is assigned to b max And recording the coordinate information at this time. After M lines, each line will calculate a new b i And the previous comparison is made. Finally, when the whole frame data transmission is finished, each channel has only one b max . By comparing b of the respective channels max And obtaining the maximum value b _ max of the single frame statistics.
To eliminate the interference of the background impulse information, the smaller value of b _ max will be filtered out by a predefined threshold. Therefore, positioning deviation due to the influence of background information does not occur.
As shown in FIG. 4, assume that the current frame is Nth e Frame, target at N e Distance moved within a frame divided by N e Obtaining the average speed v of the target in the interval 0 . The pulse interval N of the background light can be found by determining the position of the target and the background by performing a frame difference between two frames spaced 64 frames before starting the execution of the high speed target tracking algorithm b And pulses of target lightInterval N e . In the process of real-time target tracking, the speed of the current moment is represented by the position difference between two coordinate vectors spaced by 7 frames, and then the length of the image smear is calculated according to the following formula.
And after the image trailing length is obtained through calculation, the image trailing length is added to the output coordinates of the algorithm to perform coordinate compensation. Finally, outputting the compensated positioning coordinate, wherein N 0 Is the number of pixel cells passed by the movement in unit time.
The method and the system are applied to a 40K fps pulse array image sensor, receive 8 paths of LVDS data output by the image sensor, can process the data in real time along with a sampling clock and a frame effective signal, realize the algorithm based on an FPGA platform, can realize the real-time position of a 44ns positioning target, and have smaller positioning error. The real-time motion of the table tennis ball in high-speed motion is shot, the motion trail of the table tennis ball emitted by the table tennis ball serving machine is shot in a black test box, and a high-speed target tracking algorithm is realized based on Xilinx Kintex-7 FPGA. The real-time motion trail of the table tennis is displayed on the display. Since the frame rate of the display is 60fps and the frame rate of the pulse array image sensor is 40Kfps, the positioning coordinates of the 667 frames positioned most recently are displayed on one frame of the display. In order to more intuitively display the motion trail of the table tennis, the positioning coordinates output by the algorithm are set to maintain the display of 0.3 s. In order to distinguish the positioning coordinate output by the latest algorithm from the positioning coordinate cached before, the display color of the cached positioning coordinate is gradually lightened as the caching time is longer in the display process.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.