Wheel tread image optimization method, wheel tread detection method and electronic device

CN120852171BActive Publication Date: 2026-09-25SHENHUA RAIL & FREIGHT WAGONS TRANSPORT +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510770780.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2026-09-25
Estimated Expiration
2045-06-10

AI Technical Summary

Technical Problem

[0005]本发明的目的在于至少提供一种车轮踏面图像优化方法、车轮踏面检测方法及电子设备,至少可以解决复杂光源环境下无法准确提取出轮对表面损伤特征的问题,至少可以达到准确反映轮对表面真实的光强分布特征的效果

Benefits of technology

[0060]1.采用自适应伽马变换来增强局部特征,自适应算出合适伽马值,将图像不同区域增强,既提升整体对比度,又保留细节。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120852171B_ABST
    Figure CN120852171B_ABST
Patent Text Reader

Abstract

The embodiment of the application relates to the image processing field, and discloses a wheel tread image optimization method, a wheel tread detection method and electronic equipment, which comprises the following steps: acquiring an initial wheel tread image; calculating the illumination contrast information of the neighborhood of each pixel point in the initial wheel tread image; calculating corresponding gamma correction coefficients based on the illumination contrast information of the neighborhood of each pixel point; performing gamma transformation processing on the corresponding pixel points according to the gamma correction coefficients of the pixel points to generate an illumination balanced image; and performing Gaussian filtering on the illumination balanced image to obtain a target wheel tread image. The wheel tread image optimization method disclosed by the application solves the problem that the wheel set surface damage features cannot be accurately extracted under a complex light source environment, and at least achieves the effect of accurately reflecting the real light intensity distribution features of the wheel set surface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method for optimizing wheel tread images, a method for detecting wheel treads, and an electronic device. Background Technology

[0002] As a core load-bearing component of railway vehicles, wheelsets bear crucial functions such as traction transmission, braking force application, and dynamic load support at the wheel-rail contact interface. The tread condition of the wheelsets directly affects the train's dynamic performance and operational safety. During long-term operation, the continuous rolling contact fatigue effect between the wheel and rail leads to progressive surface damage on the tread, manifested as typical defects such as peeling and denting. These defects not only cause safety hazards such as abnormal vehicle vibration and brake performance degradation, but also form a positive feedback damage mechanism through wheel-rail interaction, accelerating rail surface deterioration and significantly shortening the service life of the wheel-rail system.

[0003] Existing automated inspection systems mostly use classic edge detection algorithms as the core feature extraction method. This algorithm can accurately identify surface defects of wheelsets through noise suppression and gradient direction tracking. However, in actual engineering applications, wheelset tread inspection faces the following special working conditions: (1) multi-source light interference, including extreme dynamic lighting environments such as direct strong light areas and structural shadow areas; (2) specular reflection noise caused by the high reflectivity of metal surfaces.

[0004] Thus, under these complex working conditions, when extracting features of defects on the wheelset surface, edge oversaturation occurs in areas of strong light, and feature fractures appear in areas of low light, seriously affecting the engineering practicality of the detection system. Summary of the Invention

[0005] The purpose of this invention is to provide at least one method for optimizing wheel tread images, a method for detecting wheel treads, and an electronic device, which can at least solve the problem of not being able to accurately extract the surface damage features of wheelsets under complex lighting conditions, and can at least achieve the effect of accurately reflecting the true light intensity distribution features of the wheelset surface.

[0006] To address the aforementioned technical problems, at least one embodiment of this application provides a wheel tread image optimization method, comprising:

[0007] Obtain the initial wheel tread image;

[0008] Calculate the illumination contrast information of the neighborhood of each pixel in the initial wheel tread image;

[0009] Based on the illumination contrast information of the neighborhood of each pixel, the corresponding gamma correction coefficient is calculated.

[0010] Based on the gamma correction coefficient of each pixel, gamma transformation is performed on the corresponding pixel to generate an illumination-equalized image.

[0011] Gaussian filtering is applied to the illumination equalization image to obtain the target wheel tread image.

[0012] At least one embodiment of this application also provides a wheel tread detection method, including:

[0013] An initial wheel tread image is obtained, and the initial wheel tread image is optimized using the wheel tread image optimization method described above to obtain a target wheel tread image.

[0014] The gradient magnitude and gradient direction of each pixel in the target wheel tread image are calculated. The gradient magnitude is calculated based on the gradient values ​​of 0°, 45°, 90° and 135°.

[0015] Maximal suppression is performed on the target wheel tread image based on the gradient magnitude and gradient direction to obtain a feature map containing feature points.

[0016] A dynamic threshold is set, and pixels with pixel values ​​higher than the dynamic threshold in the feature map are marked as damaged areas to obtain the true edges of the damaged areas.

[0017] At least one embodiment of this application also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the methods described above.

[0018] The wheel tread image optimization method provided in this application addresses the difficulty in extracting wheel set image information features under complex lighting conditions. It compares each pixel in the image under test with its neighboring pixels to generate gamma transform coefficients for each pixel. Based on these gamma correction coefficients, the pixels are then subjected to illumination information equalization. Therefore, the final generated illumination-equalized image is less affected by lighting conditions. Through zonal adaptive correction, details in dark areas suppressed by strong light and bright features disturbed by shadows in the original image are effectively restored. The resulting equalized image accurately reflects the true light intensity distribution characteristics of the wheel set surface, providing a reliable image basis for subsequent damage detection.

[0019] The wheel tread detection method provided in this application performs illumination intensity equalization processing on the wheelset tread image using the aforementioned wheel tread image optimization method, effectively suppressing interference from complex lighting backgrounds and significantly enhancing the feature information related to the damaged area in the image. To accurately extract these features, a combined gradient analysis and non-maximum suppression strategy is employed: first, the gradient magnitude and direction of each pixel in the target wheel tread image are calculated; then, non-maximum suppression is performed based on the gradient direction to eliminate noise interference and accurately locate the damaged area. To further improve the ability to capture detailed features, the limitations of traditional bidirectional gradient calculation are overcome, and the gradient extraction direction is extended to four (0°, 45°, 90°, 135°). Multi-directional gradient response fusion enhances the feature representation accuracy of defects such as microcracks and pitting, thereby achieving high-reliability detection of the damaged area of ​​the wheelset tread.

[0020] In some optional embodiments, the illumination contrast information includes the standard deviation of pixel values ​​of all pixels in the neighborhood centered on the pixel. Illumination contrast information is used to characterize the illumination distribution characteristics of the neighborhood of a pixel. When the absolute value of brightness is directly used as illumination contrast information, it is difficult to accurately reflect the differences in light sources between different test images due to the lack of a dynamic adjustment mechanism. The advantages of using standard deviation as illumination contrast information in this application are reflected in two dimensions: First, it accurately characterizes the uniformity of illumination by quantifying the dispersion of pixel values—when the standard deviation value is small, it indicates that the pixel distribution in the area is highly concentrated, corresponding to the ideal working condition of uniform illumination and no significant brightness gradient; conversely, it reflects the existence of obvious light intensity differences. Second, the magnitude of the standard deviation value is strongly correlated with detail features: a larger standard deviation value not only eliminates the possibility of a single overexposed area (avoiding misjudgment of highlight clipping), but also directly characterizes that the area contains rich texture details. Based on these dual characteristics, this solution constructs a standard deviation-driven dynamic adjustment mechanism: moderate gamma correction is applied to areas with high standard deviation to preserve the integrity of details, while the correction intensity is enhanced to eliminate systematic illumination deviations in areas with low standard deviation.

[0021] In some optional embodiments, the corresponding gamma correction coefficient is calculated based on the illumination contrast information of the neighborhood of each pixel using the following formula:

[0022]

[0023] In the formula, γ represents the gamma correction coefficient, σ represents the illumination contrast information of the neighborhood centered on the pixel, k represents the scaling coefficient, and ε represents the minimum value.

[0024] When setting the gamma correction coefficient, both excessively high and excessively low values ​​may affect the details of the image, making it impossible to accurately extract key feature regions. Therefore, this solution uses the formula described above to calculate the gamma correction coefficient.

[0025] The variance σ in the formula for calculating the gamma correction factor 2 The standard deviation reflects the contrast of local areas in an image. A larger standard deviation indicates higher contrast in that area, while a smaller standard deviation indicates lower contrast. High-contrast areas, i.e., areas with a large standard deviation, indicate rich detail and high contrast. For example, in bright areas of an image, using a large gamma coefficient for transformation might over-enhance the contrast, leading to overexposure or loss of detail. Therefore, by using the standard deviation as the denominator, the calculated gamma transform coefficients are smaller, resulting in a more gentle transformation and avoiding over-enhancement.

[0026] When a low-contrast region has a small standard deviation, it means that the pixel values ​​in that region are relatively similar, resulting in low contrast. In the lesson plan section of the image, a small gamma coefficient cannot effectively improve the image's contrast. Therefore, using the standard deviation as the denominator will result in a larger calculated gamma transform coefficient, performing a stronger transform on the image, thereby enhancing the contrast of that region and making details more clearly visible.

[0027] In some optional embodiments, the step of performing Gaussian filtering on the illumination equalization image to obtain the target wheel tread image includes:

[0028] Set the Gaussian kernel parameter δ, and generate the Gaussian kernel size K based on the Gaussian kernel parameter;

[0029] K = 2 × δ + 1;

[0030] For each pixel in each Gaussian kernel, calculate the value of the two-dimensional Gaussian function;

[0031]

[0032] In the formula, u represents the x-coordinate of a pixel in the illumination equalization image, v represents the y-coordinate of a pixel in the illumination equalization image, π represents pi, and H(u, v) represents the two-dimensional Gaussian function value of pixel (u, v).

[0033] Within the same Gaussian kernel, the normalization coefficient a(u, v) is set according to the magnitude of the two-dimensional Gaussian function value of each pixel;

[0034] The pixel values ​​of the illumination-equalized image are updated based on the normalization coefficient;

[0035] G(u,v)=a(u,v)×I(u,v);

[0036] In the formula, I(u,v) represents the pixel value of pixel (u,v) in the illumination equalization image before the update, and G(u,v) represents the pixel value of pixel (u,v) in the illumination equalization image after the update.

[0037] The target wheel tread image is generated by iterating through all pixels in the illumination equalization image using a sliding Gaussian kernel to update the pixel value of each pixel in the illumination equalization image.

[0038] In the test image processed by gamma transform, noise components may be simultaneously amplified. Directly applying smoothing or median filtering to the image after illumination equalization can lead to the erroneous removal of effective feature information in specific areas, negatively impacting damage detection accuracy. This scheme employs Gaussian filtering to effectively suppress noise interference that may be amplified during gamma transform, thus preserving more complete effective feature information in the image. By synergistically fusing gamma transform and Gaussian filtering, this scheme enhances the image's edge representation capability, significantly strengthening the gray-level gradient distribution characteristics of edge regions. This method not only optimizes the overall smoothness of the illumination-equalized image but also improves the continuity of edge structures, thereby more accurately highlighting the subtle discriminative features of the actual damage area on the wheelset surface.

[0039] In some optional embodiments, the formulas for calculating the gradient magnitude and gradient direction are as follows:

[0040]

[0041] In the formula, M(x, y) represents the gradient magnitude at pixel (x, y), α(x, y) represents the gradient direction at pixel (x, y), and P 0° (x,y) represents the gradient value at 0°, P 45° (x,y) 2 P represents the gradient value at 45°. 90° (x,y) represents the gradient value at 90°, P 135° (x,y) represents the gradient value at 135°.

[0042] In some optional embodiments, the method for setting the dynamic threshold includes:

[0043] Calculate the median L of the pixel values ​​of all pixels in the feature map;

[0044] Calculate the standard deviation of the pixel values ​​of all pixels in the feature map to obtain the standard coefficient R, R = rβ, where r represents the pre-set scaling factor and β represents the standard deviation of the feature map;

[0045] A dynamic threshold is set based on standard coefficients. The dynamic threshold includes a dynamic upper limit value T. h and dynamic lower limit T l ;

[0046] T h =L+R,T l =LR;

[0047] Pixel value higher than dynamic upper limit Th Feature points are used as strong edges of the damaged region, with pixel values ​​higher than the dynamic lower limit T. l And below the dynamic upper limit value T h The feature points are used as weak edges of the damaged area;

[0048] The true edges of the damaged area are determined based on strong and weak edges.

[0049] Existing edge detection algorithms typically use fixed thresholds to determine damage features, which are only suitable for scenes with uniform image information distribution. However, wheelset surfaces have high reflectivity, requiring supplementary lighting to obtain clear images. This induces specular reflection, resulting in alternating dynamic highlight and shadow areas on the wheelset surface, leading to significant non-uniformity in image grayscale distribution. Under these conditions, fixed threshold strategies cannot adapt to sudden changes in local illumination, ultimately causing a significant decrease in edge feature extraction accuracy. The dynamic threshold setting method provided in this embodiment can effectively cope with sudden changes in local illumination and significantly improve edge feature extraction accuracy.

[0050] In some optional embodiments, maximum suppression is performed on the target wheel tread image based on the gradient magnitude and gradient direction to obtain a feature map containing feature points, including:

[0051] Traverse all pixels of the target wheel tread image and determine the pixels corresponding to the local maximum values ​​of the gradient magnitude in each gradient direction as feature points.

[0052] Generate a feature map based on all feature points in the target wheel tread image.

[0053] In some optional embodiments, determining the true edge of the damaged region based on strong and weak edges includes:

[0054] Obtain all strong and weak edges, and set the region enclosed by the strong and weak edges as the initial judgment region d;

[0055] Calculate the mean value of the first pixel of all pixels in the non-preliminary judgment region of the feature map, and determine it as the screening threshold.

[0056] Calculate the average second pixel value of all pixels in each preliminary determination region;

[0057] If the average value of the second pixel in the current preliminary judgment area is less than the filtering threshold, the strong and weak edges of the preliminary judgment area are determined to be the true edges of the damaged area; otherwise, neither the strong nor weak edges of the preliminary judgment area are the true edges of the damaged area.

[0058] Since dirt and lighting can create false edges, these false edges can lead to low accuracy in wheelset surface damage identification. This solution further filters the boundaries of damage edges based on the differences in pixels between damaged and undamaged areas, which can further remove false edges affected by lighting and oil stains, increasing the accuracy of damage area extraction.

[0059] The beneficial effects of this application are at least as follows:

[0060] 1. Adaptive gamma transform is used to enhance local features. The appropriate gamma value is calculated adaptively to enhance different regions of the image, thereby improving the overall contrast while preserving details.

[0061] 2. The original horizontal and vertical gradient calculation methods are replaced by a diagonal gradient calculation method, which calculates the gradient magnitude from multiple dimensions and fully captures image details.

[0062] 3. By calculating the mean and standard deviation of the local region, the threshold is adaptively adjusted, and by calculating the mean of the region pixels, the true edge is further determined to adapt to the characteristics of different images and make the detected edge closer to the true edge. Attached Figure Description

[0063] One or more embodiments are illustrated by way of example with reference to the accompanying drawings, and these illustrative descriptions do not constitute a limitation on the embodiments.

[0064] Figure 1 This is a flowchart of the wheel tread image optimization method provided in the embodiments of this application;

[0065] Figure 2 This is a flowchart of the wheel tread detection method provided in the embodiments of this application;

[0066] Figure 3 This is the original drawing of the wheel tread provided in the embodiments of this application;

[0067] Figure 4 This refers to the wheel tread detection results provided in the embodiments of this application;

[0068] Figure 5 This is a schematic diagram of the wheel tread image optimization device provided in an embodiment of this application;

[0069] Figure 6 This is a schematic diagram of the wheel tread detection device provided in the embodiments of this application. Detailed Implementation

[0070] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details are presented in the various embodiments of this application to facilitate a better understanding of the application. However, the technical solutions claimed in this application can be implemented even without these technical details and various variations and modifications based on the following embodiments. The division of the various embodiments below is for ease of description and should not constitute any limitation on the specific implementation of this application. The various embodiments can be combined with and referenced by each other without contradiction.

[0071] To facilitate understanding of the embodiments of this application, relevant content regarding track maintenance will be introduced first.

[0072] Because track maintenance for trains often takes place at night, supplemental lighting is required. In addition to other light sources in the environment, these light sources will produce reflected light spots when they shine on the smooth wheelset surface. These reflected light spots of varying sizes and brightness will affect the detection of damage to the wheelset surface.

[0073] To address the aforementioned technical problem of failing to accurately extract wheel tread surface damage features due to the reduction of these light spots, this invention proposes a wheel tread image optimization method. The implementation details of the wheel tread image optimization method in this embodiment are described below. The following content is only for ease of understanding and is not necessary for implementing this solution.

[0074] Example 1:

[0075] The wheel tread image optimization method of this embodiment can be applied to electronic devices with communication, computing, and data storage capabilities. Its specific process can be as follows: Figure 1 As shown, it includes:

[0076] Step 101: Obtain the initial wheel tread image.

[0077] In the specific implementation, the initial wheel tread image is a photo of the wheelset. To facilitate subsequent calculations, the input initial wheel tread image is first processed into grayscale so that the pixel values ​​of the input image are processed to be between [0, 255]. After completing the grayscale processing, the image is then normalized.

[0078] Grayscale processing uses the following formula:

[0079]

[0080] In the formula, n represents the index of a pixel in the initial wheel tread image, Qn represents the normalized gray value of the nth pixel in the initial wheel tread image, and qn represents the gray value of the nth pixel in the initial wheel tread image.

[0081] In this step, the neighborhood specifications are also set, which are the length and width of the neighborhood.

[0082] In some examples, the neighborhood size is 1*1, meaning that for a pixel (x, y), the horizontal coordinate range of the neighborhood is [x-1, x+1], and the vertical coordinate range of the neighborhood is [y-1, y+1].

[0083] Step 102: Calculate the illumination contrast information of the neighborhood of each pixel in the initial wheel tread image.

[0084] It should be understood that the initial wheel tread image in this step is a grayscale and normalized initial wheel tread image.

[0085] In this implementation, the illumination contrast information is the standard deviation of the pixel values ​​of all pixels in the neighborhood centered on the pixel. Illumination contrast information is used to characterize the illumination distribution characteristics of the neighborhood of a pixel. When the absolute value of brightness is directly used as illumination contrast information, it is difficult to accurately reflect the differences in light sources between different test images due to the lack of a dynamic adjustment mechanism. The advantage of using standard deviation as illumination contrast information in this embodiment is reflected in two dimensions: First, it accurately characterizes the uniformity of illumination by quantifying the dispersion of pixel values—when the standard deviation value is small, it indicates that the pixel distribution in the area is highly concentrated, corresponding to the ideal working condition of uniform illumination and no significant brightness gradient; conversely, it reflects the existence of obvious light intensity differences. Second, the magnitude of the standard deviation value is strongly correlated with detail features: a larger standard deviation value not only eliminates the possibility of a single overexposed area (avoiding misjudgment of highlight clipping), but also directly indicates that the area contains rich texture details. Based on these dual characteristics, this embodiment constructs a standard deviation-driven dynamic adjustment mechanism: moderate gamma correction is applied to areas with high standard deviation to preserve the integrity of details, while the correction intensity is enhanced to eliminate systematic illumination deviations in areas with low standard deviation.

[0086] In some examples, the formula for calculating illumination contrast information is as follows:

[0087]

[0088]

[0089] In the formula, σ(x,y) represents the standard deviation of the pixel values ​​of all pixels in the neighborhood centered at pixel (x,y) in the initial wheel tread image, and Q... n(x,y) represents the normalized gray value of pixel (x,y) in the initial wheel tread image, μ(x,y) represents the mean of the neighborhood of pixel (x,y) in the initial wheel tread image, M represents the length of the neighborhood, and N represents the width of the neighborhood.

[0090] Thus, for each pixel (x, y) in the initial wheel tread image, a standard deviation σ(x, y) can be calculated by adjusting its neighborhood. For pixels located at the edge of the initial wheel tread image, only the standard deviation of all pixels in the effective neighborhood is calculated. For example, the pixel (0, 0) located in the upper right corner of the initial wheel tread image has a neighborhood range of ([-1, 1], [-1, 1]). There are no pixels between -1 and 0 on the horizontal axis and between -1 and 0 on the vertical axis. Therefore, when calculating the standard deviation, the range is adjusted to ([0, 1], [0, 1]).

[0091] Step 103: Calculate the corresponding gamma correction coefficient based on the illumination contrast information of the neighborhood of each pixel.

[0092] When setting the gamma correction coefficient, both excessively high and excessively low values ​​may affect the details of the image, making it impossible to accurately extract key feature regions. Therefore, this embodiment uses the following formula to calculate the corresponding gamma correction coefficient:

[0093]

[0094] In the formula, γ represents the gamma correction coefficient, σ represents the illumination contrast information of the neighborhood centered on the pixel, k represents the scaling coefficient, and ε represents the minimum value.

[0095] The scaling factor k primarily adjusts the overall magnitude of the gamma correction coefficient. A larger scaling factor results in a larger overall gamma correction coefficient; a smaller scaling factor results in a smaller overall gamma correction coefficient, making the image darker and reducing contrast.

[0096] In some examples, k takes the value between 0.5 and 1.5.

[0097] The variance σ in the formula for calculating the gamma correction factor 2The standard deviation reflects the contrast of a local area in an image. A larger standard deviation indicates higher contrast in that area, while a smaller standard deviation indicates lower contrast. High-contrast areas, meaning areas with a large standard deviation, indicate rich detail and high contrast. For example, in bright areas of an image, using a large gamma coefficient for transformation might over-enhance contrast, leading to overexposure or loss of detail. Therefore, using the standard deviation as the denominator results in a smaller calculated gamma transform coefficient, applying a gentler transformation to avoid over-enhancement. Conversely, low-contrast areas, meaning areas with a small standard deviation, indicate similar pixel values ​​and low contrast. In the example image, a small gamma coefficient is insufficient to effectively improve contrast. Therefore, using the standard deviation as the denominator results in a larger calculated gamma transform coefficient, applying a stronger transformation to enhance contrast and make details more visible.

[0098] For example, for a certain pixel (x, y), its standard deviation is σ(x, y). Thus, the gamma correction coefficient of the pixel (x, y) can be calculated according to the formula for calculating the gamma correction coefficient. Therefore, for each pixel, one gamma correction coefficient can be calculated.

[0099] Step 104: Perform gamma transformation on the corresponding pixels according to the gamma correction coefficient of each pixel to generate an illumination-equalized image.

[0100] Q out (x,y)=Q n (x,y) γ(x,y)

[0101] In the formula, Q n (x,y) represents the normalized grayscale value of pixel (x,y) in the initial wheel tread image, γ(x,y) is the gamma correction coefficient of pixel (x,y) in the initial wheel tread image, and Q out (x,y) represents the gray value of pixel (x,y) after gamma transformation in an image with equal illumination.

[0102] In step 101, the grayscale values ​​in the initial wheel tread image were normalized for ease of calculation. However, this normalization process requires increased calculation precision during subsequent filtering. Therefore, inverse normalization is necessary to restore the original pixel range by normalizing the grayscale values ​​in the illumination equalization image. The inverse normalization method is existing technology and will not be described further here.

[0103] Step 105: Perform Gaussian filtering on the illumination equalization image to obtain the target wheel tread image.

[0104] In the aforementioned scheme, illumination equalization was performed on the initial wheel tread image. However, this overly refined processing introduces a significant amount of noise. Therefore, this step employs filtering to remove noise signals and obtain the target wheel tread image.

[0105] Step S105a: Set the Gaussian kernel parameter δ, and generate the Gaussian kernel size K based on the Gaussian kernel parameter.

[0106] K = 2 × δ + 1;

[0107] The kernel size K is the side length of the Gaussian kernel. The Gaussian kernel is the positive selection box, and the range of the Gaussian kernel is K*K.

[0108] Step S105b: Calculate the two-dimensional Gaussian function value for each pixel in each Gaussian kernel.

[0109]

[0110] In the formula, u represents the x-coordinate of a pixel in the illumination-equalized image, v represents the y-coordinate of a pixel in the illumination-equalized image, π represents pi, and H(u, v) represents the two-dimensional Gaussian function value of pixel (u, v).

[0111] Step S105c: Within the same Gaussian kernel, set the normalization coefficient a(u, v) according to the magnitude of the two-dimensional Gaussian function value of each pixel.

[0112] Within the same Gaussian kernel, the sum of the normalization coefficients a(u, v) for all pixels is 1. Therefore, the normalization coefficients are actually weighted according to the magnitude of the two-dimensional Gaussian function value.

[0113] Step S105d: Update the pixel values ​​of the illumination equalization image based on the normalization coefficient.

[0114] G(u,v)=a(u,v)×I(u,v);

[0115] In the formula, I(u,v) represents the pixel value of pixel (u,v) in the illumination equalization image before the update, and G(u,v) represents the pixel value of pixel (u,v) in the illumination equalization image after the update.

[0116] Step S105e: By sliding a Gaussian kernel, traverse all pixels in the illumination equalization image to update the pixel value of each pixel in the illumination equalization image to generate the target wheel tread image.

[0117] In step S105d, each time a Gaussian kernel is selected, Gaussian filtering is performed on the pixels within the kernel. Therefore, by continuously sliding the Gaussian kernel, Gaussian filtering can be performed on the illumination equalization image sequentially. To avoid redundant filtering, the sliding distance of the Gaussian kernel is equal to its size when sliding.

[0118] In the test image processed by gamma transform, its noise components may be simultaneously amplified. If smoothing filtering or median filtering is directly applied to the image after illumination equalization, effective feature information in specific areas will be mistakenly filtered out, thus negatively impacting the accuracy of damage detection. This method uses the aforementioned Gaussian filtering to effectively suppress noise interference that may be amplified during the gamma transform, thereby preserving the effective feature information in the image more completely. By synergistically fusing gamma transform and Gaussian filtering, the image edge representation capability can be enhanced, significantly improving the gray-level gradient distribution characteristics of the edge region. This not only optimizes the overall smoothness of the illumination equalization image but also improves the continuity of the edge structure, thereby more accurately highlighting the subtle discriminative features of the actual damage area on the wheelset surface.

[0119] This embodiment provides a method for optimizing wheel tread images. Each pixel in the image under test is compared with its neighboring pixels to generate a gamma transform coefficient for each pixel. Illumination information equalization is then performed on the pixels based on the gamma correction coefficients. Therefore, the final generated illumination-equalized image is less affected by illumination, solving the problem of difficult extraction of wheel set image information features under complex lighting conditions. Through zonal adaptive correction, details in dark areas suppressed by strong light and bright features disturbed by shadows in the original image are effectively restored. The final equalized image accurately reflects the true light intensity distribution characteristics of the wheel set surface, providing a reliable image basis for subsequent damage detection.

[0120] Example 2:

[0121] The wheel tread detection method of this embodiment can be applied to electronic devices with communication, computing, and data storage capabilities. Its specific process can be as follows: Figure 2 As shown, it includes:

[0122] Step 201: Obtain an initial wheel tread image, and optimize the initial wheel tread image using the wheel tread image optimization method described in the above embodiment to obtain a target wheel tread image.

[0123] After preprocessing using the wheel tread image optimization method of Example 1, a target wheel tread image of the wheelset tread image can be obtained. This target wheel tread image is a light equalization image that has undergone Gaussian filtering, resulting in smoother image information.

[0124] Step 202: Calculate the gradient magnitude and gradient direction of each pixel in the target wheel tread image. The gradient magnitude is calculated based on the gradient values ​​of 0°, 45°, 90° and 135°.

[0125] In related technologies, there are only two gradient directions. This embodiment has four gradient directions, and the calculation of the gradient magnitude requires information from all four directions. The four gradient directions are as follows:

[0126]

[0127] In some examples, the formulas for calculating the gradient magnitude and gradient direction are as follows:

[0128]

[0129] In the formula, M(x, y) represents the gradient magnitude at pixel (x, y), α(x, y) represents the gradient direction at pixel (x, y), and P 0° (x,y) represents the gradient value at 0°, P 45° (x,y) 2 P represents the gradient value at 45°. 90° (x,y) represents the gradient value at 90°, P 135° (x,y) represents the gradient value at 135°.

[0130] In this way, the gradient magnitude and gradient direction of each pixel in the target wheel tread image can be calculated. This embodiment calculates the gradient magnitude in four directions, enabling the detection of pixel value changes from multiple angles. Compared to existing solutions that only calculate the horizontal or vertical directions, using the above gradient magnitude calculation formula to calculate the gradient magnitude in four directions can more comprehensively capture edges with different orientations and avoid omissions.

[0131] Step 203: Perform maximum suppression on the target wheel tread image based on the gradient magnitude and gradient direction to obtain a feature map containing feature points.

[0132] In a specific implementation, maximum suppression is performed on the target wheel tread image based on the gradient magnitude and gradient direction to obtain a feature map containing feature points, which may include:

[0133] Step 203a: Traverse all pixels of the target wheel tread image and determine the pixels corresponding to the local maximum values ​​of the gradient magnitude in each gradient direction as feature points.

[0134] Step 203b: Generate a feature map based on all feature points in the target wheel tread image.

[0135] Specifically, during the process of traversing all pixels of the target wheel tread image one by one, if the gradient magnitude of a pixel is a local maximum in the gradient direction, then the pixel is taken as a feature point; all feature points are obtained to generate a feature map.

[0136] Maximum suppression is essentially a process of selecting feature points. Therefore, it filters pixels based on gradient magnitude and direction, identifying those where the gradient magnitude is a local maximum along the gradient direction, and marking them as feature points. In reality, most of these feature points represent edge characteristics, but some error still exists. Therefore, further filtering based on pixel values ​​is performed to obtain more accurate edge information.

[0137] Step 204: Set a dynamic threshold and mark pixels in the feature map whose pixel values ​​are higher than the dynamic threshold as damaged areas to obtain the true edges of the damaged areas.

[0138] After the aforementioned steps, damaged and smooth regions in the feature map can be distinguished. Furthermore, by setting a threshold, damaged and intact regions can be differentiated. Existing edge detection algorithms typically use a fixed threshold to determine damage features, which is only suitable for scenarios with uniform image information distribution. However, wheelset surfaces have high reflectivity, requiring supplementary lighting to achieve clear imaging. This induces specular reflection, resulting in alternating dynamic highlight and shadow areas on the wheelset surface, causing significant non-uniformity in image grayscale distribution. Under these conditions, the fixed threshold strategy cannot adapt to sudden changes in local illumination, ultimately leading to a significant decrease in edge feature extraction accuracy. Furthermore, both light and oil stains can mimic the characteristics of damaged edges. The dynamic threshold setting method provided in this embodiment effectively addresses sudden changes in local illumination and misjudgments of damaged edges caused by light and oil stains, significantly improving edge feature extraction accuracy. Specifically, the dynamic threshold setting method includes:

[0139] Step 204a: Calculate the median L of the pixel values ​​of all pixels in the feature map.

[0140] Step 204b: Calculate the standard deviation of the pixel values ​​of all pixels in the feature map to obtain the standard coefficient R, R = rβ, where r represents the pre-set scaling factor and β represents the standard deviation of the feature map.

[0141] The scaling factor (r) determines the degree to which the standard coefficient (R) affects the dynamic thresholds Th and TL. A larger r value results in a more drastic change in the dynamic threshold with respect to the standard coefficient R. A smaller r value leads to a smoother threshold change. In practical applications, the r value can be determined based on experiments with a large number of similar images. When r is between 1 and 1.5, the dynamic threshold can effectively segment different scene regions in the image.

[0142] Step 204c: Set a dynamic threshold based on the standard coefficients. The dynamic threshold includes a dynamic upper limit value T. h and dynamic lower limit T l ;

[0143] T h =L+R,T l =LR;

[0144] Step 204d: Set the pixel value to be higher than the dynamic upper limit value T. h Feature points are used as strong edges of the damaged region, with pixel values ​​higher than the dynamic lower limit T. l And below the dynamic upper limit value T h The feature points are used as weak edges of the damaged area.

[0145] In practical implementation, when a feature point is determined to be a strong edge, if a weak edge is directly connected to a strong edge, the weak edge also needs to be set as a strong edge.

[0146] Step 204e: Determine the true edge of the damaged area based on the strong and weak edges.

[0147] This embodiment addresses the issue of uneven light source characteristics on wheelset surfaces caused by differences in the placement of supplementary lighting lamps by proposing a dynamic threshold adjustment mechanism: setting dynamic upper and lower limits linked to pixel distribution. Specifically, when pixel value dispersion within the feature map is large, the dynamic upper limit is automatically increased to filter illumination artifacts at the boundaries of reflective areas; when pixel value dispersion is small, the dynamic upper limit is decreased to enhance the sensitivity of capturing damaged edge features. Through this dynamic adaptation mechanism, the threshold range can match the light intensity distribution characteristics in real time, thereby accurately identifying the actual edge contours of surface damaged areas.

[0148] In some cases, the true edges of the damaged region are determined based on strong and weak edges, including:

[0149] E1, obtain all strong and weak edges, and set the area enclosed by the strong and weak edges as the initial judgment area d;

[0150] Damage to wheelsets is typically glass damage, meaning these damaged areas are closed circular regions. Therefore, after identifying all strong and weak edges, these edges will inevitably enclose several potential damage areas, which may contain damage. These potential damage areas are used as preliminary assessment areas. Edges that do not enclose closed damage areas are simply considered as preliminary assessment areas.

[0151] E2, calculate the mean of the first pixel value of all pixels in the non-preliminary judgment region of the feature map, and determine it as the screening threshold F;

[0152] E3, calculate the mean value of the second pixel value I of all pixels in each preliminary judgment region. d If the average value of the second pixel in the current preliminary judgment area is less than the filtering threshold, the strong and weak edges of the preliminary judgment area are determined to be the true edges of the damaged area; otherwise, neither the strong nor weak edges of the preliminary judgment area are the true edges of the damaged area.

[0153]

[0154] In the formula, d represents the index of the preliminary judgment region, D represents the total number of pixels in the preliminary judgment region d, and I s This represents the pixel value of the s-th pixel in the initial determination region d;

[0155] Specifically, if I d If the edges are less than the screening threshold F, then both the strong and weak edges of region d are initially determined to be the true edges of the damaged region; otherwise, neither the strong nor weak edges of region d are initially determined to be the true edges of the damaged region.

[0156] Since dirt and lighting can create false edges, these false edges can lead to low accuracy in wheelset surface damage identification. This solution further filters the boundaries of damage edges based on the differences in pixels between damaged and undamaged areas, which can further remove false edges affected by lighting and oil stains, increasing the accuracy of damage area extraction.

[0157] This embodiment also provides experimental information on the relevant patterns in step E3, as follows:

[0158] Experimental data: Wheel tread image data were collected over 20 days, with 1200 images collected each day, totaling 24,000 images. These images cover wheel treads under different lighting conditions and with varying degrees of dirt, ensuring the experimental data is broadly representative.

[0159] Experimental procedure:

[0160] Data preprocessing: The 24,000 acquired images were converted to grayscale to facilitate subsequent processing using an adaptive dual-threshold edge detection algorithm.

[0161] Edge detection: An adaptive dual-threshold edge detection algorithm is used to process the preprocessed image one by one, calculate the median and standard deviation of pixel grayscale for each image, dynamically set high and low thresholds, complete edge detection, and mark the initial damaged edges.

[0162] False edge removal: For the initially detected damaged edges, the average gray value of the pixels in the damaged area is calculated. Based on the rule that the gray value of the pixels in the damaged area is lower than that of the pixels on the normal surface, an appropriate threshold is set to remove false edges caused by dirt, lighting, etc., and the final damaged edge detection result is obtained.

[0163] Experimental Results and Analysis:

[0164] Two hundred images with detected damage were randomly selected, and the average pixel grayscale values ​​of the damaged areas and the normal tread areas were calculated separately. The results showed that in 196 of these 200 images, the average pixel grayscale value of the damaged areas was lower than that of the normal tread area, accounting for 98%. This fully verifies the rule that the pixel values ​​of damaged areas are generally lower than those of the normal tread area. Furthermore, analysis of the remaining four images that did not conform to this rule revealed that they were mainly due to severe uneven lighting and significant dirt interference, causing deviations in the algorithm's calculation of the average pixel grayscale value.

[0165] This embodiment adds gradient magnitude calculation in the diagonal direction, enabling the algorithm to capture image edge features more comprehensively and precisely during edge detection, effectively preserving details. During feature enhancement, an adaptive gamma transform is employed, applying different gamma values ​​to dark and bright areas of the image, ensuring better detail representation across varying brightness levels. Then, the mean and standard deviation of local image regions are used for estimation, adaptively selecting the optimal threshold to ensure consistently stable and reliable edge detection results, significantly improving the overall efficiency of image processing.

[0166] In one example, the effect of wheel tread detection is as follows: Figures 3-4 As shown. Figure 3 This is the original image of the wheel tread. Figure 4 The edge detection method provided in this embodiment is used to accurately detect the edge features of die damage.

[0167] The wheel tread detection method provided in this embodiment performs illumination intensity equalization processing on the wheelset tread image using the aforementioned wheel tread image optimization method, effectively suppressing interference from complex lighting backgrounds and significantly enhancing the feature information related to the damaged area in the image. To accurately extract the above features, a gradient analysis and non-maximum suppression strategy is adopted: first, the gradient magnitude and gradient direction of each pixel in the image are calculated; then, non-maximum suppression is performed based on the gradient direction to eliminate noise interference and accurately locate the damaged area. To further improve the ability to capture detailed features, the limitations of traditional bidirectional gradient calculation are overcome, and the gradient extraction direction is extended to four (0°, 45°, 90°, 135°). Multi-directional gradient response fusion enhances the feature characterization accuracy of defects such as microcracks and pitting, thereby achieving high-reliability detection of the damaged area of ​​the wheelset tread.

[0168] Example 3:

[0169] Another embodiment of this application relates to a wheel tread image optimization device. The implementation details of this embodiment's wheel tread image optimization device are described below. The following details are provided for ease of understanding and are not essential for implementing this solution. A schematic diagram of this embodiment's wheel tread image optimization device can be seen as follows: Figure 5 As shown, it includes an image acquisition module 301, an information calculation module 302, a coefficient calculation module 303, an image generation module 304, and a Gaussian filtering module 305.

[0170] Image acquisition module 301 is used to acquire an initial wheel tread image;

[0171] Information calculation module 302 is used to calculate the illumination contrast information of the neighborhood of each pixel in the initial wheel tread image;

[0172] The coefficient calculation module 303 is used to calculate the corresponding gamma correction coefficient based on the illumination contrast information of the neighborhood of each pixel.

[0173] The image generation module 304 is used to perform gamma transformation processing on the corresponding pixels according to the gamma correction coefficient of each pixel to generate an illumination-equalized image.

[0174] The Gaussian filter module 305 is used to perform Gaussian filtering on the illumination equalization image to obtain the target wheel tread image.

[0175] In the specific implementation, the initial wheel tread image is a photo of the wheelset. To facilitate subsequent calculations, the input initial wheel tread image is first processed into grayscale so that the pixel values ​​of the input image are processed to be between [0, 255]. After completing the grayscale processing, the image is then normalized.

[0176] Grayscale processing uses the following formula:

[0177]

[0178] In the formula, n represents the index of a pixel in the initial wheel tread image, Qn represents the normalized gray value of the nth pixel in the initial wheel tread image, and qn represents the gray value of the nth pixel in the initial wheel tread image.

[0179] In addition to performing grayscale processing and normalization on the initial wheel tread image, the image acquisition module 301 also sets the neighborhood specifications, which are the length and width of the neighborhood.

[0180] In some examples, the neighborhood size is 1*1, meaning that for a pixel (x, y), the horizontal coordinate range of the neighborhood is [x-1, x+1], and the vertical coordinate range of the neighborhood is [y-1, y+1].

[0181] In this implementation, the illumination contrast information is the standard deviation of the pixel values ​​of all pixels in the neighborhood centered on the pixel. Illumination contrast information is used to characterize the illumination distribution characteristics of the neighborhood of a pixel. When the absolute value of brightness is directly used as illumination contrast information, it is difficult to accurately reflect the differences in light sources between different test images due to the lack of a dynamic adjustment mechanism. The advantage of using standard deviation as illumination contrast information in this embodiment is reflected in two dimensions: First, it accurately characterizes the uniformity of illumination by quantifying the dispersion of pixel values—when the standard deviation value is small, it indicates that the pixel distribution in the area is highly concentrated, corresponding to the ideal working condition of uniform illumination and no significant brightness gradient; conversely, it reflects the existence of obvious light intensity differences. Second, the magnitude of the standard deviation value is strongly correlated with detail features: a larger standard deviation value not only eliminates the possibility of a single overexposed area (avoiding misjudgment of highlight clipping), but also directly indicates that the area contains rich texture details. Based on these dual characteristics, this embodiment constructs a standard deviation-driven dynamic adjustment mechanism: moderate gamma correction is applied to areas with high standard deviation to preserve the integrity of details, while the correction intensity is enhanced to eliminate systematic illumination deviations in areas with low standard deviation.

[0182] In some examples, the formula for calculating illumination contrast information is as follows:

[0183]

[0184]

[0185] In the formula, σ(x,y) represents the standard deviation of the pixel values ​​of all pixels in the neighborhood centered at pixel (x,y) in the initial wheel tread image, and Q... n (x,y) represents the normalized gray value of pixel (x,y) in the initial wheel tread image, μ(x,y) represents the mean of the neighborhood of pixel (x,y) in the initial wheel tread image, M represents the length of the neighborhood, and N represents the width of the neighborhood.

[0186] Thus, for each pixel (x, y) in the initial wheel tread image, a standard deviation σ(x, y) can be calculated by adjusting its neighborhood. For pixels located at the edge of the initial wheel tread image, only the standard deviation of all pixels in the effective neighborhood is calculated. For example, the pixel (0, 0) located in the upper right corner of the initial wheel tread image has a neighborhood range of ([-1, 1], [-1, 1]). There are no pixels between -1 and 0 on the horizontal axis and between -1 and 0 on the vertical axis. Therefore, when calculating the standard deviation, the range is adjusted to ([0, 1], [0, 1]).

[0187] When setting the gamma correction coefficient, both excessively high and excessively low values ​​may affect the details of the image, making it impossible to accurately extract key feature regions. Therefore, this embodiment uses the following formula to calculate the corresponding gamma correction coefficient:

[0188]

[0189] In the formula, γ represents the gamma correction coefficient, σ represents the illumination contrast information of the neighborhood centered on the pixel, k represents the scaling coefficient, and ε represents the minimum value.

[0190] The scaling factor k primarily adjusts the overall magnitude of the gamma correction coefficient. A larger scaling factor results in a larger overall gamma correction coefficient; a smaller scaling factor results in a smaller overall gamma correction coefficient, making the image darker and reducing contrast.

[0191] In some examples, k takes the value between 0.5 and 1.5.

[0192] The variance σ in the formula for calculating the gamma correction factor 2 The standard deviation reflects the contrast of a local area in an image. A larger standard deviation indicates higher contrast in that area, while a smaller standard deviation indicates lower contrast. High-contrast areas, meaning areas with a large standard deviation, indicate rich detail and high contrast. For example, in bright areas of an image, using a large gamma coefficient for transformation might over-enhance contrast, leading to overexposure or loss of detail. Therefore, using the standard deviation as the denominator results in a smaller calculated gamma transform coefficient, applying a gentler transformation to avoid over-enhancement. Conversely, low-contrast areas, meaning areas with a small standard deviation, indicate similar pixel values ​​and low contrast. In the example image, a small gamma coefficient is insufficient to effectively improve contrast. Therefore, using the standard deviation as the denominator results in a larger calculated gamma transform coefficient, applying a stronger transformation to enhance contrast and make details more visible.

[0193] For example, for a certain pixel (x, y), its standard deviation is σ(x, y). Thus, the gamma correction coefficient of the pixel (x, y) can be calculated according to the formula for calculating the gamma correction coefficient. Therefore, for each pixel, one gamma correction coefficient can be calculated.

[0194] Q out (x,y)=Q n (x,y) γ(x,y)

[0195] In the formula, Q n(x,y) represents the normalized grayscale value of pixel (x,y) in the initial wheel tread image, γ(x,y) is the gamma correction coefficient of pixel (x,y) in the initial wheel tread image, and Q ouT (x,y) represents the gray value of pixel (x,y) after gamma transformation in an image with equal illumination.

[0196] To facilitate calculations, the grayscale values ​​in the initial wheel tread image were normalized. However, subsequent filtering requires increased computational precision. Therefore, inverse normalization is necessary to restore the original pixel range by reverting the grayscale values ​​in the illumination equalization image. The inverse normalization method is a current technique and will not be described further here.

[0197] In the aforementioned scheme, illumination equalization was performed on the initial wheel tread image. However, this overly refined processing introduces a significant amount of noise. Therefore, filtering is performed as follows to remove noise signals and obtain the target wheel tread image:

[0198] Set the Gaussian kernel parameter δ, and generate the Gaussian kernel size K based on the Gaussian kernel parameter.

[0199] K = 2 × δ + 1;

[0200] The kernel size K is the side length of the Gaussian kernel. The Gaussian kernel is the positive selection box, and the range of the Gaussian kernel is K*K.

[0201] For each pixel in each Gaussian kernel, calculate the value of the two-dimensional Gaussian function.

[0202]

[0203] In the formula, u represents the x-coordinate of a pixel in the illumination-equalized image, v represents the y-coordinate of a pixel in the illumination-equalized image, π represents pi, and H(u, v) represents the two-dimensional Gaussian function value of pixel (u, v).

[0204] Within the same Gaussian kernel, the normalization coefficient a(u, v) is set according to the magnitude of the two-dimensional Gaussian function value of each pixel.

[0205] Within the same Gaussian kernel, the sum of the normalization coefficients a(u, v) for all pixels is 1. Therefore, the normalization coefficients are actually weighted according to the magnitude of the two-dimensional Gaussian function value.

[0206] The pixel values ​​of the illumination-equalized image are updated based on the normalization coefficient.

[0207] G(u,v)=a(u,v)×I(u,v);

[0208] In the formula, I(u,v) represents the pixel value of pixel (u,v) in the illumination equalization image before the update, and G(u,v) represents the pixel value of pixel (u,v) in the illumination equalization image after the update.

[0209] The target wheel tread image is generated by iterating through all pixels in the illumination equalization image using a sliding Gaussian kernel to update the pixel value of each pixel in the illumination equalization image.

[0210] Each selected Gaussian kernel performs a Gaussian filter on the pixels within it. Therefore, by continuously sliding the Gaussian kernel, Gaussian filtering can be applied to the illumination equalization image sequentially. To avoid redundant filtering, the sliding distance of the Gaussian kernel is equal to its size.

[0211] In the image under test processed by gamma transform, noise components may be simultaneously amplified. Directly applying smoothing or median filtering to the image after illumination equalization can lead to the erroneous removal of effective feature information in specific areas, negatively impacting damage detection accuracy. This device employs Gaussian filtering to effectively suppress noise interference that may be amplified during gamma transform, thus preserving more complete effective feature information in the image. By synergistically fusing gamma transform and Gaussian filtering, the image edge representation capability is enhanced, significantly improving the gray-level gradient distribution characteristics of edge regions. This not only optimizes the overall smoothness of the illumination-equalized image but also improves the continuity of edge structures, thereby more accurately highlighting the subtle discriminative features of the actual damage area on the wheelset surface.

[0212] The wheel tread image optimization device provided in this embodiment compares each pixel in the image under test with its neighboring pixels to generate a gamma transform coefficient for each pixel. Based on the gamma correction coefficient, the device performs illumination information equalization on the pixels. Therefore, the final generated illumination-equalized image is less affected by illumination, solving the problem of difficult extraction of wheel set image information features under complex lighting conditions. Through partitioned adaptive correction, details in dark areas suppressed by strong light and bright features interfered with by shadows in the original image are effectively restored. The final generated equalized image accurately reflects the true light intensity distribution characteristics of the wheel set surface, providing a reliable image basis for subsequent damage detection.

[0213] It is worth mentioning that all modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed in this application; however, this does not mean that other units are absent in this embodiment.

[0214] Example 4:

[0215] Another embodiment of this application relates to a wheel tread detection device. The implementation details of this embodiment's wheel tread detection device are described below. The following details are provided for ease of understanding and are not essential for implementing this solution. A schematic diagram of this embodiment's wheel tread detection device can be seen as follows: Figure 6 As shown, it includes an image optimization module 401, a gradient calculation module 402, a maximum suppression module 403, and an edge recognition module 404.

[0216] The image optimization module 401 is used to acquire an initial wheel tread image and optimize the initial wheel tread image using the aforementioned wheel tread image optimization device to obtain a target wheel tread image.

[0217] The gradient calculation module 402 is used to calculate the gradient magnitude and gradient direction of each pixel in the target wheel tread image. The gradient magnitude is calculated based on the gradient values ​​of 0°, 45°, 90° and 135°.

[0218] The maximum suppression module 403 is used to perform maximum suppression on the target wheel tread image based on the gradient magnitude and gradient direction to obtain a feature map containing feature points.

[0219] The edge recognition module 404 is used to set a dynamic threshold and mark pixels in the feature map whose pixel values ​​are higher than the dynamic threshold as damaged areas, so as to obtain the true edge of the damaged area.

[0220] In related technologies, there are only two gradient directions. This embodiment has four gradient directions, and the calculation of the gradient magnitude requires information from all four directions. The four gradient directions are as follows:

[0221]

[0222] In some examples, the formulas for calculating the gradient magnitude and gradient direction are as follows:

[0223]

[0224] In the formula, M(x, y) represents the gradient magnitude at pixel (x, y), α(x, y) represents the gradient direction at pixel (x, y), and P 0° (x,y) represents the gradient value at 0°, P 45° (x,y) 2 P represents the gradient value at 45°. 90° (x,y) represents the gradient value at 90°, P 135° (x,y) represents the gradient value at 135°.

[0225] In this way, the gradient magnitude and gradient direction of each pixel in the target wheel tread image can be calculated. This embodiment calculates the gradient magnitude in four directions, enabling the detection of pixel value changes from multiple angles. Compared to existing solutions that only calculate the horizontal or vertical directions, using the above gradient magnitude calculation formula to calculate the gradient magnitude in four directions can more comprehensively capture edges with different orientations and avoid omissions.

[0226] In the specific implementation, maximum suppression is performed on the target wheel tread image based on the gradient magnitude and gradient direction to obtain a feature map containing feature points. This can include: traversing all pixels of the target wheel tread image and determining the pixels corresponding to the local maximum values ​​of the gradient magnitude in each gradient direction as feature points; and generating a feature map based on all feature points of the target wheel tread image.

[0227] Specifically, during the process of traversing all pixels of the target wheel tread image one by one, if the gradient magnitude of a pixel is a local maximum in the gradient direction, then the pixel is taken as a feature point; all feature points are obtained to generate a feature map.

[0228] Maximum suppression is essentially a process of selecting feature points. Therefore, it filters pixels based on gradient magnitude and direction, identifying those where the gradient magnitude is a local maximum along the gradient direction, and marking them as feature points. In reality, most of these feature points represent edge characteristics, but some error still exists. Therefore, further filtering based on pixel values ​​is performed to obtain more accurate edge information.

[0229] After the aforementioned processing, damaged and smooth regions in the feature map can be distinguished. Furthermore, by setting a threshold, damaged and intact regions can be differentiated. Existing edge detection algorithms typically use a fixed threshold to determine damage features, which is only applicable to scenarios where image information is uniformly distributed. However, wheelset surfaces have high reflectivity, requiring supplementary lighting to obtain clear images. This causes specular reflection, resulting in alternating dynamic highlight and shadow areas on the wheelset surface, leading to significant non-uniformity in image grayscale distribution. Under these conditions, the fixed threshold strategy cannot adapt to sudden changes in local illumination, ultimately resulting in a significant decrease in edge feature extraction accuracy. Moreover, both light and oil stains can mimic the characteristics of damaged edges. The dynamic threshold setting method provided in this embodiment can effectively address sudden changes in local illumination and misjudgments of damaged edges caused by light and oil stains, significantly improving edge feature extraction accuracy. Specifically, the dynamic threshold setting method includes:

[0230] Calculate the median L of the pixel values ​​of all pixels in the feature map;

[0231] Calculate the standard deviation of the pixel values ​​of all pixels in the feature map to obtain the standard coefficient R, R = rβ, where r represents the pre-set scaling factor and β represents the standard deviation of the feature map;

[0232] A dynamic threshold is set based on standard coefficients. The dynamic threshold includes a dynamic upper limit value T. h and dynamic lower limit T l ;

[0233] T h =L+R,T l =LR;

[0234] Pixel value higher than dynamic upper limit T h Feature points are used as strong edges of the damaged region, with pixel values ​​higher than the dynamic lower limit T. l And below the dynamic upper limit value T h The feature points are used as weak edges of the damaged area;

[0235] Determine the true edge of the damaged area based on strong and weak edges;

[0236] This embodiment addresses the issue of uneven light source characteristics on wheelset surfaces caused by differences in the placement of supplementary lighting lamps by proposing a dynamic threshold adjustment mechanism: setting dynamic upper and lower limits linked to pixel distribution. Specifically, when pixel value dispersion within the feature map is large, the dynamic upper limit is automatically increased to filter illumination artifacts at the boundaries of reflective areas; when pixel value dispersion is small, the dynamic upper limit is decreased to enhance the sensitivity of capturing damaged edge features. Through this dynamic adaptation mechanism, the threshold range can match the light intensity distribution characteristics in real time, thereby accurately identifying the actual edge contours of surface damaged areas.

[0237] In some cases, the true edges of the damaged region are determined based on strong and weak edges, including:

[0238] Obtain all strong and weak edges, and set the region enclosed by the strong and weak edges as the initial determination region d;

[0239] Damage to wheelsets is typically glass damage, meaning these damaged areas are closed circular regions. Therefore, after identifying all strong and weak edges, these edges will inevitably enclose several potential damage areas, which may contain damage. These potential damage areas are used as preliminary assessment areas. Edges that do not enclose closed damage areas are simply considered as preliminary assessment areas.

[0240] Calculate the mean value of the first pixel of all pixels in the non-preliminary judgment region of the feature map, and determine it as the screening threshold F;

[0241] Calculate the mean value I of the second pixel of all pixels in each preliminary determination region.d If the average value of the second pixel in the current preliminary judgment area is less than the filtering threshold, the strong and weak edges of the preliminary judgment area are determined to be the true edges of the damaged area; otherwise, neither the strong nor weak edges of the preliminary judgment area are the true edges of the damaged area.

[0242]

[0243] In the formula, d represents the index of the preliminary judgment region, D represents the total number of pixels in the preliminary judgment region d, and I s This represents the pixel value of the s-th pixel in the initial determination region d;

[0244] Specifically, if I d If the edges are less than the screening threshold F, then both the strong and weak edges of region d are initially determined to be the true edges of the damaged region; otherwise, neither the strong nor weak edges of region d are initially determined to be the true edges of the damaged region.

[0245] Since dirt and lighting can create false edges, these false edges can lead to low accuracy in wheelset surface damage identification. This solution further filters the boundaries of damage edges based on the differences in pixels between damaged and undamaged areas, which can further remove false edges affected by lighting and oil stains, increasing the accuracy of damage area extraction.

[0246] This embodiment adds gradient magnitude calculation in the diagonal direction, enabling the algorithm to capture image edge features more comprehensively and precisely during edge detection, effectively preserving details. During feature enhancement, an adaptive gamma transform is employed, applying different gamma values ​​to dark and bright areas of the image, ensuring better detail representation across varying brightness levels. Then, the mean and standard deviation of local image regions are used for estimation, adaptively selecting the optimal threshold to ensure consistently stable and reliable edge detection results, significantly improving the overall efficiency of image processing.

[0247] The wheel tread detection device provided in this embodiment performs illumination intensity equalization processing on the wheelset tread image using the aforementioned wheel tread image optimization device, effectively suppressing interference from complex lighting backgrounds and significantly enhancing the feature information related to the damaged area in the image. To accurately extract these features, a combined gradient analysis and non-maximum suppression strategy is employed: first, the gradient magnitude and direction of each pixel in the image are calculated; then, non-maximum suppression is performed based on the gradient direction to eliminate noise interference and accurately locate the damaged area. To further improve the ability to capture detailed features, the limitations of traditional bidirectional gradient calculation are overcome, and the gradient extraction direction is extended to four (0°, 45°, 90°, 135°). Multi-directional gradient response fusion enhances the feature representation accuracy of defects such as microcracks and pitting, thereby achieving high-reliability detection of the damaged area of ​​the wheelset tread.

[0248] Example 5:

[0249] Another embodiment of this application relates to an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the methods described in the above embodiments.

[0250] The memory and processor are connected via a bus, which can include any number of interconnecting buses and bridges, connecting various circuits of one or more processors and memories. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and will not be described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over the wireless medium via an antenna, which further receives data and transmits it to the processor.

[0251] The processor manages the bus and general processing, and also provides various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory is used to store data used by the processor during operation.

[0252] Example 6:

[0253] Another embodiment of this application relates to a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the method embodiments described above.

[0254] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0255] Those skilled in the art will understand that the above embodiments are specific embodiments for implementing this application, and in practical applications, various changes can be made to them in form and detail without departing from the spirit and scope of this application.

Claims

1. A method for optimizing wheel tread images, characterized in that, include: Obtain the initial wheel tread image; Calculate the illumination contrast information of the neighborhood of each pixel in the initial wheel tread image, wherein the illumination contrast information includes the standard deviation of the pixel values ​​of all pixels in the neighborhood centered on the pixel. Based on the illumination contrast information of the neighborhood of each pixel, the corresponding gamma correction coefficient is calculated using the following formula: ; In the formula, γ Indicates the gamma correction factor. σ This represents the illumination contrast information of the neighborhood centered on the pixel. k Indicates the scaling factor. ε Indicates the minimum value; Based on the gamma correction coefficient of each pixel, gamma transformation is performed on the corresponding pixel to generate an illumination-equalized image. Gaussian filtering is applied to the illumination equalization image to obtain the target wheel tread image.

2. The wheel tread image optimization method according to claim 1, characterized in that, The step of performing Gaussian filtering on the illumination equalization image to obtain the target wheel tread image includes: Set the Gaussian kernel parameter δ, and generate the Gaussian kernel size K based on the Gaussian kernel parameter; K = 2 × δ + 1; For each pixel in each Gaussian kernel, calculate the value of the two-dimensional Gaussian function; ; In the formula, u represents the x-coordinate of a pixel in the illumination equalization image, v represents the y-coordinate of a pixel in the illumination equalization image, π represents pi, and H(u, v) represents the two-dimensional Gaussian function value of pixel (u, v). Within the same Gaussian kernel, the normalization coefficient a(u, v) is set according to the magnitude of the two-dimensional Gaussian function value of each pixel. The pixel values ​​of the illumination-equalized image are updated based on the normalization coefficient; G(u,v)=a(u,v)×I(u,v); In the formula, I(u,v) represents the pixel value of pixel (u,v) in the illumination equalization image before the update, and G(u,v) represents the pixel value of pixel (u,v) in the illumination equalization image after the update. The target wheel tread image is generated by iterating through all pixels in the illumination equalization image using a sliding Gaussian kernel to update the pixel value of each pixel in the illumination equalization image.

3. A method for detecting wheel tread surface, characterized in that, include: An initial wheel tread image is obtained, and the initial wheel tread image is optimized using the wheel tread image optimization method described in claim 1 or 2 to obtain a target wheel tread image. The gradient magnitude and gradient direction of each pixel in the target wheel tread image are calculated. The gradient magnitude is calculated based on the gradient values ​​of 0°, 45°, 90° and 135°. Maximal suppression is performed on the target wheel tread image based on the gradient magnitude and gradient direction to obtain a feature map containing feature points. A dynamic threshold is set, and pixels with pixel values ​​higher than the dynamic threshold in the feature map are marked as damaged areas to obtain the true edges of the damaged areas.

4. The wheel tread detection method according to claim 3, characterized in that, The formulas for calculating the gradient magnitude and gradient direction are as follows: ; ; In the formula, M(x,y) represents the gradient magnitude at pixel (x,y), and α(x,y) represents the gradient direction at pixel (x,y). This represents the gradient value at 0°. This represents the gradient value at 45°. This represents the gradient value at 90°. This represents the gradient value at 135°.

5. The wheel tread detection method according to claim 3, characterized in that, The method for setting the dynamic threshold includes: Calculate the median L of the pixel values ​​of all pixels in the feature map; Calculate the standard deviation of the pixel values ​​of all pixels in the feature map to obtain the standard coefficient R, R=rβ, where r represents the pre-set scaling factor and β represents the standard deviation of the feature map; A dynamic threshold is set based on standard coefficients. The dynamic threshold includes a dynamic upper limit value T. h and dynamic lower limit T l ; T h =L+R, T l =L-R; Pixel value higher than dynamic upper limit T h Feature points are used as strong edges of the damaged region, with pixel values ​​exceeding the dynamic lower limit. T l And below the dynamic upper limit value T h The feature points are used as weak edges of the damaged area; The true edges of the damaged area are determined based on strong and weak edges.

6. The wheel tread detection method according to claim 3, characterized in that, Maximum suppression is performed on the target wheel tread image based on the gradient magnitude and gradient direction to obtain a feature map containing feature points, including: Traverse all pixels of the target wheel tread image and determine the pixels corresponding to the local maximum values ​​of the gradient magnitude in each gradient direction as feature points. Generate a feature map based on all feature points in the target wheel tread image.

7. The wheel tread detection method according to claim 5, characterized in that, The process of determining the true edge of the damaged region based on strong and weak edges includes: Obtain all strong and weak edges, and set the area enclosed by the strong and weak edges as the initial determination area. d ; Calculate the mean value of the first pixel of all pixels in the non-preliminary judgment region of the feature map, and determine it as the screening threshold. Calculate the average second pixel value of all pixels in each preliminary determination region; If the average value of the second pixel in the current preliminary judgment area is less than the filtering threshold, the strong and weak edges of the preliminary judgment area are determined to be the true edges of the damaged area; otherwise, neither the strong nor weak edges of the preliminary judgment area are the true edges of the damaged area.

8. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Cutter head image detection and correction method under non-uniform illumination in shield tunneling machine

    CN118279210A