Improved filtering and local direction adaptive rust identification method for hull surface rust image

By combining wavelet transform and total variational fusion denoising algorithm and adaptive Gaussian core denoising algorithm, the problems of noise interference and unclear edge recognition in the hull surface rust image are solved, and efficient rust recognition effect is achieved.

CN120355613APending Publication Date: 2025-07-22JIANGSU UNIV OF SCI & TECH
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202510434623.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

The existing image filtering and edge detection methods are difficult to effectively remove complex background noise, retain rust details, and identify inaccurately in low contrast or fine edges when processing hull surface rust images.

Method used

Combining the improved wavelet transform and total variational fusion denoising algorithm for global denoising, the adaptive Gaussian core denoising algorithm is used for local denoising, and the rust edge is extracted through the direction adaptive edge detection algorithm.

Benefits of technology

It effectively removes noise from the hull surface image, retains important details, and improves the accuracy and robustness of rust identification, especially in complex backgrounds that can accurately extract rust edge features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120355613A_ABST
    Figure CN120355613A_ABST
Patent Text Reader

Abstract

The invention discloses an improved filtering and local direction adaptive rust recognition method for a hull surface rust image, which comprises the following steps of: 1, performing gray processing on the hull surface rust image to obtain a gray image; 2, performing global denoising on the image after gray scale by adopting a wavelet transform and total variation fusion denoising algorithm to obtain a globally denoised image; 3, performing local denoising on the globally denoised image by adopting a self-adaptive Gaussian kernel denoising algorithm to obtain a final denoised image; 4, carrying out the edge extraction of the final denoised image through a direction self-adaptive edge detection algorithm, and obtaining a rust image; according to the method, the improved wavelet transform and total variation fusion denoising algorithm is combined, efficient noise removal is achieved, the size and the standard deviation of the filtering kernel are adjusted in a self-adaptive mode, noise of a local area is effectively processed, detail loss is avoided, and the image quality is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image recognition, and in particular to an improved filtering and local direction self-adaptive rust recognition method for rust images on a hull surface. Background Art

[0002] Image processing technology occupies a core position in the field of machine vision and is widely used in tasks such as target detection, target positioning, and defect detection. With the development of industrial automation and intelligent manufacturing, the recognition and detection of rust on the surface of the hull has become an important research direction. In order to improve the processing accuracy of the hull surface image, especially in the case of complex background and uneven lighting, image filtering and edge detection play an important role in practical applications.

[0003] Existing image filtering methods include histogram equalization, Gaussian filtering, median filtering, bilateral filtering, etc. Among them, Gaussian filtering is widely used in denoising, which can effectively smooth images and remove most noise, but it has certain shortcomings in removing detail information and sharpening edges. Median filtering effectively retains the edge information of the image and is suitable for removing salt and pepper noise, but it is less effective for removing other types of noise. Although bilateral filtering can better process image details, it has high computational complexity and relatively slow processing speed.

[0004] In terms of image edge detection, traditional algorithms such as the Sobel operator, Canny operator, and Laplacian operator are widely used in edge detection. These methods extract image edges by calculating the gradient of image pixels, but in noisy images, they are easily interfered by noise, resulting in inaccurate recognition results. In order to solve this problem, researchers have proposed a variety of improved algorithms in recent years.

[0005] Existing filtering and edge detection methods still face certain challenges when dealing with hull surface images with complex background noise and variable lighting conditions. To address this issue, how to retain image detail information while denoising and achieve more accurate rust recognition is a difficult problem that needs to be solved in the current image processing field.

[0006] Filtering algorithms and rust recognition methods in image processing have achieved good results in general environments. However, there are still some challenges in processing rust images on the surface of the hull. First, the rust images on the surface of the hull are usually affected by lighting changes, noise interference and complex backgrounds. When processing such images, traditional image denoising algorithms often cannot effectively remove background noise while retaining the detailed features of the rust, and are prone to losing the details of the rust.

[0007] Secondly, although existing rust edge detection algorithms can extract the basic edge information in images, they often perform poorly for rust edges in complex backgrounds, especially in cases of low contrast or subtle edges. Existing edge detection algorithms mainly rely on global gradient information and cannot adaptively adjust according to the characteristics of local regions, resulting in insufficient accuracy and robustness when dealing with complex scenes.

[0008] How to improve the denoising effect and recognition accuracy of rust images in complex backgrounds remains a technical problem to be solved. Traditional image filtering and edge detection methods have not well solved these problems. Especially when dealing with rust images on the hull surface, more refined and robust algorithms are needed. Summary of the Invention

[0009] Object of the Invention: To solve the problems of noise interference, detail loss, and unclear edge recognition in rust images on the hull surface, the present invention proposes an improved image filtering and local direction adaptive rust recognition method. By combining an improved wavelet transform and total variation fusion denoising algorithm, efficient noise removal is achieved. And by adaptively adjusting the size and standard deviation of the filter kernel, the noise in local regions is effectively processed, avoiding detail loss and improving the image quality.

[0010] Technical Solution: An improved filtering and local direction adaptive rust recognition method for rust images on the hull surface includes the following steps:

[0011] Step 1: Perform grayscale processing on the rust image on the hull surface to obtain the grayscale image;

[0012] Step 2: Use the wavelet transform and total variation fusion denoising algorithm to perform global denoising on the grayscale image to obtain the globally denoised image;

[0013] Step 3: Use the adaptive Gaussian kernel denoising algorithm to perform local denoising on the globally denoised image to obtain the finally denoised image;

[0014] Step 4: Use the direction adaptive edge detection algorithm to perform edge extraction on the finally denoised image to obtain the rust image.

[0015] Further, in Step 2, the operation of using the wavelet transform and total variation fusion denoising algorithm to perform global denoising on the grayscale image to obtain the globally denoised image specifically includes:

[0016] Use wavelet transform to divide the grayscale image into low frequency and high frequency, expressed as:

[0017] f(x,y) = DWT(LL,LH,HL,HH)

[0018] Among them, LL represents the low-frequency component, LH, HL, and HH represent the high-frequency components, and f(x, y) represents the grayscale image; the low-frequency component LL is smoothed using Gaussian filtering, expressed as:

[0019] LL' = G σ (LL)

[0020] Among them, G σ is a Gaussian kernel with a standard deviation of σ;

[0021] An adaptive threshold denoising method based on local characteristics is used to process the high-frequency components LH, HL, and HH to obtain the processed high-frequency components LH', HL', and HH';

[0022] The inverse wavelet transform is performed using the smoothed low-frequency component LL' and the processed high-frequency components LH', HL', and HH' to reconstruct the image, and the wavelet-denoised image is obtained, expressed as:

[0023] f′(x, y) = IDWT(LL', LH', HL', HH')

[0024] The wavelet-denoised image f′(x, y) is normalized to the range [0, 1] to obtain the normalized image u0;

[0025] The optimization objective function of the total variation is established, expressed as:

[0026]

[0027] In the formula, u is the image after total variation optimization, and λ is the weight parameter;

[0028] The Chambolle algorithm is used to iteratively solve the optimization objective function of the total variation to obtain the optimal solution u;

[0029] The optimal solution u is mapped back to the original grayscale range to obtain the final denoised image.

[0030] Furthermore, the operation of using an adaptive threshold denoising method based on local characteristics to process the high-frequency components LH, HL, and HH to obtain the processed high-frequency components LH', HL', and HH' specifically includes:

[0031] The local noise level of the grayscale image is calculated according to the following formula, expressed as:

[0032]

[0033] In the formula, is the Laplacian operator of the grayscale image, and Var(·) represents the variance operator;

[0034] Determine an adaptive threshold based on the local noise level, expressed as:

[0035] τ = LocalVariance · k

[0036] where k is an adjustment factor;

[0037] Attenuate the part of the absolute value of the high-frequency component that is greater than the adaptive threshold, and directly set the part that is not greater than the adaptive threshold to 0, expressed as:

[0038]

[0039] where y represents the current high-frequency component, represents the high-frequency component after threshold processing.

[0040] Furthermore, in step 3, the adaptive Gaussian kernel denoising algorithm is used to perform local denoising on the globally denoised image to obtain the finally denoised image. The specific operations include:

[0041] Use the Sobel operator to calculate the gradient components of the gray-scaled image in the horizontal and vertical directions respectively;

[0042] Combine the gradient components in the horizontal and vertical directions to calculate the total gradient magnitude of each pixel point:

[0043]

[0044] where G x (x, y) and G y (x, y) represent the gradient components of the gray-scaled image in the horizontal and vertical directions respectively, and are defined by the following formulas:

[0045]

[0046] where f(x, y) represents the gray-scaled image;

[0047] For each local region, according to the noise intensity of the local region, adaptively determine the size of the Gaussian kernel and the standard deviation of Gaussian filtering according to the following formula:

[0048] KernelSize = clip(2 · mean(LocalStd(x, y)), K min , K max )

[0049]

[0050] where clip(x, a, b) means restricting x within the interval [a, b], K min and K maxare the minimum and maximum sizes of the Gaussian kernel, σ min and σ max are the minimum and maximum values of the standard deviation, respectively;

[0051] Where:

[0052] LocalStd(x,y) = G σ (Grad(x,y))

[0053] Where G σ is the Gaussian smoothing operation, and Grad(x,y) represents the local gradient magnitude;

[0054] For each local region, according to the adaptively determined size of the Gaussian kernel and the standard deviation of Gaussian filtering, the corresponding Gaussian filtering operation is applied, which is expressed as:

[0055] f′(x,y) = G KernelSize,σ (f(x,y))

[0056] Where G KernelSize,σ represents the Gaussian kernel, with a size of KernelSize and a standard deviation of σ.

[0057] Furthermore, in step 4, the direction adaptive edge detection algorithm is used to extract the edges of the finally denoised image to obtain the rust image. The specific operations include:

[0058] Using the Sobel operator to calculate the gradient components of the finally denoised image in the horizontal and vertical directions respectively;

[0059] Combining the gradient components of the image in the horizontal and vertical directions, and using the following formula to calculate the total gradient magnitude of each pixel:

[0060]

[0061] Where G x (x,y) and G y (x,y) represent the gradient components in the horizontal and vertical directions respectively;

[0062] Extracting the edge direction of each pixel through the following formula:

[0063]

[0064] Judging the edge direction of the local region according to the calculated gradient direction of each pixel;

[0065] For each local region, adaptively select convolution kernels according to its edge direction, including: horizontal convolution kernel, vertical convolution kernel and diagonal convolution kernel;

[0066] The horizontal convolution kernel is used to detect horizontal edges and is expressed as:

[0067]

[0068] The vertical convolution kernel is used to detect vertical edges and is expressed as:

[0069]

[0070] The diagonal convolution kernel is used to detect diagonal edges and includes:

[0071]

[0072] By calculating the standard deviation in each direction, the weights in each direction are dynamically adjusted and are expressed as:

[0073]

[0074] where σ i represents the standard deviation in the i-th direction, and α i represents the weight in this direction;

[0075] By performing weighted summation on the gradient magnitudes in each direction, the final edge magnitude image is obtained and is expressed as:

[0076] G final = σ1G horizontal + σ2G vertical + σ3G diagonal1 + σ4G diagonal2

[0077] In the formula, G horizontal , G vertical , G diagonal1 , G diagonal2 respectively represent the gradient magnitudes in the horizontal, vertical, and two diagonal directions.

[0078] Perform binary processing on the edges of the final edge magnitude image so that each pixel point in the final output image has only two states: edge point or non-edge point, and finally obtain the rust image. Beneficial effects: Compared with the prior art, the present invention has the following advantages:

[0079] (1) The method of the present invention first uses an improved wavelet transform and total variation fusion denoising algorithm to remove noise from the image. By combining the multi-scale decomposition of wavelet transform and the edge-preserving characteristics of total variation, the noise in the image is eliminated and important detail information is retained. Secondly, a denoising algorithm based on an adaptive Gaussian kernel is adopted. By combining local gradient information and noise evaluation, the size and standard deviation of the filtering kernel are dynamically adjusted, effectively processing the noise in the local area, thereby improving the denoising effect under complex backgrounds, avoiding detail loss, and enhancing the image quality. Finally, through a direction-adaptive edge detection algorithm, according to the gradient characteristics of the local area of the image, the appropriate convolution kernel direction is automatically selected, improving the accuracy of edge detection. Especially in the case of multi-directions and complex backgrounds, the edge features of the rust on the hull surface can be accurately extracted.

[0080] (2) The method of the present invention accurately detects rust edges in different directions by dynamically adjusting the direction and size of the convolution kernel. When processing images with complex backgrounds and multi-directional edge features, it can significantly improve the accuracy of rust recognition. By weighting the gradient information in different directions, the present invention effectively solves the problem of blurred rust edges and improves the final recognition effect. Description of the Drawings

[0081] Figure 1 It is a schematic diagram of the overall framework of an improved filtering and local direction-adaptive rust recognition method proposed by the present invention;

[0082] Figure 2 It is a flowchart of the overall denoising method;

[0083] Figure 3 It is a wavelet transform structure framework;

[0084] Figure 4 It is a flowchart of the local denoising algorithm;

[0085] Figure 5 It is a flowchart of the edge detection algorithm. Detailed Embodiment

[0086] The technical solution of this embodiment will be further elaborated below in conjunction with the drawings and embodiments.

[0087] This embodiment proposes an improved filtering and local direction-adaptive rust recognition method for rust images on the hull surface, as Figure 1 shown, which mainly includes the following steps:

[0088] Step 1: Grayscale processing: The input color image is grayscale processed to convert it into a grayscale image, which can reduce the computational complexity and retain sufficient edge information.

[0089] Step 2: Overall denoising: In the image processing of the hull steel plate surface, the presence of noise has a great impact on the image quality, especially for complex texture images with rich details. Therefore, in this embodiment, an improved wavelet transform and total variation fusion denoising algorithm is used for overall denoising. The image is transformed into the frequency domain for noise removal and then returned to the spatial domain, while retaining important image details. This improved wavelet transform and total variation fusion denoising algorithm utilizes the advantages of wavelet transform in multi-scale decomposition and the good retention characteristics of the total variation method for image edges and textures, thus achieving efficient image denoising processing. Now, in combination with Figure 2 The improved wavelet transform and total variation fusion denoising algorithm proposed in this embodiment will be further described.

[0090] Using wavelet transform, an image can be decomposed into different frequency components. The wavelet transform structural framework Figure 3 As shown, using wavelet transform, an image can be divided into low frequency and high frequency, expressed as:

[0091] f(x,y) = DWT(LL,LH,HL,HH)

[0092] Among them, LL represents the low-frequency component, indicating the smooth characteristics of the image; LH, HL, and HH represent the high-frequency components, respectively indicating the details and noise information of the image in the horizontal, vertical, and diagonal directions. The low-frequency component usually reflects the large-scale structure, while the high-frequency component reflects the rapidly changing information, including texture, details, and noise.

[0093] Traditional wavelet denoising methods mainly remove noise by thresholding the high-frequency components, but this is likely to cause the loss of edge information. To overcome this problem, this embodiment improves on wavelet denoising by adaptively smoothing the low-frequency component and further optimizing the high-frequency component processing to enhance the image quality.

[0094] The low-frequency component LL mainly contains the background and illumination information of the image. To improve the uneven illumination situation and avoid excessive smoothing affecting the image clarity, this embodiment uses Gaussian filtering to smooth the low-frequency component:

[0095] LL' = G σ (LL)

[0096] Among them, G σ is a Gaussian kernel with a standard deviation of σ. The size of σ is related to the amplitude of the image illumination change and is determined through experiments. For regions in the image with large illumination changes, a larger Gaussian kernel (i.e., a larger σ value) can effectively smooth the irregular illumination fluctuations and remove the influence of uneven illumination; while in regions with small illumination changes, a smaller Gaussian kernel helps to retain more details. This embodiment selects a 3×3 Gaussian kernel, whose size is suitable for most cases, can weaken the low-frequency noise while retaining the large-scale background information.

[0097] The high-frequency components LH, HL, and HH contain texture details and noise information. This embodiment proposes an adaptive threshold denoising method based on local characteristics.

[0098] Noise usually appears as random variations in the image, especially obvious in the high-frequency components. The Laplacian operator is a commonly used tool in image processing. By calculating the Laplacian operator, the second-order derivative of the image is calculated to capture the regions where the pixel values change most drastically in the image. Compared with the first-order derivative, the second-order derivative is more sensitive to rapid changes (such as noise), thus providing a reliable basis for noise detection.

[0099] Calculate the noise variance of the local region according to the following formula:

[0100]

[0101] where is the Laplacian operator of the image, which is the second-order derivative of the image and approximately represents the local noise level. Var(·) represents the variance operator.

[0102] Determine the adaptive threshold according to the local noise level:

[0103] τ = LocalVariance · k

[0104] In the formula, k is an adjustment factor used to balance the effects of noise removal and detail preservation, and usually takes values from 0.2 to 0.5.

[0105] Attenuate the part of the high-frequency component whose absolute value is greater than the threshold, and directly set the part less than the threshold to zero. This can effectively remove noise while trying to retain the detail information of the image. The calculation method of soft threshold processing for high-frequency components:

[0106]

[0107] where y represents the current high-frequency component, τ represents the calculated noise threshold, represents the high-frequency component after threshold processing.

[0108] Perform wavelet inverse transform on the low-frequency and high-frequency components processed through the above steps to reconstruct the image:

[0109] f′(x, y) = IDWT(LL', LH', HL', HH')

[0110] On the basis of wavelet denoising, to further remove the residual noise, enhance the image edges and details, and improve the smoothness and visual effect of the image, this embodiment introduces the total variation method for optimization. The mathematical model of total variation denoising is:

[0111]

[0112] Among them, u0 is the image after wavelet denoising, u is the image after total variation optimization, and λ is the weight parameter that determines the balance between noise smoothing and edge preservation.

[0113] The steps of optimizing by using the total variation method include:

[0114] Normalize the image u0 after wavelet denoising to the range of [0, 1];

[0115] Use the Chambolle algorithm to iteratively solve the optimal solution u;

[0116] Map the optimal solution u back to the original gray level range to obtain the final denoised image.

[0117] Although the overall denoising process effectively reduces most of the noise, there may still be some local noise points left, especially in areas around complex textures or weld seams, and further local denoising is required.

[0118] Step 3: Local denoising: The image is denoised in the local area by an improved adaptive Gaussian kernel denoising algorithm, which further improves the image quality and provides a clear input image for the recognition of rust.

[0119] The surface of the hull steel plate often contains some small-scale, high-frequency noises, such as light spots, stray reflections, shooting noises, etc. These noises are usually limited to local areas and interfere with the details in the image. In order to further improve the image quality, especially to retain the tiny details of the weld seam. In this embodiment, an improved adaptive Gaussian kernel denoising algorithm is used for local denoising, aiming to improve the local denoising effect of the image by dynamically adjusting the size and standard deviation of the filtering kernel, and flexibly adjusting the denoising parameters according to the noise intensity and local detail information of the image, so as to improve the denoising effect, especially more advantageous when dealing with complex scenes. The specific flow chart of the local denoising algorithm is as Figure 4 shown.

[0120] The noise in the image usually appears as local high-frequency components, and its distribution varies with the complexity of the scene. Therefore, in this embodiment, the local gradient magnitude is introduced as an evaluation index of the noise intensity.

[0121] First, use the Sobel operator to calculate the gradient components of the image in the horizontal and vertical directions respectively. The gradient represents the intensity of the change of the image in a certain direction and is often used for edge detection.

[0122] Use the Sobel operator to calculate the gradient in the horizontal direction of the image, and obtain the gradient value of each pixel point in the horizontal direction of the image, that is:

[0123]

[0124] Use the Sobel operator to calculate the gradient of the image in the vertical direction, obtaining the gradient value of each pixel in the image in the vertical direction, i.e.:

[0125]

[0126] Through these two-step calculations, the obtained gradient information can provide the basic direction of edge changes in the image. However, simply relying on the gradient information in the horizontal and vertical directions cannot comprehensively reflect all edge features in the image. Therefore, combining the gradients in the horizontal and vertical directions, use the following formula to calculate the total gradient magnitude of each pixel:

[0127]

[0128] where G x (x,y) and G y (x,y) respectively represent the gradient components of the image in the x and y directions, which are defined by the following formula:

[0129]

[0130]

[0131] In the formula, f(x,y) represents the grayscale image.

[0132] In addition, combining the gradient direction of each pixel, extract the edge direction of each pixel in the image through the following formula:

[0133]

[0134] θ(x,y) is the edge direction information of each pixel in the image, providing the basis for subsequent adaptive convolution kernel selection.

[0135] Image noise usually exists in the form of high-frequency components. The gradient magnitude of the image reflects the intensity of image changes, and in areas with strong noise, the gradient magnitude is large. To evaluate the noise intensity, this algorithm calculates the local standard deviation of each pixel as the noise evaluation index. By smoothing the gradient magnitude, the noise intensity distribution in each local area of the image can be obtained.

[0136] Based on the gradient magnitude distribution, calculate the standard deviation of the local area as the noise evaluation index. The calculation of the standard deviation is achieved by performing Gaussian smoothing on the gradient magnitude. Gaussian filtering can smooth out the fine noise in the image while retaining the larger structural features. The calculation formula of Gaussian filtering is as follows:

[0137]

[0138] Among them, the standard deviation σ is used to control the smoothness of filtering. A smaller σ value indicates a stronger smoothing effect, while a larger σ value will preserve more image details.

[0139] The calculation formula of Gaussian filtering is as follows:

[0140] LocalStd(x,y) = G σ (Grad(x,y))

[0141] Among them, G σ is the Gaussian smoothing operation, Grad(x,y) represents the local gradient magnitude, and the standard deviation σ is used to control the smoothness of filtering.

[0142] According to the local distribution of the noise intensity, the size and standard deviation of the Gaussian kernel are dynamically adjusted to meet the denoising requirements of different regions of the image. The selection formulas for the kernel size and standard deviation are as follows:

[0143] ernelSize = clip(2 · mean(LocalStd(x,y)), K min , K max )

[0144]

[0145] Among them, clip(x,a,b) means restricting x within the interval [a,b], and K min and K max are the minimum and maximum sizes of the Gaussian kernel respectively, and σ min and σ max are the minimum and maximum values of the standard deviation respectively.

[0146] The final denoising operation is completed by the Gaussian filter. For each local region, according to the adaptively selected kernel size and standard deviation, the corresponding Gaussian filtering operation is applied. The calculation formula for the denoising operation is:

[0147] f′(x,y) = G KernelSize,σ (f(x,y))

[0148] Among them, G KernelSize,σ is a Gaussian kernel with a size of KernelSize and a standard deviation of σ.

[0149] Through this series of steps, the denoising parameters can be flexibly adjusted according to the local characteristics of the image and the noise intensity, so as to remove the noise while retaining as much detail and edge information in the image as possible. Especially when dealing with complex scenes, it shows significant denoising advantages.

[0150] Step 4: Rust Recognition: Through the direction - adaptive edge detection algorithm, the precise extraction of image edges, especially the recognition of rust, is achieved by using the dynamic convolution kernel adjustment technology.

[0151] For the image after overall and local denoising processing, the noise has been effectively suppressed, but precise edge extraction is still required. Especially in the weld area, these edges are often not clearly distinguishable from the background and may have complex shapes in different directions.

[0152] In this embodiment, a direction - adaptive edge detection algorithm is adopted. By dynamically adjusting the direction and size of the convolution kernel, precise edge detection is carried out based on the gradient features of the local area of the image. Compared with traditional edge detection methods, this algorithm can automatically select the most suitable convolution kernel according to the local gradient direction, thus significantly improving the detection accuracy. This algorithm can effectively identify edge features in different directions in the image, has strong adaptability and excellent performance. The specific flow chart of the direction - adaptive edge detection algorithm is as Figure 5 shown.

[0153] The Sobel operator is used to calculate the gradient components of the image in the horizontal and vertical directions respectively. The gradient represents the intensity of the change of the image in a certain direction and is often used in edge detection.

[0154] Use the Sobel operator to calculate the gradient of the image in the horizontal direction, and obtain the gradient value of each pixel point in the image in the horizontal direction, that is:

[0155]

[0156] Use the Sobel operator to calculate the gradient of the image in the vertical direction, and obtain the gradient value of each pixel point in the image in the vertical direction, that is:

[0157]

[0158] Through calculation, the obtained gradient information can provide the basic direction of edge changes in the image. However, simply relying on the gradient information in the horizontal and vertical directions cannot comprehensively reflect all edge features in the image. Therefore, further combining the horizontal and vertical gradients, the total gradient magnitude of each pixel point is calculated using the following formula:

[0159]

[0160] where, G x (x,y) and G y (x,y) represent the gradient components of the image in the x and y directions respectively. In addition, the algorithm also calculates the gradient direction of each pixel point, and extracts the edge direction of each point in the image through the following formula:

[0161]

[0162] The obtained gradient direction is the edge direction information in the image, providing a basis for subsequent adaptive convolution kernel selection.

[0163] Based on the calculated gradient direction of each pixel point, the algorithm determines the edge direction of the region and adaptively selects a suitable convolution kernel according to different gradient directions. To adapt to edge information in different directions, the algorithm uses three basic convolution kernels: horizontal convolution kernel, vertical convolution kernel, and diagonal convolution kernel.

[0164] The horizontal convolution kernel is used to detect horizontal edges in the image as follows:

[0165]

[0166] The vertical convolution kernel is used to detect vertical edges in the image as follows:

[0167]

[0168] The diagonal convolution kernel is used to detect diagonal edges in the image, including:

[0169]

[0170] By calculating the gradient direction of each region in the image, the algorithm selects the convolution kernel most suitable for that direction. For example, if the gradient direction of a certain local region is close to the horizontal direction, the horizontal convolution kernel is selected for convolution operation; if it is the vertical direction, the vertical convolution kernel is used.

[0171] To improve the accuracy of edge detection, after selecting a suitable convolution kernel, the algorithm weights the gradient magnitude in each direction. By calculating the standard deviation in each direction, the weights in each direction are dynamically adjusted to highlight the significant edge features in the image. A direction with a larger standard deviation indicates that the edge features in that direction are more obvious, so a higher weight is given to that direction.

[0172] The calculation formula for the weights in each direction is:

[0173]

[0174] where σ i represents the standard deviation in the i-th direction, and α i represents the weight in that direction.

[0175] By performing weighted summation on the gradient magnitudes in each direction, the final edge magnitude image is obtained:

[0176] G final =σ1G horizontal +σ2Gvertical +σ3G diagonal1 +σ4G diagonal2

[0177] where G horizontal , G vertical , G diagonal1 , G diagonal2 respectively represent the gradient magnitudes in the horizontal, vertical, and two diagonal directions.

[0178] Through weighted summation, important edge directions in the image will obtain higher weights, thereby enhancing their performance in the final image and improving the overall edge detection effect.

[0179] For the gradient magnitude image after weighting, binary edge processing is performed. A threshold is set, and all pixel points greater than this threshold are considered edge points, while other pixel points are regarded as non-edge points. Through binary processing, each pixel point in the final output image has only two states: edge point or non-edge point. It effectively separates the edge region from the background region in the image, ensuring the clear extraction of edge information.

[0180] Finally, a clear and accurate edge image is generated to display various edges in the image. By adaptively selecting an appropriate convolution kernel according to the local gradient direction and combining the weighted gradient magnitude fusion, the edge features in the image can be accurately extracted. Compared with traditional edge detection methods, the method of the present invention performs particularly well in extracting edge features in complex backgrounds and multi-directional situations, especially in images with more noise, and can significantly improve the accuracy and robustness of edge recognition.

Claims

1. An improved filtering and local direction adaptive rust recognition method for hull surface rust images, characterized in that: It includes the following steps: Step 1: Perform grayscale processing on the rust image on the hull surface to obtain the grayscale image; Step 2: Use the wavelet transform and total variation fusion denoising algorithm to perform global denoising on the grayscale image to obtain the globally denoised image; Step 3: Use the adaptive Gaussian kernel denoising algorithm to perform local denoising on the globally denoised image to obtain the finally denoised image; Step 4: Use the direction adaptive edge detection algorithm to extract the edges of the finally denoised image to obtain the rust image.

2. An improved filtering and local direction adaptive rust recognition method for hull surface rust images according to claim 1, characterized in that: In Step 2, the specific operations of using the wavelet transform and total variation fusion denoising algorithm to perform global denoising on the grayscale image to obtain the globally denoised image include: Use wavelet transform to divide the grayscale image into low-frequency and high-frequency components, expressed as: f(x,y) = DWT(LL,LH,HL,HH) where LL represents the low-frequency component, LH, HL, HH represent the high-frequency components, and f(x,y) represents the grayscale image; Use Gaussian filtering to smooth the low-frequency component LL, expressed as: LL' = G σ (LL) where G σ is a Gaussian kernel with a standard deviation of σ; Use an adaptive threshold denoising method based on local characteristics to process the high-frequency components LH, HL, HH to obtain the processed high-frequency components LH', HL', HH′; Use the smoothed low-frequency component LL' and the processed high-frequency components LH', HL', HH' to perform inverse wavelet transform to reconstruct the image, and obtain the wavelet denoised image expressed as: f′(x,y) = IDWT(LL',LH',HL',HH') Normalize the wavelet denoised image f′(x,y) to the range of [0,1] to obtain the normalized image u0; Establish the optimization objective function of total variation, expressed as: In the formula, u is the image after total variation optimization, and λ is the weight parameter; Use the Chambolle algorithm to iteratively solve the optimization objective function of total variation to obtain the optimal solution u; Map the optimal solution u back to the original grayscale range to obtain the final denoised image.

3. An improved filtering and local direction adaptive rust recognition method for hull surface rust images according to claim 2, characterized in that: The specific operations of using an adaptive threshold denoising method based on local characteristics to process the high-frequency components LH, HL, HH to obtain the processed high-frequency components LH', HL', HH′ include: Calculate the local noise level of the grayscale image according to the following formula, expressed as: In the formula, is the Laplacian operator of the grayscale image, and Var(·) represents the variance operator; Determine the adaptive threshold according to the local noise level, expressed as: τ = LocalVariance·k In the formula, k is the adjustment factor; Attenuate the part of the high-frequency component whose absolute value is greater than the adaptive threshold, and directly set the part not greater than the adaptive threshold to 0, expressed as: Among them, y represents the current high-frequency component, represents the high-frequency component after threshold processing.

4. An improved filtering and local direction adaptive rust recognition method for hull surface rust images according to claim 1, characterized in that: In Step 3, the specific operations of using the adaptive Gaussian kernel denoising algorithm to perform local denoising on the globally denoised image to obtain the finally denoised image include: Use the Sobel operator to calculate the gradient components of the grayscale image in the horizontal and vertical directions respectively; Combine the gradient components in the horizontal and vertical directions to calculate the total gradient amplitude of each pixel point: Among them, G x (x, y) and G y (x, y) respectively represent the gradient components of the grayscale image in the horizontal and vertical directions, and are defined by the following formula: In the formula, f(x,y) represents the grayscale image; For each local area, adaptively determine the size of the Gaussian kernel and the standard deviation of Gaussian filtering according to the noise intensity of the local area according to the following formula: KernelSize = clip(2·mean(LocalStd(x,y)), K min , K max ) where clip(x, a, b) represents restricting x within the interval [a, b], K min and K max are the minimum and maximum sizes of the Gaussian kernel respectively, σ min and σ max are the minimum and maximum values of the standard deviation respectively; where: LocalStd(x,y) = G σ (Grad(x,y)) Among them, G σ is the Gaussian smoothing operation, and Grad(x, y) represents the local gradient magnitude; For each local region, according to the size of the adaptively determined Gaussian kernel and the standard deviation of Gaussian filtering, apply the corresponding Gaussian filtering operation, expressed as: f′(x,y) = G KernelSize,σ (f(x,y)) Among them, G KernelSize,σ represents a Gaussian kernel with a size of KernelSize and a standard deviation of σ.

5. An improved filtering and local direction adaptive rust recognition method for hull surface rust images according to claim 1, characterized in that: In step 4, the direction adaptive edge detection algorithm is used to extract edges from the finally denoised image to obtain the rust image. The specific operations include: Use the Sobel operator to calculate the gradient components of the finally denoised image in the horizontal and vertical directions respectively; Combining the gradient components of the image in the horizontal and vertical directions, use the following formula to calculate the total gradient amplitude of each pixel: Among them, G x (x, y) and G y (x, y) represent the gradient components in the horizontal and vertical directions respectively; Extract the edge direction of each pixel through the following formula: According to the calculated gradient direction of each pixel, judge the edge direction of the local region; For each local region, adaptively select convolution kernels according to its edge direction, including: horizontal convolution kernel, vertical convolution kernel and diagonal convolution kernel; The horizontal convolution kernel is used to detect horizontal edges and is expressed as: The vertical convolution kernel is used to detect vertical edges and is expressed as: The diagonal convolution kernel is used to detect diagonal edges and includes: By calculating the standard deviation of each direction, dynamically adjust the weights of each direction, expressed as: Among them, σ i represents the standard deviation in the i-th direction, and α i represents the weight in this direction; By performing weighted summation on the gradient amplitudes of each direction, obtain the final edge amplitude image, expressed as: G final = σ1G horizontal + σ2G vertical + σ3G diagonal1 + σ4G diagonal2 where G horizontal , G vertical , G diagonal1 , G diagonal2 represent the gradient magnitudes in the horizontal, vertical, and two diagonal directions, respectively. Perform binary processing on the edges of the final edge amplitude image so that each pixel of the final output image has only two states: edge point or non-edge point, and finally obtain the rust image.

Citation Information

Cited By

  • Auxiliary automatic focusing method for optimizing Sobel settlement gradient value based on Gaussian filtering

    CN120583312A

  • Brake disc safety performance detection method and system

    CN120741484A

  • A method and system for testing the safety performance of brake discs

    CN120741484B

  • Power transmission channel hidden danger target detection method and device, electronic equipment and storage medium

    CN121190742A

  • Equipment surface defect detection method based on multi-dimensional feature fusion

    CN121304569A