A Visual Inspection-Based Method for Forging Defect Detection
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2026-08-11
AI Technical Summary
在锻造场景中,金属颗粒飞溅物形成的椒盐状噪声可通过灰度排序被有效滤除,因此通常使用中值滤波去除图像中的噪声;但锻造图像中某些气孔缺陷与椒盐噪声特征相似,使其被误认为噪声从而被去除,导致去噪处理后,缺陷细节丢失,降低锻造缺陷检测的准确性
在本发明中,获取疑似噪声程度能够基于像素点的灰度特征确定像素点属于噪声的可能性和疑似噪点,从而筛选分析范围与连通域划分;获取连通域能够确定疑似噪声程度特征相似和位置相似的区域范围,便于后续分析第一噪声置信度和第二噪声置信度。获取第一噪声置信度能够基于飞溅物与气孔缺陷的边缘梯度特征、连通域的灰度变化特征分析疑似噪点为真实椒盐噪声的可能性。获取第二噪声置信度能够基于飞溅物区域与气孔缺陷区域的形状特征、分布特征分析疑似噪点为真实椒盐噪声的可能性;获取综合置信度能够更准确地判断疑似噪点的类型。最终获取噪声权重能够准确地划分真实噪声和气孔缺陷区域,根据疑似噪点的噪声权重进行中值滤波,使得滤波过程能够有效保留缺陷细节并且去除椒盐噪声,从而提高了锻造缺陷的检测准确性。
Smart Images

Figure CN121437490B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection technology, and more specifically to a method for detecting forging defects based on visual inspection. Background Technology
[0002] Forging is widely used in the metal processing industry. Due to the high temperature and pressure during forging, defects such as cracks, porosity, and inclusions are easily generated on the product surface. These defects can affect the performance and reliability of the product. Therefore, defect detection of the forged surface is necessary after forging. Because products are mass-produced, automated inspection methods based on image analysis are usually used, utilizing image processing and pattern recognition technologies to locate defects.
[0003] In the process of detecting surface defects in forged products using images, image quality is easily affected by factors such as environmental noise, lighting conditions, and surface texture. Therefore, a preprocessing step of image denoising is required before detection. In forging scenarios, salt-and-pepper noise formed by metal particle spatter can be effectively filtered out through grayscale sorting, so median filtering is usually used to remove noise from the image. However, some porosity defects in forging images have similar characteristics to salt-and-pepper noise, causing them to be mistakenly identified as noise and removed. This results in the loss of defect details after denoising, reducing the accuracy of forging defect detection. Summary of the Invention
[0004] To address the aforementioned technical problems, the present invention aims to provide a forging defect detection method based on visual inspection, the specific technical solution of which is as follows: Obtain surface images of forged products; The suspected noise level and suspected noise point of a pixel are obtained based on the gray-level difference features between the pixels in the surface image; clustering is performed on all pixels based on their suspected noise level and location features to obtain different connected regions; the first noise confidence level of the suspected noise point is obtained based on the gradient change features of the edge region of the connected region of the suspected noise point and the gray-level change features of the connected region of the suspected noise point. A second noise confidence level for the suspected noise point is obtained based on the positional variation characteristics of the connected component edges, the shape characteristics of the connected component, and the difference characteristics of the connected component attributes between the suspected noise point and its neighboring pixels. A comprehensive confidence level for the suspected noise point is obtained based on the first noise confidence level and the second noise confidence level. A noise weight for the suspected noise point is obtained based on the comprehensive confidence level and the degree of suspected noise. Median filtering is performed based on the noise weights of the suspected noise points, and defect detection is performed based on the filtering results of the surface image.
[0005] Further, the step of obtaining the suspected noise level and suspected noise point of the pixel based on the grayscale difference features between the pixel and other pixels in the surface image includes: Calculate the absolute value of the difference between the gray value of the pixel and the mean gray value of its eight neighboring areas to obtain the local gray-level difference value of the pixel; calculate the average of the maximum and minimum gray values of the surface image to obtain the median value; calculate the absolute value of the difference between the gray value of the pixel and the median value to obtain the deviation; calculate the product of the local gray-level difference value and the deviation and normalize it to obtain the suspected noise level of the pixel; and identify pixels whose suspected noise level exceeds a preset first threshold as suspected noise points.
[0006] Furthermore, the step of clustering based on the suspected noise level and location features of all pixels to obtain different connected components includes: A feature vector is constructed based on the suspected noise level and coordinates of the pixel. Mean-shift clustering is performed on the feature vectors of all pixels to obtain different clusters. The cluster to which the pixel belongs is used as the label of the pixel. Connected components are constructed in the surface image based on pixels with the same label and connected positions.
[0007] Further, the step of obtaining the first noise confidence level of the suspected noise point based on the gradient change characteristics of the edge region of the connected domain of the suspected noise point and the gray-level change characteristics of the connected domain of the suspected noise point includes: Calculate the average gradient of a predetermined number of other pixels along the gradient direction of any edge pixel in the connected component to obtain a local gradient value; calculate the product of the reciprocal of the local gradient value and the gradient value of the arbitrary edge pixel to obtain a first value; calculate the average gradient feature value of all edge pixels in the connected component to obtain an edge sharpness feature value; construct a pixel grayscale value sequence from the center pixel of the connected component in different predetermined directions; calculate the number of negative slope values of the pixel grayscale value sequence to obtain a quantity feature value; calculate the reciprocal of the dynamic time-normalized distance between any two pixel grayscale value sequences to obtain a similarity; calculate the average of all similarities to obtain an average similarity; calculate the product of the average similarity and the quantity feature value to obtain a color change feature value; calculate the product of the edge sharpness feature value and the color change feature value and normalize it to obtain a first noise confidence level for the suspected noise point.
[0008] Further, the step of obtaining the second noise confidence level of the suspected noise point based on the positional variation features of the connected component edges of the suspected noise point, the shape features of the connected component, and the difference features of the connected component attributes between the suspected noise point and its neighboring pixels includes: In the formula, R represents the second noise confidence level of the suspected noise point. Let represent normalization, D represent the standard deviation of the curvature of edge pixels on the edge lines of the connected component, S represent the area of the connected component, and L represent the side length of the connected component. The value of "circularity" is represented by M, which represents the number of pixels in the preset neighborhood of the suspected noise that have the same label as the suspected noise.
[0009] Further, the step of obtaining the combined confidence level of the suspected noise point based on the first noise confidence level and the second noise confidence level includes: Calculate the average of the first noise confidence level and the second noise confidence level to obtain the overall confidence level of the suspected noise point.
[0010] Further, the step of obtaining the noise weight of the suspected noise point based on the comprehensive confidence level and the suspected noise level includes: The noise weight of the suspected noise point is obtained by multiplying the overall confidence level and the suspected noise level.
[0011] Furthermore, the step of performing median filtering based on the noise weights of the suspected noise points includes: When the noise weight of the suspected noise point does not exceed a preset noise threshold, the suspected noise point is a defect point; median filtering is performed on all non-defect points of the surface image.
[0012] The present invention has the following beneficial effects: In this invention, obtaining the suspected noise level can determine the probability of a pixel belonging to noise and suspected noise points based on the grayscale features of the pixel, thereby filtering the analysis range and dividing the connected components. Obtaining the connected components can determine the range of regions with similar suspected noise level features and similar positions, facilitating subsequent analysis of the first and second noise confidence levels. Obtaining the first noise confidence level can analyze the probability that the suspected noise point is real salt-and-pepper noise based on the edge gradient features of spatter and porosity defects and the grayscale change features of the connected components. Obtaining the second noise confidence level can analyze the probability that the suspected noise point is real salt-and-pepper noise based on the shape and distribution features of the spatter region and the porosity defect region. Obtaining the comprehensive confidence level can more accurately determine the type of suspected noise point. Finally, obtaining the noise weight can accurately divide the real noise and porosity defect regions. Median filtering is performed based on the noise weight of the suspected noise point, so that the filtering process can effectively preserve defect details and remove salt-and-pepper noise, thereby improving the detection accuracy of forging defects. Attached Figure Description
[0013] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 This is a flowchart of a forging defect detection method based on vision inspection, provided as an embodiment of the present invention. Detailed Implementation
[0015] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a visual inspection-based forging defect detection method proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0016] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0017] The following description, in conjunction with the accompanying drawings, details a specific scheme for a visual inspection-based forging defect detection method provided by the present invention.
[0018] Please see Figure 1 The diagram illustrates a flowchart of a vision-based forging defect detection method according to an embodiment of the present invention, which includes the following steps: Step S1: Obtain a surface image of the forged product.
[0019] In this embodiment of the invention, the implementation scenario is to detect surface defects in forged products and improve the accuracy of defect detection. First, an image of the forged product's surface is acquired. This is done by taking a picture of the product's surface after forging using a camera in a well-lit environment and then performing grayscale processing to obtain the product's surface image.
[0020] Step S2: Obtain the suspected noise level and suspected noise point of the pixel based on the gray-level difference features between the pixel and other pixels in the surface image; perform clustering based on the suspected noise level and location features of all pixels to obtain different connected regions; obtain the first noise confidence level of the suspected noise point based on the gradient change features of the edge region of the connected region of the suspected noise point and the gray-level change features of the connected region of the suspected noise point.
[0021] Metal spatter is formed when high-temperature metal fragments splash onto the product surface and solidify during the forging process. It is an adhering substance, not a defect in the material itself, and therefore constitutes noise in the surface image that interferes with defect detection, requiring denoising. Simultaneously, porosity defects on the product surface have similar characteristics to metal spatter in the image and are easily lost during denoising. Therefore, further analysis is needed when performing median filtering on the image to improve the accuracy of denoising and defect detection. Since metal particles are solidified matter on the product surface and differ in color from the surface, the suspected noise level and suspected noise points of each pixel are first obtained based on the grayscale difference characteristics between pixels and other pixels in the surface image. Preferably, in this embodiment, the steps of obtaining the suspected noise level and suspected noise points of a pixel include: calculating the absolute value of the difference between the pixel's grayscale value and the mean grayscale value of its eight neighboring areas to obtain the local grayscale difference value of the pixel. Because metal spatter is salt-and-pepper noise, it has a significant difference in grayscale value from other neighboring pixels; therefore, the larger the local grayscale difference value, the more likely the pixel is to be noise. The average of the maximum and minimum grayscale values of the surface image is calculated to obtain the median value. The absolute value of the difference between the grayscale value of the pixel and the median value is calculated to obtain the deviation. The larger the deviation, the more extreme the grayscale value of the pixel is within the grayscale range, and the more likely the pixel is to be noise. The product of the local grayscale difference value and the deviation is calculated and normalized to obtain the suspected noise level of the pixel. The larger the suspected noise level, the more likely the pixel is to be noise. Pixels with a suspected noise level exceeding a preset first threshold are then identified as suspected noise points. In this embodiment, the preset first threshold is 0.5, which can be determined by the implementer according to the implementation scenario. Suspected noise points indicate that the pixel may be metal particle spatter or a porous area, so further analysis of suspected noise points is needed to improve the accuracy of noise removal.
[0022] Furthermore, since metal spatter and porosity defects share similar characteristics—both are clump-shaped regions with grayscale differences from normal areas—to improve denoising accuracy, it is necessary to combine the imaging and physical characteristics of metal spatter and porosity defects in grayscale images to analyze noise confidence. First, clustering is performed based on the suspected noise level and location features of all pixels to obtain different connected components. Preferably, in this embodiment, the step of obtaining connected components includes: constructing feature vectors based on the suspected noise level and coordinates of pixels; performing mean-shift clustering based on the feature vectors of all pixels to obtain different clusters; the suspected noise features and location features of pixels in each cluster are similar. The cluster to which a pixel belongs is used as the label of that pixel; connected components are constructed in the surface image based on pixels with the same label and connected positions, with the noise features and location features of pixels in each connected component being similar.
[0023] In surface images, metal particle spatters, as independent protrusions, have clear boundaries with the product surface, exhibiting sharp, distinct edges with significant edge gradients; while pore defects, as surface depressions, show smooth transitions at their edges. Furthermore, under specific lighting conditions, metal particle spatters, due to their smooth surface and protruding features, exhibit a highlight within their interior, with a gradient trend from the center outwards; whereas the interiors of pores, due to light capture, typically appear as uniformly dark areas. Therefore, the first noise confidence level of suspected noise can be obtained based on the gradient change characteristics of the edge regions of the connected domains of suspected noise and the grayscale change characteristics of the connected domains of suspected noise.
[0024] Preferably, in this embodiment of the invention, the step of obtaining the first noise confidence level includes: calculating the average gradient of a preset number of other pixels along the gradient direction of any edge pixel in the connected region to obtain a local gradient value; in this embodiment of the invention, the preset number is 5. Since the edges of the splatter are sharp and clear, showing a significant difference from the product surface, the gradient value along the gradient direction of the edge pixel is small; therefore, the smaller the local gradient value, the smaller the grayscale change along the gradient direction, and the less smooth the edge transition, the more likely the connected region is to be a splatter. Conversely, the larger the local gradient value, the greater the grayscale change along the gradient direction, and the more likely it is to be a smooth transition of the pore depression edge. The product of the reciprocal of the local gradient value and the gradient value of the arbitrary edge pixel is calculated to obtain a first value; when the gradient value of the arbitrary edge pixel is larger and the local gradient value is smaller, it means the edge is more obvious and clear. The average gradient feature value of all edge pixels in the connected region is calculated to obtain an edge sharpness feature value; when the edge sharpness feature value is larger, it means the connected region where the suspected noise point is located is more likely to be a splatter region. A sequence of pixel grayscale values is constructed from the center pixel of a connected component in different preset directions. In this embodiment, the preset directions are the four directions of up, down, left, and right of the center pixel, and the length of the pixel grayscale value sequence is from the center pixel to the edge of the connected component. The number of negative fitting slopes of the pixel grayscale value sequences is calculated to obtain quantitative feature values. When the connected component is a splatter region, due to the influence of illumination, the central region will be bright with a large grayscale value, while it will gradually darken as it spreads outwards; therefore, the grayscale value becomes smaller and smaller, and the fitting slope of the grayscale value sequence is negative. The more negative fitting slopes there are, the more quantitative feature values there are, and the more likely the connected component is to be a splatter region. In contrast, pore defects have a darker central region and a brighter edge region, with a smaller quantitative feature value. The reciprocal of the dynamic time warping distance between any two pixel grayscale value sequences is calculated to obtain the similarity. It should be noted that the dynamic time warping distance is obtained through existing dynamic time warping algorithms. The more similar the two grayscale value sequences are, the smaller the dynamic time warping distance is, and the greater the similarity is. Calculate the average of all similarities to obtain the average similarity; a higher average similarity means more similar grayscale variation features across all four directions. Calculate the product of the average similarity and the quantity feature value to obtain the color variation feature value; a higher color variation feature value means the connected components of the suspected noise point are more likely to be splatter regions. Calculate the product of the edge sharpness feature value and the color variation feature value and normalize it to obtain the first noise confidence score for the suspected noise point; a higher first noise confidence score means the suspected noise point is more likely to belong to the salt-and-pepper noise of splatter. The formula for obtaining the first noise confidence score includes:
[0025] In the formula, W represents the first noise confidence level of the suspected noise point. This represents normalization, where N represents the number of edge pixels in the connected component. This represents the gradient value of the nth edge pixel. This represents the local gradient value corresponding to the nth edge pixel. Sharp edge eigenvalues This represents the quantity feature value, where K represents the number of combinations of grayscale values between any two pixels. This represents the similarity of the sequence of gray values of the j-th pixel. This represents the characteristic value of color change. It should be noted that, in this embodiment of the invention, when any reciprocal has a denominator of 0, the denominator is taken as a preset minimum positive number of 0.01 for calculation.
[0026] Step S3: Obtain the second noise confidence of the suspected noise based on the positional change features of the connected domain edges of the suspected noise, the shape features of the connected domain, and the difference features of the connected domain attributes between the suspected noise and its neighboring pixels; obtain the comprehensive confidence of the suspected noise based on the first noise confidence and the second noise confidence; obtain the noise weight of the suspected noise based on the comprehensive confidence and the degree of suspected noise.
[0027] Metal particle spatter and porosity defects differ not only in imaging but also in physical properties. Spatter is random, generally appearing as isolated, irregular clumps; while porosity defects are mostly distributed along forging flow lines, forming elliptical or circular dark spot clusters. Therefore, the areas containing spatter have lower shape regularity and higher edge complexity; while the areas containing porosity defects are more circular with regular edges. Furthermore, spatter has lower density and is more dispersed, while porosity defects have higher density. Therefore, a second noise confidence level for a suspected noise point is obtained based on the positional variation characteristics of the connected domain edges, the shape characteristics of the connected domain, and the difference in connected domain attributes between the suspected noise point and its neighboring pixels. Preferably, in this embodiment of the invention, the step of obtaining the second noise confidence level includes:
[0028] In the formula, R represents the second noise confidence level of the suspected noise point. Let S represent normalization, and D represent the standard deviation of the curvature of the edge pixels on the edge lines of the connected region. A larger standard deviation indicates greater differences in the curvature of the edge lines, resulting in more irregular edges and a higher likelihood of spatter areas. S represents the area of the connected region, and L represents the side length of the connected region. This indicates circularity; the more a connected region resembles a circle, the more similar the radius obtained by using the side length is to the radius obtained by using the area. for and The ratio is obtained, where r represents the radius. The closer the ratio is to 1, the greater the roundness, and the more likely the connected region is to have a porosity defect; conversely, when the ratio is less than 1, the more likely the region is to have a pore-like defect. The larger the value, the more likely the connected region is to be a spatter region. M represents the number of pixels with the same label as the suspected noise within a preset neighborhood of the suspected noise. In this embodiment of the invention, the preset neighborhood is the range of the nearest 100 pixels of the suspected noise. The more pixels with the same label, that is, the more pixels in the same cluster, the more likely the distribution of the same type of pixels is to be a porosity defect feature; conversely, the fewer pixels, the more likely the defect is to be a porosity defect feature. The larger the value, the more likely it is to be a feature of splashing material. Therefore, the higher the confidence level of the second noise, the more likely the suspected noise point is to be splashing material noise.
[0029] Further, after obtaining the first and second noise confidence levels of the suspected noise point, a comprehensive confidence level of the suspected noise point can be obtained based on the first and second noise confidence levels. Specifically, this includes: calculating the average of the first and second noise confidence levels to obtain the comprehensive confidence level of the suspected noise point; the higher the comprehensive confidence level, the more likely the suspected noise point is to belong to the salt-and-pepper noise of the splashing material. Furthermore, the higher the comprehensive confidence level and the higher the suspected noise level, the more likely the suspected noise point is to be characterized as a region of metal particle splashing material; therefore, the noise weight of the suspected noise point is obtained based on the comprehensive confidence level and the suspected noise level. Preferably, in this embodiment of the invention, the step of obtaining the noise weight includes: calculating the product of the comprehensive confidence level and the suspected noise level to obtain the noise weight of the suspected noise point; the higher the noise weight, the more likely the suspected noise is real salt-and-pepper noise.
[0030] Step S4: Perform median filtering based on the noise weight of the suspected noise points, and perform defect detection based on the filtering result of the surface image.
[0031] During median filtering, true salt-and-pepper noise needs to be removed as much as possible, while features of pore defects with similar characteristics need to be preserved to improve the accuracy of defect detection. Therefore, median filtering is performed based on the noise weight of suspected noise points, specifically including: when the noise weight of a suspected noise point does not exceed a preset noise threshold, the suspected noise point is considered a defect point; median filtering is performed on all non-defect points in the surface image. In this embodiment of the invention, the preset noise threshold is 0.5, which can be determined by the implementer according to the implementation scenario. Median filtering is an existing technology, and the specific steps will not be elaborated here. Defect points represent pore defect areas and are not subject to median filtering; while non-defect points include salt-and-pepper noise and normal areas, which need to be subject to normal median filtering to improve monitoring accuracy. After denoising, defect detection can be performed based on the filtering results of the surface image. The denoised image can be input into a pre-trained defect recognition model for defect recognition. The implementer can perform defect detection based on the denoised image according to the implementation scenario, which is not limited here. Thus, by analyzing the features of different pixels, pixels in noise and defect areas with similar features are divided, enabling median filtering to accurately remove noise while preserving defect details and improving the accuracy of forging defect detection.
[0032] In summary, this invention provides a visual inspection-based method for detecting forging defects. It obtains the suspected noise level and suspected noise points of pixels based on the grayscale difference features of pixels in a surface image; obtains connected components based on the suspected noise level and positional features of pixels; obtains a first noise confidence level based on the gradient change features of the edge regions of the connected components of suspected noise points and the grayscale change features of the connected components; obtains a second noise confidence level based on the positional change features of the edges of the connected components of suspected noise points, the shape features of the connected components, and the connected component attributes of the suspected noise points and neighboring pixels; and obtains a comprehensive confidence level based on the first and second noise confidence levels. This invention obtains noise weights based on the comprehensive confidence level and the suspected noise level; performs median filtering based on the noise weights of suspected noise points; and performs defect detection based on the filtering results, thereby improving the accuracy of defect detection.
[0033] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0034] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A method for detecting forging defects based on visual inspection, characterized in that, The method includes the following steps: Obtain surface images of forged products; The suspected noise level and suspected noise point of a pixel are obtained based on the gray-level difference features between the pixels in the surface image; clustering is performed on all pixels based on their suspected noise level and location features to obtain different connected regions; the first noise confidence level of the suspected noise point is obtained based on the gradient change features of the edge region of the connected region of the suspected noise point and the gray-level change features of the connected region of the suspected noise point. A second noise confidence level for the suspected noise point is obtained based on the positional variation characteristics of the connected component edges, the shape characteristics of the connected component, and the difference characteristics of the connected component attributes between the suspected noise point and its neighboring pixels. A comprehensive confidence level for the suspected noise point is obtained based on the first noise confidence level and the second noise confidence level. A noise weight for the suspected noise point is obtained based on the comprehensive confidence level and the degree of suspected noise. Median filtering is performed based on the noise weights of the suspected noise points, and defect detection is performed based on the filtering results of the surface image. Obtain the first noise confidence level, including: ; In the formula, W represents the first noise confidence level of the suspected noise point. This represents normalization, where N represents the number of edge pixels in the connected component. This represents the gradient value of the nth edge pixel. This represents the local gradient value corresponding to the nth edge pixel. Represents quantitative characteristic values. This represents the number of combinations of grayscale values between any two pixels. This represents the similarity of the grayscale value sequence combinations of the j-th pixel. The step of obtaining the second noise confidence level of the suspected noise point based on the positional variation features of the connected component edges of the suspected noise point, the shape features of the connected component, and the difference features of the connected component attributes between the suspected noise point and its neighboring pixels includes: In the formula, R represents the second noise confidence level of the suspected noise point. Let represent normalization, D represent the standard deviation of the curvature of edge pixels on the edge lines of the connected region, S represent the area of the connected region, and L represent the side length of the connected region. The circleness is represented by M, which represents the number of pixels with the same label as the suspected noise within a preset neighborhood of the suspected noise. The step of obtaining the combined confidence level of the suspected noise point based on the first noise confidence level and the second noise confidence level includes: Calculate the average of the first noise confidence level and the second noise confidence level to obtain the overall confidence level of the suspected noise point; The step of obtaining the noise weight of the suspected noise point based on the comprehensive confidence level and the suspected noise level includes: Calculate the product of the overall confidence level and the suspected noise level to obtain the noise weight of the suspected noise point; The step of performing median filtering based on the noise weights of the suspected noise points includes: When the noise weight of the suspected noise point does not exceed a preset noise threshold, the suspected noise point is a defect point; median filtering is performed on all non-defect points of the surface image; The noise is metal particle spatter, and the defect is pores.
2. The forging defect detection method based on vision inspection according to claim 1, characterized in that, The step of obtaining the suspected noise level and suspected noise point of a pixel based on the grayscale difference features between the pixel and other pixels in the surface image includes: Calculate the absolute value of the difference between the gray value of the pixel and the mean gray value of its eight neighboring areas to obtain the local gray-level difference value of the pixel; calculate the average of the maximum and minimum gray values of the surface image to obtain the median value; calculate the absolute value of the difference between the gray value of the pixel and the median value to obtain the deviation; calculate the product of the local gray-level difference value and the deviation and normalize it to obtain the suspected noise level of the pixel; and identify pixels whose suspected noise level exceeds a preset first threshold as suspected noise points.
3. The forging defect detection method based on vision inspection according to claim 1, characterized in that, The step of clustering based on the suspected noise level and location features of all pixels to obtain different connected components includes: A feature vector is constructed based on the suspected noise level and coordinates of the pixel. Mean-shift clustering is performed on the feature vectors of all pixels to obtain different clusters. The cluster to which the pixel belongs is used as the label of the pixel. Connected components are constructed in the surface image based on pixels with the same label and connected positions.
Citation Information
Patent Citations
Intelligent welding defect positioning and detecting system based on image processing
CN120782759A