A method for detecting oil accumulation on the top surface of a rail based on projection quantity analysis
By combining near-infrared illumination and linear array imaging with projection analysis, the problems of high false positive rate and insufficient quantification in traditional detection methods have been solved, and accurate quantitative detection of oil accumulation on the top surface of rails has been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-22
- Publication Date
- 2026-03-24
AI Technical Summary
Traditional machine vision inspection methods are easily affected by rolling scratches, rust, wear textures, etc. when identifying oil accumulation on the top surface of rails, resulting in a high false judgment rate. Furthermore, they lack quantitative models, making it impossible to accurately quantify the amount of oil accumulation, and they do not consider the influence of environmental factors.
A detection method based on projection analysis is adopted. Images are acquired through near-infrared supplementary lighting and linear array imaging equipment, and regional adaptive preprocessing is performed. The binarization threshold is dynamically adjusted by combining gray-scale mean and variance. A layered projection strategy and accumulation mapping model are used to distinguish and quantify rail scratches and oil accumulation.
It effectively reduces the false positive rate, improves the stability and accuracy of identification, achieves a breakthrough in detection from qualitative to quantitative, and ensures the reliability and accuracy of detection results.
Smart Images

Figure CN121544638B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of rail transit equipment inspection, specifically to a detection method based on projection analysis of oil accumulation on the top surface of rails. Background Technology
[0002] As the core load-bearing component of rail transit, the condition of the rail surface directly affects wheel-rail contact performance, train operation safety, and equipment lifespan. To reduce wheel-rail wear on curved sections, rail transit systems typically apply oil to the rails for maintenance. However, fuel leaks from locomotives and rolling stock, grease seepage from axle boxes, and waste oil pollution from track maintenance operations can all lead to oil accumulation on the rail surface. If the oil accumulation exceeds a safe threshold, it will reduce the friction coefficient between the wheel and rail, affecting train braking performance. It may also accelerate rail surface wear and cause wheel-rail adhesion failure, posing safety hazards. Therefore, accurate detection of the oil accumulation condition on the rail surface is necessary. Traditional machine vision inspection methods mostly rely on global threshold binarization and single-direction projection analysis to identify oil deposit areas. However, these methods suffer from several technical limitations in practical applications. The top surface of rails is prone to interference from factors such as rolling scratches, rust, and wear textures. The grayscale distribution characteristics of scratch areas are similar to those of oil deposit areas, making it easy for single-direction projection analysis to misjudge scratches as oil deposits, resulting in a high false positive rate. Furthermore, the background grayscale distribution on the rail top surface is uneven, with significant differences in grayscale between rails of different tracks and with different degrees of wear. Global threshold binarization struggles to adapt to complex working conditions, easily leading to missed detections of oil deposit areas or misjudgments of background areas. In addition, traditional detection methods often only achieve qualitative judgments of oil deposit accumulation, lacking quantitative models that correlate with the actual accumulation amount. They also fail to consider the impact of environmental factors such as temperature and humidity, and oil type on detection accuracy, resulting in insufficient accuracy in the accumulation amount calculation.
[0003] Therefore, in order to solve the problems existing in the prior art, the present invention proposes a detection method for oil accumulation on the top surface of rails based on projection analysis. Summary of the Invention
[0004] To achieve the above objectives, the present invention provides the following technical solution:
[0005] A detection method for oil accumulation on the top surface of rails based on projection analysis includes:
[0006] The image acquisition step involves lighting the top surface of the rail to enhance the grayscale contrast between the oil area and the rail background, and then acquiring the area image using an image acquisition device.
[0007] The image preprocessing step involves dividing the regional image into several sub-regions along the extension direction of the rail, calculating the gray-scale statistical parameters of each sub-region, performing binarization processing on each sub-region according to a preset binarization threshold to obtain a binary image, and retaining the original gray-scale image of the sub-region.
[0008] The layered projection positioning step involves horizontally projecting the binary image along the vertical rail extension direction and marking the suspicious oil accumulation area. Then, the grayscale image of this area is vertically projected along the rail extension direction and the projection curve features are recorded.
[0009] The accumulation area verification step involves constructing an association verification strategy based on the grayscale and morphological features of the suspected oil accumulation area. According to the association verification strategy, the rail scratches in the area are distinguished from the actual oil accumulation area, and the rail scratches are output.
[0010] The accumulation result output step removes the rail scratch sub-area in the suspected oil accumulation area and outputs the final oil accumulation area.
[0011] As a further improvement of the present invention, the image preprocessing step includes: dividing the sub-regions according to the texture distribution characteristics of the top surface of the rail; the gray-level statistical parameters include the gray-level mean and gray-level variance of each sub-region; the preset binarization threshold is calculated by the proportionality coefficient of the gray-level mean and the gray-level variance, and the proportionality coefficient is determined by training with historical samples; after performing binarization processing on each sub-region, morphological operations are performed on the binary image by the closing operation of the preset structuring element to fill the small holes in the oil area; the binary image and the original gray-level image of the corresponding sub-region maintain an associated mapping relationship to ensure the consistency of region correspondence during subsequent projection analysis.
[0012] As a further improvement of the present invention, the layered projection positioning step includes: the horizontal projection is achieved by counting the number of pixels corresponding to the oil region in each column of the binary image; the preset judgment threshold is determined based on the projection characteristics of the standard rail image without oil contamination; when the number of pixels in a column reaches the preset judgment threshold, the horizontal region corresponding to the column is marked as the suspected oil accumulation area; when performing vertical grayscale projection on the original grayscale image of the suspected oil accumulation area, the recorded projection curve features include the peak interval of the curve and the grayscale mean distribution, wherein the peak interval corresponds to the thick oil accumulation area.
[0013] As a further improvement of the present invention, the layered projection positioning step further includes: traversing the column pixel distribution of the binary image by horizontal projection, filtering out suspected areas with a pixel count exceeding a threshold and marking them; for the marked areas, obtaining the gray-scale variation pattern of the area along the rail extension direction by vertical gray-scale projection, and supplementing the area feature information with the peak interval of the projection curve and the gray-scale mean distribution to complete the positioning of the suspected oil accumulation area.
[0014] As a further improvement of the present invention, the accumulation area verification step includes: extracting multiple parallel transverse profile lines in the suspected oil accumulation area along the vertical extension direction of the rail using an equally spaced sampling method, each transverse profile line containing a preset number of continuous pixels; extracting grayscale sequences from the pixels of each transverse profile line, determining whether there are continuous pixel combinations in the grayscale sequence where the grayscale of the middle pixel is lower than that of the pixels on both sides, and filtering noise interference by combining the grayscale gradient threshold of adjacent pixels, marking the area that meets the above conditions as a suspected scratch sub-region, and calculating the grayscale transition slope sequence of the grayscale sequence of the region, the grayscale transition slope sequence being used as the input parameter for secondary verification.
[0015] As a further improvement of the present invention, the accumulation area verification step further includes: extracting edge contours from the binary image of the suspected scratch sub-region, calculating the continuity parameter of the edge contour, wherein the continuity parameter is the ratio of the number of continuous edge pixels to the total number of edge pixels; calculating gray-level gradient features based on the gray-level transition slope sequence, wherein the gray-level gradient features include the maximum slope value and the slope fluctuation range; combining the inverse parameter of edge continuity and the normalization parameter of gray-level gradient features according to a preset weight to obtain scratch determination parameters; when the scratch determination parameters reach a preset threshold, the region is determined to be a rail scratch sub-region, otherwise it is determined to be an actual oil accumulation region.
[0016] As a further improvement of the present invention, the layered projection positioning step further includes: constructing an accumulation volume mapping model based on the projection features of the actual oil accumulation area, wherein the projection feature combination includes the integral value of the vertical grayscale projection and the width parameter of the binary projection; collecting multiple types of oil samples and multiple levels of accumulation volume samples, obtaining the projection feature combination and actual accumulation volume data corresponding to each sample, establishing the correlation between the projection feature combination and the actual accumulation volume through a linear or nonlinear fitting algorithm, and completing the construction of the accumulation volume mapping model; inputting the projection feature combination of the actual oil accumulation area into the model, and outputting the corresponding oil accumulation volume data.
[0017] As a further improvement of the present invention, the step of outputting the accumulation result includes: comparing the coordinate information of the rail scratch sub-region with the coordinate information of the suspected oil accumulation area; removing the rail scratch sub-region in the suspected oil accumulation area through coordinate subtraction operation; extracting the contour coordinates, area parameters and corresponding accumulation amount data of the remaining area; associating the contour coordinates with the rail mileage information; generating and outputting a detection result containing the accumulation location, accumulation range and accumulation amount.
[0018] As a further improvement of the present invention, in the image acquisition step, a near-infrared band supplementary lighting unit is used for illumination. The supplementary lighting unit is equipped with a diffuser to ensure that the light uniformly covers the acquisition area, avoiding grayscale distortion caused by local reflection. The image acquisition device adopts a linear array imaging device, whose sampling frequency is adapted to the moving speed of the rail or imaging device, ensuring that each frame of regional image covers the effective area of the rail top surface within a preset range, and that the grayscale contrast between the oil area and the rail background meets the requirements of subsequent analysis.
[0019] The beneficial effects of this invention are as follows: By using a regional adaptive preprocessing method, and combining the mean and variance of grayscale to dynamically adjust the binarization threshold, it adapts to the complex working conditions of uneven grayscale on the top surface of the rail, effectively reducing the risk of misjudgment caused by rust and wear textures, and improving the stability of oil area identification; by using a layered projection strategy to balance the efficiency of suspicious area screening and the accuracy of positioning, and by constructing an accumulation mapping model through projection feature combination, it achieves a breakthrough from qualitative identification to quantitative analysis, solving the defect of traditional methods that cannot accurately quantify the accumulation amount; by performing secondary verification of rail scratches and oil accumulation areas, it avoids grayscale confusion and interference between rail scratches and oil accumulation, reduces the detection misjudgment rate, and ensures the reliability of detection results. Attached Figure Description
[0020] Figure 1 This is a flowchart of the detection method for oil accumulation on the top surface of rails based on projection analysis according to an embodiment of the present invention;
[0021] Figure 2 This is a flowchart of the verification process for the oil accumulation detection method on the top surface of rails based on projection analysis, according to an embodiment of the present invention.
[0022] Figure 3 This is a schematic diagram of image acquisition according to an embodiment of the present invention;
[0023] Figure 4 This is a flowchart of the layered projection steps of the detection method for oil accumulation on the top surface of rails based on projection analysis according to an embodiment of the present invention. Detailed Implementation
[0024] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Identical components are denoted by the same reference numerals. It should be noted that the terms "front," "rear," "left," "right," "upper," and "lower" used in the following description refer to directions in the accompanying drawings, and the terms "bottom surface," "top surface," "inner," and "outer" refer to directions toward or away from the geometric center of a specific component, respectively.
[0025] This embodiment proposes a detection method for oil accumulation on the top surface of rails based on projection analysis, including:
[0026] The image acquisition step involves lighting the top surface of the rail to enhance the grayscale contrast between the oil area and the rail background, and then acquiring the area image using an image acquisition device.
[0027] Specifically, such as Figures 1 to 4 As shown, in the image acquisition step, illumination is provided by a near-infrared band supplementary lighting unit. Near-infrared light has special propagation and reflection characteristics, which can effectively reduce the interference of irrelevant factors such as rust and wear texture on the rail surface on the identification of the oil area. Compared with the visible light band, the grayscale difference formed by near-infrared light between the oil and the rail substrate is more significant, providing a clear basis for subsequent image analysis. The supplementary lighting unit is equipped with a diffuser to ensure uniform light coverage of the acquisition area. The diffuser optimizes the light propagation path, allowing the light emitted by the supplementary lighting unit to uniformly cover the entire acquisition area from multiple angles without direct sunlight. This light coverage method avoids the formation of reflective bright spots on the rail surface by direct light from a single direction. Such bright spots can cause abnormally high or low gray values in local areas, thus compromising the rationality of the image's gray-scale distribution and affecting the accuracy of subsequent binarization processing and feature extraction. The application of the diffuser ensures the gray-scale uniformity of the acquired image from the perspective of light propagation. The image acquisition device uses a linear array imaging device, whose sampling frequency is adapted to the moving speed of the rail or imaging device, ensuring that each frame of the regional image covers the effective area of the rail's top surface within a preset range, and that the gray-scale contrast between the oil area and the rail background meets the requirements for subsequent analysis.
[0028] The core advantage of linear array imaging equipment lies in its ability to continuously acquire image information line by line during relative movement between the equipment and the rail. This acquisition method is particularly suitable for the long-distance, continuous inspection needs of rail transit lines, enabling efficient coverage of large areas of rail lines and avoiding problems such as image stitching misalignment and missed detections due to acquisition gaps that easily occur with area array imaging equipment during continuous moving inspection. The sampling frequency of the linear array imaging equipment needs to be coordinated and adapted with the moving speed of the rail or imaging equipment. The core logic of this adaptation is to ensure that the image information acquired by adjacent lines can be seamlessly connected during relative movement. This avoids data redundancy caused by excessive overlap of acquisition areas and missed detections due to excessive acquisition intervals. Ultimately, it ensures that the regional image output of each frame can completely cover the preset effective range of the top surface of the rail, providing continuous and complete image data support for subsequent sub-region division, projection analysis, and other steps.
[0029] The core objective of the entire image acquisition process is to ensure the grayscale contrast between the oil accumulation area and the rail background. Grayscale contrast is a fundamental prerequisite for subsequent image preprocessing and feature extraction. If the contrast is insufficient, the grayscale difference between the oil accumulation area and the background area will become blurred, making it difficult to accurately define the boundary between the target area and the background area during binarization processing, thus affecting the positioning accuracy of the suspected oil accumulation area. Therefore, the wavelength and intensity of the light from the supplementary lighting unit need to be coordinated with the exposure parameters of the imaging equipment. Through the optimized combination of multiple parameters, a clear distinction between the oil accumulation area and the rail background can be achieved, ensuring that the acquired area image can meet the analysis requirements of subsequent steps and laying the foundation for the accuracy of the entire detection method.
[0030] The image preprocessing step involves dividing the regional image into several sub-regions along the extension direction of the rail, calculating the gray-scale statistical parameters of each sub-region, performing binarization processing on each sub-region according to a preset binarization threshold to obtain a binary image, and retaining the original gray-scale image of the sub-region.
[0031] Specifically, such as Figures 1 to 4 As shown, the image preprocessing steps include: dividing the sub-regions according to the texture distribution characteristics of the rail top surface; the gray-level statistical parameters include the gray-level mean and gray-level variance of each sub-region; the preset binarization threshold is calculated by the proportional coefficient of the gray-level mean and the gray-level variance, and the proportional coefficient is determined through training with historical samples; after performing binarization processing on each sub-region, morphological operations are performed on the binary image by the closing operation of the preset structuring element to fill the small holes in the oil area; the binary image and the original gray-level image of the corresponding sub-region maintain an associated mapping relationship to ensure the consistency of region correspondence during subsequent projection analysis.
[0032] Gray-level statistical parameters include the mean and variance of gray levels in each sub-region. The mean gray level reflects the average gray level of all pixels within the sub-region, directly indicating the overall brightness of the area. The variance gray level reflects the deviation of each pixel's gray level from the mean, quantifying the uniformity of gray level distribution within the region. For example, areas with concentrated rust or wear will have a significantly greater variance than areas with uniform texture. These two parameters together constitute the core description of the background characteristics of the sub-region, providing data support for the dynamic adjustment of the binarization threshold. Relying solely on the mean gray level cannot handle gray level fluctuations within a region; combining it with the variance allows the threshold to better reflect the actual gray level distribution within the region, improving the accuracy of distinguishing oily areas from the background.
[0033] The preset binarization threshold is calculated using a ratio coefficient between the grayscale mean and the grayscale variance. The essence of binarization is to set a grayscale boundary, dividing pixels above or below this boundary into target or background regions, thus achieving initial separation of the oil-covered area from the rail background. The logic behind using a ratio coefficient to construct the threshold is that different sub-regions have different background grayscale levels and fluctuations. A fixed threshold cannot adapt to all operating conditions. However, by using the ratio of the mean to the variance, the threshold can be dynamically adjusted according to the background characteristics of the sub-region: for sub-regions with a brighter background and uniform grayscale, the threshold will be appropriately increased based on the mean; for sub-regions with a darker background or large grayscale fluctuations, the threshold will be adjusted downwards based on the variance for better fit. The ratio coefficient is determined through training with historical samples. During training, a large number of rail images of different lines, different wear levels, and different oil types are collected. After dividing these into sub-regions, the actual oil-covered areas are manually labeled. Through repeated iterative calculations, the ratio relationship that optimizes the oil-covered area recognition accuracy for each sub-region is found, ensuring the universality and accuracy of the threshold calculation.
[0034] After binarizing each sub-region, morphological operations are performed on the binary image using a closing operation on a pre-defined structuring element. The structuring element is the basic template for morphological processing; its shape and size are set according to the common morphology of the oil-bearing area on the top surface of the rail, accurately matching the small pore features that may appear in the binarized oil-bearing area. The closing operation's processing logic involves first dilating the binary image, followed by erosion. The dilution operation fills the small pores in the oil-bearing area and connects adjacent small oil-bearing patches, while the subsequent erosion operation restores the original contour size of the oil-bearing area, avoiding excessive expansion caused by the dilution operation. This processing method eliminates false pores caused by noise, uneven lighting, and other factors during binarization, ensuring the integrity of the oil-bearing area, without altering its core contour features. This provides accurate binary image data for pixel count and area determination in subsequent projection analysis.
[0035] The binary image maintains an associated mapping relationship with the original grayscale image of the corresponding sub-region. This associated mapping means that the two images correspond completely in spatial coordinates. That is, the position of any pixel in the binary image can be uniquely matched with the position of a pixel in the original grayscale image, and the boundaries of the sub-regions are completely consistent in both images. The core significance of establishing this association is that in the subsequent layered projection localization step, it is necessary to both utilize the high contrast characteristics of the binary image to quickly mark suspicious oil accumulation areas and call the original grayscale image for vertical grayscale projection to extract more refined grayscale features. The associated mapping can ensure that the marked suspicious areas are accurately located in the original grayscale image, avoiding projection feature extraction errors caused by mismatched area positions. It ensures the consistency of the regions in all subsequent analysis steps from the perspective of spatial correspondence, thereby improving the accuracy of the overall detection results.
[0036] The layered projection positioning step involves horizontally projecting the binary image along the vertical rail extension direction and marking the suspicious oil accumulation area. Then, the grayscale image of this area is vertically projected along the rail extension direction and the projection curve features are recorded.
[0037] Specifically, such as Figures 1 to 4 As shown, the layered projection positioning step includes: the horizontal projection is achieved by counting the number of pixels corresponding to the oil region in each column of the binary image; the preset judgment threshold is determined based on the projection characteristics of the standard rail image without oil contamination; when the number of pixels in a column reaches the preset judgment threshold, the horizontal region corresponding to that column is marked as the suspected oil accumulation area; when performing vertical grayscale projection on the original grayscale image of the suspected oil accumulation area, the recorded projection curve features include the peak interval of the curve and the grayscale mean distribution, and the peak interval corresponds to the thick oil accumulation area.
[0038] The preset judgment threshold is determined based on standard rail images free of oil contamination. These images contain only background elements such as the rail substrate and normal wear texture, and the pixel distribution of their horizontal projection reflects the maximum range of background noise. By analyzing the projection characteristics of a large number of standard rail images, a boundary value that can distinguish between background noise and actual oil areas is determined; this is the preset judgment threshold. When the number of pixels in a column reaches this threshold, it indicates that the oil pixel coverage in that column exceeds the reasonable range of background noise. Therefore, the corresponding horizontal area is marked as a suspected oil accumulation area. This threshold setting method effectively reduces false markings caused by background interference and improves the initial accuracy of suspicious area location.
[0039] Vertical grayscale projection is performed on the original grayscale image of the suspected oil accumulation area, with the projection direction consistent with the rail extension direction. This direction selection allows for the acquisition of detailed grayscale variations along the longitudinal direction of the track in the suspected area. Compared to a binary image, the original grayscale image retains more grayscale level information. Vertical grayscale projection can transform this information into a projection curve, with the peak interval and mean grayscale distribution of the curve being the core feature parameters. The peak interval refers to a continuous interval in the projection curve where the grayscale value is significantly higher than other areas. Since the greater the thickness of the oil accumulation, the more stable its light reflection characteristics, resulting in a higher corresponding grayscale value, the peak interval can accurately correspond to thick oil accumulation areas. The mean grayscale distribution reflects the average grayscale level of the entire suspected area, supplementing information on thin accumulation areas not covered by the peak interval, thus allowing the projection features to more comprehensively reflect the overall state of the oil accumulation.
[0040] Specifically, such as Figures 1 to 4As shown, the layered projection positioning step also includes a complete traversal of the column-wise pixel distribution of the binary image. This traversal ensures that no column with potential oil accumulation is overlooked. By comparing the number of pixels column by column with a preset threshold, all suspected areas with pixel counts exceeding the threshold are filtered out and marked. The marked areas only have their lateral range determined by horizontal projection; their longitudinal boundaries and internal grayscale distribution characteristics remain unclear. Therefore, further refinement is needed through vertical grayscale projection. Vertical grayscale projection can obtain the grayscale variation pattern along the rail extension direction of the area. This variation pattern directly reflects the longitudinal distribution density and thickness differences of the oil. Areas with consistently high grayscale values indicate continuous longitudinal oil distribution, while areas with smaller grayscale value fluctuations indicate uniform oil accumulation thickness. Using the peak range and mean grayscale distribution of the projection curve as supplementary feature information, the longitudinal boundaries of the suspected area can be accurately defined, while distinguishing between thick and thin accumulations within the area. This ultimately completes the process of determining suspected oil accumulation areas from "lateral screening" to "precise longitudinal and lateral positioning."
[0041] Specifically, such as Figures 1 to 4 As shown, the layered projection positioning step also includes the construction and application of an accumulation volume mapping model. The core purpose of this model is to transform abstract projection features into quantifiable actual accumulation volume data. The projection feature combination selects the integral value of vertical grayscale projection and the width parameter of binary projection. This combination design is based on the composition logic of accumulation volume. The integral value of vertical grayscale projection is a value obtained by accumulating the area enclosed by the projection curve and the baseline. Its magnitude is directly related to the thickness of the oil accumulation; the thicker the accumulation, the higher the grayscale value, and the larger the integral value. The width parameter of binary projection reflects the lateral and longitudinal coverage of the oil accumulation; the larger the range, the greater the accumulation volume. The combination of the two can comprehensively cover the two core dimensions of accumulation volume—thickness and range—ensuring a strong correlation between features and accumulation volume.
[0042] The model construction process requires collecting samples of various types of oils and samples of different levels of accumulation. The oil types include common lubricants found in rail transit scenarios such as grease, diesel fuel, and axle box grease. The accumulation levels cover different quantities, from slight to severe accumulation. By acquiring images and extracting projection features from these samples, the projected feature combinations and actual accumulation data for each sample are obtained. The actual accumulation data is determined through precise measurements such as standard weighing. Linear or nonlinear fitting algorithms are then used to analyze this data, establishing a stable correlation between the projected feature combinations and the actual accumulation volume. This correlation can adapt to differences in oil types and accumulation morphologies. During actual detection, the projected feature combinations of the determined actual oil accumulation areas are input into the model. The model can then output the corresponding oil accumulation volume data based on the pre-established correlation, achieving a complete closed loop from area identification to quantitative analysis.
[0043] The accumulation area verification step involves constructing an association verification strategy based on the grayscale and morphological features of the suspected oil accumulation area. According to the association verification strategy, the rail scratches in the area are distinguished from the actual oil accumulation area, and the rail scratches are output.
[0044] Specifically, such as Figures 1 to 4 As shown, the core design logic of the accumulation area verification step is to establish a strong correlation verification mechanism of "preliminary screening - secondary precise judgment". Through layered extraction and correlation analysis of grayscale and morphological features, it solves the problem of misjudgment caused by the similarity in grayscale distribution between rail scratches and oil accumulation. Specifically, the preliminary screening stage uses a transverse profile sampling method, with the sampling direction set perpendicular to the rail extension direction. This direction choice is highly compatible with the common distribution pattern of rail scratches—scratches formed by train rolling are mostly distributed in long strips along the rail extension direction. A transverse profile perpendicular to the extension direction can accurately capture the transverse cross-sectional shape of the scratches, capturing the unique grayscale distribution pattern of the scratches. Using an equally spaced sampling method to extract multiple parallel transverse profiles ensures that the sampling covers the entire suspected oil accumulation area, avoiding missed scratches due to local sampling omissions. At the same time, the parallel profiles provide multi-dimensional grayscale information support, improving the reliability of the preliminary screening.
[0045] Each horizontal profile line contains a predetermined number of consecutive pixels. The selection of consecutive pixels ensures the integrity of the grayscale sequence, preventing subsequent grayscale trend analysis from being affected by pixel breaks. A grayscale sequence is extracted from the pixels of each horizontal profile line. This sequence is a continuous data set formed by arranging the grayscale values of each pixel along the profile line in positional order, directly reflecting the grayscale distribution changes along the profile line direction. The system determines whether there are consecutive pixel combinations in the grayscale sequence where the grayscale value of the middle pixel is lower than that of the pixels on either side. This judgment logic stems from the fundamental difference between scratches and oil deposits: scratches are indentations on the rail surface, reflecting less light when illuminated, exhibiting a distribution characteristic of low grayscale in the middle and high grayscale on both sides; while oil deposits have a relatively flat surface with a uniform grayscale distribution, and do not exhibit this continuous grayscale combination of low grayscale in the middle and high grayscale on both sides.
[0046] Simultaneously, noise interference is filtered by combining the gray-level gradient threshold of adjacent pixels. The gray-level gradient is the degree of change in gray-level values between adjacent pixels. Noise interference usually manifests as abrupt changes in gray-level values, and its gradient change amplitude is much greater than that of normal scratches or oil areas. By setting a reasonable gray-level gradient threshold, such abrupt noise pixel combinations can be excluded, avoiding false suspicious scratch sub-region markings caused by isolated noise points, and ensuring the accuracy of the initial screening results. For continuous pixel combination regions that meet the requirement that "the gray level of the middle pixel is lower than that of the pixels on both sides" and whose gradient meets the requirements, they are marked as suspicious scratch sub-regions, and the gray-level transition slope sequence of the gray-level sequence in this region is calculated. The gray-level transition slope sequence is a quantitative description of the rate of gray-level change of adjacent pixels in the gray-level sequence, which can accurately reflect the gentleness or steepness of the gray-level decrease from both sides to the middle. This sequence serves as the core input parameter for secondary verification, establishing a strong correlation between the initial screening and secondary judgment, enabling secondary verification to proceed based on the gray-level change patterns of the initial screening, and improving the coherence and accuracy of the judgment logic.
[0047] Specifically, such as Figures 1 to 4 As shown, the secondary precise judgment stage focuses on the fusion analysis of morphological features and gray-level gradient features to further distinguish between suspicious scratch sub-regions and actual oil accumulation areas. First, edge contours are extracted from the binary images of suspicious scratch sub-regions. Edge contours are the boundaries between the target area and the background area in a binary image, directly reflecting the morphological structure of the area. The edge contours of rail scratches typically exhibit a continuous, regular, elongated shape, while the edge contours of oil accumulation are mostly irregular and discontinuous. This difference in edge contours provides a key morphological basis for distinguishing between the two. The continuity parameter of the edge contour is calculated. This continuity parameter is obtained by the ratio of the number of continuous edge pixels to the total number of edge pixels, quantifying the completeness of the edge contour: a high proportion of continuous edge pixels in scratches results in a large continuity parameter value; a low proportion of continuous edge pixels in oil accumulation results in a small continuity parameter value. The inverse parameter of edge continuity is the reverse transformation of the continuity parameter, ensuring that the parameter change trend remains consistent with the scratch judgment logic. That is, the smaller the inverse parameter value, the closer it is to the morphological characteristics of the scratch.
[0048] Gray-level gradient features are calculated based on the gray-level transition slope sequence obtained in the preliminary screening stage. These features include the maximum slope value and the slope fluctuation range. The maximum slope value reflects the most drastic gray-level change in the gray-level sequence. In the scratch area, due to its concave center and convex sides, the gray-level decreases rapidly from the sides to the center, resulting in a relatively large maximum slope value. In contrast, the oil accumulation area has a gentler gray-level distribution and a smaller maximum slope value. The slope fluctuation range reflects the dispersion of each slope value in the slope sequence. The gray-level change pattern in the scratch area is stable, resulting in a small slope fluctuation range. The gray-level change in the oil accumulation area is irregular, resulting in a large slope fluctuation range. Normalization is performed on the gray-level gradient features to obtain normalization parameters. The purpose of normalization is to eliminate the incomparability of gradient features between different suspicious areas due to differences in pixel count and gray-level range, enabling comparative analysis of gradient features from different areas under the same quantization standard and improving the rationality of feature fusion.
[0049] The scratch determination parameters are calculated by combining the inverse parameter of edge continuity and the normalized parameter of gray-level gradient features according to preset weights. The preset weights are based on the contribution analysis of two types of features to scratch determination: edge continuity features directly reflect the essential morphological differences of the region and have a more critical impact on scratch determination, thus receiving a relatively high weight; gray-level gradient features, as supplementary features, assist in verifying the consistency of gray-level change patterns, thus receiving a relatively low weight. The weight values are determined through extensive sample training to ensure that the combined determination parameters can maximize the distinction between scratches and oil accumulation. The preset threshold is a critical value determined through statistical analysis of determination parameters collected from a large number of real scratch and oil accumulation samples. When the scratch determination parameters reach this threshold, it indicates that the region conforms to the essential attributes of a scratch in both morphological and gray-level gradient features, and is determined as a rail scratch sub-region; if it does not reach this threshold, it indicates that the region's features are more consistent with the attributes of oil accumulation, and is determined as an actual oil accumulation region, thereby achieving accurate differentiation between the two types of regions.
[0050] The accumulation result output step removes the rail scratch sub-area in the suspected oil accumulation area and outputs the final oil accumulation area.
[0051] Specifically, such as Figures 1 to 4 As shown, the steps for outputting the accumulation results include: comparing the coordinate information of the rail scratch sub-region with the coordinate information of the suspected oil accumulation area; removing the rail scratch sub-region in the suspected oil accumulation area through coordinate subtraction operation; extracting the contour coordinates, area parameters and corresponding accumulation amount data of the remaining area; associating the contour coordinates with the rail mileage information; generating and outputting a detection result containing the accumulation location, accumulation range and accumulation amount.
[0052] Coordinate subtraction is not simply region deletion, but rather precise spatial matching and overlapping region stripping based on coordinate information. The technical logic is as follows: First, by comparing coordinates, identify the portion of the suspicious oil accumulation area that completely overlaps with the rail scratch sub-area; this overlapping area is the interference area to be removed. Then, using pixel-level spatial masking technology, the pixel states of the overlapping area are marked as background, while retaining the non-overlapping pixel areas in the suspicious oil accumulation area, ultimately forming the remaining area containing only the actual oil accumulation. This subtraction method can minimize the accidental deletion of non-overlapping oil areas, ensuring the integrity of the actual oil accumulation area and solving problems such as blurred boundaries and residual areas that easily occur in traditional region removal methods.
[0053] The feature parameter extraction of the remaining area is based on the correlation mapping relationship of the previous steps. The extracted contour coordinates, area parameters, and accumulation volume data form a three-dimensional feature description of the space, range, and quantification of the oil accumulation. The contour coordinates are the set of spatial positions of the boundary pixels of the remaining area. They are obtained by extracting the boundaries of the remaining area through edge detection algorithms, which can accurately define the spatial contour shape of the oil accumulation, including the lateral span and longitudinal extension length of the accumulation area, providing core data for subsequent location positioning. The area parameter is calculated based on the contour coordinates. By counting the total number of pixels enclosed by the contour coordinates and combining the conversion with the scale of the image acquisition, the actual coverage area of the oil accumulation is obtained, which intuitively reflects the size of the planar range of the accumulation. The accumulation volume data calls the accumulation volume mapping model built in the layered projection positioning step. The projection features of the remaining area are combined and input into the model. The model outputs the corresponding quantitative value according to the pre-established correlation relationship, realizing a complete connection from area recognition to quantitative analysis, and solving the technical deficiency of traditional detection that can only be qualitative and cannot be quantitative.
[0054] The correlation between contour coordinates and rail mileage information is a crucial step in converting image location to actual track location. During image acquisition, the positioning module of the image acquisition device and the rail mileage recording system operate synchronously. The positioning module records the spatial position of the acquisition device in real time, forming a one-to-one mapping relationship between this position and the rail mileage information. Through this synchronous mapping relationship, the contour coordinates (position relative to the image origin) of the remaining area in the image can be converted into the corresponding rail mileage value and lateral offset position. The rail mileage value clarifies the longitudinal position of the accumulation area within the entire track, while the lateral offset position clarifies the lateral distribution of the accumulation on the top surface of the rail. The combination of these two factors allows maintenance personnel to accurately locate the oil accumulation point on the actual track, completely solving the problem of the disconnect between image location and actual track location, and the difficulty for maintenance personnel to locate the target area.
[0055] The foregoing has illustrated and described the basic features, principles, and advantages of the present invention. It should be noted that the present invention is not limited to the above embodiments, but only to some embodiments. Any improvements and additions made without departing from the spirit and scope of the present invention are considered to be within the scope of protection of the present invention.
Claims
1. A method for detecting oil accumulation on the top surface of rails based on projection analysis, characterized in that, include: The image acquisition step involves lighting the top surface of the rail to enhance the grayscale contrast between the oil area and the rail background, and then acquiring the area image using an image acquisition device. The image preprocessing step involves dividing the regional image into several sub-regions along the extension direction of the rail, calculating the gray-scale statistical parameters of each sub-region, performing binarization processing on each sub-region according to a preset binarization threshold to obtain a binary image, and retaining the original gray-scale image of the sub-region. The layered projection positioning step involves horizontally projecting the binary image along the vertical rail extension direction and marking the suspicious oil accumulation area. Then, the grayscale image of this area is vertically projected along the rail extension direction and the projection curve features are recorded. The accumulation area verification step involves constructing an association verification strategy based on the grayscale and morphological features of the suspected oil accumulation area. According to the association verification strategy, the rail scratches in the area are distinguished from the actual oil accumulation area, and the rail scratches are output. The accumulation result output step removes the rail scratch sub-area in the suspected oil accumulation area and outputs the final oil accumulation area.
2. The detection method for oil accumulation on the top surface of rails based on projection analysis according to claim 1, characterized in that, The image preprocessing steps include: dividing the sub-regions according to the texture distribution characteristics of the rail top surface; the gray-level statistical parameters include the gray-level mean and gray-level variance of each sub-region; the preset binarization threshold is calculated by the ratio coefficient of the gray-level mean and the gray-level variance, and the ratio coefficient is determined through training with historical samples; after performing binarization processing on each sub-region, morphological operations are performed on the binary image through the closing operation of the preset structuring element to fill the small holes in the oil area; the binary image and the original gray-level image of the corresponding sub-region maintain an associated mapping relationship to ensure the consistency of region correspondence during subsequent projection analysis.
3. The detection method for oil accumulation on the top surface of rails based on projection analysis according to claim 1, characterized in that, The layered projection positioning step includes: the horizontal projection is achieved by counting the number of pixels corresponding to the oil region in each column of the binary image; the preset judgment threshold is determined based on the projection characteristics of the standard rail image without oil contamination; when the number of pixels in a column reaches the preset judgment threshold, the horizontal region corresponding to that column is marked as the suspected oil accumulation area; when performing vertical grayscale projection on the original grayscale image of the suspected oil accumulation area, the recorded projection curve features include the peak interval of the curve and the grayscale mean distribution, and the peak interval corresponds to the thick oil accumulation area.
4. The detection method for oil accumulation on the top surface of rails based on projection analysis according to claim 3, characterized in that, The layered projection positioning step further includes: traversing the column pixel distribution of the binary image through horizontal projection, filtering out suspected areas with a pixel count exceeding a threshold and marking them; for the marked areas, obtaining the grayscale variation pattern along the rail extension direction of the area through vertical grayscale projection, and supplementing the area feature information with the peak interval and grayscale mean distribution of the projection curve to complete the positioning of the suspected oil accumulation area.
5. The detection method for oil accumulation on the top surface of rails based on projection analysis according to claim 1, characterized in that, The verification step of the accumulation area includes: extracting multiple parallel transverse profile lines in the suspected oil accumulation area along the vertical extension direction of the rail using an equally spaced sampling method; each transverse profile line contains a preset number of continuous pixels; extracting grayscale sequences from the pixels of each transverse profile line; determining whether there are continuous pixel combinations in the grayscale sequence where the grayscale value of the middle pixel is lower than that of the pixels on both sides; filtering noise interference by combining the grayscale gradient threshold of adjacent pixels; marking the area that meets the above conditions as a suspected scratch sub-region; and calculating the grayscale transition slope sequence of the grayscale sequence of the region, which is used as the input parameter for secondary verification.
6. The detection method for oil accumulation on the top surface of rails based on projection analysis according to claim 5, characterized in that, The stacking region verification step further includes: extracting edge contours from the binary image of the suspected scratch sub-region, calculating the continuity parameter of the edge contours, wherein the continuity parameter is the ratio of the number of continuous edge pixels to the total number of edge pixels; calculating gray-level gradient features based on the gray-level transition slope sequence, wherein the gray-level gradient features include the maximum slope value and the slope fluctuation range; and combining the inverse parameter of edge continuity and the normalization parameter of gray-level gradient features according to preset weights to obtain scratch determination parameters. When the scratch determination parameter reaches the preset threshold, the area is determined to be a rail scratch sub-area; otherwise, it is determined to be an actual oil accumulation area.
7. The detection method for oil accumulation on the top surface of rails based on projection analysis according to claim 1, characterized in that, The layered projection positioning step further includes: constructing an accumulation volume mapping model based on the projection features of the actual oil accumulation area, wherein the projection feature combination includes the integral value of the vertical grayscale projection and the width parameter of the binary projection; collecting multiple types of oil samples and multiple levels of accumulation volume samples, obtaining the projection feature combination and actual accumulation volume data corresponding to each sample, establishing the correlation between the projection feature combination and the actual accumulation volume through linear or nonlinear fitting algorithms, and completing the construction of the accumulation volume mapping model; inputting the projection feature combination of the actual oil accumulation area into the model, and outputting the corresponding oil accumulation volume data.
8. The detection method for oil accumulation on the top surface of rails based on projection analysis according to claim 1, characterized in that, The steps for outputting the accumulation results include: comparing the coordinate information of the rail scratch sub-region with the coordinate information of the suspected oil accumulation area; removing the rail scratch sub-region in the suspected oil accumulation area through coordinate subtraction operation; extracting the contour coordinates, area parameters and corresponding accumulation amount data of the remaining area; associating the contour coordinates with the rail mileage information; generating and outputting a detection result containing the accumulation location, accumulation range and accumulation amount.
9. The detection method for oil accumulation on the top surface of rails based on projection analysis according to claim 1, characterized in that, In the image acquisition step, a near-infrared band supplementary lighting unit is used for illumination. The supplementary lighting unit is equipped with a diffuser to ensure that the light uniformly covers the acquisition area, avoiding grayscale distortion caused by local reflections. The image acquisition device adopts a linear array imaging device, and its sampling frequency is adapted to the moving speed of the rail or imaging device to ensure that each frame of regional image covers the effective area of the rail top surface within a preset range, and the grayscale contrast between the oil area and the rail background meets the requirements of subsequent analysis.
Citation Information
Patent Citations
Steel rail tread defect recognition method based on combination of gray image and depth image
CN108921846A
Track turnout foreign matter detection and type analysis method and system
CN120411656A