A method for detecting surface defects of roll forgings

By calculating the noise level and using the guide filtering algorithm of weighted mean in the image processing of roll forging, the accuracy of image denoising and defect recognition is solved, and a more efficient surface defect detection of roll forging is achieved.

CN119205773BActive Publication Date: 2025-02-28SHAANXI HUAWEI TECH CO LTD

Patent Information

Application Number
CN202411713518.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-02-28
Estimated Expiration
2044-11-27

AI Technical Summary

Technical Problem

The prior art is difficult to effectively denoise in roll forging image processing, resulting in low accuracy in defect recognition.

Method used

Through the preset pixel point observation window, the noise performance and concentration degree are calculated to obtain the noise level of pixel point, and the weighted mean is used for filtering and denoising in the guide filtering algorithm, and finally obtain the defect detection result through threshold segmentation processing.

Benefits of technology

It improves the accuracy of denoising and defect detection of surface images of roll forgings, can effectively distinguish defects and noise points, and adapt to different lighting conditions and texture changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure QLYQS_3
    Figure QLYQS_3
Patent Text Reader

Abstract

The present invention relates to the technical field of image data processing, and more specifically, to a method for detecting surface defects of a rolling mill forging, the method comprising: obtaining the noise performance of a pixel point by the uniformity of grayscale distribution in an observation window of a pixel point in a forging surface image; dividing the pixel points in the observation window into a high grayscale set and a low grayscale set by an Otsu threshold method, recording the ratio of the number of pixel points in the set to the shortest path length as a concentration index of the set, obtaining the concentration degree of the observation window by the minimum value of the concentration index in the high grayscale set and the low grayscale set, and obtaining the noise degree of the pixel point by combining the noise performance; obtaining the mean value of the pixel point by the grayscale value and weight of the pixel point in the window; and filtering by a guided filtering algorithm to obtain a denoised forging surface image, thereby obtaining a forging surface image defect detection result, and effectively improving the accuracy of forging surface image defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, and more specifically, to a method for detecting surface defects of a roll forging. Background Art

[0002] Roller forgings refer to roll parts processed by forging technology. The rotating rolls cause the rolled parts to undergo plastic deformation to obtain forgings that meet the requirements of shape and dimensional accuracy. They usually have high strength, high toughness and excellent mechanical properties and can be used in metallurgy, machinery manufacturing and other fields. In order to ensure the overall performance and quality of forgings, defect detection of forgings is required.

[0003] Most of the prior art performs defect detection by acquiring image information of forgings. For example, a patent application document with publication number CN115546099A discloses a forging flaw detection method and device based on a convolutional neural network. The application acquires fluorescent magnetic particle flaw detection images of forgings, constructs a convolutional neural network model for detecting forging defects, and optimizes multiple hyperparameters of the convolutional neural network model using a swarm intelligence optimization algorithm; trains the convolutional neural network model using a data set and a loss function; inputs the image of the forging to be tested into the trained convolutional neural network model to obtain the defect recognition result of the forging to be tested, thereby realizing intelligent detection of forging fluorescent magnetic particle flaw detection defects.

[0004] The above-mentioned prior art can improve the efficiency of forging defect detection by training a convolutional neural network model. However, when collecting forging images, it is easily affected by photon noise, resulting in noise points in the collected forging images. If defect recognition is performed directly based on the forging images that have not been denoised, the defect recognition results obtained are less accurate.

[0005] Based on this, how to accurately filter and denoise the roll forging images to achieve roll forging surface defect detection is an urgent problem to be solved by technical personnel in this field. Summary of the invention

[0006] In order to solve the above technical problem of how to accurately implement filtering and denoising of roll forging images to realize roll forging surface defect detection, the present invention proposes a roll forging surface defect detection method, which includes the following steps:

[0007] An observation window for each pixel in the forging surface image is preset, and the noise performance of the pixel is obtained by the uniformity of the grayscale distribution of the pixel in the observation window of the pixel; the pixels in the observation window are divided into a high grayscale set and a low grayscale set by the Otsu threshold method, and the ratio of the number of pixels in the set to the shortest path length is recorded as the concentration index of the set, and the negative of the minimum value of the concentration index in the high grayscale set and the low grayscale set is used as the exponent of the exponential function with e as the base to obtain the concentration degree of the observation window; the noise degree of the pixel is obtained by the product of the noise performance of the pixel and the concentration degree of the observation window of the pixel; the size of the pixel window is preset, and the weight of the pixel is obtained by the proportion of the noise degree of the pixel in the overall noise degree of the pixels in the window, and the mean value of the pixel is obtained by the product of the grayscale value of the pixel in the window and the weight; the mean value of the pixel is used for filtering and denoising in the guided filtering algorithm to obtain a denoised forging surface image, and the denoised forging surface image is processed by threshold segmentation to obtain the forging surface image defect detection result.

[0008] The present invention takes into account that the noise in the forging surface image will affect the accuracy of defect identification. Therefore, when determining the defect detection result of the forging surface image, the forging surface image is filtered and denoised by guiding the filtering algorithm, which can effectively improve the accuracy of the forging surface image defect detection. In this process, the present invention takes into account that the grayscale of the defects in the forging surface image is close to the grayscale of the noise points, and directly performs filtering and denoising based on the mean of the pixel point window in the forging surface image, which may blur the defects and noise points. Based on this, the present invention obtains the noise level of the pixel point and obtains the weight of each pixel point in the window when determining the mean, so that the mean in the window can be accurately obtained, which effectively improves the accuracy of the forging surface image denoising, thereby effectively improving the accuracy of the forging surface image defect detection.

[0009] According to a method for detecting surface defects of a rolling mill forging provided by the present invention, the observation window of each pixel point in the preset forging surface image also includes: collecting an RGB image of the forging surface by an industrial camera, and graying the RGB image of the forging surface to obtain the forging surface image.

[0010] According to a method for detecting surface defects of a roll forging provided by the present invention, the observation window of each pixel point in the forging surface image is preset, including: the size of the preset observation window ; Get around a pixel as the center The observation window of a pixel is obtained by taking a pixel point.

[0011] According to a method for detecting surface defects of a rolling mill forging provided by the present invention, the noise performance of the pixel point is obtained, including: obtaining the grayscale level and the corresponding number of pixels in the pixel point observation window, and recording the inverse of the variance of the number of pixels corresponding to the grayscale level as the noise index of the pixel point; using the negative of the ratio of the noise index of the pixel point to the grayscale level extreme value difference in the observation window as the exponent of an exponential function with e as the base to obtain the noise performance of the pixel point.

[0012] The present invention provides an accurate method for calculating the noise performance of a pixel point, and the noise performance of the pixel point in a local range can be accurately obtained by analyzing the distribution of the pixel points in an observation window of the pixel point.

[0013] According to a method for detecting surface defects of rolling mill forgings provided by the present invention, the pixel points in the observation window are divided into a high grayscale set and a low grayscale set by using the Otsu threshold method, including: taking the grayscale level in the pixel point observation window as a possible threshold, dividing the grayscale level greater than the possible threshold into a high grayscale set, and dividing the grayscale level not greater than the possible threshold into a low grayscale set; calculating the inter-class variance between the high grayscale set and the low grayscale set, traversing the inter-class variances corresponding to all possible thresholds, and taking the high grayscale set and the low grayscale set corresponding to the maximum value of the inter-class variance as the high grayscale set and the low grayscale set of the observation window.

[0014] According to a method for detecting surface defects of a roll forging provided by the present invention, the weight of the pixel point satisfies the relationship:

[0015] ;

[0016] In the formula, represents the weight of the i-th pixel, Indicates the noise level of the i-th pixel, Indicates the number of pixels in the window where the i-th pixel is located, Indicates the noise level of the jth pixel in the window where the i-th pixel is located. Represents an exponential function with base e.

[0017] According to a method for detecting surface defects of a rolling mill forging provided by the present invention, the mean value of pixel points is used for filtering and denoising in a guided filtering algorithm, comprising: taking a forging surface image as a guided image, obtaining a linear relationship between the guide image and the pixel points in the forging surface image in the window by the mean value and variance of the pixel points in the guide image and the forging surface image window; and adjusting the grayscale value of the pixel points of the forging surface image based on the linear relationship to obtain a denoised forging surface image.

[0018] The present invention denoises the forging surface image by using a guided filtering algorithm, which can accurately denoise and retain edge details in the image, thus preparing for defect identification.

[0019] According to a method for detecting surface defects of a rolling mill forging provided by the present invention, the denoised surface image of the forging is processed by threshold segmentation to obtain a defect detection result of the forging surface image, including: performing threshold segmentation on the denoised surface image of the forging by the Otsu threshold method, and recording the area smaller than the threshold as a defect area.

[0020] The present invention takes into account that even if the industrial camera keeps its own parameters unchanged when collecting forging images, there may still be external factors such as lighting that cause the lighting performance of the collected forging surface image to be inconsistent with the forging texture. Therefore, the forging surface image after dynamic adaptation and denoising is segmented by threshold value, so that defects in the forging surface image can be accurately identified.

[0021] According to a roll forging surface defect detection method provided by the present invention, the forging surface image defect detection result is obtained, and then the method further includes: marking the defect area with a marking frame and then issuing a prompt to the outside.

[0022] The present invention helps workers to accurately and timely obtain defective forgings by marking defective areas in the forging surface image.

[0023] The present invention has the following beneficial effects:

[0024] Based on the above technical scheme, when determining the forging surface image defect detection result, the present invention filters and denoises the forging surface image by guiding the filtering algorithm, which can effectively improve the accuracy of forging surface image defect detection. In this process, the present invention obtains the noise level of the pixel point and obtains the weight of each pixel point in the window when determining the mean, so that the mean in the window can be accurately obtained, reducing the influence of the defect grayscale on the image denoising, effectively improving the accuracy of forging surface image denoising, and thus effectively improving the accuracy of forging surface image defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0026] Figure 1 A schematic flow chart of a method for detecting surface defects of a roll forging provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0028] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0029] It should be noted that the acquisition of forging images is easily affected by photon noise, resulting in noise points in the acquired forging images. If defect recognition is performed directly based on the original forging images that have not been denoised, the defect recognition results obtained will have low accuracy.

[0030] The guided filtering algorithm is a filtering algorithm that can maintain the edge of an image. It uses the information in the guide image to guide the filtering process, thereby ensuring that the edge and detail information of the image can be effectively retained while removing noise. The linear coefficient can be used to determine the linear relationship between the guide image and the image to be filtered, which directly determines the filtering effect.

[0031] Based on this, the embodiment of the present invention discloses a method for detecting surface defects of roll forgings. The method uses a guided filtering algorithm to filter and denoise the forging image, and can retain the edge details of the forging image while denoising, so that the forging surface defect detection result can be accurately obtained based on this in the subsequent process. For details, please refer to Figure 1 As shown, Figure 1 A schematic flow chart of a method for detecting surface defects of a roll forging provided in an embodiment of the present invention, the method specifically comprises the following steps.

[0032] S1: Preset an observation window for each pixel point in the forging surface image, and obtain the noise performance of the pixel point through the uniformity of the grayscale distribution of the pixel point in the observation window of the pixel point.

[0033] For example, in an embodiment of the present invention, an observation window for each pixel point in the forging surface image is preset, and the method also includes: collecting an RGB image of the forging surface by an industrial camera, and gray-processing the RGB image of the forging surface to obtain the forging surface image.

[0034] It is understandable that in order to improve the efficiency of forging image defect detection, when collecting RGB images of the forging surface, the acquisition angle, distance and other parameters of the industrial camera can be kept consistent.

[0035] For example, in an embodiment of the present invention, the observation window of each pixel point in the forging surface image is preset, including: the size of the preset observation window ; Get around a pixel as the center The observation window of a pixel is obtained by taking a pixel point.

[0036] The size of the observation window can be set to 5×5, which can be set according to actual needs; the size of the observation window is the number of pixels contained in the observation window.

[0037] It is understandable that for edge pixels in the forging surface image, there are not enough pixels to construct the observation window when obtaining the observation window. For such edge pixels, the gray value mean of the existing pixels in the observation window can be obtained, and the gray value mean is used as the gray value of the missing pixels.

[0038] It should be noted that the conventional guided filtering algorithm uses the information in the guided image to guide the filtering process, where the linear coefficient can be used to determine the linear relationship between the guided image and the image to be filtered, directly determining the filtering effect. However, the grayscale of defects in the forging image is similar to the grayscale caused by noise. If the grayscale mean in the forging image window is directly calculated as the mean in the linear coefficient, the algorithm will be unable to distinguish between defects and noise, affecting the filtering effect of the algorithm on the forging image.

[0039] Based on this, the embodiment of the present invention obtains the grayscale distribution characteristics of the pixel point in the local range by acquiring the grayscale characteristics in the observation window of the pixel point, thereby calculating the noise performance of the pixel point. When calculating the mean value of the window grayscale in the forging surface image, the noise performance of the pixel point is weighted to improve the accuracy of the linear coefficient in the guided filtering algorithm.

[0040] It should be further explained that the noise points in the forging surface image are random and have low correlation with the surrounding pixels, while the grayscale values ​​of normal pixels in the forging surface image are usually evenly distributed.

[0041] Based on this, the embodiment of the present invention can obtain the noise performance of each pixel through the uniformity of the grayscale distribution of each pixel. The lower the uniformity, the higher the noise performance of the pixel.

[0042] By way of example, in an embodiment of the present invention, the noise performance of the pixel point is obtained, including: obtaining the grayscale level and the corresponding number of pixels in the pixel point observation window, and recording the inverse of the variance of the number of pixels corresponding to the grayscale level as the noise index of the pixel point; using the negative of the ratio of the noise index of the pixel point to the grayscale level extreme value difference in the observation window as the exponent of an exponential function with base e to obtain the noise performance of the pixel point.

[0043] Among them, the noise index obtains its consistency through the variance of the number of pixels of each gray level in the pixel observation window. The smaller the variance, the higher the consistency, and the higher the noise index of the pixel, which indicates that the uniformity of the grayscale distribution of the pixel in the local range is higher.

[0044] For example, the noise performance of a pixel point can be determined by referring to the following relationship:

[0045] ;

[0046] In the formula, represents the noise performance of the i-th pixel, Represents the noise index of the i-th pixel, , Respectively represent the maximum gray level and minimum gray level in the observation window of the i-th pixel, Represents an exponential function with base e.

[0047] In the above formula, It represents the grayscale extreme value difference in the observation window of the i-th pixel, that is, the grayscale range in the observation window. The larger the grayscale range, the more complex the pixel distribution is and the lower the uniformity of the corresponding pixel.

[0048] The lower the noise index of a pixel, the lower the uniformity of the grayscale distribution of the pixel in the local range, and the higher the noise performance of the pixel.

[0049] After obtaining the noise performance of each pixel based on the above steps, continue to perform the following steps.

[0050] S2: The pixels in the observation window are divided into a high grayscale set and a low grayscale set by the Otsu threshold method to obtain the concentration of the observation window; the noise level of the pixel is obtained by multiplying the noise performance of the pixel by the concentration level of the observation window of the pixel.

[0051] It should be noted that there may be defects in the surface image of the roll forging, such as cracks and scratches, and the presence of defects will also make the grayscale distribution uniformity in the surface image of the forging poor. When the noise points are obtained directly based on the noise performance of each pixel point obtained in the above steps, the pixel points in the defective area may be identified as noise points. Therefore, it is necessary to correct the noise performance obtained in the above steps to distinguish the noise points from the pixel points in the defective area.

[0052] It should be further explained that the pixels in the defect area show a concentrated trend, that is, when defects appear in the forging surface image, a large number of pixels will be concentrated, while noise points usually appear isolated. In addition, compared with the normal area, the gray level of the defect area is smaller.

[0053] Based on this, an embodiment of the present invention divides the pixel points in the observation window of the pixel points into a set with a larger grayscale level and a set with a smaller grayscale level, and analyzes the concentration of the pixel points in the two sets respectively, thereby obtaining the concentration degree in the observation window. The noise performance of the pixel points belonging to the observation window is corrected according to the concentration degree of the observation window to obtain the noise degree of the pixel points.

[0054] By way of example, in an embodiment of the present invention, the pixels in the observation window are divided into a high grayscale set and a low grayscale set by the Otsu threshold method, including: taking the grayscale level in the pixel observation window as a possible threshold, dividing the grayscale level greater than the possible threshold into a high grayscale set, and dividing the grayscale level not greater than the possible threshold into a low grayscale set; calculating the inter-class variance between the high grayscale set and the low grayscale set, traversing the inter-class variances corresponding to all possible thresholds, and taking the high grayscale set and the low grayscale set corresponding to the maximum inter-class variance as the high grayscale set and the low grayscale set of the observation window.

[0055] Among them, the specific steps of dividing the pixel points in the observation window into a high grayscale set and a low grayscale set by using the Otsu threshold method can be obtained through the existing technology, and the embodiment of the present invention will not be described in detail here.

[0056] By way of example, in an embodiment of the present invention, determining the noise level of a pixel point includes: recording the ratio of the number of pixels in a set to the shortest path length as the concentration index of the set, using the negative of the minimum value of the concentration index in the high-grayscale set and the low-grayscale set as the exponent of an exponential function with base e to obtain the concentration level of the observation window; and obtaining the noise level of the pixel point by multiplying the noise performance of the pixel point by the concentration level of the observation window of the pixel point.

[0057] The set includes a high grayscale set and / or a low grayscale set.

[0058] For example, the shortest path length of the pixels in the set can be determined by Dijkstra algorithm. The specific steps of determining the shortest path length of the pixels in the set by Dijkstra algorithm can be obtained by prior art, and the embodiments of the present invention are not described in detail here.

[0059] For example, the noise level of a pixel point can be determined by referring to the following relationship:

[0060] ;

[0061] In the formula, Indicates the noise level of the i-th pixel, represents the noise performance of the i-th pixel, , Respectively represent the number of pixels in the high grayscale set and the low grayscale set, , Respectively represent the shortest path length of pixels in the high grayscale set and the low grayscale set, represents the exponential function with base e, Represents a minimum value function.

[0062] In the above formula, , It represents the concentration index of the set. The smaller the concentration index is, the smaller the density of the set is.

[0063] It represents the concentration degree of the observation window. If the concentration degree of the set with the smallest density is higher, the concentration degree of the set with the largest density is also higher. Therefore, the embodiment of the present invention obtains the concentration degree of the observation window by analyzing the minimum value of the concentration index as the concentration index of the observation window.

[0064] Based on the above steps, the concentration of the pixel observation window is obtained and the noise index of the pixel is corrected, so that the noise level of each pixel can be accurately obtained, and the following steps are continued.

[0065] S3: Preset the size of the pixel window, obtain the weight of the pixel by the proportion of the noise level of the pixel in the overall noise level of the pixels in the window, and obtain the mean value of the pixel by the product of the grayscale value of the pixel in the window and the weight.

[0066] The size of the window can be set to 5×5; the size of the window is set according to actual needs, and the embodiment of the present invention does not impose too many restrictions here. The method for obtaining the window is similar to the observation window, and the embodiment of the present invention will not be repeated here.

[0067] It should be noted that after the noise level of each pixel is obtained based on the above steps, the weight can be calculated by the noise level of each pixel to obtain the mean value required in the guided filtering algorithm.

[0068] For example, in the embodiment of the present invention, the weight of the pixel point is determined, and the specific relationship can be as follows:

[0069] ;

[0070] In the formula, represents the weight of the i-th pixel, Indicates the noise level of the i-th pixel, Indicates the number of pixels in the window where the i-th pixel is located, Indicates the noise level of the jth pixel in the window where the i-th pixel is located. Represents an exponential function with base e.

[0071] In the above formula, the higher the noise level of a pixel, the higher the possibility that it is a noise point. In order to ensure the accuracy of the mean in the window, its weight in determining the mean needs to be lower.

[0072] Based on the above formula, the weight of each pixel can be obtained. The mean of the pixel can be accurately obtained by multiplying the grayscale value of each pixel in the window where the pixel is located with the weight, and filtering and denoising can be achieved based on the mean, that is, continue to execute the following steps.

[0073] S4: In the guided filtering algorithm, the mean value of the pixel points is used for filtering and denoising to obtain a denoised forging surface image, and the denoised forging surface image is processed by threshold segmentation to obtain a forging surface image defect detection result.

[0074] It should be noted that, by processing the noise level of each pixel point as described above, the weight of each pixel point when determining the mean can be accurately obtained, thereby accurately obtaining the mean value in the window where the pixel point is located. The mean value of the pixel points obtained by the above steps is used in the guided filtering algorithm to achieve accurate filtering and denoising.

[0075] By way of example, in an embodiment of the present invention, the mean of pixel points is used for filtering and denoising in a guided filtering algorithm, including: using the forging surface image as a guiding image, and obtaining a linear relationship between the guiding image and the pixel points in the forging surface image window by the mean and variance of the pixel points in the guiding image and the forging surface image window; adjusting the grayscale value of the pixel points of the forging surface image based on the linear relationship to obtain a denoised forging surface image.

[0076] The specific steps of filtering and denoising the forging surface image by using the guided filtering algorithm can be implemented by the existing technology, and the embodiments of the present invention will not be described in detail here.

[0077] By using the mean value of the pixel points obtained in the above steps to filter and denoise in the guided filtering algorithm, the defect edge details in the image can be retained while the noise is accurately removed, so that the defect detection result of the forging surface image can be accurately obtained through the denoised forging surface image.

[0078] It should be further explained that even if the industrial camera keeps its own parameters unchanged when capturing forging images, there may still be external factors such as lighting that cause the lighting performance of the captured forging surface image to be inconsistent with the forging texture.

[0079] Based on this, the embodiment of the present invention obtains the defect detection result of the forging surface image by threshold segmentation processing of the denoised forging surface image. In this process, threshold segmentation can determine the global optimal threshold, which is dynamically determined based on the grayscale histogram of the image. Therefore, it can adapt to different lighting conditions and changes in the surface texture of the forging, thereby accurately identifying defects in the forging surface image.

[0080] For example, in an embodiment of the present invention, the denoised forging surface image is processed by threshold segmentation to obtain the forging surface image defect detection result, including: performing threshold segmentation on the denoised forging surface image by Otsu threshold method, and recording the area smaller than the threshold as the defect area.

[0081] Among them, the threshold value can be set according to actual needs; the specific steps of threshold segmentation by Otsu threshold method can be implemented by existing technologies, and the embodiments of the present invention will not be described in detail here.

[0082] After obtaining the defective area in the forging surface image based on the above steps, the defective area can also be marked to facilitate processing by the staff.

[0083] For example, in an embodiment of the present invention, after obtaining the forging surface image defect detection result, the method further includes: marking the defect area with a marking frame and then issuing a prompt externally.

[0084] The specific step of marking the defective area by marking the frame can be implemented by the existing technology, and the embodiment of the present invention will not be described in detail here.

[0085] It can be seen that in the embodiment of the present invention, when determining the surface defect detection result of the roll forging, the observation window of each pixel point in the forging surface image can be preset, and the noise performance of the pixel point can be obtained by the uniformity of the grayscale distribution of the pixel point in the observation window of the pixel point; the pixel points in the observation window are divided into a high grayscale set and a low grayscale set by the Otsu threshold method, and the ratio of the number of pixels in the set to the shortest path length is recorded as the concentration index of the set, and the negative number of the minimum value of the concentration index in the high grayscale set and the low grayscale set is used as the exponent of the exponential function with e as the base, and the concentration index of the observation window is obtained. medium degree; the noise degree of the pixel is obtained by multiplying the noise performance of the pixel by the concentration degree of the observation window of the pixel; the size of the pixel window is preset, the weight of the pixel is obtained by the proportion of the noise degree of the pixel in the overall noise degree of the pixels in the window, and the mean value of the pixel is obtained by the product of the gray value of the pixel in the window and the weight; the mean value of the pixel is used for filtering and denoising in the guided filtering algorithm to obtain the denoised forging surface image, and the denoised forging surface image is processed by threshold segmentation to obtain the forging surface image defect detection result.

[0086] In this way, the embodiment of the present invention can effectively improve the accuracy of defect detection of forging surface images by filtering and denoising the forging surface images through the guided filtering algorithm. In this process, the embodiment of the present invention takes into account that the grayscale of the defects in the forging surface image is close to the grayscale of the noise points, and directly performs filtering and denoising based on the mean of the pixel point window in the forging surface image, which may blur the defects and noise points. Based on this, the embodiment of the present invention obtains the noise level of the pixel points and obtains the weight of each pixel point in the window when determining the mean, so that the mean in the window can be accurately obtained, which effectively improves the accuracy of denoising the forging surface image, thereby effectively improving the accuracy of defect detection of the forging surface image.

[0087] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for detecting surface defects of a roll forging, characterized in that: include: The observation window of each pixel point in the forging surface image is preset, and the noise performance of the pixel point is obtained by the uniformity of the grayscale distribution of the pixel point in the observation window of the pixel point, including: Obtain the gray level and the corresponding number of pixels in the pixel observation window, and record the inverse of the variance of the number of pixels corresponding to the gray level as the noise index of the pixel; The negative number of the ratio of the noise index of the pixel point to the gray level extreme value difference in the observation window is used as the exponent of the exponential function with e as the base to obtain the noise performance of the pixel point; The pixels in the observation window are divided into a high grayscale set and a low grayscale set by the Otsu threshold method, the ratio of the number of pixels in the set to the shortest path length is recorded as the concentration index of the set, and the negative number of the minimum value of the concentration index in the high grayscale set and the low grayscale set is used as the exponent of the exponential function with e as the base to obtain the concentration degree of the observation window; the noise degree of the pixel is obtained by multiplying the noise performance of the pixel by the concentration degree of the observation window of the pixel; The size of the pixel window is preset, and the weight of the pixel is obtained by the proportion of the noise level of the pixel in the overall noise level of the pixels in the window. The mean value of the pixel is obtained by the product of the gray value of the pixel in the window and the weight; In the guided filtering algorithm, the mean value of the pixel points is used for filtering and denoising to obtain the denoised forging surface image. The denoised forging surface image is processed by threshold segmentation to obtain the forging surface image defect detection result.

2. A method for detecting surface defects of roll forgings according to claim 1, characterized in that: Before the step of presetting the observation window of each pixel point in the forging surface image, the method further includes: The RGB image of the forging surface is collected by an industrial camera, and the RGB image of the forging surface is grayed to obtain the forging surface image.

3. A method for detecting surface defects of roll forgings according to claim 1, characterized in that: The observation window of each pixel point in the preset forging surface image includes: Preset observation window size ; Get around a pixel as the center The observation window of a pixel is obtained by taking a pixel point.

4. A method for detecting surface defects of roll forgings according to claim 1, characterized in that: The pixel points in the observation window are divided into a high grayscale set and a low grayscale set by using the Otsu threshold method, including: The grayscale level in the pixel observation window is taken as a possible threshold, and the grayscale levels greater than the possible threshold are divided into a high grayscale set, and the grayscale levels not greater than the possible threshold are divided into a low grayscale set; the inter-class variance between the high grayscale set and the low grayscale set is calculated, and the inter-class variances corresponding to all possible thresholds are traversed, and the high grayscale set and the low grayscale set corresponding to the maximum inter-class variance are taken as the high grayscale set and the low grayscale set of the observation window.

5. A method for detecting surface defects of roll forgings according to claim 1, characterized in that: The weight of the pixel point satisfies the relationship: ; In the formula, represents the weight of the i-th pixel, Indicates the noise level of the i-th pixel, Indicates the number of pixels in the window where the i-th pixel is located, Indicates the noise level of the jth pixel in the window where the i-th pixel is located. Represents an exponential function with base e.

6. A method for detecting surface defects of roll forgings according to claim 1, characterized in that: The method of using the mean value of the pixel points for filtering and denoising in the guided filtering algorithm includes: The forging surface image is used as the guiding image, and the linear relationship between the guiding image and the pixels in the forging surface image window is obtained through the mean and variance of the pixels in the guiding image and the forging surface image window; based on the linear relationship, the grayscale value of the pixels in the forging surface image is adjusted to obtain the denoised forging surface image.

7. A method for detecting surface defects of roll forgings according to claim 1, characterized in that: The forging surface image after denoising by threshold segmentation is obtained to obtain the forging surface image defect detection result, including: The denoised forging surface image is segmented by Otsu threshold method, and the area smaller than the threshold is recorded as the defect area.

8. A method for detecting surface defects of roll forgings according to claim 7, characterized in that: The method further comprises: obtaining the forging surface image defect detection result; The defective area is marked with a labeling box and a prompt is given to the outside.

Citation Information

Patent Citations

  • Forging flaw detection defect detection method and device based on convolutional neural network

    CN115546099A

  • Guided filtering fluorescence image enhancement algorithm combined with bilateral filtering

    CN117788353A

  • Railway accessory defect detection method and system

    CN118037726A

Cited By

  • A Machine Vision-Based Intelligent Detection Method and System for Surface Defects in Titanium Alloy Forgings

    CN120741511B