CN-121998899-A - Visual detection method and system for defects of inorganic mineral castings
Abstract
The invention relates to the technical field of image analysis, in particular to a visual detection method and a visual detection system for defects of inorganic mineral castings, which comprise the following steps: and generating extreme point coordinates through non-overlapping scanning of the two-channel gray level images, calculating an offset sequence of adjacent point direction angles through Hough transformation, marking a disturbance unit through two-channel direction angle offset operation, analyzing a connected domain, judging a defect area by combining path length and disturbance quantity, and constructing a gradient spectrogram matching frequency fluctuation output defect type and coordinates through equidistant sampling of a main shaft. According to the invention, microscopic texture capturing capacity is enhanced through non-overlapping scanning of the two-channel gray level images, structural distortion is quantized by the Hough transformation direction offset sequence, misjudgment of illumination interference is reduced through synchronous operation of the two-channel direction angles, noise interference is restrained through constraint judgment of the connected domain, accurate defect classification is realized through equidistant sampling of the main shaft and frequency matching of the gradient spectrogram, and detection precision and anti-interference performance are improved through fusion of space arrangement feature quantization and multidimensional feature.
Inventors
- Shang teng
- ZHANG HU
- NIU CHUNFENG
- HAN LIANG
- ZHU XIWEI
Assignees
- 山东克莱蒙特新材料科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20251210
Claims (10)
- 1. The visual detection method for the defects of the inorganic mineral castings is characterized by comprising the following steps of: S1, carrying out non-overlapping scanning on a two-channel gray level image on the surface of a casting by adopting a multi-scale self-adaptive window, dynamically adjusting the window size according to local gray level gradient, extracting and fusing two-channel extreme points, and generating a coordinate set of the extreme points on the surface of the casting; s2, based on the casting surface extreme point coordinate set, carrying out spatial arrangement on the continuous window extreme point coordinates, and calculating the adjacent point connecting line direction angle by adopting Hough transformation to generate a casting surface direction offset angle sequence; S3, calling the casting surface direction offset angle sequence, performing offset operation on the two-channel co-coordinate direction angles, and marking the offset as a disturbance unit if the offset exceeds an angle difference threshold value to obtain a casting surface disturbance unit set; S4, based on the casting surface disturbance unit set, adopting a connected domain analysis algorithm to carry out eight-neighborhood connection on adjacent units, calculating the length of a connected path and the disturbance quantity of unit area, and judging that the casting surface is a defective area if both the two are larger than a set value; And S5, based on the casting surface defect area, extracting two-channel gray scale sampling points along the main shaft at equal intervals, analyzing a gray scale sequence, performing gradient offset operation, constructing a gradient spectrogram, matching a frequency fluctuation area, and outputting the casting surface defect type and coordinates.
- 2. The visual inspection method for defects of inorganic mineral castings according to claim 1, wherein, The rule setting of the spatial arrangement influences the configuration strategy of the Hough transformation parameters, and the configuration strategy cooperatively determine the accuracy and the stability of the direction angle detection; The angle precision of the Hough transformation is matched with the measurement precision; the angle difference threshold is set according to the noise level and the measurement precision of the equipment, the unit is degree, and the Min-Max normalization processing is adopted to limit the range; The set values of the length of the communication path and the disturbance quantity of the unit area are statistically set according to training data; The connected domain analysis algorithm clusters disturbance units on the surface of the casting, and identifies connected regions forming complete defects; The casting surface extreme point coordinate set is specifically an extreme point distribution coordinate, the casting surface direction deviation angle sequence comprises direction change frequency, angle deviation amplitude and direction continuity indexes, the casting surface disturbance unit set is specifically disturbance unit space density, disturbance unit morphological characteristics and disturbance unit local gradient values, the casting surface high-confidence defect area comprises an area communication length, a unit area disturbance number and an area confidence level, and the casting surface defect type and the casting surface defect coordinate comprise defect type labels, defect position coordinates and a frequency fluctuation mode.
- 3. The visual inspection method for defects of inorganic mineral castings according to claim 1, wherein the specific step of S1 includes: S101, scanning a double-channel gray level image on the surface of a casting in a non-overlapping mode by adopting a multi-scale self-adaptive window, extracting all pixel gray level values of two gray level channels in each window, calculating the change range of gray level gradient in the channels, comparing with a gradient distribution threshold value, dynamically adjusting the size of the current window, and generating a multi-scale gray level gradient window set; the initial size of the multi-scale self-adaptive window is empirically set according to the resolution of the image and the defect scale, and the sensitivity of window adjustment is determined according to the integral gradient distribution characteristics of the image; The gradient distribution threshold value is subjected to dynamic threshold value adjustment according to the local statistic value of the current scanning area; s102, calling window coordinates and corresponding gray values in the multi-scale gray gradient window set, judging whether pixel gray levels reach the upper limit and the lower limit of a channel interval in two channels, selecting coordinate points meeting the conditions at the same time, and removing image boundaries and repeated items to obtain a boundary gray extreme value coordinate point set; And S103, according to the pixel coordinates in the boundary gray level extreme value coordinate point set, carrying out coordinate integration according to the sequence of the corresponding window regions, and summarizing the extreme value point position information in the differential window regions to obtain a casting surface extreme value point coordinate set.
- 4. The visual inspection method for defects of inorganic mineral castings according to claim 3, wherein the specific step of S2 includes: S201, extracting adjacent extreme point pairs based on each group of continuous window coordinates in the extreme point coordinate set on the surface of the casting, recording coordinate differences of the point pairs in the row and column directions, disassembling vectors into transverse vector components and longitudinal vector components, calculating component ratio values, analyzing direction angles, and generating an extreme value connection direction angle sequence; S202, invoking angle values in the extreme value connection direction angle sequence, calculating the numerical difference between adjacent angles, and screening angle sections with the angle change value larger than the offset reference value according to the sequence order ratio angle change value and the direction offset reference value to obtain direction angle offset paragraph data; The direction deviation reference value adopts a method of adding standard deviation times to a fluctuation distribution mean value to set a deviation judgment reference; S203, counting the variation range and the fluctuation degree of the direction angle values among continuous paragraphs according to the offset value sequence in the direction angle offset paragraph data, calculating the variation amplitude and the variation slope interval of the multi-section direction angle, and obtaining the casting surface direction offset angle sequence.
- 5. The visual inspection method for defects of inorganic mineral castings according to claim 4, wherein the specific step of S3 includes: S301, calling the two-channel direction angle data of each coordinate point in the casting surface direction offset angle sequence, matching the direction angle values corresponding to the two channels according to the coordinate index, calculating the absolute difference value of the two direction angles under the same coordinate, and generating a coordinate angle difference value sequence; S302, based on the coordinate angle difference value sequence, extracting angle difference values item by item and comparing the angle difference values with angle difference threshold values, judging whether each coordinate point difference value exceeds a threshold value, and recording coordinate point indexes exceeding the threshold value according to a spatial position sequence to obtain a disturbance coordinate index set; S303, calling the marked coordinate points in the disturbance coordinate index set, and adding a direction offset attribute label to each marked point by combining the original coordinate data and the corresponding direction angle difference value to generate a casting surface disturbance unit set.
- 6. The visual inspection method for defects of inorganic mineral castings according to claim 5, wherein the specific step of S4 includes: s401, scanning unit coordinates and detecting eight-neighborhood connectivity based on the casting surface disturbance unit set, recording the number of units and the geometric center, calculating diagonal vertices of an external rectangle, and generating a form feature data set of a connected region; S402, invoking the morphological feature data set of the communication area, calculating the Euclidean distance path length of the external rectangle as a path length value, taking the ratio of the number of the statistic units to the area of the external rectangle as a disturbance density value of a unit area, combining the path length value and the disturbance density value as double parameter indexes, and generating a disturbance intensity index set of the communication area; S403, extracting path length and disturbance density of unit area item by item according to the disturbance intensity index set of the communication area, screening the communication area which simultaneously meets the condition that the path length is larger than a length threshold value and the disturbance density is larger than a density threshold value, and generating a casting surface defect area; The length threshold and the density threshold are statistically set according to training data.
- 7. The visual inspection method for defects in inorganic mineral castings according to claim 6, wherein said path length values are calculated using the formula: ; Wherein, the Representing the value of the path length and, Representing the polar difference in the x-axis coordinates, Representing the polar difference in the y-axis coordinates, Representing the total number of connected-region units, Represents the area of the circumscribed rectangle, Representing an area correction coefficient, representing the ratio of the actual average density to the reference density, avoiding disturbance value deviation caused by regional density abnormality, Representing the scale adjustment length, avoiding the weight unbalance of the scale region in index calculation, Representing the reference area, s is the cell size area, Representing a length reference.
- 8. The visual inspection method for defects of inorganic mineral castings according to claim 6, wherein the specific step of S5 includes: S501, setting sampling point coordinates according to a fixed interval distance based on the main axis direction of the casting surface defect area, respectively extracting gray values of each coordinate point along a two-channel gray image, and sequencing to generate a two-channel gray sampling point sequence; S502, invoking the two-channel gray scale sampling point sequence, calculating gray scale value variation of adjacent sampling points to serve as gradient values, synchronously superposing the two-channel gradient variation according to sampling positions, constructing a two-dimensional distribution map with the horizontal axis as the sampling position and the vertical axis as the gradient variation, and generating a gradient spectrogram data set; s503, calculating the similarity between the local frequency and the cosine of the reference spectrum according to the gradient spectrogram data set, screening the low-similarity region and matching the defect type library, and outputting the type and the coordinates of the surface defects of the casting.
- 9. The visual inspection method for defects of inorganic mineral castings according to claim 8, wherein said gradient change is calculated using the formula: ; Wherein, the Represents the fusion gradient variation quantity of the kth sampling point, the gradient variation quantity is used for guiding frequency spectrum enhancement and defect feature extraction, differentiation is carried out on the type of differentiation defects on the premise of not introducing a neural network structure, Representing the dynamic difference coefficient of channel c, Representing the mean shift coefficient of channel c, A gray scale measurement representing the kth sample point of channel c, Representing the local gray average value of channel c, Representing the spatial location attenuation factor of channel c, Representing the sampling interval of channel c, Representing the minimum pitch compensation amount for channel c, Representing the signal-to-noise suppression adjustment coefficient for channel c, Is the local gray standard deviation of channel c.
- 10. A visual inspection system for inorganic mineral casting defects, wherein the system is for implementing the visual inspection method for inorganic mineral casting defects according to any one of claims 1 to 9, the system comprising: The image acquisition module is used for carrying out non-overlapping scanning on the two-channel gray level image on the surface of the casting through the multi-scale self-adaptive window size, acquiring pixel coordinates corresponding to gray level values of each window, generating an extreme point coordinate set, and transmitting the extreme point coordinate set to the extreme value extraction module; the extremum extraction module is used for extracting continuous extremum points from the extremum point coordinate set and constructing a path, calling a path ordering function to order the path coordinates, calculating the direction angles of two points in the path by adopting a Hough transformation algorithm, outputting a direction offset angle sequence, and transmitting the direction offset angle sequence to the direction analysis module; The direction analysis module is used for executing inter-channel direction fluctuation judgment according to the direction deviation angle sequence, calculating the corresponding coordinate direction angle deviation amount by adopting an angle difference operation function, judging whether the threshold value is exceeded or not, counting the number of abnormal points, marking a corresponding window as a disturbance area if the number of the abnormal points exceeds the limit, outputting a disturbance unit set, and transmitting the disturbance unit set to the disturbance recognition module; the disturbance recognition module is used for executing space aggregation detection on the disturbance unit set, aggregating eight neighborhood regions by adopting a connected subgraph algorithm, calling a region screening function to evaluate whether the length of the connected region and the disturbance density meet recognition conditions, generating a high-confidence defect region, and transmitting the high-confidence defect region to the defect judgment module; And the defect judging module is used for extracting frequency characteristics from the high-confidence defect area, collecting a gray sequence along the main shaft direction, calculating a gradient, performing frequency spectrum conversion to identify frequency fluctuation, judging the defect type and outputting the defect type and coordinates of the surface of the casting.
Description
Visual detection method and system for defects of inorganic mineral castings Technical Field The invention relates to the technical field of image analysis, in particular to a visual detection method and a visual detection system for defects of inorganic mineral castings. Background The technical field of image analysis comprises a related method and application for identifying, detecting, analyzing and processing image content based on visual information, and the core content of the technical field comprises the steps of automatically identifying and quantitatively analyzing targets or features in images by utilizing a computer visual algorithm, and comprises a plurality of links such as image preprocessing, feature extraction, target detection, image segmentation, mode identification and the like. Image analysis is widely used in industrial inspection, medical diagnosis, security monitoring, agricultural inspection, etc., where typical applications in industrial inspection include automated inspection of product surface defects, structural anomalies, and material consistency. The technology in the field continuously evolves towards the development direction of high precision, multi-scene adaptability and high-efficiency processing capacity, and aims to replace manual detection and improve detection efficiency and consistency. The visual detection method for the defects of the inorganic mineral castings refers to a technical method for detecting the defects existing on the surfaces or in the surfaces of casting products made of inorganic mineral materials through visual image acquisition and processing means. The technical matters covered by the subject comprise that an industrial camera is utilized to collect image information of an inorganic mineral casting under specific lighting conditions, then image characteristics of a defect area are extracted through image enhancement and denoising treatment, and then the type and the position of the defect are judged through an algorithm based on gray characteristics and edge information, so that the identification of typical defects such as cracks, sand holes and air holes is completed. The method realizes the separation and analysis of the defect image characteristics by means of fixed-angle multi-light source illumination, image filtering processing, edge detection operators, morphological analysis and the like. In the prior art, single-channel gray feature analysis is relied on, the gray difference capturing capability of the surface micro defects is limited, sub-pixel level cracks are easy to miss-detect in a low-contrast scene, the traditional morphological analysis is based on fixed structural elements to carry out corrosion expansion operation, the method is difficult to adapt to complex texture background on the surface of an inorganic mineral casting, and natural textures are easy to misjudge as structural defects. The edge detection operator has high sensitivity to noise, and pseudo-edge interference is easy to generate in an uneven illumination or reflective area, so that defect positioning coordinate offset is caused. The defect identification method based on threshold segmentation lacks directional distortion quantitative analysis, and cannot effectively distinguish real defects from inherent texture trend differences of materials. The pattern recognition algorithm mostly adopts static characteristic template matching, a dynamic gradient spectrogram analysis mechanism is not established, and the classification accuracy rate of similar defects of air holes and sand holes is insufficient. For example, the defect of the air hole commonly found in the industrial detection is easy to form erroneous judgment with the residual air bubble in the material due to lack of frequency fluctuation characteristic analysis, and the reliability of the detection result is affected. In the existing method, only a single index of the area of the region is considered during the processing of the connected region, and a path length and distribution density combined judging mechanism is not introduced, so that the slender crack and the discrete noise point are difficult to effectively distinguish. Disclosure of Invention In order to solve the problems that the prior art relies on single-channel gray feature analysis, the gray difference capturing capability of the surface micro defects is limited, sub-pixel level cracks are easy to leak in a low-contrast scene, the traditional morphological analysis is based on fixed structural elements to perform corrosion expansion operation, the method is difficult to adapt to complex texture background on the surface of an inorganic mineral casting, and natural textures are easy to be misjudged as structural defects. The edge detection operator has high sensitivity to noise, and pseudo-edge interference is easy to generate in an uneven illumination or reflective area, so that defect positioning coordinate offset is caused. The defect i