CN113343978A - Train speed measuring method, device and system and computer readable storage medium - Google Patents
Train speed measuring method, device and system and computer readable storage medium Download PDFInfo
- Publication number
- CN113343978A CN113343978A CN202110579479.9A CN202110579479A CN113343978A CN 113343978 A CN113343978 A CN 113343978A CN 202110579479 A CN202110579479 A CN 202110579479A CN 113343978 A CN113343978 A CN 113343978A
- Authority
- CN
- China
- Prior art keywords
- image
- train
- character
- frame
- speed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 61
- 238000006073 displacement reaction Methods 0.000 claims abstract description 73
- 238000012545 processing Methods 0.000 claims abstract description 49
- 238000003706 image smoothing Methods 0.000 claims abstract description 32
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 24
- 230000011218 segmentation Effects 0.000 claims abstract description 9
- 238000004891 communication Methods 0.000 claims description 21
- 238000005259 measurement Methods 0.000 claims description 17
- 238000004590 computer program Methods 0.000 claims description 15
- 238000001914 filtration Methods 0.000 claims description 12
- 238000000691 measurement method Methods 0.000 claims description 11
- 238000006243 chemical reaction Methods 0.000 claims description 7
- 238000005516 engineering process Methods 0.000 description 11
- 239000003550 marker Substances 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 238000013507 mapping Methods 0.000 description 3
- 238000011160 research Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000006698 induction Effects 0.000 description 2
- 230000001788 irregular Effects 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000007619 statistical method Methods 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 229910000831 Steel Inorganic materials 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000002146 bilateral effect Effects 0.000 description 1
- 238000013527 convolutional neural network Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000007429 general method Methods 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 230000001678 irradiating effect Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000005507 spraying Methods 0.000 description 1
- 239000010959 steel Substances 0.000 description 1
- 238000012706 support-vector machine Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/215—Motion-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/246—Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30248—Vehicle exterior or interior
- G06T2207/30252—Vehicle exterior; Vicinity of vehicle
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
The application relates to a train speed measuring method, a device and a system thereof. The method comprises the following steps: acquiring a first image sequence; processing the first image sequence according to a preset character recognition algorithm; determining character displacement of the characters according to the positions of the characters in different frames of train side images; determining the speed of the train according to the inter-frame interval and the character displacement of each frame of the side image of the train; wherein, according to presetting the character recognition algorithm includes: carrying out gray level processing on the side image of the train to obtain a gray level image; carrying out at least one time of image smoothing treatment on the gray level image to obtain a smooth gray level image; determining the type of the pixel point according to the gray value variation of the pixel point at the same position of the gray image and the corresponding smooth gray image; carrying out connected body segmentation processing on the smooth gray image according to the type of each pixel point in the smooth gray image to obtain a connected body set; and determining characters corresponding to the target connected bodies in the connected body set. The method has good real-time performance and can quickly detect the train speed.
Description
Technical Field
The present application relates to the field of image recognition technologies, and in particular, to a method, an apparatus, a system, and a computer-readable storage medium for train speed measurement.
Background
In train operation, it is often necessary to test the speed of a train in order to accurately determine the state of the train in order to control the train. For train speed per hour measurement, there are two general methods: invasive and non-invasive. Invasive methods include induction coils, piezoelectric transducers, and the like. Such techniques are inconvenient to install, for example, the induction coil needs to be laid below the railway steel rail, the rail is damaged to a certain extent, and the later maintenance cost is high. Non-invasive methods include lightning method speed measurement, laser speed measurement, ultrasonic speed measurement, speed measurement based on image recognition technology and the like. Compared with other non-invasive methods, the speed measuring system based on the image recognition technology is simpler in structure and lower in later maintenance cost.
The method for measuring the speed of the train based on the image recognition technology in the traditional technology has the problems that the image processing time is long, the real-time performance of train speed measurement is poor, and the speed of the train cannot be measured quickly.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a system and a computer readable storage medium for measuring a train speed, which can quickly measure a train speed.
On one hand, the train speed measuring method provided by the invention comprises the following steps: acquiring a first image sequence; the first image sequence comprises a plurality of continuous frames of train side images; processing each frame of train side image of the first image sequence according to a preset character recognition algorithm to obtain characters in each frame of train side image; determining character displacement of the characters according to the positions of the characters in different frames of train side images; determining the speed of the train according to the inter-frame interval and the character displacement of each frame of the side image of the train; the method comprises the following steps of processing each frame of train side image of a first image sequence according to a preset character recognition algorithm to obtain characters in each frame of train side image: carrying out gray level processing on the side image of the train to obtain a gray level image; carrying out at least one time of image smoothing treatment on the gray level image to obtain a smooth gray level image; determining the type of the pixel point according to the gray value variation of the pixel point at the same position of the gray image and the corresponding smooth gray image; wherein, the types comprise character pixel points and background pixel points; carrying out connected body segmentation processing on the smooth gray image according to the type of each pixel point in the smooth gray image to obtain a connected body set; the communication body set comprises a plurality of target communication bodies, and each target communication body corresponds to a character in the train side image; and determining characters corresponding to the target connected bodies in the connected body set.
On the other hand, the invention also provides a train speed measuring device, which comprises: the data acquisition module is used for acquiring a first image sequence; the first image sequence comprises a plurality of continuous frames of train side images; the character recognition module is used for processing each frame of train side image of the first image sequence according to a preset character recognition algorithm so as to obtain characters in each frame of train side image; processing each frame of train side image of the first image sequence according to a preset character recognition algorithm to obtain characters in each frame of train side image, wherein the step of carrying out gray processing on the train side image to obtain a gray image; carrying out at least one time of image smoothing treatment on the gray level image to obtain a smooth gray level image; determining the type of the pixel point according to the gray value variation of the pixel point at the same position of the gray image and the corresponding smooth gray image; wherein, the types comprise character pixel points and background pixel points; carrying out connected body segmentation processing on the smooth gray image according to the type of each pixel point in the smooth gray image to obtain a connected body set; the communication body set comprises a plurality of target communication bodies, and each target communication body corresponds to a character in the train side image; determining characters corresponding to all target connected bodies in the connected body set; the character displacement determining module is used for determining the character displacement of the characters according to the positions of the characters in different frames of the train side images; and the vehicle speed determining module is used for determining the vehicle speed of the train according to the inter-frame interval and the character displacement of each frame of the side image of the train.
In another aspect, the present invention further provides a train speed measuring system, including: the lens of the image acquisition equipment is parallel to the side surface of the train and is used for acquiring images under the control of the control signal; the trigger equipment is used for outputting a trigger signal when the train reaches a trigger position; the controller is connected with the image acquisition equipment and the trigger equipment and comprises a memory and a processor, wherein the memory stores a computer program, the processor executes the computer program and sends a control signal to the image acquisition equipment when receiving a trigger signal, and the control signal is used for indicating the image acquisition equipment to acquire an image with preset time length so as to obtain a first image sequence; the processor is further used for implementing the steps of the train speed measuring method in any one of the above embodiments when executing the computer program.
In still another aspect, the present invention further provides a computer readable storage medium, on which a computer program is stored, wherein the computer program is executed by a processor to implement the steps of the method for measuring speed of a train according to any of the above embodiments.
According to the train speed measurement method in the embodiment of the application, the first image sequence is processed through a preset character recognition algorithm to obtain characters in each frame of train side image in the first image sequence, the character displacement is determined according to the position of each frame of side image of the characters, and finally the speed of the characters is determined according to the character displacement and the inter-frame interval of each frame of train side image. Because the character and the train move synchronously, the train speed can be obtained after the character speed is determined. The preset character recognition algorithm can determine the type of the pixel points according to the variation of the gray value of each pixel point before and after the image smoothing processing, so that the process of calculating the threshold value is omitted, the speed of image processing is increased, the real-time performance of the train speed measuring method is improved, and the rapid train speed measurement is realized.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments or the conventional technologies of the present application, the drawings used in the descriptions of the embodiments or the conventional technologies will be briefly introduced below, it is obvious that the drawings in the following descriptions are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a diagram illustrating a scenario of a train speed measurement method according to an embodiment;
FIG. 2 is a schematic flow chart of a method for measuring train speed according to an embodiment;
FIG. 3 is a diagram illustrating character shifting in one embodiment;
FIG. 4 is a flowchart illustrating the steps of determining character displacements in another embodiment;
FIG. 5 is a flowchart illustrating the steps for determining the speed of a train in one embodiment;
FIG. 6 is a block diagram of a train speed measuring device according to an embodiment;
FIG. 7 is a schematic structural diagram of a train speed measurement system in one embodiment;
FIG. 8 is a diagram illustrating a first displacement and a second displacement in one embodiment.
Detailed Description
To facilitate an understanding of the present application, the present application will now be described more fully with reference to the accompanying drawings. Embodiments of the present application are set forth in the accompanying drawings. This application may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another.
It will be understood that when an element is referred to as being "connected" to another element, it can be directly connected to the other element or be connected to the other element through intervening elements. Further, "connection" in the following embodiments is understood to mean "electrical connection", "communication connection", or the like, if there is a transfer of electrical signals or data between the connected objects.
As used herein, the singular forms "a", "an" and "the" may include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises/comprising," "includes" or "including," etc., specify the presence of stated features, integers, steps, operations, components, parts, or combinations thereof, but do not preclude the presence or addition of one or more other features, integers, steps, operations, components, parts, or combinations thereof. Also, as used in this specification, the term "and/or" includes any and all combinations of the associated listed items.
As described in the background art, the method for measuring the speed of the train by using the image recognition technology in the prior art has the problem of long image processing time, and the inventor researches and discovers that the problem is caused because the gray values of the character pixel points and the background pixel points in a general image are greatly different, so that the image is often subjected to binarization processing in order to screen the character pixel points from the whole image, that is, the character pixel points and the background pixel points are respectively set with two different gray values. The commonly used binarization processing method comprises a global threshold method and a local threshold method, but the applicant researches and discovers that the current global threshold method and the current local threshold method need longer processing time when calculating the global threshold or the local threshold, so that the real-time performance of the whole speed measurement is poor.
Based on the reasons, the invention provides a train speed measuring method. Fig. 1 is a scene diagram of an application of a train speed measurement method provided in an embodiment of the present application, where the application of the train speed measurement method may include a train speed measurement device. The train speed measuring device may be specifically integrated in a server or a terminal or other computer equipment, where the server may be an independent physical server, may also be a server cluster or a distributed system formed by a plurality of physical servers, and may also be a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, Network service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), and a big data and artificial intelligence platform, but is not limited thereto. The terminal can be a mobile phone, a tablet computer, a notebook computer, a desktop computer and the like. The computer equipment acquires the first image sequence from the image acquisition equipment and identifies the speed of the train based on the train speed measuring method in the embodiment of the invention. The image acquisition equipment can be a camera in a video monitoring system in a railway system, and can also be additionally arranged, and is not limited herein.
In one embodiment, as shown in fig. 2, the train speed measuring method provided by the invention includes steps S100 to S700.
S100, a first image sequence is obtained.
Wherein the first image sequence comprises a plurality of continuous frames of train side images.
And S300, processing each frame of train side image of the first image sequence according to a preset character recognition algorithm to obtain characters in each frame of train side image.
It can be understood that the side surfaces of each carriage of the rail train are sprayed with various characters, the characters are used for reflecting relevant information of the sprayed train, such as the type of the train, the number of the train and the like, and relevant workers can conveniently know the relevant information of the freight train by observing the characters so as to manage and track the train and the like. The preset character recognition algorithm is used for processing each frame of train side image in the first image sequence, so that characters in each frame of train side image are recognized.
The step S300 specifically includes steps S310 to S350.
And S310, carrying out gray level processing on the side image of the train to obtain a gray level image.
It is understood that the grayscale image refers to a grayed-out image of the side of the train. An image acquired by a common image acquisition device is generally colored, in an RGB model, pixel points of different colors of a color image can be obtained by superimposing three primary colors of red, green, and blue, but each pixel point corresponds to 3 variables respectively, which increases the operation difficulty of image analysis, so that color information with 3 variables is generally converted into gray information with only 1 variable to simplify the analysis process. Specifically, the gray scale processing can be realized by a weighted average method, an average value method, a maximum value method, or the like.
And S320, performing at least one image smoothing treatment on the gray level image to obtain a smooth gray level image.
It can be understood that the image smoothing processing refers to an image processing algorithm for processing the gray value of each pixel point to reduce the gray value difference between each pixel point and the field pixel point, so that the image becomes blurred and the noise in the image is removed. The smoothed grayscale image refers to a smoothed grayscale image. In an actual application scenario, collected train side images of each frame have more or less noise, which affects the accuracy of subsequent character extraction, so image smoothing processing is often used to remove the noise. However, since the image smoothing process blurs the image, if the number of times of performing the image smoothing process is too large, some useful information in the image may be blurred and difficult to recognize, so the number of times of performing the image smoothing process may be selected according to actual situations.
S330, determining the type of the pixel point according to the gray value variation of the pixel point at the same position of the gray image and the corresponding smooth gray image.
The types of the pixel points comprise character pixel points and background pixel points.
Specifically, the brightness difference between the characters sprayed on the train compartment and the overall color of the compartment is large, and the contrast is strong, so that people can observe the character contents conveniently. Therefore, after the gray level processing, the difference between the gray level value of the character pixel point in the image on the side surface of the train and the gray level value of the background pixel point of the character is larger. Because the occupation ratio of the character pixel points in the whole carriage is small, under the influence of background pixel points with large occupation ratio, the gray value of the character pixel points is greatly changed to approach the gray value of the background pixel points through image smoothing processing, and the gray value of the background pixel points is not greatly changed. Based on the above, the pixel points can be determined to belong to character pixel points or background pixel points according to the gray value change of the gray image before and after the image smoothing processing. Since the image smoothing is a common step in the image recognition technology, the type of the pixel point can be determined by comparing the gray values of the pixel points before and after the image smoothing, and the step of calculating a global threshold or a local threshold in the traditional technology is omitted, so that the time for image processing is reduced.
S340, carrying out connected body segmentation processing on the smooth gray image according to the type of each pixel point in the smooth gray image to obtain a connected body set.
The communication body set comprises a plurality of target communication bodies, and each target communication body corresponds to a character in the train side image.
It can be understood that after the type of each pixel point is determined, in order to facilitate processing, binarization can be performed on each pixel point, and other similar methods can be adopted to mark character pixel points and background pixel points. Taking an example of binary values of each pixel point, the gray value of the character pixel point is set to 255, and the gray value of the background pixel point is set to 0. After the binarized image is obtained, each pixel point in the image has only 0 or 255 gray values, adjacent pixel points with the same gray value can be found out based on an analysis method such as a 4-neighborhood region or an 8-neighborhood region and connected bodies are formed, and each connected body corresponds to different labels or marks for distinguishing. Common methods for segmentation of the connected body include Two-pass and Seed-FillIng methods. Because each target connected body is formed by connecting character pixel points, each target connected body corresponds to one character in the train side image.
And S350, determining characters corresponding to the target connected components in the connected component set.
Specifically, each connected body can be converted into a character according to the mapping relationship between the connected body and the character. At present, many mature technologies can judge the mapping relationship between the connected entities and the characters, convert the connected entities into corresponding characters, for example, a template matching method, a support vector machine or a convolutional neural network-based method is used to extract and train the character features, and then further identify the characters corresponding to the connected entities. The algorithm for judging the mapping relation between the connected body and the character is not limited.
And S500, determining character displacement of the characters according to the positions of the characters in the side images of the trains in different frames.
It is understood that the character displacement is used to reflect the amount of change in the character from a position in one frame of the train-side image to a position in the other frame of the train-side image. The sizes of the train side images in the first image sequence are consistent, and the character displacement can be obtained according to the coordinate change of the same character in the train side images of different frames by establishing the same coordinate system in the train side images. As shown in fig. 3 (the cars in solid and dashed lines in the figure represent train side images of different frames, respectively).
And S700, determining the train speed according to the inter-frame interval and the character displacement of each frame of the train side image.
It can be understood that the inter-frame interval refers to a time interval between two consecutive frames of train side images, and the current image acquisition device can acquire images at a specific frame rate, and the inter-frame interval can be calculated according to the frame rate of the image acquisition device. Because each frame of train side image in the first image sequence is continuous, the time corresponding to the character displacement can be obtained according to the inter-frame interval. The speed of the object can be calculated according to the displacement of the object and the time corresponding to the displacement, so that the speed of the character can be calculated according to the displacement of the character and the inter-frame space related to the time corresponding to the displacement of the character. And because the characters are sprayed on the train, the characters and the train move synchronously, so that the speed of the train can be determined according to the speed of the characters.
According to the train speed measurement method in the embodiment of the application, the first image sequence is processed through a preset character recognition algorithm to obtain characters in each frame of train side image in the first image sequence, the character displacement is determined according to the position of each frame of side image of the characters, and finally the speed of the characters is determined according to the character displacement and the inter-frame interval of each frame of train side image. Because the character and the train move synchronously, the train speed can be obtained after the character speed is determined. The preset character recognition algorithm can determine the type of the pixel points according to the variation of the gray value of each pixel point before and after the image smoothing processing, so that the process of calculating the threshold value is omitted, the speed of image processing is increased, the real-time performance of the train speed measuring method is improved, and the rapid train speed measurement is realized.
In an embodiment, the step S320 specifically includes: and performing image smoothing processing on the gray level image twice to obtain a smooth gray level image.
It will be appreciated that the image smoothing process will blur the image to remove some noise. However, the number of times of image smoothing processing is too large, which may cause the useful pixel points to be blurred, and it is difficult to distinguish the useful pixel points from the background pixel points. The inventor finds that when the number of times of image smoothing is selected to be twice, the noise filtering effect can be good, and character pixel points in the image can be well reserved.
In one embodiment, the specific way of the image smoothing processing in step S320 is gaussian filtering.
Specifically, the algorithms for image smoothing include mean filtering, median filtering, bilateral filtering, gaussian filtering, and the like, and these algorithms are all applicable to this scheme. However, the inventor researches and finds that the noise during image acquisition can be generally regarded as gaussian noise, and gaussian filtering has a good filtering effect on the gaussian noise, so that the gaussian filtering algorithm is preferably used for image smoothing processing in the embodiment. In addition, the Gaussian filtering is specifically realized by performing two-dimensional convolution on a two-dimensional Gaussian convolution kernel with a set window size and an image to obtain a smoothed image. Because the convolution operation can be carried out in parallel, the speed of using Gaussian filtering to carry out image smoothing processing is very high, and the real-time performance of the whole algorithm is further improved.
In one embodiment, the step S350 further includes: and if the target connected body in the connected body set does not meet the shape characteristics, removing the target connected body which does not meet the shape characteristics from the connected body set.
The shape characteristics comprise the aspect ratio of the target connected body and/or the area proportion of the target connected body in the train side image.
It can be understood that under different shooting conditions, the side images of the freight train may be imaged with interference images, for example, shadows formed by sunlight irradiating on the side of the freight train, and the interference images may also form some connected bodies, but these interference images are generally irregular structures, and the connected bodies corresponding to the interference images are also irregular. In order to reduce the influence caused by the interference image, the connected objects corresponding to the interference image in the connected object set need to be removed, that is, the target connected objects which do not meet the shape characteristics need to be removed. Further, the shape feature may include an aspect ratio of the target via and/or an area fraction of the target via in the train-side image. The characters have certain size requirements during spraying, so the aspect ratio of the connected body corresponding to the characters is within a reasonable interval, and whether the target connected body is to be removed or not can be judged according to the aspect ratio of the target connected body. In addition, the occupation ratio of the characters in the whole train side image is small, and whether the target connected body should be removed or not can be judged according to the area occupation ratio of the target connected body in the train side image.
In one embodiment, step S500 specifically includes step S510 to step S550.
S510, dividing the first image sequence into a plurality of image subsequences.
It can be understood that the character displacement of the character between two adjacent frames is small, which is not beneficial for calculation. The first image sequence may be divided into a plurality of identical or different sub-sequences, facilitating statistics of the displacement of the character in each image sub-sequence. The specific segmentation method can be selected according to actual needs, for example, the first image sequence is divided into a plurality of image subsequences with the same number of frames.
S530, determining a first target frame and a second target frame in each image subsequence.
The first target frame is a frame in which the character appears first in the image subsequence, and the second target frame is a frame in which the character appears last in the image subsequence.
And S550, determining the character displacement corresponding to each image subsequence according to the position of the character in the train side image corresponding to the first target frame and the position of the character in the train side image corresponding to the second target frame.
Specifically, the amount of change of the character from the position in the train side image corresponding to the first target frame to the position in the train side image corresponding to the second target frame is the character displacement. The same coordinate system can be established through train side images corresponding to the first target frame and the second target frame, and the character displacement can be obtained by selecting a certain pixel point of the character as a reference point and comparing the coordinates of the reference point in the two frame images.
In one embodiment, after determining the character displacement according to steps S510 to S550, as shown in the figure, step S700 specifically includes steps S710 to S770.
S710, obtaining time corresponding to each character displacement according to the frame number and the inter-frame interval between the first target frame and the second target frame in each image subsequence.
Specifically, the product of the inter-frame interval and the number of frames between the first target frame and the second target frame is the time taken by the character to move from the position in the train-side image corresponding to the first target frame to the position in the train-side image corresponding to the second target frame, which corresponds to the character displacement.
And S730, converting the character displacement into actual displacement according to a displacement conversion formula.
It is understood that the displacement conversion formula refers to a quantitative relation satisfied between the character displacement and the actual displacement. The character displacement is the position variation of the character in the image, the actual displacement is the position variation of the character in the actual space, and the character displacement can be converted into the actual displacement by using a character conversion formula.
Specifically, the displacement conversion formula may be obtained experimentally. For example, a marker of any measurable size is posted on the side of a train, and an image containing the marker is taken using an image capture device similar to that used to capture the first sequence of images in the embodiments of the present application. Optionally, a portion of the marker is used as a reference, e.g., if the marker is a circular target, the diameter of the marker is selected as the reference, and the image containing the marker is analyzed to obtain the number of pixels corresponding to the diameter of the marker. According to the actual distance of the diameter of the circular target and the number of the pixel points corresponding to the diameter of the circular target, the corresponding relation between the number of the pixel points and the actual distance can be obtained, namely a displacement conversion formula.
And S750, obtaining the character speed corresponding to each image subsequence according to the actual displacement and the time corresponding to the character displacement.
It is understood that character speed refers to the speed of a character in real space.
And S770, determining the speed of the train according to the character speed corresponding to each image subsequence.
It can be understood that after the character speeds corresponding to the image sub-sequences are obtained, the train speed can be obtained by statistically analyzing a large number of character speeds by using various statistical methods.
In a specific embodiment, the step S770 includes:
and calculating the average value of the character speeds corresponding to the image subsequences to obtain the train speed.
It can be understood that averaging is a more common statistical method, and when the number of samples is large, the error of a single sample can be balanced, and the error between the calculated theoretical value and the actual value can be reduced.
It should be understood that although the steps in the flowcharts of fig. 2, 4 and 5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2, 4 and 5 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the other steps.
The embodiment of the invention also provides a train speed measuring device, as shown in fig. 6, which comprises a data acquisition module 10, a character recognition module 30, a character displacement determination module 50 and a train speed determination module 70.
The data acquisition module 10 is configured to acquire a first sequence of images. Wherein the first image sequence comprises a plurality of continuous frames of train side images.
The character recognition module 30 is configured to process each frame of train side image of the first image sequence according to a preset character recognition algorithm to obtain a character in each frame of train side image.
The character recognition module 30 processes each frame of train side image of the first image sequence according to a preset character recognition algorithm to obtain characters in each frame of train side image, and specifically includes performing gray processing on the train side image to obtain a gray image; carrying out at least one time of image smoothing treatment on the gray level image to obtain a smooth gray level image; determining the type of the pixel point according to the gray value variation of the pixel point at the same position of the gray image and the corresponding smooth gray image; wherein, the types comprise character pixel points and background pixel points; carrying out connected body segmentation processing on the smooth gray image according to the type of each pixel point in the smooth gray image to obtain a connected body set; the communication body set comprises a plurality of target communication bodies, and each target communication body corresponds to a character in the train side image; and determining characters corresponding to the target connected bodies in the connected body set.
The character displacement determining module 50 is used for determining the character displacement of the character according to the positions of the character in the side images of the train in different frames.
The vehicle speed determining module 70 is configured to determine a vehicle speed of the train according to the inter-frame interval and the character displacement of each frame of the train side image.
In one embodiment, the character recognition module 30 is configured to perform at least one image smoothing process on the grayscale image, and obtaining the smooth grayscale image specifically includes performing two image smoothing processes on the grayscale image to obtain the smooth grayscale image.
In one embodiment, character recognition module 30 performs the image smoothing process in a Gaussian filter.
In one embodiment, the character recognition module 30 is further configured to, if a target connected body in the connected body set does not satisfy the shape feature, remove the target connected body which does not satisfy the shape feature from the connected body set; the shape characteristics comprise the aspect ratio of the target connected body and/or the area proportion of the target connected body in the train side image.
In one embodiment, the character displacement determination module 50 is specifically configured to divide the first image sequence into a plurality of image sub-sequences. Determining a first target frame and a second target frame in each image subsequence; the first target frame is a frame in which the character appears first in the image subsequence, and the second target frame is a frame in which the character appears last in the image subsequence. And determining the character displacement corresponding to each image subsequence according to the position of the character in the train side image corresponding to the first target frame and the position of the character in the train side image corresponding to the second target frame.
In one embodiment, the vehicle speed determining module 70 is specifically configured to obtain the time corresponding to each character displacement according to the frame number and the inter-frame interval between the first target frame and the second target frame in each image subsequence. And converting the character displacement into actual displacement according to a displacement conversion formula. And obtaining the character speed corresponding to each image subsequence according to the actual displacement corresponding to the character displacement and the time corresponding to the character displacement. And determining the train speed according to the character speed corresponding to each image subsequence.
In one embodiment, the vehicle speed determining module 70 is further configured to calculate an average value of the character speeds corresponding to the image sub-sequences, so as to obtain the train speed.
For specific definition of the train speed measuring device, reference may be made to the definition of the train speed measuring device above, and details are not described here. All modules in the train speed measuring device can be completely or partially realized through software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules. It should be noted that, in the embodiment of the present application, the division of the module is schematic, and is only one logic function division, and there may be another division manner in actual implementation.
The embodiment of the invention further provides a train speed measurement system, as shown in fig. 7, which includes an image acquisition device 100, a trigger device 300 and a controller 500.
The lens of the image capturing apparatus 100 is parallel to the side of the train for capturing an image under the control of a control signal transmitted from the controller 500. The first sequence of images captured is most effective when the image capturing device 100 is parallel to the side of the train. In order to ensure that the lens of the image capturing apparatus 100 is parallel to the side of the train, the image capturing apparatus 100 may be calibrated in a calibration manner. The specific calibration process may be as follows: a static train carriage is parked on a fixed railway rail, and a circular target (the diameter of which is known) is pasted on one side of the train carriage. Since the circular target is a standard circle, if the target plane (i.e., the car plane) is not parallel to the lens plane of the image capturing device 100, the circle will be geometrically distorted when imaged, so that the aspect ratio of the image is no longer 1: 1. It is determined whether the target plane (i.e., the car plane) and the lens plane of the image capturing apparatus 100 remain parallel by scaling the aspect ratio of the circular target. Through multiple times of calibration and adjustment, the lens of the image acquisition device 100 is parallel to the side face of the train. The image capturing device 300 may be a camera in an original video system of the railway system, or may be any other various additional camera devices. The present embodiment does not limit the type of the image pickup apparatus 300.
The trigger device 300 is used for outputting a trigger signal when the train reaches a trigger position. The trigger device 300 is provided to determine whether a train arrives. The trigger signal is transmitted to the controller 500, and the controller 500 can know that the train has arrived when receiving the trigger signal. The trigger device 300 may be a proximity switch or a laser trigger switch. The present embodiment does not limit the type of the triggering device 300.
The controller 500 is connected to the image capturing device 100 and the triggering device 300, and includes a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the processor sends a control signal to the image capturing device 100 when receiving a triggering signal, and the control signal is used to instruct the image capturing device 100 to capture an image with a preset duration to obtain a first image sequence. The processor, when executing the computer program, is further configured to implement the steps in any of the embodiments of the train speed measuring method described above. The controller 500 may be a control chip in a mobile phone, a tablet computer, a notebook computer, a desktop computer, or the like.
In one embodiment, the preset time period is determined according to the first length, the second length and the average train speed.
As shown in fig. 8, the first length is the length of a train single car, and the second length is the distance between the trigger position and the image capturing device 100. The running speed of the railway train is high, so that the calculation real-time performance of the train speed measuring system is high. In this case, if the preset time is too long, the time consumed by the system for storing and calculating the video data will be long; and if the preset time period is too short, it may make it difficult for the system to calculate the vehicle speed from the small amount of stored video data. Therefore, the application proposes a scheme for designing the preset duration, namely determining the preset duration according to the first length, the second length and the average speed of the train. The specific formula is as follows:
T=(L2+N×L1)/v (1)
wherein T is a predetermined time, L1Is a first length, L2And N is a set constant, and v is the average speed of the train. Specifically, L1And L2The train speed measurement method can be obtained through simple measurement, the railway system can carry out statistics on train speed measurement in each interval, relevant data of average train speed of trains in each interval exist in the railway system, and N can be determined to be better selected according to an experimental mode. Preferably, N ═ 5.
The embodiment of the invention also provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps in any of the above embodiments of the train speed measuring method.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
In the description herein, references to the description of "some embodiments," "other embodiments," "desired embodiments," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, a schematic description of the above terminology may not necessarily refer to the same embodiment or example.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (11)
1. A train speed measuring method is characterized by comprising the following steps:
acquiring a first image sequence; wherein the first image sequence comprises a plurality of consecutive frames of train side images;
processing each frame of the train side image of the first image sequence according to a preset character recognition algorithm to obtain characters in each frame of the train side image;
determining the character displacement of the character according to the positions of the character in the side images of the train in different frames;
determining the speed of the train according to the inter-frame interval of each frame of the side image of the train and the character displacement;
wherein, the step of processing each frame of the train side image of the first image sequence according to a preset character recognition algorithm to obtain the characters in each frame of the train side image comprises the following steps:
carrying out gray level processing on the side image of the train to obtain a gray level image;
carrying out at least one time of image smoothing treatment on the gray level image to obtain a smooth gray level image;
determining the type of the pixel point according to the gray value variation of the pixel point at the same position of the gray image and the corresponding smooth gray image; wherein the types comprise character pixel points and background pixel points;
carrying out connected body segmentation processing on the smooth gray image according to the type of each pixel point in the smooth gray image to obtain a connected body set; the communication body set comprises a plurality of target communication bodies, and each target communication body corresponds to a character in the train side image;
and determining the character corresponding to each target connected body in the connected body set.
2. The train speed measurement method according to claim 1, wherein the step of performing at least one image smoothing process on the gray-scale image to obtain a smoothed gray-scale image comprises:
and performing the image smoothing processing twice on the gray level image to obtain the smooth gray level image.
3. The train speed measurement method according to claim 1, wherein the image smoothing is gaussian filtering.
4. The train speed measurement method according to claim 1, wherein the step of determining the character corresponding to each target communication body further comprises:
if the target connected body in the connected body set does not meet the shape characteristics, the target connected body which does not meet the shape characteristics is removed from the connected body set; wherein the shape feature comprises an aspect ratio of the target link and/or an area ratio of the target link in the train side image.
5. The train speed measurement method according to claim 1, wherein the step of determining the character displacement of the character according to the position of the character in the train side image of different frames comprises:
dividing the first image sequence into a plurality of image subsequences;
determining a first target frame and a second target frame in each image subsequence; wherein the first target frame is a frame in which the character appears first in the image sub-sequence, and the second target frame is a frame in which the character appears last in the image sub-sequence;
and determining the character displacement corresponding to each image subsequence according to the position of the character in the train side image corresponding to the first target frame and the position of the character in the train side image corresponding to the second target frame.
6. The method for measuring the speed of the train according to claim 5, wherein the step of determining the speed of the train according to the inter-frame interval of each frame of the side image of the train and the character displacement comprises the following steps:
obtaining time corresponding to each character displacement according to the frame number between a first target frame and a second target frame in each image subsequence and the interframe space;
converting the character displacement into actual displacement according to a displacement conversion formula;
obtaining a character speed corresponding to each image subsequence according to the actual displacement corresponding to the character displacement and the time corresponding to the character displacement;
and determining the train speed according to the character speed corresponding to each image subsequence.
7. The method for measuring the speed of the train according to claim 6, wherein the step of determining the speed of the train according to the character speed corresponding to each image subsequence comprises the following steps:
and calculating the average value of the character speeds corresponding to the image subsequences to obtain the train speed.
8. A train speed measuring device is characterized by comprising:
the data acquisition module is used for acquiring a first image sequence; wherein the first image sequence comprises a plurality of consecutive frames of train side images;
the character recognition module is used for processing each frame of the train side image of the first image sequence according to a preset character recognition algorithm so as to obtain characters in each frame of the train side image; processing each frame of the train side image of the first image sequence according to a preset character recognition algorithm to obtain characters in each frame of the train side image comprises performing gray processing on the train side image to obtain a gray image; carrying out at least one time of image smoothing treatment on the gray level image to obtain a smooth gray level image; determining the type of the pixel point according to the gray value variation of the pixel point at the same position of the gray image and the corresponding smooth gray image; wherein the types comprise character pixel points and background pixel points; carrying out connected body segmentation processing on the smooth gray image according to the type of each pixel point in the smooth gray image to obtain a connected body set; the communication body set comprises a plurality of target communication bodies, and each target communication body corresponds to a character in the train side image; determining the characters corresponding to the target connected bodies in the connected body set;
the character displacement determining module is used for determining the character displacement of the character according to the positions of the character in the train side images of different frames;
and the vehicle speed determining module is used for determining the vehicle speed of the train according to the inter-frame interval of each frame of the side image of the train and the character displacement.
9. A train speed measurement system, comprising:
the lens of the image acquisition equipment is parallel to the side surface of the train and is used for acquiring images under the control of the control signal;
the trigger equipment is used for outputting a trigger signal when the train reaches a trigger position;
the controller is connected with the image acquisition equipment and the trigger equipment, and comprises a memory and a processor, wherein the memory stores a computer program, the processor sends the control signal to the image acquisition equipment when the processor executes the computer program and realizes that the trigger signal is received, and the control signal is used for indicating the image acquisition equipment to acquire images with preset time length so as to obtain a first image sequence; the processor, when executing the computer program, is further configured to implement the steps of the train speed measurement method according to any one of claims 1 to 7.
10. The train speed measurement system according to claim 9, wherein the preset duration is determined according to the first length, the second length and the average train speed; the first length is the length of a single train carriage, and the second length is the distance between the trigger position and the image acquisition equipment.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for measuring speed of a train according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110579479.9A CN113343978A (en) | 2021-05-26 | 2021-05-26 | Train speed measuring method, device and system and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110579479.9A CN113343978A (en) | 2021-05-26 | 2021-05-26 | Train speed measuring method, device and system and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113343978A true CN113343978A (en) | 2021-09-03 |
Family
ID=77471636
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110579479.9A Pending CN113343978A (en) | 2021-05-26 | 2021-05-26 | Train speed measuring method, device and system and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113343978A (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105277735A (en) * | 2014-07-24 | 2016-01-27 | 南车株洲电力机车研究所有限公司 | Detection method and device for speed and displacement of rail train |
-
2021
- 2021-05-26 CN CN202110579479.9A patent/CN113343978A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105277735A (en) * | 2014-07-24 | 2016-01-27 | 南车株洲电力机车研究所有限公司 | Detection method and device for speed and displacement of rail train |
Non-Patent Citations (2)
Title |
---|
徐正等: "基于交通摄像头视频的车牌识别与测速", 《江西科学》 * |
林柏林: "基于视频序列图像的车辆测速的实现方法", 《通信技术》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Li et al. | Blind image quality assessment using statistical structural and luminance features | |
CN104408460B (en) | A kind of lane detection and tracking detection method | |
CN112800860B (en) | High-speed object scattering detection method and system with coordination of event camera and visual camera | |
CN112348787B (en) | Training method of object defect detection model, object defect detection method and device | |
JP2020527785A (en) | Ship detection methods and systems based on multidimensional features of the scene | |
CN109740445B (en) | Method for detecting infrared dim target with variable size | |
CN107330390B (en) | People counting method based on image analysis and deep learning | |
CN100571335C (en) | Image syncretizing effect real-time estimating method and device based on pixel space relativity | |
CN111723773B (en) | Method and device for detecting carryover, electronic equipment and readable storage medium | |
CN113592861A (en) | Bridge crack detection method based on dynamic threshold | |
CN117132510B (en) | Monitoring image enhancement method and system based on image processing | |
CN108830856B (en) | GA automatic segmentation method based on time series SD-OCT retina image | |
CN111415339B (en) | Image defect detection method for complex texture industrial product | |
CN112365475A (en) | Power transmission line icing monitoring method and system based on image processing mode | |
CN111753794B (en) | Fruit quality classification method, device, electronic equipment and readable storage medium | |
CN112528861A (en) | Foreign matter detection method and device applied to track bed in railway tunnel | |
CN111402301B (en) | Water accumulation detection method and device, storage medium and electronic device | |
CN104299234B (en) | The method and system that rain field removes in video data | |
CN116071692A (en) | Morphological image processing-based water gauge water level identification method and system | |
CN111738984B (en) | Skin image spot evaluation method and system based on watershed and seed filling | |
CN113963307A (en) | Method and device for identifying content on target and acquiring video, storage medium and computer equipment | |
JP4918615B2 (en) | Object number detection device and object number detection method | |
CN113343978A (en) | Train speed measuring method, device and system and computer readable storage medium | |
CN112785550B (en) | Image quality value determining method and device, storage medium and electronic device | |
CN107818287B (en) | Passenger flow statistics device and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |