Alloy casting quality detection method and system based on machine vision

By adaptively adjusting the detection wavelength of the Gabor filter in the surface quality detection of alloy castings, more accurate texture features are extracted, and the problem of poor detection accuracy of fixed wavelengths is solved and the detection accuracy is improved.

CN119395033AInactive Publication Date: 2025-02-07FUGU COUNTY JINCHUAN MAGNESIUM IND CO LTD

Patent Information

Application Number
CN202510014354.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-06
Publication Date
2025-02-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the surface quality detection of alloy castings, when using a fixed wavelength Gabor filter to extract texture features, the accuracy is poor, making it difficult to effectively detect surface defects of complex textures.

Method used

By acquiring the surface image of the alloy casting and dividing it into multiple window areas, the optimal detection wavelength of each window area is calculated, texture features are extracted using an adaptive Gabor filter, and inputting it to a preset detection model for analysis.

Benefits of technology

This method can better adapt to the characteristics of different surface defects, extract clearer and more accurate texture features, and improve the accuracy of surface quality detection of alloy castings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119395033A_ABST
    Figure CN119395033A_ABST
Patent Text Reader

Abstract

The invention relates to the field of quality detection, in particular to an alloy casting quality detection method and system based on machine vision, and the method comprises the steps: obtaining an alloy casting surface image, setting a window, and moving the window along the alloy casting surface image to obtain a plurality of window regions; and for each window area, calculating the optimal detection wavelength in the Gabor filter, extracting a texture image in the window area by using the Gabor filter, and inputting the texture image into a preset detection model to obtain the defect type of the surface of the alloy casting. The method can better adapt to the characteristics of different surface defects, can extract clearer and more accurate texture characteristics, and further improves the detection precision of the surface quality of the alloy casting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of quality inspection, and in particular to a method and system for inspecting alloy casting quality based on machine vision. Background Art

[0002] Alloy castings refer to metal products with specific shapes and properties obtained by melting metal alloys into liquid form through a casting process and pouring them into a pre-designed mold, and then cooling and solidifying them. Alloy castings are usually more advantageous than pure metal castings in terms of structure and performance, because the composition of the alloy can be adjusted according to demand to improve its hardness, strength, corrosion resistance, wear resistance and other properties. Alloy castings have high requirements for surface quality, so it is necessary to detect defects in the surface quality of alloy castings. Cracks are a common surface quality problem of alloy castings, so it is necessary to focus on detecting crack defects on the surface of alloy castings.

[0003] A Chinese patent document with publication number CN111105389B discloses a method for detecting pavement cracks by integrating a Gabor filter and a convolutional neural network. The method includes acquiring pavement images; preprocessing the acquired images; dividing the preprocessed images into image blocks and annotating them, and dividing the annotated image blocks into a training set and a test set; and inputting the pavement image blocks into a designed convolutional neural network to obtain pavement crack detection results.

[0004] When detecting defects on the surface of alloy castings, the texture features of the surface image of the alloy castings can be extracted using a Gabor filter, and then the texture features can be analyzed using a corresponding detection model to determine whether there are defects on the surface of the alloy castings. However, in the related art, when the texture features of the surface image of the alloy castings are extracted using a Gabor filter, the detection wavelength in the Gabor filter uses a fixed wavelength. For the surface image of the alloy castings with complex textures, the accuracy of the texture features obtained using a fixed wavelength is poor, which in turn affects the detection of the quality of the alloy castings. Summary of the invention

[0005] In order to solve the problem of poor accuracy when extracting texture features using a fixed wavelength, the present invention provides a method and system for detecting alloy casting quality based on machine vision.

[0006] In a first aspect, the present invention provides a method for detecting the quality of alloy castings based on machine vision, which adopts the following technical solution: Acquire the surface image of the alloy casting and set a window, and move the window along the surface image of the alloy casting to obtain multiple window areas; For each window area, the optimal detection wavelength in the Gabor filter is calculated, and the texture image in the window area is extracted using the Gabor filter. The texture image is input into the preset detection model to obtain the defect type on the surface of the alloy casting; Among them, the calculation method of the optimal detection wavelength is: for each window area, construct the corresponding gray level co-occurrence matrix, calculate the energy characteristics, inverse moment characteristics and contrast characteristics of the gray level co-occurrence matrix; calculate the optimal proportional coefficient, the optimal proportional coefficient is negatively correlated with the product of the energy characteristics and the inverse moment characteristics, and is positively correlated with the contrast characteristics; the product of the optimal proportional coefficient and the initial detection wavelength in the Gabor filter is used as the optimal detection wavelength.

[0007] When using Gabor filters to extract texture features of alloy casting surface images, by adaptively adjusting the detection wavelength, compared with traditional detection using fixed wavelengths, it can better adapt to the characteristics of different surface defects and extract clearer and more accurate texture features, further improving the detection accuracy of the surface quality of alloy castings.

[0008] Preferably, the method further comprises: The texture feature vector of the corresponding window is constructed based on the energy feature, inverse moment feature and contrast feature. The expression is: ; In the formula, is the texture feature vector corresponding to the kth window area, is the energy characteristic of the gray-level co-occurrence matrix corresponding to the k-th window area; is the inverse moment feature of the gray level co-occurrence matrix corresponding to the kth window area; is the contrast feature of the gray level co-occurrence matrix corresponding to the kth window area; multiple texture feature vectors are clustered to obtain multiple clusters, and the window area corresponding to the feature vector in the cluster with the most data points is taken as the normal area, and the remaining window areas are defective areas.

[0009] By classifying the window area based on the texture feature vector, the defect area and the normal area can be preliminarily determined.

[0010] Preferably, a first average texture feature vector of a normal area and a second average texture vector of a defective area are calculated, and the expression of the first average texture feature vector is: ; In the formula, is the first average texture feature vector, is the mean value of the energy characteristics of the gray-level co-occurrence matrix in the normal area, is the mean of the inverse moment feature of the gray level co-occurrence matrix in the normal area, is the mean value of the contrast feature of the gray level co-occurrence matrix in the normal area; The expression of the second average texture feature vector is: ; In the formula, is the second average texture feature vector, is the mean value of the energy characteristics of the gray level co-occurrence matrix in the defect area, is the mean of the inverse moment feature of the gray level co-occurrence matrix in the defect area, is the mean value of the contrast feature of the gray level co-occurrence matrix in the defect area; The difference between the first average texture feature vector and the second average texture feature vector is calculated.

[0011] By calculating the first average texture feature vector and the second average texture feature vector, the texture features of the normal area and the texture features of the defective area can be comprehensively understood.

[0012] Preferably, the expression of the difference between the first average texture feature vector and the second average texture feature vector is: ; In the formula, represents the difference between the first average texture feature vector and the second average texture feature vector, represents the i-th element in the first average texture feature vector, Represents the i-th element in the second average texture feature vector.

[0013] The difference degree can be used to understand the difference level between the normal area and the defective area, so that it is convenient to adjust the detection wavelength according to the difference degree.

[0014] Preferably, the expression of the difference between the first average texture feature vector and the second average texture feature vector is: ; In the formula, represents the difference between the first average texture feature vector and the second average texture feature vector, Represents the cosine value of the angle between the first average texture feature vector and the second average texture feature vector.

[0015] Preferably, the expression of the optimal proportional coefficient is: ; In the formula, represents the optimal scale coefficient corresponding to the kth window, represents the difference between the first average texture feature vector and the second average texture feature vector, is the energy characteristic of the gray-level co-occurrence matrix corresponding to the k-th window area; is the inverse difference moment feature of the gray level co-occurrence matrix corresponding to the kth window area; is the contrast feature of the gray-level co-occurrence matrix corresponding to the k-th window area; Represents the normalization function.

[0016] The optimal proportionality coefficient is obtained by calculating parameters in multiple dimensions, which improves the accuracy of the optimal proportionality coefficient and facilitates the adjustment of the detection wavelength through the proportionality coefficient.

[0017] Preferably, the detection model is a convolutional neural network model or a support vector machine.

[0018] In a second aspect, the present invention provides an alloy casting quality inspection system based on machine vision, which adopts the following technical solutions: The invention discloses a machine vision-based alloy casting quality inspection system, a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the machine vision-based alloy casting quality inspection method is implemented.

[0019] The beneficial effect is that the above-mentioned machine vision-based alloy casting quality inspection method is generated into a computer program and stored in a memory so as to be loaded and executed by a processor, thereby making a system based on the memory and the processor for easy use.

[0020] The present invention has the following technical effects: When using Gabor filters to extract texture features of alloy casting surface images, the alloy casting surface images are divided into multiple window areas. By adaptively adjusting the detection wavelength of each window area, compared with traditional detection using fixed wavelengths, it can better adapt to the characteristics of different surface defects and extract clearer and more accurate texture features, further improving the detection accuracy of the surface quality of alloy castings. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0022] Figure 1 It is a flow chart of the alloy casting quality detection method based on machine vision of the present invention. DETAILED DESCRIPTION

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

[0024] It should be understood that when the terms "first", "second", etc. are used in the claims, descriptions, and drawings of the present invention, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the description and claims of the present invention indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their collections.

[0025] The embodiment of the present invention discloses a method for detecting the quality of alloy castings based on machine vision, referring to Figure 1 , including the following steps, as follows: S1: Acquire the surface image of the alloy casting and set a window, and move the window along the surface image of the alloy casting to obtain multiple window areas.

[0026] An industrial camera is used to collect the surface image of the alloy casting. A Gaussian filter is used to remove the noise of the surface image of the alloy casting. The denoised surface image of the alloy casting is converted into a grayscale image. A window is constructed on the surface of the grayscale image with a window size of w×w. The step size of each window movement is w, that is, the moved window area does not intersect with the original window area, and multiple window areas are obtained by moving the window.

[0027] S2: For each window area, construct the corresponding gray-level co-occurrence matrix, and calculate the energy feature, inverse moment feature and contrast feature of the gray-level co-occurrence matrix.

[0028] The energy feature is the square sum of the grayscale co-occurrence matrix element values. The energy feature reflects the uniformity of grayscale distribution and texture coarseness in the window area. The larger the energy feature, the more uniform and regularly changing the texture pattern in the window area. The smaller the energy feature, the more complex the texture in the window area.

[0029] The inverse difference moment feature reflects the homogeneity of the texture in the window area and is used to measure the amount of local changes in the texture in the window area. A large value indicates that there is a lack of changes between different parts of the texture in the window area and the texture is uniform. A smaller inverse difference moment indicates that the grayscale value in the window area changes more dramatically and the texture is more complex.

[0030] The contrast feature reflects the clarity of the window area and the depth of the texture grooves. The deeper the texture grooves, the greater the contrast, indicating that the texture is more complex; conversely, the smaller the contrast, the shallower the grooves, indicating that the texture is simpler. The construction method of the gray level co-occurrence matrix and the calculation method of the energy feature, the inverse difference moment feature, and the contrast feature are existing technologies, and the specific methods are not repeated here.

[0031] S3: Calculate the optimal scale coefficient. The optimal scale coefficient is negatively correlated with the product of the energy feature and the inverse moment feature, and positively correlated with the contrast feature.

[0032] The method to calculate the optimal scale factor is: S31: Construct a texture feature vector of the corresponding window according to the energy feature, the inverse moment feature and the contrast feature.

[0033] The expression of texture feature vector is: ; In the formula, is the texture feature vector corresponding to the kth window area, is the energy characteristic of the gray-level co-occurrence matrix corresponding to the k-th window area; is the inverse moment feature of the gray level co-occurrence matrix corresponding to the kth window area; is the contrast feature of the gray-level co-occurrence matrix corresponding to the k-th window area.

[0034] S32: clustering the obtained multiple texture feature vectors to obtain multiple clusters, taking the window area corresponding to the feature vector in the cluster with the most data points as the normal area, and the remaining window areas as the defective areas.

[0035] For the entire alloy casting surface image, the area of ​​defective parts accounts for a small proportion, and most of them are normal areas. Therefore, the k-means clustering algorithm is used to cluster the multiple texture feature vectors to obtain multiple clusters. The window area corresponding to the feature vector in the cluster containing the largest number of texture feature vectors is taken as the normal area, and the window area corresponding to the feature vector in other clusters is taken as the defective area. It is more likely that there is a crack defect on the surface of the defective area.

[0036] S33: Calculate a first average texture feature vector of the normal area and a second average texture vector of the defect area.

[0037] The expression of the first average texture feature vector is: ; In the formula, is the first average texture feature vector, is the mean value of the energy characteristics of the gray-level co-occurrence matrix in the normal area, is the mean of the inverse moment feature of the gray level co-occurrence matrix in the normal area, is the mean of the contrast features of the gray level co-occurrence matrix in the normal area.

[0038] The expression of the second average texture feature vector is: ; In the formula, is the second average texture feature vector, is the mean value of the energy characteristics of the gray level co-occurrence matrix in the defect area, is the mean of the inverse moment feature of the gray level co-occurrence matrix in the defect area, is the mean value of the contrast feature of the gray level co-occurrence matrix in the defect area.

[0039] S34: Calculate the difference between the first average texture feature vector and the second average texture feature vector.

[0040] In one embodiment, the expression of the difference between the first average texture feature vector and the second average texture feature vector is: ; In the formula, represents the difference between the first average texture feature vector and the second average texture feature vector, represents the i-th element in the first average texture feature vector, Represents the i-th element in the second average texture feature vector.

[0041] Expand the expression of difference degree to: ; The greater the difference, the greater the texture difference between the defective area and the normal area, and the greater the degree to which the corresponding wavelength needs to be reduced when using the Gabor filter for detection. The smaller the difference, the smaller the texture difference between the defective area and the normal area, and the smaller the degree to which the wavelength needs to be reduced.

[0042] In one embodiment, the expression of the difference between the first average texture feature vector and the second average texture feature vector is: ; In the formula, represents the difference between the first average texture feature vector and the second average texture feature vector, The cosine value of the angle between the first average texture feature vector and the second average texture feature vector is represented by the cosine value of the angle between the first average texture feature vector and the second average texture feature vector. The greater the difference, the greater the texture difference between the defective area and the normal area. Conversely, the smaller the difference, the smaller the texture difference between the defective area and the normal area.

[0043] S35: Calculate the optimal proportional coefficient, which is negatively correlated with the product of the energy feature and the inverse moment feature, and positively correlated with the contrast feature.

[0044] The expression of the optimal proportional coefficient is: ; In the formula, represents the optimal scale coefficient corresponding to the kth window, represents the difference between the first average texture feature vector and the second average texture feature vector, is the energy characteristic of the gray-level co-occurrence matrix corresponding to the k-th window area; is the inverse difference moment feature of the gray level co-occurrence matrix corresponding to the kth window area; is the contrast feature of the gray-level co-occurrence matrix corresponding to the k-th window area; Represents the normalization function.

[0045] S4: The product of the optimal proportional coefficient and the initial detection wavelength in the Gabor filter is taken as the optimal detection wavelength.

[0046] The expression for the optimal detection wavelength is: ; In the formula, represents the optimal detection wavelength corresponding to the kth window, represents the initial detection wavelength of the Gabor filter, Indicates the optimal proportional coefficient corresponding to the kth window. In the window area with simple texture, it is suitable to use long wave to extract texture features, but the texture of the crack defect part in the window area is relatively complex compared with the normal part, so it is necessary to reduce the corresponding wavelength to extract the texture features of the window area; in the window area with complex texture, it is suitable to use short wave to extract texture features, but the texture of the crack defect part in the window area is relatively simple compared with the normal part, so it is necessary to increase the corresponding wavelength to extract the texture features of the window area; by using appropriate detection wavelengths for different window areas, the texture features in the window area can be accurately extracted.

[0047] S5: Using a Gabor filter to extract a texture image in the window area, and inputting the texture image into a preset detection model to obtain the defect type on the surface of the alloy casting.

[0048] The optimal detection wavelength of the Gabor filter is calculated, and the texture image in the window area is extracted using the Gabor filter. The texture image is input into the detection model to obtain the defect type on the surface of the alloy casting. The defect type is manually set according to the situation. For example, the defect type is divided into mild defects, moderate defects and severe defects. The detection model is a convolutional neural network model or a support vector machine.

[0049] The embodiment of the present invention also discloses an alloy casting quality inspection system based on machine vision, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the alloy casting quality inspection method based on machine vision according to the present invention is implemented.

[0050] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.

[0051] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high bandwidth memory HBM (High Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module or both. Any such computer storage medium may be part of a device or accessible or connectable to a device.

[0052] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

[0053] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. The alloy casting quality detection method based on machine vision is characterized by: Includes steps: Acquire the surface image of the alloy casting and set a window, and move the window along the surface image of the alloy casting to obtain multiple window areas; For each window area, the optimal detection wavelength in the Gabor filter is calculated, and the texture image in the window area is extracted using the Gabor filter. The texture image is input into the preset detection model to obtain the defect type on the surface of the alloy casting; Among them, the calculation method of the optimal detection wavelength is: for each window area, construct the corresponding gray level co-occurrence matrix, calculate the energy characteristics, inverse moment characteristics and contrast characteristics of the gray level co-occurrence matrix; calculate the optimal proportional coefficient, the optimal proportional coefficient is negatively correlated with the product of the energy characteristics and the inverse moment characteristics, and is positively correlated with the contrast characteristics; the product of the optimal proportional coefficient and the initial detection wavelength in the Gabor filter is used as the optimal detection wavelength.

2. The method for detecting alloy casting quality based on machine vision according to claim 1, characterized in that: The method also includes: The texture feature vector of the corresponding window is constructed based on the energy feature, inverse moment feature and contrast feature. The expression is: ; In the formula, is the texture feature vector corresponding to the kth window area, is the energy characteristic of the gray-level co-occurrence matrix corresponding to the k-th window area; is the inverse moment feature of the gray level co-occurrence matrix corresponding to the kth window area; is the contrast feature of the gray level co-occurrence matrix corresponding to the kth window area; multiple texture feature vectors are clustered to obtain multiple clusters, and the window area corresponding to the feature vector in the cluster with the most data points is taken as the normal area, and the remaining window areas are defective areas.

3. The method for detecting alloy casting quality based on machine vision according to claim 2, characterized in that: The first average texture feature vector of the normal area and the second average texture vector of the defect area are calculated. The expression of the first average texture feature vector is: ; In the formula, is the first average texture feature vector, is the mean value of the energy characteristics of the gray-level co-occurrence matrix in the normal area, is the mean of the inverse moment feature of the gray level co-occurrence matrix in the normal area, is the mean value of the contrast feature of the gray level co-occurrence matrix in the normal area; The expression of the second average texture feature vector is: ; In the formula, is the second average texture feature vector, is the mean value of the energy characteristics of the gray level co-occurrence matrix in the defect area, is the mean of the inverse moment feature of the gray level co-occurrence matrix in the defect area, is the mean value of the contrast feature of the gray level co-occurrence matrix in the defect area; The difference between the first average texture feature vector and the second average texture feature vector is calculated.

4. The method for detecting alloy casting quality based on machine vision according to claim 3, characterized in that: The expression of the difference between the first average texture feature vector and the second average texture feature vector is: ; In the formula, represents the difference between the first average texture feature vector and the second average texture feature vector, represents the i-th element in the first average texture feature vector, Represents the i-th element in the second average texture feature vector.

5. The method for detecting alloy casting quality based on machine vision according to claim 3, characterized in that: The expression of the difference between the first average texture feature vector and the second average texture feature vector is: ; In the formula, represents the difference between the first average texture feature vector and the second average texture feature vector, Represents the cosine value of the angle between the first average texture feature vector and the second average texture feature vector.

6. The method for detecting alloy casting quality based on machine vision according to any one of claims 3 to 5, characterized in that: The expression of the optimal proportional coefficient is: ; In the formula, represents the optimal scale coefficient corresponding to the kth window, represents the difference between the first average texture feature vector and the second average texture feature vector, is the energy characteristic of the gray-level co-occurrence matrix corresponding to the k-th window area; is the inverse moment feature of the gray level co-occurrence matrix corresponding to the kth window area; is the contrast feature of the gray-level co-occurrence matrix corresponding to the k-th window area; Represents the normalization function.

7. The method for detecting alloy casting quality based on machine vision according to claim 1, characterized in that: The detection model is a convolutional neural network model or a support vector machine.

8. The alloy casting quality inspection system based on machine vision is characterized by: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method for detecting quality of alloy castings based on machine vision according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • A method for detecting road surface cracks by integrating Gabor filters and convolutional neural networks.

    CN111105389B

Cited By

  • Slag salvaging control method and slag salvaging device for medium-sized metal cast ingot

    CN120411088A

  • Crankshaft surface defect detection method and system based on image processing

    CN120598944A

  • Casting riser image recognition method based on machine learning

    CN121033528A

  • Online detection method and system for surface defects of automobile parts

    CN121258956A