A method, device and medium for detecting surface defects of a die casting
Patent Information
- Application Number
- CN202510580874.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2045-05-07
AI Technical Summary
[0003]在通过压铸的方式生产压铸件时,压铸件表面可能会产生凸起缺陷或凹陷缺陷,在现有技术中,对压铸件表面的检测方法单一,依赖单一的检测手段,导致无法全面捕捉压铸件表面的缺陷,同时传统的检测方法无法定量识别缺陷的影响程度,导致无法对缺陷进行修复优先级排序;
本发明通过高清摄像机以固定条件采集压铸件表面的检测图像,而后对压铸件表面的检测图像进行检测分析,从而分析得到压铸件表面的疑似缺陷区域,另一方面,同时获取压铸件表面所有的真实坐标对应阻抗虚部,并计算阻抗实部,对阻抗实部和阻抗虚部进行分析,分析得到压铸件表面的缺陷区域,最后依据缺陷区域面积评估缺陷区域的影响程度,本发明将视觉技术与涡流探伤技术结合实现对压铸件表面缺陷的全面检测。
Smart Images

Figure CN120539152B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of nondestructive testing technology, specifically a method, equipment, and medium for detecting surface defects in die-cast parts. Background Technology
[0002] Surface defect inspection of die-cast parts involves examining the surface of the die-cast parts using various non-destructive testing techniques to identify and locate potential defects. During the die-casting process, surface defects such as cracks, porosity, shrinkage cavities, depressions, and protrusions may occur due to factors such as cooling, pressure, or material quality. These defects can affect product quality and performance. Common inspection methods include visual inspection, eddy current testing, ultrasonic testing, infrared thermography, and X-ray inspection. These methods effectively identify surface defects, ensuring that die-cast parts meet quality standards and improving product reliability and safety.
[0003] When die castings are produced by die casting, protrusion defects or depression defects may occur on the surface of the die castings. In the existing technology, the detection method for the surface of die castings is single and relies on a single detection method, which makes it impossible to fully capture the defects on the surface of the die castings. At the same time, traditional detection methods cannot quantitatively identify the degree of impact of defects, making it impossible to prioritize the repair of defects. Therefore, this invention proposes a method, equipment, and medium for detecting surface defects in die-cast parts. Summary of the Invention
[0004] The purpose of this invention is to provide a method, equipment, and medium for detecting surface defects in die-cast parts, so as to solve the problems mentioned in the background art.
[0005] The technical problem to be solved by this invention is: How to combine vision technology with eddy current testing technology to detect defects on the surface of die castings.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: A method for detecting surface defects in die-cast parts, the method comprising: Step S1: A high-definition camera acquires inspection images of the die-cast part surface under fixed conditions; Step S2: Analyze the inspection image of the die casting surface to identify suspected defect areas on the die casting surface. Step S3: Obtain the imaginary part of the impedance corresponding to all the real coordinates on the surface of the die casting, and calculate the real part of the impedance. Analyze the real part and the imaginary part of the impedance to obtain the defect area on the surface of the die casting. Step S4: Assess the impact of the defect area based on its area.
[0007] Further, step S1 includes the following sub-steps: Step S11: Set the illumination angle between the light source and the surface of the die casting to 90°, and set the shooting angle between the high-definition camera and the surface of the die casting to 90°. Step S12: Lower the shooting angle between the high-definition camera and the surface of the die-casting part by a fixed angle, and simultaneously lower the illumination angle between the light source and the surface of the die-casting part. At the same time, capture the detection image of the surface of the die-casting part after each reduction in shooting angle and illumination angle, until the shooting angle is reduced to 0° and the shooting stops. Step S13: Adjust the illumination angle between the light source and the surface of the die-cast part to 90°, adjust the shooting angle between the high-definition camera and the surface of the die-cast part to 90°, and increase the shooting angle by a fixed angle. At the same time, increase the illumination angle between the light source and the surface of the die-cast part synchronously, and capture the detection image of the surface of the die-cast part after each increase in shooting angle and illumination angle until the shooting angle increases to 180° and then stop capturing.
[0008] Furthermore, step S2 includes the following sub-steps: Step S21: Construct a two-dimensional coordinate system for the die-cast surface, obtain the real coordinates corresponding to the real coordinates of the real coordinate points on the die-cast surface, and the pixel coordinates (xi, yi) and corresponding RGB values of all pixels in the detection image, where i is the pixel number, i=1, 2, ..., n, and n is the maximum value of the pixel. Map the pixel coordinates one-to-one with the real coordinates, and convert the pixel values of all pixels in the detection image to grayscale values HDZ(xi, yi) using a grayscale conversion formula. Then, construct the grayscale detection image of the die-cast surface. The specific formula is as follows: HDZ(xi,yi) = 0.3R(xi,yi) + 0.59G(xi,yi) + 0.11B(xi,yi); Step S22: Merge the gray values of the same pixel in all grayscale detection images to obtain the grayscale value sequence HDZ. j (xi, yi) = [HDZ1(xi, yi), HDZ2(xi, yi), ..., HDZ j [(xi, yi)], j is the number of the grayscale detection image, j=1,2,...,m, m is the maximum number of grayscale detection images; Step S23: Iterate through the gray values of pixels in any grayscale detection image to obtain the maximum gray value HDZ of the corresponding pixel in the grayscale detection image. jmax and minimum grayscale value HDZ jmin Then, the normalized grayscale values GYZ of all pixels in the grayscale detection image are calculated using a normalization formula. j(xi, yi) yields the normalized image of the die-cast part surface. The specific formula is as follows: GYZ j (xi, yi) = [HDZ j (xi, yi) - HDZ jmin ] / [HDZ jmax -HDZ jmin ]; Step S24: Obtain the normalized grayscale value GYZ of any pixel in the current normalized image. j (xi, yi), and simultaneously obtain the normalized grayscale value GYZ of the corresponding pixel in the previous normalized image. j-1 (xi, yi) and the normalized gray value GYZ of the corresponding pixel in the next normalized image. j+1 (xi, yi) is used to calculate the smoothed gray value PHH of any pixel in the current normalized image using the median filtering formula. j (xi, yi), the specific formula is as follows: PHH j (xi, yi) = median[GYZ] j-1 (xi, yi), GYZ j (xi, yi), GYZ j+1 (xi, yi)]; Step S25: Calculate the average brightness value LDJ of any pixel using the formula. j (xi, yi) and luminance standard deviation BZC j The formula for the average brightness (xi, yi) is as follows: ; The formula for the standard deviation of luminance is as follows: ; In step S26, if the brightness standard deviation is less than or equal to the defect threshold, no operation is performed; if the brightness standard deviation is greater than the defect threshold, the corresponding pixel is determined to be a suspected defect point, and the process proceeds to the next step.
[0009] Furthermore, step S2 also includes the following sub-steps: Step S27: Iterate through the smoothed gray values of suspected defect points to obtain the maximum, minimum, and median smoothed gray values. Simultaneously, calculate the gray difference (HDC) of the smoothed gray values using the summation and averaging formula. j (xi, yi), the specific formula is as follows: ; Specifically, the median smoothed gray value is the median of the smoothed gray values; Step S28: Set the corresponding protrusion judgment criteria for judging protrusion defects on the surface of the die casting, and perform defect detection on the surface of the die casting according to the protrusion judgment criteria. The specific protrusion judgment criteria are as follows: If the maximum smoothed gray value of any suspected defect point is greater than or equal to the first maximum smoothed gray value, or the result of subtracting the maximum smoothed gray value from the median smoothed gray value is greater than or equal to the brightness offset threshold, or the gray value difference of the smoothed gray values is greater than or equal to the gray value difference threshold, and two or more of the judgment conditions are met, the corresponding suspected defect point is determined to be a protruding defect, and the protruding defect is repaired; if only one condition is met or none of the conditions are met, proceed to step S3. Step S29: Set the criteria for judging depressions on the surface of the die-cast part, and perform defect detection on the surface of the die-cast part according to the criteria. The specific criteria for judging depressions are as follows: If the average brightness of any suspected defect point is less than or equal to the brightness threshold, or the maximum smoothed gray value is less than or equal to the second maximum smoothed gray value, or the median smoothed gray value is less than or equal to the median smoothed gray threshold and the brightness standard deviation is greater than or equal to the brightness standard deviation threshold, and two or more judgment conditions are met, the corresponding suspected defect point is determined to be a depression defect, and the depression defect is repaired; if only one condition is met or none of them are met, proceed to step S3.
[0010] Further, step S3 includes the following sub-steps: Step S31: Obtain the real and imaginary parts of the impedance of all non-suspected defect points. Then, average the real parts of the impedance of all non-suspected defect points to obtain the average real part of the impedance. At the same time, average the imaginary parts of the impedance of all non-suspected defect points to obtain the average imaginary part of the impedance. Step S32: Subtract the real part of the impedance of all suspected defect points from the real part of the average impedance to obtain the change in the real part of the impedance of the corresponding suspected defect point. At the same time, subtract the imaginary part of the impedance of all suspected defect points from the imaginary part of the average impedance to obtain the change in the imaginary part of the impedance of the corresponding suspected defect point. Step S33: If the change in the real part of the impedance is greater than the threshold of the real part of the impedance, or the change in the imaginary part of the impedance is greater than the threshold of the imaginary part of the impedance, then the corresponding suspected defect point is a defect point, and proceed to the next step. If the change in the real part of the impedance is less than or equal to the threshold value of the real part of the impedance, and the change in the imaginary part of the impedance is less than or equal to the threshold value of the imaginary part of the impedance, then the corresponding suspected defect point is not a defect point, and no operation is performed.
[0011] Furthermore, step S3 also includes the following sub-steps: Step S34: When any real coordinate point on the surface of the die casting is not a defect point, the corresponding real coordinate point is recorded as 1; when any real coordinate point on the surface of the die casting is a defect point, the corresponding real coordinate point is recorded as 0. Then, a binary image of the surface of the die casting is constructed. Step S35: Merge adjacent defect points to construct a defect region; Step S36: Obtain the number of defect points in all defect areas and use the number of defect points as the area of the defect area.
[0012] Furthermore, the process of constructing the defect region is as follows: By using an eight-neighbor connection method, it is detected whether there is a defect point among the eight adjacent real coordinate points of any central real coordinate point. If there is a real coordinate point that is a defect point, the corresponding real coordinate point and the central real coordinate point are merged and recorded as a defect area; if there is no real coordinate point that is a defect point, no operation is performed.
[0013] Further, step S4 includes the following sub-steps: Step S41: When the area of the defect region belongs to the first area range, the influence degree of the corresponding defect region is determined to be a severe defect, and the processing priority of the corresponding defect region is set to high priority for processing. Step S42: When the area of the defect region belongs to the second area interval, the influence degree of the corresponding defect region is determined to be a medium defect, and the processing priority of the corresponding defect region is set to medium priority for processing. Step S43: When the area of the defect region belongs to the third area interval, the influence degree of the corresponding defect region is determined to be a minor defect, and the processing priority of the corresponding defect region is set to low priority for processing. Among them, the endpoint value of the first area interval is greater than the endpoint value of the second area interval, and the endpoint value of the second area interval is greater than the endpoint value of the third area interval.
[0014] In a second aspect, a computer device, said computer device comprising: A memory that stores a computer program; The processor is communicatively connected to the memory. When the computer program is executed by the processor, it implements the method for detecting surface defects in die-cast parts.
[0015] Thirdly, a computer-readable storage medium having a computer program stored thereon, characterized in that the program, when executed by a processor, implements the aforementioned method for detecting surface defects in die-cast parts.
[0016] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are: This invention uses a high-definition camera to acquire inspection images of the die-cast part surface under fixed conditions, and then analyzes these images to identify suspected defect areas. Simultaneously, it acquires the imaginary part of the impedance corresponding to all real coordinates on the die-cast part surface and calculates the real part of the impedance. Analyzing both the real and imaginary parts of the impedance reveals defect areas on the die-cast part surface. Finally, the impact of the defect areas is assessed based on their area. This invention combines visual technology with eddy current testing technology to achieve comprehensive detection of surface defects in die-cast parts. Attached Figure Description
[0017] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings.
[0018] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a front view of the inspection image of the die-cast part surface acquired in this invention; Figure 3 This is an example diagram of the defective region in this invention; Figure 4 This is a schematic diagram of the computer device in this invention. Detailed Implementation
[0019] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Example 1: Please refer to Figures 1-3 As shown, the technical solution provided by this invention is: a method for detecting surface defects in die-cast parts, the method being as follows: Step S1, as follows Figure 2 As shown, a high-definition camera acquires inspection images of the die-cast part surface under fixed conditions; The acquisition device is a high-definition camera, which captures inspection images of the die-cast surface. When the shooting angle between the high-definition camera and the die-cast surface decreases, the illumination angle between the light source and the die-cast surface decreases simultaneously. In this embodiment, step S1 includes the following sub-steps: Step S11: Set the illumination angle between the light source and the surface of the die casting to 90°, and set the shooting angle between the high-definition camera and the surface of the die casting to 90°. Step S12: Lower the shooting angle between the high-definition camera and the surface of the die-casting part by a fixed angle, and simultaneously lower the illumination angle between the light source and the surface of the die-casting part. At the same time, capture the detection image of the surface of the die-casting part after each reduction in shooting angle and illumination angle, until the shooting angle is reduced to 0° and the shooting stops. Step S13: Adjust the illumination angle between the light source and the surface of the die-cast part to 90°, adjust the shooting angle between the high-definition camera and the surface of the die-cast part to 90°, and increase the shooting angle by a fixed angle. At the same time, increase the illumination angle between the light source and the surface of the die-cast part synchronously, and capture the detection image of the surface of the die-cast part after each increase in shooting angle and illumination angle until the shooting angle increases to 180° and then stop capturing.
[0021] Step S2: Analyze the inspection image of the die casting surface to identify suspected defect areas on the die casting surface. In this embodiment, step S2 includes the following sub-steps: Step S21: Construct a two-dimensional coordinate system for the die-cast surface, obtain the real coordinates corresponding to the real coordinates of the real coordinate points on the die-cast surface, and the pixel coordinates (xi, yi) and corresponding RGB values of all pixels in the detection image, where i is the pixel number, i=1, 2, ..., n, and n is the maximum value of the pixel. Map the pixel coordinates one-to-one with the real coordinates, and convert the pixel values of all pixels in the detection image to grayscale values HDZ(xi, yi) using a grayscale conversion formula. Then, construct the grayscale detection image of the die-cast surface. The specific formula is as follows: HDZ(xi,yi) = 0.3R(xi,yi) + 0.59G(xi,yi) + 0.11B(xi,yi); Step S22: Merge the gray values of the same pixel in all grayscale detection images to obtain the grayscale value sequence HDZ. j (xi, yi) = [HDZ1(xi, yi), HDZ2(xi, yi), ..., HDZ j [(xi, yi)], j is the number of the grayscale detection image, j=1,2,...,m, m is the maximum number of grayscale detection images; Step S23: Iterate through the gray values of pixels in any grayscale detection image to obtain the maximum gray value HDZ of the corresponding pixel in the grayscale detection image. jmax and minimum grayscale value HDZ jmin Then, the normalized grayscale values GYZ of all pixels in the grayscale detection image are calculated using a normalization formula. j (xi, yi) yields the normalized image of the die-cast part surface. The specific formula is as follows: GYZ j (xi, yi) = [HDZj (xi, yi) - HDZ jmin ] / [HDZ jmax -HDZ jmin ]; Step S24: Obtain the normalized grayscale value GYZ of any pixel in the current normalized image. j (xi, yi), and simultaneously obtain the normalized grayscale value GYZ of the corresponding pixel in the previous normalized image. j-1 (xi, yi) and the normalized gray value GYZ of the corresponding pixel in the next normalized image. j+1 (xi, yi) is used to calculate the smoothed gray value PHH of any pixel in the current normalized image using the median filtering formula. j (xi, yi), the specific formula is as follows: PHH j (xi, yi) = median[GYZ] j-1 (xi, yi), GYZ j (xi, yi), GYZ j+1 (xi, yi)]; Step S25: Calculate the average brightness value LDJ of any pixel using the formula. j (xi, yi) and luminance standard deviation BZC j The formula for the average brightness (xi, yi) is as follows: ; The formula for the standard deviation of luminance is as follows: ; Step S26: If the brightness standard deviation is less than or equal to the defect threshold, no operation is performed; if the brightness standard deviation is greater than the defect threshold, the corresponding pixel is determined to be a suspected defect point, and the process proceeds to the next step. Specifically, the defect threshold is the 99th percentile of the luminance standard deviation in the distribution of luminance standard deviation. Step S27: Iterate through the smoothed gray values of suspected defect points to obtain the maximum, minimum, and median smoothed gray values. Simultaneously, calculate the gray difference (HDC) of the smoothed gray values using the summation and averaging formula. j (xi, yi), the specific formula is as follows: ; Specifically, the median smoothed gray value is the median of the smoothed gray values; Step S28: Set the corresponding protrusion judgment criteria for judging protrusion defects on the surface of the die casting, and perform defect detection on the surface of the die casting according to the protrusion judgment criteria. The specific protrusion judgment criteria are as follows: If the maximum smoothed gray value of any suspected defect point is greater than or equal to the first maximum smoothed gray value, or the result of subtracting the maximum smoothed gray value from the median smoothed gray value is greater than or equal to the brightness offset threshold, or the gray value difference of the smoothed gray values is greater than or equal to the gray value difference threshold, and two or more of the judgment conditions are met, the corresponding suspected defect point is determined to be a protruding defect, and the protruding defect is repaired; if only one condition is met or none of the conditions are met, proceed to step S3. Step S29: Set the criteria for judging depressions on the surface of the die-cast part, and perform defect detection on the surface of the die-cast part according to the criteria. The specific criteria for judging depressions are as follows: If the average brightness of any suspected defect point is less than or equal to the brightness threshold, or the maximum smoothed gray value is less than or equal to the second maximum smoothed gray value, or the median smoothed gray value is less than or equal to the median smoothed gray threshold and the brightness standard deviation is greater than or equal to the brightness standard deviation threshold, and two or more judgment conditions are met, the corresponding suspected defect point is determined to be a depression defect, and the depression defect is repaired; if only one condition is met or none of them are met, proceed to step S3.
[0022] Step S3: Obtain the imaginary part of the impedance corresponding to all the real coordinates on the surface of the die casting, and calculate the real part of the impedance. Analyze the real part and the imaginary part of the impedance to obtain the defect area on the surface of the die casting. Specifically, by applying an alternating current to the probe coil to generate an alternating magnetic field, eddy currents are generated in the die-cast part. The eddy currents generate reactive impedance inside and on the surface of the die-cast part. The imaginary part of the impedance is detected by the sensor; the real part of the impedance is directly obtained by the sensor. Specifically, the total impedance is obtained by the formula Z=R+kX, where R is the real part of the impedance, X is the imaginary part of the impedance, both in ohms, and k is the unit of the imaginary part of the impedance in a complex number. The real part of the impedance is the actual energy loss when electrical energy is converted into heat energy in the circuit; the imaginary part of the impedance is the value of energy storage and release in the circuit, and the magnitude of the imaginary part of the impedance is related to the frequency, changing with the frequency of the alternating current. In this embodiment, step S3 includes the following sub-steps: Step S31: Obtain the real and imaginary parts of the impedance of all non-suspected defect points. Then, average the real parts of the impedance of all non-suspected defect points to obtain the average real part of the impedance. At the same time, average the imaginary parts of the impedance of all non-suspected defect points to obtain the average imaginary part of the impedance. Step S32: Subtract the real part of the impedance of all suspected defect points from the real part of the average impedance to obtain the change in the real part of the impedance of the corresponding suspected defect point. At the same time, subtract the imaginary part of the impedance of all suspected defect points from the imaginary part of the average impedance to obtain the change in the imaginary part of the impedance of the corresponding suspected defect point. Step S33: If the change in the real part of the impedance is greater than the threshold of the real part of the impedance, or the change in the imaginary part of the impedance is greater than the threshold of the imaginary part of the impedance, then the corresponding suspected defect point is a defect point, and proceed to the next step. If the change in the real part of the impedance is less than or equal to the threshold value of the real part of the impedance, and the change in the imaginary part of the impedance is less than or equal to the threshold value of the imaginary part of the impedance, then the corresponding suspected defect point is not a defect point and no operation is performed. Step S34: When any real coordinate point on the surface of the die casting is not a defect point, the corresponding real coordinate point is recorded as 1; when any real coordinate point on the surface of the die casting is a defect point, the corresponding real coordinate point is recorded as 0. Then, a binary image of the surface of the die casting is constructed. Step S35, as Figure 3 As shown, adjacent defect points are merged to construct a defect region; Specifically, by connecting eight neighboring areas, it detects whether there are defect points among the eight neighboring real coordinate points of any central real coordinate point. If there are real coordinate points that are defect points, the corresponding real coordinate points and the central real coordinate point are merged and recorded as a defect area; if there are no real coordinate points that are defect points, no operation is performed. Step S36: Obtain the number of defect points in all defect areas and use the number of defect points as the area of the defect area.
[0023] Step S4: Assess the impact of the defect area based on its area. In this embodiment, step S4 includes the following sub-steps: Step S41: When the area of the defect region belongs to the first area range, the influence degree of the corresponding defect region is determined to be a severe defect, and the processing priority of the corresponding defect region is set to high priority for processing. Step S42: When the area of the defect region belongs to the second area interval, the influence degree of the corresponding defect region is determined to be a medium defect, and the processing priority of the corresponding defect region is set to medium priority for processing. Step S43: When the area of the defect region belongs to the third area interval, the influence degree of the corresponding defect region is determined to be a minor defect, and the processing priority of the corresponding defect region is set to low priority for processing. Among them, the endpoint value of the first area interval is greater than the endpoint value of the second area interval, and the endpoint value of the second area interval is greater than the endpoint value of the third area interval.
[0024] In this application, if a corresponding calculation formula appears, the above calculation formula is a dimensionless calculation. The weighting coefficient, proportional coefficient and other coefficients in the formula are set to quantify each parameter to obtain a result value. The size of the weighting coefficient and proportional coefficient is only required to not affect the proportional relationship between the parameter and the result value.
[0025] Example 2: Figure 4 An example is a schematic diagram of the structure of a computer device, such as... Figure 4 As shown, the computer device may include a processor, a communication interface, memory, and a communication bus, wherein the processor, communication interface, and memory communicate with each other via the communication bus. The processor can call logical instructions in the memory to execute a method for detecting surface defects in die-cast parts. This method includes: acquiring inspection images of the die-cast part surface using a high-definition camera under fixed conditions; analyzing the inspection images of the die-cast part surface to identify suspected defect areas; obtaining the imaginary parts of the impedance corresponding to all real coordinates of the die-cast part surface and calculating the real parts of the impedance; analyzing the real and imaginary parts of the impedance to identify defect areas on the die-cast part surface; and assessing the impact of the defect areas based on their area.
[0026] Furthermore, when the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0027] Example 3: This application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a method for detecting surface defects of die-cast parts provided by the above methods. The method includes: acquiring detection images of the die-cast part surface using a high-definition camera under fixed conditions; performing detection and analysis on the detection images of the die-cast part surface to obtain suspected defect areas on the die-cast part surface; obtaining the imaginary parts of impedance corresponding to all real coordinates of the die-cast part surface and calculating the real parts of impedance; analyzing the real and imaginary parts of impedance to obtain defect areas on the die-cast part surface; and evaluating the degree of influence of the defect areas based on the area of the defect areas.
[0028] Example 4: This application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program performs one of the above-described methods for detecting surface defects in die-cast parts. The method includes: acquiring detection images of the die-cast part surface using a high-definition camera under fixed conditions; performing detection and analysis on the detection images of the die-cast part surface to obtain suspected defect areas on the die-cast part surface; obtaining the imaginary parts of impedance corresponding to all real coordinates on the die-cast part surface and calculating the real parts of impedance; analyzing the real and imaginary parts of impedance to obtain defect areas on the die-cast part surface; and evaluating the degree of influence of the defect areas based on the area of the defect areas.
[0029] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0030] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0031] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for detecting surface defects in die-cast parts, characterized in that the method... include: Step S1: A high-definition camera acquires inspection images of the die-cast part surface under fixed conditions; Step S1 includes the following sub-steps: Step S11: Set the illumination angle between the light source and the surface of the die casting to 90°, and set the shooting angle between the high-definition camera and the surface of the die casting to 90°. Step S12: Lower the shooting angle between the high-definition camera and the surface of the die-casting part by a fixed angle, and simultaneously lower the illumination angle between the light source and the surface of the die-casting part. At the same time, capture the detection image of the surface of the die-casting part after each reduction in shooting angle and illumination angle, until the shooting angle is reduced to 0° and the shooting stops. Step S13: Adjust the illumination angle between the light source and the die-cast surface to 90°, adjust the shooting angle between the high-definition camera and the die-cast surface to 90°, and increase the shooting angle by a fixed angle. At the same time, increase the illumination angle between the light source and the die-cast surface synchronously, and capture the detection image of the die-cast surface after each increase in shooting angle and illumination angle until the shooting angle increases to 180° and then stop capturing. Step S2: Analyze the inspection image of the die casting surface to identify suspected defect areas on the die casting surface. Step S2 includes the following sub-steps: Step S21: Construct a two-dimensional coordinate system for the die-cast surface, obtain the real coordinates corresponding to the real coordinates of the real coordinate points on the die-cast surface, and the pixel coordinates (xi, yi) and corresponding RGB values of all pixels in the detection image, where i is the pixel number, i=1, 2, ..., n, and n is the maximum value of the pixel. Map the pixel coordinates one-to-one with the real coordinates, and convert the pixel values of all pixels in the detection image to grayscale values HDZ(xi, yi) using a grayscale conversion formula. Then, construct the grayscale detection image of the die-cast surface. The specific formula is as follows: HDZ(xi,yi) = 0.3R(xi,yi) + 0.59G(xi,yi) + 0.11B(xi,yi); Step S22: Merge the gray values of the same pixel in all grayscale detection images to obtain the grayscale value sequence HDZ. j (xi, yi) = [HDZ1(xi, yi), HDZ2(xi, yi), ..., HDZ j [(xi, yi)], j is the number of the grayscale detection image, j=1,2,...,m, m is the maximum number of grayscale detection images; Step S23: Iterate through the gray values of pixels in any grayscale detection image to obtain the maximum gray value HDZ of the corresponding pixel in the grayscale detection image. jmax and minimum grayscale value HDZ jmin Then, the normalized grayscale values GYZ of all pixels in the grayscale detection image are calculated using a normalization formula. j (xi, yi) yields the normalized image of the die-cast part surface. The specific formula is as follows: GYZ j (xi,yi)=[HDZ j (xi, yi)-HDZ jmin ] / [HDZ jmax -HDZ jmin ]; Step S24: Obtain the normalized grayscale value GYZ of any pixel in the current normalized image. j (xi, yi), and simultaneously obtain the normalized grayscale value GYZ of the corresponding pixel in the previous normalized image. j-1 (xi, yi) and the normalized gray value GYZ of the corresponding pixel in the next normalized image. j+1 (xi, yi) is used to calculate the smoothed gray value PHH of any pixel in the current normalized image using the median filtering formula. j (xi, yi), the specific formula is as follows: PHH j (xi, yi) = median[GYZ] j-1 (xi, yi), GYZ j (xi, yi), GYZ j+1 (xi, yi)]; Step S25: Calculate the average brightness value LDJ of any pixel using the formula. j (xi, yi) and luminance standard deviation BZC j The formula for the average brightness (xi, yi) is as follows: ; The formula for the standard deviation of luminance is as follows: ; Step S26: If the brightness standard deviation is less than or equal to the defect threshold, no operation is performed; if the brightness standard deviation is greater than the defect threshold, the corresponding pixel is determined to be a suspected defect point, and the process proceeds to the next step. Step S27: Iterate through the smoothed gray values of suspected defect points to obtain the maximum, minimum, and median smoothed gray values. Simultaneously, calculate the gray difference (HDC) of the smoothed gray values using the summation and averaging formula. j (xi, yi), the specific formula is as follows: ; Specifically, the median smoothed gray value is the median of the smoothed gray values; Step S28: Set the corresponding protrusion judgment criteria for judging protrusion defects on the surface of the die casting, and perform defect detection on the surface of the die casting according to the protrusion judgment criteria. The specific protrusion judgment criteria are as follows: If the maximum smoothed gray value of any suspected defect point is greater than or equal to the first maximum smoothed gray value, or the result of subtracting the maximum smoothed gray value from the median smoothed gray value is greater than or equal to the brightness offset threshold, or the gray value difference of the smoothed gray values is greater than or equal to the gray value difference threshold, and two or more of the judgment conditions are met, the corresponding suspected defect point is determined to be a protruding defect, and the protruding defect is repaired; if only one condition is met or none of the conditions are met, proceed to step S3. Step S29: Set the criteria for judging depressions on the surface of the die-cast part, and perform defect detection on the surface of the die-cast part according to the criteria. The specific criteria for judging depressions are as follows: If the average brightness of any suspected defect point is less than or equal to the brightness threshold, or the maximum smoothed gray value is less than or equal to the second maximum smoothed gray value, or the median smoothed gray value is less than or equal to the median smoothed gray threshold and the brightness standard deviation is greater than or equal to the brightness standard deviation threshold, and two or more judgment conditions are met, the corresponding suspected defect point is determined to be a depression defect, and the depression defect is repaired; if only one condition is met or none of them are met, proceed to step S3. Step S3: Obtain the imaginary part of the impedance corresponding to all the real coordinates on the surface of the die casting, and calculate the real part of the impedance. Analyze the real part and the imaginary part of the impedance to obtain the defect area on the surface of the die casting. Step S3 includes the following sub-steps: Step S31: Obtain the real and imaginary parts of the impedance of all non-suspected defect points. Then, average the real parts of the impedance of all non-suspected defect points to obtain the average real part of the impedance. At the same time, average the imaginary parts of the impedance of all non-suspected defect points to obtain the average imaginary part of the impedance. Step S32: Subtract the real part of the impedance of all suspected defect points from the real part of the average impedance to obtain the change in the real part of the impedance of the corresponding suspected defect point. At the same time, subtract the imaginary part of the impedance of all suspected defect points from the imaginary part of the average impedance to obtain the change in the imaginary part of the impedance of the corresponding suspected defect point. Step S33: If the change in the real part of the impedance is greater than the threshold of the real part of the impedance, or the change in the imaginary part of the impedance is greater than the threshold of the imaginary part of the impedance, then the corresponding suspected defect point is a defect point, and proceed to the next step. If the change in the real part of the impedance is less than or equal to the threshold value of the real part of the impedance, and the change in the imaginary part of the impedance is less than or equal to the threshold value of the imaginary part of the impedance, then the corresponding suspected defect point is not a defect point and no operation is performed. Step S34: When any real coordinate point on the surface of the die casting is not a defect point, the corresponding real coordinate point is recorded as 1; when any real coordinate point on the surface of the die casting is a defect point, the corresponding real coordinate point is recorded as 0. Then, a binary image of the surface of the die casting is constructed. Step S35: Merge adjacent defect points to construct a defect region; Step S36: Obtain the number of defect points in all defect areas and use the number of defect points as the area of the defect area. Step S4: Assess the impact of the defect area based on its area. Step S4 includes the following sub-steps: Step S41: When the area of the defect region belongs to the first area range, the influence degree of the corresponding defect region is determined to be a severe defect, and the processing priority of the corresponding defect region is set to high priority for processing. Step S42: When the area of the defect region belongs to the second area interval, the influence degree of the corresponding defect region is determined to be a medium defect, and the processing priority of the corresponding defect region is set to medium priority for processing. Step S43: When the area of the defect region belongs to the third area interval, the influence degree of the corresponding defect region is determined to be a minor defect, and the processing priority of the corresponding defect region is set to low priority for processing. Among them, the endpoint value of the first area interval is greater than the endpoint value of the second area interval, and the endpoint value of the second area interval is greater than the endpoint value of the third area interval.
2. The method for detecting surface defects in die-cast parts according to claim 1, characterized in that, The process of constructing the defect region is as follows: By using the eight-neighbor connection method, it is detected whether there is a defect point among the eight adjacent real coordinate points of any central real coordinate point. If there is a real coordinate point that is a defect point, the corresponding real coordinate point and the central real coordinate point are merged and recorded as a defect area. If no real coordinate point is found to be the defect point, no operation will be performed.
3. A computer device, characterized in that, The computer device includes: A memory that stores a computer program; A processor, communicatively connected to the memory, implements the method described in any one of claims 1-2 when the computer program is executed by the processor.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the method described in any one of claims 1 to 2.
Citation Information
Patent Citations
Galvanized strip steel surface quality detection system based on vision and vortex
CN119198777A
Photovoltaic panel surface defect detection method and system based on physical property analysis
CN120404847A