A traffic track deformation detection method, system, device and program product
Through machine vision detection technology, image processing and edge detection methods are used to quickly and accurately detect track deformation, solving the problem of labor-intensive and low efficiency in the prior art, and improving the safety and transportation smoothness of rail transit.
Patent Information
- Application Number
- CN202410906984.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-08
AI Technical Summary
The existing track deformation detection methods rely on manual observation and professional equipment, consume manpower and lack efficiency and reliability, making it difficult to quickly and accurately detect track deformation.
Using machine vision detection technology, the track monitoring images are collected for grayscale processing, adaptive weighted median filtering, threshold segmentation, mathematical morphological filtering and edge detection, the track surface image area is extracted, the reference line is fitted, the distance parameters are calculated, and the distance parameters are determined. Deformation points and mark the deformation triangle area.
It realizes intelligent detection of track deformation, quickly and accurately detects track deformation, improves detection efficiency, and ensures the smoothness and safety of rail transit.
Smart Images

Figure CN118505677B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine vision detection, and specifically relates to a traffic track deformation detection method, system, equipment and program product. Background Art
[0002] With the rapid development of rail transit, the safety of rail transit has become increasingly important. During long-term use, the track may be deformed due to external forces, changes in its own stress or environmental factors, such as unevenness, uneven track direction, triangular pits, etc. Track deformation will affect rail driving. Therefore, in order to ensure the normal operation of rail vehicles, it is necessary to regularly detect track deformation.
[0003] Currently, the more common way to detect track deformation is for operation and maintenance personnel to observe with the naked eye, or use professional measuring equipment, such as infrared rangefinders, to conduct manual measurement and data analysis of the track to determine whether the track is deformed. This detection method is very labor-intensive, and the efficiency and reliability of the detection need to be improved. Summary of the invention
[0004] The purpose of the present invention is to provide a traffic track deformation detection method, system, device and program product to solve the above-mentioned problems existing in the prior art.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] In a first aspect, a method for detecting deformation of a traffic track is provided, comprising:
[0007] Collecting the track surface monitoring image of the traffic track in the target track segment along the track direction, and performing grayscale processing on the track surface monitoring image to obtain a track surface grayscale image;
[0008] Performing adaptive weighted median filtering on the rail surface grayscale image to obtain a filtered rail surface grayscale image;
[0009] Determine the first grayscale mean of all pixels in the filtered rail surface grayscale image, take the pixels whose grayscale values are greater than the first grayscale mean as segmentation pixels, and determine the second grayscale mean of all segmentation pixels;
[0010] The first grayscale mean and the second grayscale mean are used to form a grayscale threshold interval, and the target grayscale threshold is determined by using the maximum inter-class variance method based on the grayscale threshold interval and the grayscale value of each pixel in the filtered rail surface grayscale image;
[0011] The filtered rail surface grayscale image is binarized using the target grayscale threshold to obtain a rail surface binary image, and the rail surface image area is extracted from the rail surface binary image;
[0012] Performing mathematical morphological filtering on the rail surface image region to obtain an enhanced rail surface image region, and performing edge detection on the enhanced rail surface image region to extract edge lines of the enhanced rail surface image region;
[0013] Selecting a number of first reference points at equal intervals on the corresponding edge line according to the set first image spacing, determining the image coordinates corresponding to each first reference point, and fitting the first reference straight line using the least squares method according to the image coordinates of each first reference point to determine the image coordinate information of the first reference straight line;
[0014] Calculate the first distance from each first reference point to the first reference line, and mark the first distances corresponding to each first reference point on one side of the first reference line as positive, and mark the first distances corresponding to each first reference point on the other side of the first reference line as negative;
[0015] When it is determined that there are three consecutive first reference points, such that the first distance corresponding to the middle first reference point is positive and the first distances corresponding to the first reference points on both sides are negative, or the first distance corresponding to the middle first reference point is negative and the first distances corresponding to the first reference points on both sides are positive, the three consecutive first reference points are all used as first pre-selected points;
[0016] Calculating a first distance parameter according to the first distances corresponding to the three first pre-selected points, and when the first distance parameter exceeds a set distance parameter threshold, using the three first pre-selected points as first deformation points;
[0017] The first deformation triangle is constructed using the three first deformation points, and the enhanced rail surface image area is marked with the first deformation triangle before output.
[0018] In a possible design, the adaptive weighted median filtering process on the rail surface grayscale image includes:
[0019] A preselected window with a range of 3×3 pixels is selected with each pixel in the rail surface grayscale image as the center, and the grayscale value of each pixel in the preselected window and the average grayscale value of all pixels in the preselected window are determined;
[0020] The grayscale value standard deviation of all pixels in the pre-selected window is calculated based on the grayscale value of each pixel in the pre-selected window and the average grayscale value of all pixels in the pre-selected window, and the grayscale value standard deviation is used as the detection threshold;
[0021] Calculate the absolute value of the grayscale difference between the grayscale value of each pixel in the pre-selected window and the average grayscale value, and mark the pixel whose absolute value of the grayscale difference is greater than the detection threshold as a statistical point, otherwise mark it as a non-statistical point;
[0022] Determine the number of statistical points in the preselected window. If the number of statistical points is in the interval [1, 3], keep the size of the preselected window unchanged and use it as the filtering window corresponding to the central pixel. If the number of statistical points is in the interval [4, 6], expand the preselected window to a 5×5 pixel range window with the central pixel unchanged and use it as the filtering window corresponding to the central pixel. If the number of statistical points is in the interval [7, 9], expand the preselected window to a 7×7 pixel range window with the central pixel unchanged and use it as the filtering window corresponding to the central pixel.
[0023] Based on the grayscale value of each pixel in the filter window, the weight coefficient of each pixel in the filter window is calculated using the set weight coefficient formula. The weight coefficient formula is: , where S represents the weight coefficient, A represents the grayscale value of the corresponding pixel in the filter window, and B represents the grayscale reference value, which is set to the grayscale value of the center pixel of the filter window;
[0024] The center pixel of the filter window is subjected to weighted median filtering according to the grayscale value and weight coefficient of each pixel in the filter window.
[0025] In a possible design, the grayscale threshold value based on the grayscale threshold interval and the grayscale value of each pixel in the filtered rail surface grayscale image is determined by using the maximum inter-class variance method, including:
[0026] Traverse all grayscale thresholds within the grayscale threshold interval, and use each grayscale threshold to distinguish each pixel in the filtered rail surface grayscale image, and regard the pixel whose grayscale value exceeds the corresponding grayscale threshold as a type pixel, and the pixel whose grayscale value does not exceed the corresponding grayscale threshold as a type pixel;
[0027] Determine the number of class a pixels p1, the number of class b pixels p2, the grayscale mean m1 of all class a pixels, and the grayscale mean m2 of all class b pixels under the corresponding grayscale threshold condition;
[0028] Substitute the number of class a pixels p1, the number of class b pixels p2, the grayscale mean m1 of all class a pixels, and the grayscale mean m2 of all class b pixels under the corresponding grayscale threshold into the inter-class variance formula for calculation to obtain the inter-class variance corresponding to the grayscale threshold. The inter-class variance formula is σ= , where σ represents the between-class variance;
[0029] The grayscale threshold with the largest inter-class variance is taken as the target grayscale threshold.
[0030] In a possible design, the method of binarizing the filtered rail surface grayscale image using a target grayscale threshold to obtain a rail surface binary image, and extracting a rail surface image region from the rail surface binary image includes:
[0031] In the filtered rail surface grayscale image, the grayscale values of the pixels whose grayscale values are greater than or equal to the target grayscale threshold are changed to 0, and the grayscale values of the pixels whose grayscale values are less than the target grayscale threshold are changed to 255, so as to obtain a rail surface binary image;
[0032] Scan all pixels in the rail surface binary image column by column to determine the number of pixels Q1 with a gray value of 0 and the number of pixels Q2 with a gray value of 255 in each column;
[0033] The pixel columns whose Q2 is greater than the set first quantity threshold are regarded as white columns, and the pixel columns whose Q1 is greater than the set second quantity threshold are regarded as black columns;
[0034] When there are two white columns in the rail surface binary image and the area between the two white columns is entirely black, the black column area between the two white columns is taken as the rail surface image area;
[0035] Extract the rail surface image area from the rail surface binary image.
[0036] In a possible design, the method of performing mathematical morphological filtering on the rail surface image region to obtain an enhanced rail surface image region, and performing edge detection on the enhanced rail surface image region to extract edge lines of the enhanced rail surface image region includes:
[0037] Performing opening and closing operations on the rail surface image region to obtain an enhanced rail surface image region;
[0038] The Sobel operator is used to perform edge detection on the enhanced rail surface image area and extract the edge lines of the enhanced rail surface image area.
[0039] In one possible design, calculating the first distance parameter according to the first distances corresponding to the three first pre-selected points includes:
[0040] Substitute the first distances corresponding to the three first preselected points into the preset first distance parameter formula for calculation to obtain the corresponding first distance parameter. The first distance parameter formula is:
[0041]
[0042] Wherein, D is the first distance parameter, d1, d2 and d3 are the first distances corresponding to the three first pre-selected points respectively, and β is the set distance coefficient.
[0043] In one possible design, when it is determined that there are not three consecutive first pre-selected points, the method further includes:
[0044] Divide the first image spacing by the set reduction factor to obtain the second image spacing;
[0045] Selecting a number of second reference points at equal intervals on the corresponding edge line according to the second image spacing, determining the image coordinates corresponding to each second reference point, and fitting the second reference straight line using the least squares method according to the image coordinates of each second reference point to determine the image coordinate information of the second reference straight line;
[0046] Calculate the second distance from each second reference point to the second reference line, and mark the second distance corresponding to each second reference point on one side of the second reference line as positive, and mark the second distance corresponding to each second reference point on the other side of the second reference line as negative;
[0047] When it is determined that there are three consecutive second reference points, such that the second distance corresponding to the middle second reference point is positive and the second distances corresponding to the second reference points on both sides are negative, or the second distance corresponding to the middle second reference point is negative and the second distances corresponding to the second reference points on both sides are positive, the three consecutive second reference points are all used as second pre-selected points;
[0048] Calculating a second distance parameter according to the second distances corresponding to the three second pre-selected points, and when the second distance parameter exceeds a set distance parameter threshold, using the three second pre-selected points as second deformation points;
[0049] The second deformation triangle is constructed using the three second deformation points, and the enhanced track surface image area is marked with the second deformation triangle before output.
[0050] In a second aspect, a traffic track deformation detection system is provided, including an image acquisition unit, an image filtering unit, an extreme value determination unit, a threshold determination unit, a binary segmentation unit, an edge detection unit, an image calibration unit, a distance determination unit, a point preselection unit, a parameter calculation unit and a deformation annotation unit, wherein:
[0051] An image acquisition unit is used to acquire a track surface monitoring image of the traffic track in the target track segment along the track direction, and perform grayscale processing on the track surface monitoring image to obtain a track surface grayscale image;
[0052] An image filtering unit is used to perform adaptive weighted median filtering on the rail surface grayscale image to obtain a filtered rail surface grayscale image;
[0053] An extreme value determination unit is used to determine a first grayscale mean value of all pixel points in the filtered rail surface grayscale image, and to use pixel points whose grayscale values are greater than the first grayscale mean value as segmentation pixel points, and to determine a second grayscale mean value of all segmentation pixel points;
[0054] A threshold determination unit, configured to form a grayscale threshold interval using the first grayscale mean and the second grayscale mean, and determine a target grayscale threshold using a maximum inter-class variance method based on the grayscale threshold interval and the grayscale value of each pixel in the filtered rail surface grayscale image;
[0055] A binary segmentation unit is used to perform a binary process on the filtered rail surface grayscale image using a target grayscale threshold to obtain a rail surface binary image, and to extract a rail surface image region from the rail surface binary image;
[0056] An edge detection unit is used to perform mathematical morphological filtering on the rail surface image area to obtain an enhanced rail surface image area, and perform edge detection on the enhanced rail surface image area to extract each edge line of the enhanced rail surface image area;
[0057] An image calibration unit, configured to select a plurality of first reference points at equal intervals on a corresponding edge line according to a set first image spacing, determine image coordinates corresponding to each first reference point, and fit a first reference straight line using a least square method according to the image coordinates of each first reference point to determine image coordinate information of the first reference straight line;
[0058] a distance determination unit, configured to calculate a first distance from each first reference point to the first reference line, and mark the first distances corresponding to each first reference point on one side of the first reference line as positive, and mark the first distances corresponding to each first reference point on the other side of the first reference line as negative;
[0059] A point preselection unit, for, when it is determined that there are three consecutive first reference points, the first distance corresponding to the middle first reference point is positive, and the first distances corresponding to the first reference points on both sides are negative, or the first distance corresponding to the middle first reference point is negative, and the first distances corresponding to the first reference points on both sides are positive, taking the three consecutive first reference points as first preselected points;
[0060] A parameter calculation unit, used to calculate a first distance parameter according to the first distances corresponding to the three first pre-selected points, and when the first distance parameter exceeds a set distance parameter threshold, use the three first pre-selected points as first deformation points;
[0061] The deformation annotation unit is used to construct a first deformation triangle area by using three first deformation points, and output the enhanced rail surface image area after annotating the first deformation triangle area.
[0062] In a third aspect, a traffic track deformation detection device is provided, comprising:
[0063] A memory for storing instructions;
[0064] A processor is used to read the instructions stored in the memory and execute any one of the methods described in the first aspect according to the instructions.
[0065] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored on the computer-readable storage medium, and when the instructions are executed on a computer, the computer executes any one of the methods described in the first aspect. In addition, a computer program product is provided, and when the computer program product is executed on a computer, the computer executes any one of the methods described in the first aspect.
[0066] Beneficial effects: The present invention acquires track monitoring images and performs corresponding grayscale processing, adaptive weighted median filtering processing and threshold segmentation processing to obtain a track surface binary image, and extracts the track surface image area, then performs morphological filtering and edge detection on the track surface image area, extracts edge lines, selects reference points based on edge lines, fits reference lines, calculates the distance from reference points to reference lines, and performs positive and negative markings, and then based on the distances and marks corresponding to each reference point, determines that there is a deformed triangle area, and then marks the deformed triangle area on the corresponding track surface image area for output, so that operation and maintenance personnel can intuitively grasp the deformation detection results of the track. The present invention can realize intelligent deformation detection of transportation tracks through machine vision detection technology, quickly and accurately detect the deformation of corresponding parts on transportation tracks, improve the efficiency of transportation track deformation detection, and ensure the smoothness and safety of rail transportation. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0068] Figure 1 This is a schematic diagram of the steps of the method in Example 1 of the present invention;
[0069] Figure 2 This is a schematic diagram of the structure of the system in Example 2 of the present invention;
[0070] Figure 3 This is a schematic diagram of the structure of the device in Example 3 of the present invention. DETAILED DESCRIPTION
[0071] It should be noted that the description of these embodiments is intended to help understand the present invention, but does not constitute a limitation of the present invention. The specific structures and functional details disclosed herein are only intended to describe exemplary embodiments of the present invention. However, the present invention can be embodied in a number of alternative forms, and should not be construed as being limited to the embodiments set forth herein.
[0072] It should be understood that, unless otherwise clearly specified and limited, the term "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the embodiments can be understood according to specific circumstances.
[0073] In the following description, certain details are provided to facilitate a complete understanding of the example embodiments. However, it will be appreciated by those of ordinary skill in the art that the example embodiments may be implemented without these certain details. For example, devices may be shown in block diagrams to avoid obscuring the examples with unnecessary details. In other embodiments, well-known processes, structures, and techniques may not be shown in unnecessary detail to avoid obscuring the embodiments.
[0074] Embodiment 1:
[0075] This embodiment provides a method for detecting deformation of a traffic track. Figure 1 As shown, the method comprises the following steps:
[0076] S1. Collecting a track surface monitoring image of the traffic track in the target track segment along the track direction, and performing grayscale processing on the track surface monitoring image to obtain a track surface grayscale image.
[0077] In specific implementation, corresponding image acquisition equipment, such as CCD cameras, etc., can be installed on the track inspection vehicle. When the track inspection vehicle inspects the traffic track along the track direction, the image acquisition equipment is used to collect the track surface monitoring image of the traffic track in the corresponding segment. The track surface monitoring image can be an image of the top surface of the track or an image of the side surface of the track, so as to ensure that in the track surface monitoring image, the track surface area is vertically through the entire track surface monitoring image. Then the image acquisition device transmits the track surface monitoring image of the traffic track in the target track segment to the image processing device, and the image processing device receives the track surface monitoring image of the target track segment and performs subsequent image analysis and processing. After the track surface monitoring image is collected, the weighted average method can be used to grayscale the track surface monitoring image to obtain a track surface grayscale image. For example, the RGB three-color channel brightness value of each pixel point of the track surface monitoring image is substituted into the weighted average formula gray=0.3×R+0.59×G+0.11×B for calculation to obtain the grayscale value gray of each pixel point, and the track surface grayscale image is obtained based on the grayscale value gray of each pixel point.
[0078] S2. Perform adaptive weighted median filtering on the rail surface grayscale image to obtain a filtered rail surface grayscale image.
[0079] In specific implementation, a pre-selected window with a range of 3×3 pixels can be selected with each pixel in the grayscale image of the rail surface as the center, and the grayscale value of each pixel in the pre-selected window and the average grayscale value of all pixels in the pre-selected window can be determined. The standard deviation of the grayscale values of all pixels in the pre-selected window is calculated based on the grayscale value of each pixel in the pre-selected window and the average grayscale value of all pixels in the pre-selected window, and the standard deviation of the grayscale value is used as the detection threshold.
[0080] Then calculate the absolute value of the grayscale difference between the grayscale value of each pixel in the pre-selected window and the average grayscale value, and mark the pixel whose absolute value of the grayscale difference is greater than the detection threshold as a statistical point, otherwise it is marked as a non-statistical point. Determine the number of statistical points in the pre-selected window. If the number of statistical points is in the interval [1, 3], keep the size of the pre-selected window unchanged and use it as the filtering window corresponding to the central pixel. If the number of statistical points is in the interval [4, 6], expand the pre-selected window to a 5×5 pixel range window with an unchanged central pixel, and use it as the filtering window corresponding to the central pixel. If the number of statistical points is in the interval [7, 9], expand the pre-selected window to a 7×7 pixel range window with an unchanged central pixel, and use it as the filtering window corresponding to the central pixel.
[0081] Then, based on the grayscale value of each pixel in the filter window, the weight coefficient of each pixel in the filter window is calculated using the set weight coefficient formula, and the weight coefficient formula is: , where S represents the weight coefficient, A represents the grayscale value of the corresponding pixel in the filter window, and B represents the grayscale reference value, which is set to the grayscale value of the center pixel of the filter window;
[0082] Finally, a weighted median filter is performed on the central pixel of the filter window according to the grayscale value and weight coefficient of each pixel in the filter window to obtain the grayscale value of the central pixel after filtering. Based on the grayscale value of each pixel after filtering in the track surface grayscale image, the filtered track surface grayscale image is obtained.
[0083] S3. Determine the first grayscale mean of all pixels in the filtered rail surface grayscale image, and use the pixels whose grayscale values are greater than the first grayscale mean as segmentation pixels, and determine the second grayscale mean of all segmentation pixels.
[0084] In specific implementation, the grayscale values of all pixels in the filtered rail surface grayscale image can be used to calculate the mean value to obtain the first grayscale mean value of all pixels in the filtered rail surface grayscale image, and then the pixels with grayscale values greater than the first grayscale mean value are used as segmentation pixels, and then the grayscale values of all segmentation pixels are used to calculate the mean value to obtain the second grayscale mean value. The grayscale threshold interval composed of the first grayscale mean value and the second grayscale mean value can effectively remove a large amount of overly dark and overly bright background in the filtered rail surface grayscale image, which is convenient for the subsequent determination of the segmentation threshold value for more accurate rail surface area segmentation.
[0085] S4. The first grayscale mean and the second grayscale mean are used to form a grayscale threshold interval, and the target grayscale threshold is determined by using the maximum between-class variance method based on the grayscale threshold interval and the grayscale value of each pixel in the filtered rail surface grayscale image.
[0086] In specific implementation, the grayscale threshold interval can be composed of the first grayscale mean and the second grayscale mean, and then all grayscale thresholds within the grayscale threshold interval are traversed, and each grayscale threshold is used to distinguish each pixel in the filtered track surface grayscale image, and the pixel points whose grayscale values exceed the corresponding grayscale threshold are regarded as class a pixels, and the pixel points whose grayscale values do not exceed the corresponding grayscale threshold are regarded as class b pixels. Then determine the number of class a pixels p1, the number of class b pixels p2, the grayscale mean m1 of all class a pixels, and the grayscale mean m2 of all class b pixels under the corresponding grayscale threshold conditions. Then substitute the number of class a pixels p1, the number of class b pixels p2, the grayscale mean m1 of all class a pixels, and the grayscale mean m2 of all class b pixels under the corresponding grayscale threshold conditions into the inter-class variance formula for calculation to obtain the inter-class variance of the corresponding grayscale threshold. The inter-class variance formula is σ= , where σ represents the inter-class variance. Finally, the grayscale threshold with the largest inter-class variance is taken as the target grayscale threshold.
[0087] S5. Binarize the filtered rail surface grayscale image using the target grayscale threshold to obtain a rail surface binary image, and extract the rail surface image area from the rail surface binary image.
[0088] In specific implementation, the grayscale values of the pixels whose grayscale values are greater than or equal to the target grayscale threshold in the filtered track surface grayscale image can be changed to 0, that is, black, and the grayscale values of the pixels whose grayscale values are less than the target grayscale threshold can be changed to 255, that is, white, to obtain a track surface binary image. In the track surface binary image, the grayscale value of the pixels in the track surface area is 0, that is, black, and there are two obvious white stripes at the boundaries on both sides of the track surface area, that is, the area where most of the pixel grayscale values are 255, and outside the two white stripes is the background area. The white pixels and black pixels in the background area are randomly and randomly distributed. Therefore, the track surface image area can be extracted from the track surface binary image according to the regular distribution characteristics of the track surface area and the white stripes at the boundaries on both sides. The process includes:
[0089] All pixels in the track surface binary image are scanned column by column to determine the number of pixels L1 with a grayscale value of 0 and the number L2 with a grayscale value of 255 in each column. Since the track surface monitoring image is an image of the track top or track side collected along the track direction, the track surface area in the processed track surface binary image runs through the entire image vertically. Therefore, it is necessary to scan the pixel array in the track surface binary image column by column in order to subsequently find the white strip area at the boundary on both sides of the track surface area.
[0090] Then, the pixel column whose L2 is greater than the set first quantity threshold is regarded as the white column, and the pixel column whose L1 is greater than the set second quantity threshold is regarded as the black column. The number of white pixels in the white column accounts for the vast majority or even all of them, and visually appears to be completely white, that is, the white stripe area. On the contrary, the number of black pixels in the black column accounts for the vast majority or even all of them, and visually appears to be completely black, that is, the track surface area. When there are two white columns spaced apart in the track surface binary image and the area between the two white columns is entirely black, the two white columns spaced apart are the boundary on both sides of the black area of the track surface, and the black column area between the two white columns spaced apart is regarded as the track surface image area. Finally, the track surface image area is extracted from the track surface binary image.
[0091] S6. Perform mathematical morphological filtering on the rail surface image region to obtain an enhanced rail surface image region, and perform edge detection on the enhanced rail surface image region to extract edge lines of the enhanced rail surface image region.
[0092] In specific implementation, the rail surface image area can be opened and closed to obtain an enhanced rail surface image area. The opening operation is to first perform an erosion process and then perform an expansion process, and the closing operation is to first perform an expansion process and then perform an erosion process. The opening and closing operations can effectively remove noise points in the rail surface image area, enhance image details, and make the contour of the rail surface image area smoother. Then, the Sobel operator can be used to perform edge detection on the enhanced rail surface image area to extract the edge lines of the enhanced rail surface image area. Using the Sobel operator for edge detection can reduce the blur of the edge and achieve a better edge extraction effect.
[0093] S7. Select a number of first reference points at equal intervals on the corresponding edge line according to the set first image spacing, determine the image coordinates corresponding to each first reference point, and use the least squares method to fit the first reference straight line according to the image coordinates of each first reference point to determine the image coordinate information of the first reference straight line.
[0094] In a specific implementation, a number of first reference points can be selected in an evenly spaced order on the corresponding edge line according to the set first image spacing, the image coordinates corresponding to each first reference point can be determined, and the first reference straight line can be fitted based on the image coordinates corresponding to each first reference point. When fitting the first reference straight line, the least squares method can be used to perform straight line fitting to obtain the image coordinate information of the first reference straight line.
[0095] S8. Calculate the first distance from each first reference point to the first reference line, and mark the first distances corresponding to each first reference point on one side of the first reference line as positive, and mark the first distances corresponding to each first reference point on the other side of the first reference line as negative.
[0096] In specific implementation, after fitting the first reference straight line, the first distance from each first reference point to the first reference straight line can be calculated based on the image coordinates corresponding to each first reference point and the image coordinate information of the first reference straight line, and then the first distances corresponding to each first reference point on one side of the first reference straight line are marked as positive, and the first distances corresponding to each first reference point on the other side of the first reference straight line are marked as negative.
[0097] S9. When it is determined that there are three consecutive first reference points, and the first distance corresponding to the middle first reference point is positive, and the first distances corresponding to the first reference points on both sides are negative, or the first distance corresponding to the middle first reference point is negative, and the first distances corresponding to the first reference points on both sides are positive, the three consecutive first reference points are all used as first pre-selected points.
[0098] In specific implementation, when it is determined that there are three consecutive first reference points, the first distance corresponding to the middle first reference point is positive, and the first distance corresponding to the first reference points on both sides is negative, or the first distance corresponding to the middle first reference point is negative, and the first distance corresponding to the first reference points on both sides is positive, it indicates that there are change features in the edge line. At this time, the three consecutive first reference points can all be used as first pre-selected points for subsequent change feature judgment.
[0099] S10. Calculate a first distance parameter according to the first distances corresponding to the three first pre-selected points, and when the first distance parameter exceeds a set distance parameter threshold, use the three first pre-selected points as first deformation points.
[0100] In specific implementation, the first distances corresponding to the three first pre-selected points can be substituted into a preset first distance parameter formula for calculation to obtain the corresponding first distance parameter. The first distance parameter formula is:
[0101]
[0102] Wherein, D is the first distance parameter, d1, d2 and d3 are the first distances corresponding to the three first pre-selected points, and β is the set distance coefficient. When the calculated first distance parameter exceeds the set distance parameter threshold, it indicates that the change characteristics of the edge line are more obvious and have reached the deformation judgment standard. At this time, the three first pre-selected points are all used as the first deformation points.
[0103] S11. construct a first deformation triangle using three first deformation points, and output the enhanced rail surface image area after marking the first deformation triangle.
[0104] In specific implementation, the three first deformation points can be used to construct the first deformation triangle, and then the first deformation triangle can be marked on the enhanced track surface image area for output display, so that the operation and maintenance personnel can intuitively see the first deformation triangle on the enhanced track surface image area, and then determine whether the target track segment is deformed, resulting in uneven track height or track direction, and then carry out targeted processing.
[0105] Furthermore, if it is determined in step S9 that there are no three consecutive first pre-selected points, the following processing steps may be performed:
[0106] The first image spacing is divided by the set reduction factor to obtain the second image spacing, and by reducing the image spacing, a subsequent more detailed edge line change feature detection is achieved;
[0107] Selecting a number of second reference points at equal intervals on the corresponding edge line according to the second image spacing, determining the image coordinates corresponding to each second reference point, and fitting the second reference straight line using the least squares method according to the image coordinates of each second reference point to determine the image coordinate information of the second reference straight line;
[0108] Calculate the second distance from each second reference point to the second reference line, and mark the second distance corresponding to each second reference point on one side of the second reference line as positive, and mark the second distance corresponding to each second reference point on the other side of the second reference line as negative;
[0109] When it is determined that there are three consecutive second reference points, such that the second distance corresponding to the middle second reference point is positive and the second distances corresponding to the second reference points on both sides are negative, or the second distance corresponding to the middle second reference point is negative and the second distances corresponding to the second reference points on both sides are positive, the three consecutive second reference points are all used as second pre-selected points;
[0110] Calculating a second distance parameter according to the second distances corresponding to the three second pre-selected points, and when the second distance parameter exceeds a set distance parameter threshold, using the three second pre-selected points as second deformation points;
[0111] The second deformation triangle is constructed using the three second deformation points, and the enhanced track surface image area is marked with the second deformation triangle before output.
[0112] The method of this embodiment can realize intelligent deformation detection of traffic tracks through machine vision detection technology, quickly and accurately detect the deformation of corresponding parts on the traffic track, improve the efficiency of traffic track deformation detection, and ensure the smoothness and safety of rail transportation.
[0113] Embodiment 2:
[0114] This embodiment provides a traffic track deformation detection system. Figure 2 As shown, it includes an image acquisition unit, an image filtering unit, an extreme value determination unit, a threshold determination unit, a binary segmentation unit, an edge detection unit, an image calibration unit, a distance determination unit, a point preselection unit, a parameter calculation unit and a deformation annotation unit, wherein:
[0115] An image acquisition unit is used to acquire a track surface monitoring image of the traffic track in the target track segment along the track direction, and perform grayscale processing on the track surface monitoring image to obtain a track surface grayscale image;
[0116] An image filtering unit is used to perform adaptive weighted median filtering on the rail surface grayscale image to obtain a filtered rail surface grayscale image;
[0117] An extreme value determination unit is used to determine a first grayscale mean value of all pixel points in the filtered rail surface grayscale image, and to use pixel points whose grayscale values are greater than the first grayscale mean value as segmentation pixel points, and to determine a second grayscale mean value of all segmentation pixel points;
[0118] A threshold determination unit, configured to form a grayscale threshold interval using the first grayscale mean and the second grayscale mean, and determine a target grayscale threshold using a maximum inter-class variance method based on the grayscale threshold interval and the grayscale value of each pixel in the filtered rail surface grayscale image;
[0119] A binary segmentation unit is used to perform a binary process on the filtered rail surface grayscale image using a target grayscale threshold to obtain a rail surface binary image, and to extract a rail surface image region from the rail surface binary image;
[0120] An edge detection unit is used to perform mathematical morphological filtering on the rail surface image area to obtain an enhanced rail surface image area, and perform edge detection on the enhanced rail surface image area to extract each edge line of the enhanced rail surface image area;
[0121] An image calibration unit is used to select a number of first reference points in an evenly spaced order on a corresponding edge line according to a set first image spacing, determine the image coordinates corresponding to each first reference point, and fit a first reference line using a least square method according to the image coordinates of each first reference point to determine the image coordinate information of the first reference line; and divide the first image spacing by a set reduction factor to obtain a second image spacing, select a number of second reference points in an evenly spaced order on a corresponding edge line according to the second image spacing, determine the image coordinates corresponding to each second reference point, and fit a second reference line using a least square method according to the image coordinates of each second reference point to determine the image coordinate information of the second reference line;
[0122] a distance determination unit, configured to calculate a first distance from each first reference point to a first reference line, and mark the first distances corresponding to each first reference point on one side of the first reference line as positive, and mark the first distances corresponding to each first reference point on the other side of the first reference line as negative; and calculate a second distance from each second reference point to a second reference line, and mark the second distances corresponding to each second reference point on one side of the second reference line as positive, and mark the second distances corresponding to each second reference point on the other side of the second reference line as negative;
[0123] A point preselection unit is used to, when it is determined that there are three consecutive first reference points, the first distance corresponding to the middle first reference point is positive, and the first distances corresponding to the first reference points on both sides are negative, or the first distance corresponding to the middle first reference point is negative, and the first distances corresponding to the first reference points on both sides are positive, use the three consecutive first reference points as first preselected points; and when it is determined that there are three consecutive second reference points, the second distance corresponding to the middle second reference point is positive, and the second distances corresponding to the second reference points on both sides are negative, or the second distance corresponding to the middle second reference point is negative, and the second distances corresponding to the second reference points on both sides are positive, use the three consecutive second reference points as second preselected points;
[0124] A parameter calculation unit, configured to calculate a first distance parameter according to first distances corresponding to the three first preselected points, and when the first distance parameter exceeds a set distance parameter threshold, use the three first preselected points as first deformation points; and calculate a second distance parameter according to second distances corresponding to the three second preselected points, and when the second distance parameter exceeds a set distance parameter threshold, use the three second preselected points as second deformation points;
[0125] The deformation annotation unit is used to construct a first deformation triangle using three first deformation points, and output the enhanced track surface image area after annotating the first deformation triangle; and construct a second deformation triangle using three second deformation points, and output the enhanced track surface image area after annotating the second deformation triangle.
[0126] Embodiment 3:
[0127] This embodiment provides a traffic track deformation detection device, such as Figure 3 As shown, at the hardware level, it includes:
[0128] Data interface, used to establish data connection between the processor and the image acquisition device;
[0129] A memory for storing instructions;
[0130] The processor is used to read the instructions stored in the memory and execute the traffic track deformation detection method in Example 1 according to the instructions.
[0131] Optionally, the device further includes an internal bus, through which the processor, the memory and the data interface can be interconnected, and the internal bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0132] The memory may include, but is not limited to, random access memory (RAM), read only memory (ROM), flash memory, first input first output (FIFO) and / or first in last out (FILO), etc. The processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0133] Embodiment 4:
[0134] This embodiment provides a computer-readable storage medium, on which instructions are stored. When the instructions are executed on a computer, the computer executes the traffic track deformation detection method in Embodiment 1. The computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive, and / or a memory stick, etc. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0135] This embodiment further provides a computer program product, which, when executed on a computer, executes the traffic track deformation detection method in Embodiment 1. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0136] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for detecting deformation of a traffic track, characterized in that: include: Collecting the track surface monitoring image of the traffic track in the target track segment along the track direction, and performing grayscale processing on the track surface monitoring image to obtain a track surface grayscale image; Performing adaptive weighted median filtering on the rail surface grayscale image to obtain a filtered rail surface grayscale image; Determine the first grayscale mean of all pixels in the filtered rail surface grayscale image, take the pixels whose grayscale values are greater than the first grayscale mean as segmentation pixels, and determine the second grayscale mean of all segmentation pixels; The first grayscale mean and the second grayscale mean are used to form a grayscale threshold interval, and the target grayscale threshold is determined by using the maximum inter-class variance method based on the grayscale threshold interval and the grayscale value of each pixel in the filtered rail surface grayscale image; The filtered rail surface grayscale image is binarized using the target grayscale threshold to obtain a rail surface binary image, and the rail surface image area is extracted from the rail surface binary image; Performing mathematical morphological filtering on the rail surface image region to obtain an enhanced rail surface image region, and performing edge detection on the enhanced rail surface image region to extract edge lines of the enhanced rail surface image region; Selecting a number of first reference points at equal intervals on the corresponding edge line according to the set first image spacing, determining the image coordinates corresponding to each first reference point, and fitting the first reference straight line using the least squares method according to the image coordinates of each first reference point to determine the image coordinate information of the first reference straight line; Calculate the first distance from each first reference point to the first reference line, and mark the first distances corresponding to each first reference point on one side of the first reference line as positive, and mark the first distances corresponding to each first reference point on the other side of the first reference line as negative; When it is determined that there are three consecutive first reference points, such that the first distance corresponding to the middle first reference point is positive and the first distances corresponding to the first reference points on both sides are negative, or the first distance corresponding to the middle first reference point is negative and the first distances corresponding to the first reference points on both sides are positive, the three consecutive first reference points are all used as first pre-selected points; Calculating a first distance parameter according to the first distances corresponding to the three first pre-selected points, and when the first distance parameter exceeds a set distance parameter threshold, using the three first pre-selected points as first deformation points; The first deformation triangle is constructed using the three first deformation points, and the enhanced rail surface image area is marked with the first deformation triangle before output.
2. A traffic track deformation detection method according to claim 1, characterized in that: The step of performing adaptive weighted median filtering on the rail surface grayscale image comprises: A preselected window with a range of 3×3 pixels is selected with each pixel in the rail surface grayscale image as the center, and the grayscale value of each pixel in the preselected window and the average grayscale value of all pixels in the preselected window are determined; The grayscale value standard deviation of all pixels in the pre-selected window is calculated based on the grayscale value of each pixel in the pre-selected window and the average grayscale value of all pixels in the pre-selected window, and the grayscale value standard deviation is used as the detection threshold; Calculate the absolute value of the grayscale difference between the grayscale value of each pixel in the pre-selected window and the average grayscale value, and mark the pixel whose absolute value of the grayscale difference is greater than the detection threshold as a statistical point, otherwise mark it as a non-statistical point; Determine the number of statistical points in the preselected window. If the number of statistical points is in the interval [1, 3], keep the size of the preselected window unchanged and use it as the filtering window corresponding to the central pixel. If the number of statistical points is in the interval [4, 6], expand the preselected window to a 5×5 pixel range window with the central pixel unchanged and use it as the filtering window corresponding to the central pixel. If the number of statistical points is in the interval [7, 9], expand the preselected window to a 7×7 pixel range window with the central pixel unchanged and use it as the filtering window corresponding to the central pixel. Based on the grayscale value of each pixel in the filter window, the weight coefficient of each pixel in the filter window is calculated using the set weight coefficient formula. The weight coefficient formula is: , where S represents the weight coefficient, A represents the grayscale value of the corresponding pixel in the filter window, and B represents the grayscale reference value, which is set to the grayscale value of the center pixel of the filter window; The center pixel of the filter window is subjected to weighted median filtering according to the grayscale value and weight coefficient of each pixel in the filter window.
3. A traffic track deformation detection method according to claim 1, characterized in that: The method of determining the target grayscale threshold value based on the grayscale threshold interval and the grayscale value of each pixel in the filtered rail surface grayscale image by using the maximum inter-class variance method includes: Traverse all grayscale thresholds within the grayscale threshold interval, and use each grayscale threshold to distinguish each pixel in the filtered rail surface grayscale image, and regard the pixel whose grayscale value exceeds the corresponding grayscale threshold as a type pixel, and the pixel whose grayscale value does not exceed the corresponding grayscale threshold as a type pixel; Determine the number of class a pixels p1, the number of class b pixels p2, the grayscale mean m1 of all class a pixels, and the grayscale mean m2 of all class b pixels under the corresponding grayscale threshold condition; Substitute the number of class a pixels p1, the number of class b pixels p2, the grayscale mean m1 of all class a pixels, and the grayscale mean m2 of all class b pixels under the corresponding grayscale threshold into the inter-class variance formula for calculation to obtain the inter-class variance corresponding to the grayscale threshold. The inter-class variance formula is σ= , where σ represents the between-class variance; The grayscale threshold with the largest inter-class variance is taken as the target grayscale threshold.
4. A traffic track deformation detection method according to claim 1, characterized in that: The method of binarizing the filtered rail surface grayscale image by using the target grayscale threshold to obtain a rail surface binary image, and extracting the rail surface image area from the rail surface binary image includes: In the filtered rail surface grayscale image, the grayscale values of the pixels whose grayscale values are greater than or equal to the target grayscale threshold are changed to 0, and the grayscale values of the pixels whose grayscale values are less than the target grayscale threshold are changed to 255, so as to obtain a rail surface binary image; Scan all pixels in the rail surface binary image column by column to determine the number of pixels L1 with a gray value of 0 and the number of pixels L2 with a gray value of 255 in each column; The pixel columns whose L2 is greater than a first threshold are regarded as white columns, and the pixel columns whose L1 is greater than a second threshold are regarded as black columns; When there are two white columns in the rail surface binary image and the area between the two white columns is entirely black, the black column area between the two white columns is taken as the rail surface image area; Extract the rail surface image area from the rail surface binary image.
5. A traffic track deformation detection method according to claim 1, characterized in that: The method of performing mathematical morphological filtering on the rail surface image region to obtain an enhanced rail surface image region, and performing edge detection on the enhanced rail surface image region to extract edge lines of the enhanced rail surface image region includes: Performing opening and closing operations on the rail surface image region to obtain an enhanced rail surface image region; The Sobel operator is used to perform edge detection on the enhanced rail surface image area and extract the edge lines of the enhanced rail surface image area.
6. A traffic track deformation detection method according to claim 1, characterized in that: The calculating the first distance parameter according to the first distances corresponding to the three first pre-selected points includes: Substitute the first distances corresponding to the three first preselected points into the preset first distance parameter formula for calculation to obtain the corresponding first distance parameter. The first distance parameter formula is: Wherein, D is the first distance parameter, d1, d2 and d3 are the first distances corresponding to the three first pre-selected points respectively, and β is the set distance coefficient.
7. A traffic track deformation detection method according to claim 1, characterized in that: When it is determined that there are no three consecutive first pre-selected points, the method further includes: Divide the first image spacing by the set reduction factor to obtain the second image spacing; Selecting a number of second reference points at equal intervals on the corresponding edge line according to the second image spacing, determining the image coordinates corresponding to each second reference point, and fitting the second reference straight line using the least squares method according to the image coordinates of each second reference point to determine the image coordinate information of the second reference straight line; Calculate the second distance from each second reference point to the second reference line, and mark the second distance corresponding to each second reference point on one side of the second reference line as positive, and mark the second distance corresponding to each second reference point on the other side of the second reference line as negative; When it is determined that there are three consecutive second reference points, such that the second distance corresponding to the middle second reference point is positive and the second distances corresponding to the second reference points on both sides are negative, or the second distance corresponding to the middle second reference point is negative and the second distances corresponding to the second reference points on both sides are positive, the three consecutive second reference points are all used as second pre-selected points; Calculating a second distance parameter according to the second distances corresponding to the three second pre-selected points, and when the second distance parameter exceeds a set distance parameter threshold, using the three second pre-selected points as second deformation points; The second deformation triangle is constructed using the three second deformation points, and the enhanced track surface image area is marked with the second deformation triangle before output.
8. A traffic track deformation detection system, characterized in that: It includes an image acquisition unit, an image filtering unit, an extreme value determination unit, a threshold determination unit, a binary segmentation unit, an edge detection unit, an image calibration unit, a distance determination unit, a point preselection unit, a parameter calculation unit and a deformation annotation unit, wherein: An image acquisition unit is used to acquire a track surface monitoring image of the traffic track in the target track segment along the track direction, and perform grayscale processing on the track surface monitoring image to obtain a track surface grayscale image; An image filtering unit is used to perform adaptive weighted median filtering on the rail surface grayscale image to obtain a filtered rail surface grayscale image; An extreme value determination unit is used to determine a first grayscale mean value of all pixel points in the filtered rail surface grayscale image, and to use pixel points whose grayscale values are greater than the first grayscale mean value as segmentation pixel points, and to determine a second grayscale mean value of all segmentation pixel points; A threshold determination unit, configured to form a grayscale threshold interval using the first grayscale mean and the second grayscale mean, and determine a target grayscale threshold using a maximum inter-class variance method based on the grayscale threshold interval and the grayscale value of each pixel in the filtered rail surface grayscale image; A binary segmentation unit is used to perform a binary process on the filtered rail surface grayscale image using a target grayscale threshold to obtain a rail surface binary image, and to extract a rail surface image region from the rail surface binary image; An edge detection unit is used to perform mathematical morphological filtering on the rail surface image area to obtain an enhanced rail surface image area, and perform edge detection on the enhanced rail surface image area to extract each edge line of the enhanced rail surface image area; An image calibration unit is used to select a number of first reference points at equal intervals on the corresponding edge line according to a set first image spacing, determine the image coordinates corresponding to each first reference point, and fit the first reference straight line using the least squares method according to the image coordinates of each first reference point to determine the image coordinate information of the first reference straight line; a distance determination unit, configured to calculate a first distance from each first reference point to the first reference line, and mark the first distances corresponding to each first reference point on one side of the first reference line as positive, and mark the first distances corresponding to each first reference point on the other side of the first reference line as negative; A point preselection unit, for, when it is determined that there are three consecutive first reference points, the first distance corresponding to the middle first reference point is positive, and the first distances corresponding to the first reference points on both sides are negative, or the first distance corresponding to the middle first reference point is negative, and the first distances corresponding to the first reference points on both sides are positive, taking the three consecutive first reference points as first preselected points; A parameter calculation unit, used to calculate a first distance parameter according to the first distances corresponding to the three first pre-selected points, and when the first distance parameter exceeds a set distance parameter threshold, use the three first pre-selected points as first deformation points; The deformation annotation unit is used to construct a first deformation triangle area by using three first deformation points, and output the enhanced rail surface image area after annotating the first deformation triangle area.
9. A traffic track deformation detection device, characterized in that: include: A memory for storing instructions; A processor is used to read the instructions stored in the memory and execute the traffic track deformation detection method according to any one of claims 1 to 7 according to the instructions.
10. A computer program product, characterized in that When the computer program product is run on a computer, the traffic track deformation detection method according to any one of claims 1 to 7 is executed.
