Surface detection device for nonferrous castings
By combining the acquisition controller, database and processor, the texture features are analyzed using the Sobel operator and grayscale symbiosis matrix, spatial position information and adaptive threshold optimization are introduced, and false positive and false negative problems in surface detection of colored castings are solved, achieving efficient and accurate defect recognition.
Patent Information
- Application Number
- CN202411623815.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2044-11-14
AI Technical Summary
Traditional human eye detection of surface defects of castings is inefficient and susceptible to subjective factors, making it difficult to ensure the consistency and accuracy of detection. Especially, the surface of colored castings is rich in color and complex in texture, and traditional methods that rely on grayscale information cannot effectively distinguish defects.
The acquisition controller is used to obtain casting process parameters and surface images of colored castings, combine database storage and processor for defect identification, use Sobel operator to detect edges, analyze texture features, introduce spatial position information and adaptive threshold optimization, and establish a defect probability model with casting process parameters, and display the detection results at the terminal.
Through multi-channel fusion color information and grayscale symbiosis matrix, the texture characteristics of different color areas are accurately identified, false positives and false negatives are reduced, and the reliability and accuracy of the detection results are improved.
Smart Images

Figure CN119375236B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition, in particular to a surface detection device for nonferrous castings. Background Art
[0002] With the continuous improvement of industrial automation and intelligence, higher requirements are being placed on the precise identification and location of surface defects (such as pores and cracks) in castings. Traditional human visual inspection is not only inefficient but also easily influenced by subjective factors, making it difficult to ensure the consistency and accuracy of inspection. Therefore, the development of efficient and accurate automated surface inspection technology has become an urgent need in the industry. Non-ferrous castings have rich surface colors and complex textures, which increase the difficulty of inspection. This has prompted researchers to explore the application of advanced image processing technology and machine learning algorithms to casting surface inspection to achieve automatic identification and classification of subtle defects, thereby significantly improving production efficiency and product quality. Existing technologies can result in false positives (misidentified defects) and false negatives (missed defects), and casting surfaces may have multiple colors and textures. Traditional methods that rely on grayscale information may not be able to effectively distinguish defects on the casting surface. Therefore, a surface inspection device for non-ferrous castings is designed. Summary of the Invention
[0003] The purpose of the present invention is to provide a surface inspection device for non-ferrous castings to solve the problems raised in the above-mentioned background technology, such as false positives (incorrectly identified defects) and false negatives (missed defects), and the problem that the surface of the casting may have multiple colors and textures, and the traditional method relying on grayscale information may not be able to effectively distinguish defects on the surface of the casting.
[0004] To achieve the above object, the present invention provides a surface detection device for nonferrous castings, comprising:
[0005] An acquisition controller, the acquisition controller is used to acquire casting process parameters, environmental data and images of the non-ferrous casting surface, and transmit the casting process parameters, environmental data and images of the non-ferrous casting surface to a database;
[0006] A database, wherein the database is used to store the data and images collected by the acquisition controller, and each storage record is timestamped;
[0007] A processor configured to process the image and identify defects, optimize the defect identification process by incorporating spatial location information and the influence of adaptive thresholds, and establish a relationship model between process parameters and defect probabilities in combination with casting process parameters; defects include cracks and bubbles;
[0008] The processor includes a feature extraction unit, a defect recognition unit, and a parameter analysis unit;
[0009] The terminal is used to display the test results in the form of images and charts, generate detailed test reports, and record defect information and process parameters.
[0010] As a further improvement of the present technical solution, the casting process parameters collected by the controller include pouring temperature, cooling rate, and casting pressure.
[0011] As a further improvement of the present technical solution, the specific steps of acquiring the image of the surface of the colored casting in the acquisition controller are as follows:
[0012] S11. Before shooting, select a high-resolution camera, lighting equipment, and fixtures. Also, select a temperature sensor, cooling rate meter, pressure sensor, and temperature and humidity sensor.
[0013] S12. Setting the sampling frequency and trigger condition parameters, and setting the camera parameters, to photograph the casting surface from multiple angles to cover all defect areas;
[0014] S13. Start the data acquisition software to collect and record the pouring temperature, cooling rate, casting pressure and ambient temperature and humidity data in real time. At the same time, use a high-resolution camera to capture the surface image of the casting. Finally, transfer the collected data and images to the database.
[0015] As a further improvement of this technical solution, in the processor:
[0016] The feature extraction unit is used to detect edges in the image using the Sobel operator and analyze the texture features of the image using the gray-level co-occurrence matrix to identify defective areas on the surface of non-ferrous castings;
[0017] The defect recognition unit is used to classify the identified defect area and determine whether it is a crack or a pore;
[0018] The parameter analysis unit is used to analyze the causes of defects in combination with casting process parameters, establish a relationship model between process parameters and defect probability, and obtain the influencing factors of defect generation.
[0019] As a further improvement of the present technical solution, the feature extraction unit uses the Sobel operator to detect edges in the image, as follows:
[0020] ;
[0021] in, is the convolution kernel in the horizontal direction; is a pixel;
[0022] ;
[0023] in, is the convolution kernel in the vertical direction;
[0024] ;
[0025] in, is the gradient amplitude;
[0026] ;
[0027] in, is the gradient direction.
[0028] As a further improvement of the present technical solution, in the feature extraction unit, the texture features of the image are analyzed using a gray level co-occurrence matrix, as follows:
[0029] Each pixel in the collected colored casting image has three color channels, and a separate , and then for each color channel Combine to form multiple channels ;
[0030] Known , , are grayscale images of the image on three color channels, then for each color channel, the constructed , recorded as , , ,in is the distance between pixels, It is the direction;
[0031] ;
[0032] in, For the distance and direction The gray value is The pixel and gray value are The joint probability of the pixels appearing; is the color channel; ; For images in color channels Upper position Gray value at ; is the number of pixel pairs that meet the conditions; For color channels The weight of .
[0033] As a further improvement of the present technical solution, the processor introduces the influence of spatial position information and adaptive thresholds during the defect recognition process for optimization. The optimization is as follows:
[0034] ;
[0035] in, is the spatial position function; is the center coordinate of the image; is the standard deviation of the Gaussian function; is the base of the exponential function;
[0036] ;
[0037] in, is the adaptive threshold function; and To adjust the parameters; For The standard deviation of the grayscale value in the local area centered at ;
[0038] but:
[0039] ;
[0040] in, The distance after optimization and direction The gray value is The pixel and gray value are The joint probability of the pixels appearing; is the indicator function.
[0041] As a further improvement of this technical solution, the optimized formula constructed based on , , , generate texture features:
[0042] ;
[0043] in, For any one ; is the contrast; is the gray-level co-occurrence matrix Middle Rank The element value of the column;
[0044] ;
[0045] in, For relevance; Grayscale value The average value of Grayscale value The average value of Grayscale value The standard deviation of Grayscale value The standard deviation of
[0046] ;
[0047] in, for energy;
[0048] ;
[0049] in, For homogeneity.
[0050] As a further improvement of this technical solution, the defect recognition unit is specifically as follows:
[0051] S31. Collect a large number of casting surface images in advance, including samples containing cracks and pores, mark each sample, indicate the location and type of defects, and then standardize the images;
[0052] S32, combining texture features to form a high-dimensional feature vector, and using a linear analysis method to reduce the feature dimension, retaining information that can distinguish cracks and pores;
[0053] S33. Select a model and find the optimal model parameter configuration, then train and evaluate the model, and continuously adjust the model based on the evaluation results until the optimal performance level is achieved;
[0054] S34. Finally, the trained model is used for defect detection to distinguish cracks and pores.
[0055] As a further improvement of this technical solution, the S32 is specifically as follows:
[0056] Feature extraction:
[0057] ;
[0058] in, is a high-dimensional feature vector; For the Contrast features; For the correlation features; For the energy characteristics; For the homogeneous characteristics;
[0059] Centralization:
[0060] ;
[0061] in, is the centered eigenvector; is the mean vector of the eigenvectors;
[0062] Covariance matrix:
[0063] ;
[0064] in, is the covariance matrix; for The transposed matrix of
[0065] Eigenvalues and eigenvectors:
[0066] ;
[0067] in, is the eigenvector; is the eigenvalue;
[0068] Before selection The eigenvectors corresponding to the eigenvalues form the projection matrix :
[0069] ;
[0070] in, is the projection matrix;
[0071] PCA projection:
[0072] ;
[0073] in, is the eigenvector after PCA projection;
[0074] Within-class scatter matrix:
[0075] ;
[0076] in, is the intra-class scatter matrix; For the The sample set of the class; For the The mean vector of the class;
[0077] Between-class scatter matrix:
[0078] ;
[0079] in, is the inter-class scatter matrix; For the The number of class samples;
[0080] Generalized eigenvalue problem:
[0081] ;
[0082] in, is the eigenvector; is the characteristic value;
[0083] Before selection The eigenvectors corresponding to the eigenvalues form the projection matrix :
[0084] ;
[0085] in, is the projection matrix;
[0086] LDA Projection:
[0087] ;
[0088] in, is the feature vector after LDA projection.
[0089] Compared with the prior art, the present invention has the following beneficial effects:
[0090] 1. In this surface inspection device for non-ferrous castings, multi-channel fusion can more comprehensively reflect surface features. By combining color information with the gray-level co-occurrence matrix, the texture features of different color regions can be more accurately identified. By introducing color channel weights, the formula can adjust the contribution of different color channels, making the identification of defects sensitive to specific colors more accurate.
[0091] 2. In this surface inspection device for non-ferrous castings, the features of the central area of the image are emphasized by a Gaussian function, ensuring that the features of the key areas are given higher weights in defect detection. The algorithm can adaptively determine the threshold based on the local characteristics of the image, thereby more accurately identifying defects in different areas, especially in images with uneven lighting or complex backgrounds, reducing false positives and false negatives and improving the reliability of the detection results. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] Figure 1 It is the overall flow chart of the present invention;
[0093] Figure 2 is a system block diagram of the processor in the present invention;
[0094] The meaning of each number in the figure is:
[0095] 1. Acquisition controller; 2. Database; 3. Processor; 31. Feature extraction unit; 32. Defect recognition unit; 33. Parameter analysis unit; 4. Terminal. DETAILED DESCRIPTION
[0096] The following will provide a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0097] See also Figure 1-2 As shown, a surface detection device for nonferrous castings is provided, comprising an acquisition controller 1, a database 2, a processor 3 and a terminal 4; wherein,
[0098] The acquisition controller 1 is used to acquire casting process parameters, environmental data and images of the non-ferrous casting surface, and transmit the casting process parameters, environmental data and images of the non-ferrous casting surface to the database 2; the casting process parameters acquired by the controller 1 include pouring temperature, cooling rate and casting pressure;
[0099] The specific steps of acquiring the image of the non-ferrous casting surface in the acquisition controller 1 are as follows:
[0100] S11. Before shooting, select a high-resolution camera, lighting equipment, and fixtures to ensure high enough image quality to clearly capture subtle cracks and pores. Use appropriate lighting equipment, such as ring lights, coaxial lights, or backlights, to ensure even illumination of the casting surface and avoid shadows and reflections. Use fixtures (such as tripods and clamps) to ensure the camera is stable to avoid shaking during shooting. Also, select temperature sensors, cooling rate meters, pressure sensors, and temperature and humidity sensors.
[0101] S12. Set the sampling frequency and trigger condition parameters to ensure that the sampling frequency and trigger condition settings of all sensors are reasonable to meet actual needs, and set the camera parameters to shoot the casting surface from multiple angles to cover all defect areas, ensuring that all possible defect areas are covered to improve the comprehensiveness of the detection;
[0102] S13. Start the data acquisition software to collect and record the pouring temperature, cooling rate, casting pressure, and ambient temperature and humidity data in real time. At the same time, use a high-resolution camera to capture the surface image of the casting and save the image file according to a unified naming rule, such as "casting number_shooting location_date time.jpg". Finally, transfer the collected data and images to database 2.
[0103] The database 2 is used to store the data and images collected by the acquisition controller 1, and each storage record is timestamped;
[0104] Processor 3 is used to process the image and identify defects. During the defect identification process, spatial position information and the influence of adaptive thresholds are introduced for optimization. In combination with casting process parameters, a relationship model between process parameters and defect probability is established. Defects include cracks and bubbles.
[0105] The processor 3 includes a feature extraction unit 31, a defect recognition unit 32, and a parameter analysis unit 33;
[0106] In processor 3:
[0107] The feature extraction unit 31 is used to detect edges in the image using the Sobel operator and analyze the texture features of the image using the gray-level co-occurrence matrix to identify defective areas on the surface of the non-ferrous casting;
[0108] In the feature extraction unit 31, the Sobel operator is used to detect edges in the image, as follows:
[0109] ;
[0110] in, is the convolution kernel in the horizontal direction; is a pixel;
[0111] ;
[0112] in, is the convolution kernel in the vertical direction;
[0113] ;
[0114] in, is the gradient amplitude;
[0115] ;
[0116] in, is the gradient direction;
[0117] The gradient magnitude reflects the degree of change in the grayscale value of pixels in an image. Edges typically correspond to areas with large grayscale changes, so areas with high gradient magnitudes are often edges. By setting a threshold, areas with high gradient magnitudes can be marked as edges, thus enabling edge detection. The gradient direction can be used for edge linking, helping to connect broken edges and form a continuous edge curve.
[0118] In the feature extraction unit 31, the texture features of the image are analyzed using the gray level co-occurrence matrix, as follows:
[0119] Since the casting surface is colored, relying solely on grayscale information may not be sufficient to accurately distinguish pores from other defects or normal areas. Combined, for example by building multi-channel Alternatively, you can first convert the image to a color space that is more suitable for distinguishing color differences (such as HSV or Lab), which can enhance the ability to identify pores. Specifically:
[0120] Each pixel in the collected colored casting image has three color channels (red R, green G, blue B), and a separate image is constructed for each color channel. , and then for each color channel Combine to form multiple channels ;
[0121] Known , , are grayscale images of the three color channels (red, green, and blue), then for each color channel, the constructed , recorded as , , ,in is the distance between pixels, It is the direction;
[0122] ;
[0123] in, For the distance and direction The gray value is The pixel and gray value are The joint probability of the pixels appearing; is the color channel; ; For images in color channels Upper position Gray value at ; is the number of pixel pairs that meet the conditions; For color channels The weights are used to adjust the contribution of different color channels or under different conditions; Kronecker Function, returns 1 if the two parameters are equal, otherwise returns 0;
[0124] Because the casting surface may have a variety of colors and textures, relying solely on grayscale information may not be able to effectively distinguish them. , can adapt to this complexity and improve the robustness and accuracy of detection. Specifically, it is constructed in the red, green and blue color channels respectively. , and then combine them to form multi-channel , which enables the system to capture the features of the casting surface from multiple angles. It reflects the texture information in a specific color space, while multi-channel fusion can reflect the surface features more comprehensively. By combining color information with the gray-level co-occurrence matrix, the texture features of different color areas can be more accurately identified.
[0125] By introducing color channel weights, the formula can adjust the contribution of different color channels, making the identification of defects sensitive to specific colors more accurate, and using Kronecker The function simplifies the calculation process and only counts when the grayscale values are equal, reducing unnecessary calculations and improving the efficiency of feature extraction;
[0126] The effects of spatial position information and adaptive thresholds are introduced into the defect recognition process for optimization. The optimization results are as follows:
[0127] ;
[0128] in, It is a spatial position function, which can be a Gaussian function or other forms of functions, used to emphasize the characteristics of certain areas; is the center coordinate of the image; is the standard deviation of the Gaussian function, which controls the width of the function; is the base of the exponential function;
[0129] ;
[0130] in, It is an adaptive threshold function that dynamically adjusts the threshold according to local characteristics; and To adjust the parameters; For The standard deviation of the grayscale value in the local area centered at ;
[0131] Specifically, parameters The weight coefficient used to amplify or reduce the local standard deviation. It controls the influence of the local grayscale standard deviation on the threshold in the image and determines the sensitivity to small defects. The offset used to balance the overall threshold value so that a reasonable threshold starting point can be maintained even in areas with low image brightness or gentle changes. Typically, this value is set between 0.5 and 1.5. Depending on your inspection needs, if you want to be more sensitive to small defects (such as tiny cracks or pores), you can choose a higher initial value (such as 1.0 to 1.5); if you are experiencing high noise levels, you can choose a lower value (such as 0.5 to 1.0). It is usually set to a value between 0 and 20 to compensate for the threshold deviation in low contrast areas. A data-driven approach can be used to automatically adjust the threshold based on a set of image samples. and : Label sample images containing defects in different and The defect detection is performed under the combination of the two methods, and the error between the detection results and the actual annotation is recorded. By minimizing the mean square error between the detection results and the annotation, the optimal detection accuracy can be found. and Group value.
[0132] but:
[0133] ;
[0134] in, The distance after optimization and direction The gray value is The pixel and gray value are The joint probability of the pixels appearing; is the indicator function, when and The gray value difference is less than Returns 1 when the grayscale value difference is less than the adaptive threshold, otherwise returns 0, ensuring that the probability is only counted when the grayscale value difference is less than the adaptive threshold, which helps to filter noise and improve the accuracy of defect recognition;
[0135] By using the Gaussian function to emphasize the features of the central area of the image, or emphasizing specific areas according to application requirements, the features of key areas are given higher weight in defect detection. Dynamic adjustment based on the standard deviation of local grayscale values enables the algorithm to adaptively determine the threshold based on the local characteristics of the image, thereby more accurately identifying defects in different areas, especially in images with uneven lighting or complex backgrounds.
[0136] After introducing adaptive thresholds and spatial position information, the algorithm's adaptability to local image changes is enhanced, reducing false positives (incorrectly identified defects) and false negatives (missed defects), and improving the reliability of detection results.
[0137] Based on the above formula , , , generate texture features:
[0138] ;
[0139] in, For any one ; is the contrast; is the gray-level co-occurrence matrix Middle Rank The element value of the column;
[0140] Contrast reflects the intensity of grayscale changes in an image. In the formula, Represents grayscale value and The square of the difference between them, multiplied by the joint probability of their occurrence , and for all and Sum. The larger the contrast value, the higher the texture contrast in the image, that is, the more dramatic the change in grayscale value;
[0141] ;
[0142] in, For relevance; Grayscale value The average value of Grayscale value The average value of Grayscale value The standard deviation of Grayscale value The standard deviation of
[0143] Correlation reflects the linear dependence between the gray values in the image. In the formula, Represents grayscale value and The degree of deviation from their mean, multiplied by the joint probability of their occurrence , and for all and Sum the values and finally divide the result by the product of the standard deviations of the two grayscale values to get the normalized correlation value. The closer the correlation value is to 1 or -1, the stronger the linear relationship between the grayscale values.
[0144] ;
[0145] in, for energy;
[0146] Energy reflects the uniformity of grayscale distribution in the image. In the formula, Represents grayscale value and The square of the joint probability of occurrence, for all and Sum; the larger the energy value, the higher the frequency of occurrence of certain grayscale value pairs in the image, that is, the grayscale value distribution is more concentrated;
[0147] ;
[0148] in, for homogeneity;
[0149] Homogeneity reflects the uniformity of the grayscale values in the image. In the formula, Represents grayscale value and The joint probability of occurrence is divided by the absolute difference between them plus 1, for all and Sum, the larger the homogeneity value is, the smaller the difference between the gray values in the image is, that is, the gray value distribution is more uniform;
[0150] By using the above method, we can construct a separate And extract a variety of texture features (contrast, correlation, energy, homogeneity) from it. These features can be combined into a multi-channel feature vector for subsequent classification or recognition tasks, thereby improving the recognition ability of pores on the surface of non-ferrous castings.
[0151] The defect recognition unit 32 is used to classify the identified defect area and determine whether it is a crack or a pore; the details are as follows:
[0152] S31. Collect a large number of casting surface images in advance, including samples containing cracks and pores. Ensure that the samples cover a variety of environmental conditions and defect morphologies to increase the generalization ability of the model. Label each sample to indicate the location and type of defect (crack or pore). Then perform standardization processing on the image, such as resizing, grayscale conversion, and noise removal, to reduce the influence of irrelevant factors and improve the accuracy of feature extraction.
[0153] S32, combining texture features to form a high-dimensional feature vector, and using a linear analysis method to reduce the feature dimension, retaining information that can distinguish cracks and pores, while reducing the complexity of subsequent processing;
[0154] S33. Select a model and find the optimal model parameter configuration, then train and evaluate the model, and continuously adjust the model based on the evaluation results until the optimal performance level is achieved;
[0155] S34. Finally, the trained model is used for defect detection to distinguish cracks and pores.
[0156] S32 is as follows:
[0157] Calculated in 4 directions (0°, 45°, 90°, 135°) and 3 distances (1, 2, 3) , each feature has 12 values;
[0158] Feature extraction:
[0159] ;
[0160] in, is a high-dimensional feature vector; For the Contrast features; For the correlation features; For the energy characteristics; For the homogeneous characteristics;
[0161] By extracting multiple texture features (contrast, correlation, energy, homogeneity), the texture information of the image can be fully captured, and the richness and representativeness of the features can be improved; by calculating GLCM at different directions and distances, texture information of different scales and directions can be captured, and the robustness and diversity of the features can be enhanced;
[0162] Centralization:
[0163] ;
[0164] in, is the centered eigenvector; is the mean vector of the eigenvectors;
[0165] Centralization eliminates the mean shift of the feature vector, making the data distribution more concentrated, which is conducive to subsequent feature extraction and dimensionality reduction. The centralized data is easier to perform numerical calculations, avoiding numerical instability caused by data shift;
[0166] Covariance matrix:
[0167] ;
[0168] in, is the covariance matrix; for The transposed matrix of
[0169] The covariance matrix reflects the linear correlation between features, which helps to understand the relationship between features. The covariance matrix can be used to find the main direction of change of the data, providing a basis for subsequent dimensionality reduction.
[0170] Eigenvalues and eigenvectors:
[0171] ;
[0172] in, is the eigenvector; is the eigenvalue;
[0173] Eigenvalues and eigenvectors are the core of PCA. Eigenvalues can be used to determine the main direction of data change, while eigenvectors provide a specific representation of these directions. Selecting eigenvectors with larger eigenvalues can retain the main information of the data while reducing the feature dimension and computational complexity.
[0174] Before selection The eigenvectors corresponding to the eigenvalues form the projection matrix :
[0175] ;
[0176] in, is the projection matrix, The eigenvalues correspond to the eigenvectors;
[0177] By selecting The eigenvector corresponding to each eigenvalue can project high-dimensional data into a low-dimensional space, retaining the most important information. The data after dimensionality reduction is easier to process, reducing the consumption of computing resources and improving the processing speed.
[0178] PCA projection:
[0179] ;
[0180] in, is the eigenvector after PCA projection;
[0181] PCA projection converts high-dimensional data into low-dimensional data, retaining the main features of the data, simplifying subsequent analysis and modeling, and removing noise from the data, improving data quality and model robustness;
[0182] Within-class scatter matrix:
[0183] ;
[0184] in, is the intra-class scatter matrix; For the The sample set of the class; For the The mean vector of the class; the intra-class scatter matrix reflects the differences between data of the same class, which helps to understand the data distribution within the class. By minimizing the intra-class scatter, the consistency of the data within the class can be improved, and the classification effect can be enhanced;
[0185] Between-class scatter matrix:
[0186] ;
[0187] in, is the inter-class scatter matrix; For the The number of class samples; the inter-class scatter matrix reflects the differences between different classes of data, which helps to understand the degree of separation between classes. By maximizing the inter-class scatter, the distinction between different classes of data can be enhanced, thereby improving the accuracy of classification;
[0188] Generalized eigenvalue problem:
[0189] ;
[0190] in, is the eigenvector; The generalized eigenvalue problem provides the optimal projection direction, which maximizes the inter-class difference of the projected data while minimizing the intra-class difference. By selecting the appropriate eigenvector, the performance of the classification model can be significantly improved.
[0191] Before selection The eigenvectors corresponding to the eigenvalues form the projection matrix :
[0192] ;
[0193] in, is the projection matrix, The eigenvalues correspond to the eigenvectors;
[0194] LDA Projection:
[0195] ;
[0196] in, is the feature vector after LDA projection. LDA projection projects the data into the optimal classification subspace, enhancing the distinction between different types of data and improving the accuracy of classification. LDA projection further simplifies the data, making the classification model easier to train and apply.
[0197] Through the above steps, texture features are combined into high-dimensional feature vectors, and linear analysis methods are used to reduce feature dimensions, improving the accuracy and efficiency of casting surface defect detection. Each step has clear benefits, ensuring the effectiveness and reliability of the entire process, not only improving the representativeness and robustness of features, but also optimizing the performance of the classification model.
[0198] The parameter analysis unit 33 is used to analyze the causes of defects in combination with casting process parameters, establish a relationship model between process parameters and defect probability, and obtain the influencing factors of defect generation;
[0199] Terminal 4 is used to display the test results in the form of images and charts, generate detailed test reports, and record defect information and process parameters.
[0200] The basic principles, main features, and advantages of the present invention are shown and described above. It should be understood by those skilled in the art that the present invention is not limited to the above-described embodiments. The above-described embodiments and descriptions are merely preferred examples of the present invention and are not intended to limit the present invention. Various changes and modifications may be made to the present invention without departing from the spirit and scope of the present invention, and such changes and modifications fall within the scope of the invention claimed.
Claims
1. A surface detection device for nonferrous castings, characterized in that: include: An acquisition controller (1), the acquisition controller (1) is used to acquire casting process parameters, environmental data and images of the surface of the non-ferrous casting, and transmit the casting process parameters, environmental data and images of the surface of the non-ferrous casting to a database (2); A database (2), the database (2) is used to store the data and images collected by the acquisition controller (1), each storage record having a timestamp; A processor (3), the processor (3) is used to process the image and identify defects, introduce spatial position information and the influence of adaptive thresholds to optimize the defect identification process, and combine casting process parameters to establish a relationship model between process parameters and defect probability; wherein defects include cracks and bubbles; The processor (3) includes a feature extraction unit (31), a defect recognition unit (32), and a parameter analysis unit (33); In the processor (3): The feature extraction unit (31) is used to detect edges in the image using the Sobel operator and analyze the texture features of the image using the gray-level co-occurrence matrix to identify defective areas on the surface of the non-ferrous casting; The defect recognition unit (32) is used to classify the identified defect area and determine whether it is a crack or a pore; The parameter analysis unit (33) is used to analyze the causes of defects in combination with casting process parameters, establish a relationship model between process parameters and defect probability, and obtain influencing factors of defect generation; In the feature extraction unit (31), the texture features of the image are analyzed using the gray level co-occurrence matrix, as follows: Each pixel in the collected colored casting image has three color channels, and a separate , and then for each color channel Combine to form multiple channels ; Known , , are grayscale images of the image on three color channels, then for each color channel, the constructed , recorded as , , ,in is the distance between pixels, It is the direction; ; in, For the distance and direction The grayscale value is The pixel and gray value are The joint probability of the pixels appearing; is the color channel; ; For images in color channels Upper position Gray value at ; is the number of pixel pairs that meet the conditions; For color channels The weight of In the processor (3), the effects of spatial position information and adaptive thresholds are introduced during the defect recognition process for optimization, and the optimization is as follows: ; in, is the spatial position function; is the center coordinate of the image; is the standard deviation of the Gaussian function; is the base of the exponential function; ; in, is the adaptive threshold function; and To adjust the parameters; For The standard deviation of the grayscale value in the local area centered at ; but: ; in, The distance after optimization and direction The gray value is The pixel and gray value are The joint probability of the pixels appearing; is the indicator function; The terminal (4) is used to display the test results in the form of images and charts, generate a detailed test report, and record defect information and process parameters.
2. The surface detection device for nonferrous castings according to claim 1, characterized in that: The casting process parameters collected by the controller (1) include pouring temperature, cooling rate, and casting pressure.
3. The surface detection device for nonferrous castings according to claim 2, characterized in that: The specific steps of acquiring the image of the surface of the non-ferrous casting in the acquisition controller (1) are as follows: S11. Before shooting, select a high-resolution camera, lighting equipment, and fixtures. Also, select a temperature sensor, cooling rate meter, pressure sensor, and temperature and humidity sensor. S12. Setting the sampling frequency and trigger condition parameters, and setting the camera parameters, to photograph the casting surface from multiple angles to cover all defect areas; S13. Start the data acquisition software to collect and record the pouring temperature, cooling rate, casting pressure and ambient temperature and humidity data in real time. At the same time, use a high-resolution camera to take images of the casting surface. Finally, transfer the collected data and images to the database (2).
4. The surface detection device for nonferrous castings according to claim 1, characterized in that: In the feature extraction unit (31), the Sobel operator is used to detect edges in the image, as follows: ; in, is the convolution kernel in the horizontal direction; is a pixel; ; in, is the convolution kernel in the vertical direction; ; in, is the gradient amplitude; ; in, is the gradient direction.
5. The surface detection device for nonferrous castings according to claim 1, characterized in that: Based on the optimized formula , , , generate texture features: ; in, For any one ; is the contrast; is the gray-level co-occurrence matrix Middle Rank The element value of the column; ; in, For relevance; Grayscale value The average value of Grayscale value The average value of Grayscale value The standard deviation of Grayscale value The standard deviation of ; in, for energy; ; in, For homogeneity.
6. The surface detection device for nonferrous castings according to claim 5, characterized in that: The defect recognition unit (32) is specifically as follows: S31. Collect a large number of casting surface images in advance, including samples containing cracks and pores, mark each sample, indicate the location and type of defects, and then standardize the images; S32, combining texture features to form a high-dimensional feature vector, and using a linear analysis method to reduce the feature dimension, retaining information that can distinguish cracks and pores; S33. Select a model and find the optimal model parameter configuration, then train and evaluate the model, and continuously adjust the model based on the evaluation results until the optimal performance level is achieved; S34. Finally, the trained model is used for defect detection to distinguish cracks and pores.
7. The surface detection device for nonferrous castings according to claim 6, characterized in that: The S32 is specifically as follows: Feature extraction: ; in, is a high-dimensional feature vector; For the Contrast features; For the correlation features; For the energy characteristics; For the homogeneous characteristics; Centralization: ; in, is the centered eigenvector; is the mean vector of the eigenvectors; Covariance matrix: ; in, is the covariance matrix; for The transposed matrix of Eigenvalues and eigenvectors: ; in, is the eigenvector; is the characteristic value; Before selection The eigenvectors corresponding to the eigenvalues form the projection matrix : ; in, is the projection matrix; PCA projection: ; in, is the eigenvector after PCA projection; Within-class scatter matrix: ; in, is the intra-class scatter matrix; For the The sample set of the class; For the The mean vector of the class; Between-class scatter matrix: ; in, is the inter-class scatter matrix; For the The number of class samples; Generalized eigenvalue problem: ; in, is the eigenvector; is the eigenvalue; Before selection The eigenvectors corresponding to the eigenvalues form the projection matrix : ; in, is the projection matrix; LDA Projection: ; in, is the feature vector after LDA projection.
Citation Information
Patent Citations
Casting quality detection method, system and equipment based on machine vision
CN118505703A