Mold surface flaw recognition and detection method based on image matching
Patent Information
- Application Number
- CN202611118813.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-27
- Publication Date
- 2026-10-23
AI Technical Summary
现有模具表面图像检测方法通常采用单一光照图像采集、模板灰度差分、边缘阈值分割或普通特征匹配方式进行异常提取,该类方法虽然能够识别部分灰度变化明显的区域,但难以同时适应模具表面复杂结构、曲面反光、多方向划痕以及细微起伏瑕疵的检测需求
[0016]本发明通过获取正常模具在多种光照条件下的模板图像集和待测模具在相同光照条件下的待测图像集,并按照型腔表面、型芯表面、分型面、浇口区域、流道区域、排气槽、顶针孔、镶件接缝、滑块接触面、斜顶接触面、深腔底部和曲面过渡区进行下位区域匹配,使检测过程不再依赖单张图像或单一光照下的简单灰度判断。通过灰度差异、边缘差异和纹理差异的融合,可以从大量图像区域中筛选出真正需要关注的疑似瑕疵区域,减少无效候选区域对后续识别流程的干扰。本发明还设置图像准入判断和补拍流程,使失焦、过曝、遮挡或覆盖不足的图像不会直接进入后续识别,由此提高了图像输入质量和疑似瑕疵筛选的稳定性。
Smart Images

Figure CN122966569A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of image processing and industrial visual inspection technology, specifically to a method for identifying and detecting surface defects in molds based on image matching. Background Technology
[0002] During injection molding, die casting, and stamping processes, molds are subjected to prolonged exposure to high temperatures, high pressures, friction, impacts, and residual material adhesion. Surface defects such as microcracks, wear, ablation, pits, burrs, residual material adhesion, and localized uneven wear are prone to appear on the cavity surface, parting surface, gate, runner, ejector pin holes, venting grooves, and insert seams. Existing mold surface image detection methods typically employ single-light image acquisition, template grayscale difference, edge threshold segmentation, or ordinary feature matching for anomaly extraction. While these methods can identify some areas with significant grayscale variations, they struggle to simultaneously address the detection needs of complex mold surface structures, curved surface reflections, multi-directional scratches, and subtle undulations. Furthermore, the mold surface itself contains normal structures such as parting lines, slot boundaries, insert seams, gate edges, and curved transitions. These normal structures also exhibit abrupt grayscale changes, edge enhancement, or brightness variations in the image. Traditional methods easily misjudge normal structural boundaries as cracks, scratches, or chipped edges. Meanwhile, some microcracks, shallow pits, pinholes, and minor wear are only noticeable under specific lighting angles. If judgment is based solely on differences in a single image, it is easy to miss them. This situation leads to unstable screening of suspected abnormal areas, difficulty in distinguishing between real defects and false anomalies, and insufficient basis for defect type identification, thus affecting the accuracy of mold maintenance, rework, and quality assessment results. Summary of the Invention
[0003] The purpose of this invention is to provide a method for identifying and detecting surface defects in molds based on image matching, so as to solve the problems mentioned in the background art.
[0004] To achieve the above objectives, the present invention provides the following technical solution:
[0005] A method for identifying and detecting surface defects in molds based on image matching, comprising the following steps:
[0006] The template image set of the normal mold under various lighting conditions is acquired, and the test image set of the mold under test under the same lighting conditions, which includes multiple frames of test images or multiple view test images, is acquired through continuous frame acquisition or multi-view collaborative acquisition. The template image set and the test image set are judged for image admission. If the image quality does not meet the preset admission requirements, reshoot is performed. If the image quality meets the preset admission requirements, the subsequent matching process is entered.
[0007] Based on the template image set, a mold structure area map is established. The mold structure area map is used to mark the normal structural boundaries in the cavity surface, core surface, parting surface, gate area, runner area, venting groove, ejector pin hole, insert joint, slider contact surface, inclined ejector contact surface, deep cavity bottom and curved transition area.
[0008] The test image set and the template image set are matched under the same lighting conditions and the same lower region to obtain gray level difference, edge difference and texture difference. The suspected defect response value formed by the gray level difference, edge difference and texture difference is compared with the preset suspected response threshold to generate suspected defect area.
[0009] Based on the appearance frequency, positional phase stability, grayscale peak and valley response direction, edge enhancement direction, and brightness-dark transition law of suspected defect areas under different lighting conditions, a multi-lighting defect phase response index is obtained, and stage markers are formed for phase support of real defects, phase pending comprehensive judgment, or phase not support of real defects.
[0010] Based on the area overlap ratio, direction consistency, boundary width deviation, and boundary expansion of the suspected defect area and the normal structural boundary in the mold structure area map, the structural prior overlap inhibition coefficient is obtained, and stage markers for strong structural pseudo-anomaly tendency, structural correlation anomaly candidate, or non-structural pseudo-anomaly candidate are formed.
[0011] The suspected defect areas in at least one image in the image set to be tested are mapped to the same mold area coordinate system. Based on the positional anchoring deviation, contour anchoring overlap, area drift and edge direction drift of the mapped suspected defect areas, the mold coordinate anchoring stability coefficient is obtained, and stage markers are formed for coordinate anchoring that supports real defects, anchoring that needs to be comprehensively judged or anchoring that does not support real defects.
[0012] Based on the multi-light defect phase response index, the structural prior coincidence suppression coefficient, and the mold coordinate anchoring stability coefficient, the surface defect discrimination index is obtained, and the suspected defect area is divided into the real defect area, the abnormal area to be re-inspected, or the pseudo-abnormal area according to the surface defect discrimination index.
[0013] The morphological features, gray-level polarity features, positional features, and edge continuity features of the real defect areas are extracted to obtain the defect type identification results;
[0014] The quality inspection results of the mold under test are obtained based on the defect type, the subordinate region, area, length, width, degree of boundary loss, and surface defect discrimination index of the actual defect area.
[0015] Compared with the prior art, the beneficial effects of the present invention are:
[0016] This invention acquires template image sets of normal molds under various lighting conditions and test image sets of the mold under test under the same lighting conditions. It then performs lower-level region matching according to the cavity surface, core surface, parting surface, gate area, runner area, venting groove, ejector pin hole, insert seam, slider contact surface, inclined ejector contact surface, deep cavity bottom, and curved transition area. This eliminates reliance on simple grayscale judgment under a single image or lighting condition. By fusing grayscale differences, edge differences, and texture differences, it can filter out truly relevant suspected defect areas from a large number of image regions, reducing interference from invalid candidate areas in subsequent identification processes. This invention also incorporates image admission judgment and re-shooting processes to prevent out-of-focus, overexposed, occluded, or insufficiently covered images from directly entering subsequent identification, thereby improving image input quality and the stability of suspected defect screening.
[0017] This invention establishes a mold structure region map and compares suspected defect areas with normal structural boundaries based on area overlap, direction consistency, width deviation, and boundary expansion. This allows it to distinguish pseudo-anomalies caused by normal structures such as parting lines, gate boundaries, runner boundaries, ejector pin hole boundaries, venting groove boundaries, and insert seams from genuine defect candidates. Simultaneously, this invention incorporates a multi-lighting defect phase response index to determine whether suspected areas exhibit stable visibility and brightness transition patterns under forward, oblique, and low-angle grazing light, avoiding misjudging moving highlights, random shadows, and dust reflections as defects. Through the combined effect of structural prior rejection and multi-lighting phase response, this invention improves the ability to distinguish between genuine defects and pseudo-anomalies in normal structures.
[0018] This invention maps suspected defect areas from multiple frames or multiple viewpoints of test images to the same mold area coordinate system. It then calculates the mold coordinate anchoring stability coefficient based on positional anchoring deviation, contour anchoring overlap, area drift, and edge direction drift, further determining whether the anomaly stably exists at the same physical surface location. For genuine pits, cracks, wear, burrs, and residual material adhesion, their positions and contours are usually relatively stable; however, highlights, shadows, temporary contaminants, and shooting noise often drift or change shape. Combined with subsequent shape matching, grayscale polarity matching, position matching, and edge continuity matching, this invention can output specific defect types and quality inspection results, thereby improving the accuracy of mold maintenance judgment. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the overall method flow of the present invention.
[0020] Figure 2 This is a schematic diagram of the image admission and suspected defect screening process of the present invention.
[0021] Figure 3This is a schematic diagram of the prior overlap suppression process of the present invention.
[0022] Figure 4 This is a schematic diagram of the mold coordinate anchoring stability judgment process of the present invention.
[0023] Figure 5 This is a schematic diagram of the defect type identification and quality inspection process of the present invention.
[0024] Figure 6 Example image of a sample for defect type classification and detection.
[0025] Figure 7 Example image for identifying the true type of defect. Detailed Implementation
[0026] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0027] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0028] This implementation method is applied to precision mold maintenance workshops and bypass inspection stations on automated production lines. The inspection object is the mold to be tested after cleaning and fixed positioning. The mold to be tested includes the cavity surface, core surface, parting surface, gate area, runner area, venting groove, ejector pin hole, insert joint, slider contact surface, inclined ejector contact surface, deep cavity bottom, and curved transition area. The inspection device includes an industrial camera, a coaxial forward light source, a left oblique light source, a right oblique light source, a low-angle grazing light source, a mold positioning fixture, a pixel calibration plate, and an image processing terminal. The pixel calibration plate is used to establish the conversion relationship between pixel size and mold physical size. Preferably, the pixel resolution is 0.010 mm / pixel to 0.030 mm / pixel.
[0029] The defects identified in this embodiment include, but are not limited to: microcracks, thermal fatigue cracks, crazing, fine scratches, scratches, pits, pits, indentations, dents, chipping, rounded edges, parting surface wear, cavity wear, core wear, ejector hole burrs, ejector hole enlargement, venting channel blockage, venting channel wear, gate ablation, gate defects, runner residual material adhesion, runner carbon buildup, insert gap enlargement, insert misalignment, slider contact surface wear, angled ejector contact surface wear, deep cavity bottom corrosion, deep cavity bottom residual glue, and shallow depressions in the curved transition area.
[0030] Please see Figures 1 to 7 The present invention provides the following technical solution:
[0031] A method for identifying and detecting surface defects in molds based on image matching, comprising the following steps:
[0032] Step 1: Obtain a template image set of a normal mold under various lighting conditions, and obtain a test image set of the mold under test under the same lighting conditions, including multiple frames of test images or multiple view test images, through continuous frame acquisition or multi-view collaborative acquisition, and establish a mold structure region map.
[0033] Step 2: Match the image set to be tested with the template image set under the same lighting conditions and the same lower region to obtain grayscale differences, edge differences and texture differences, and generate suspected defect areas;
[0034] Step 3: Based on the grayscale peak and valley response direction, edge enhancement direction, bright-dark transition sequence, and regional location stability of the suspected defect area under different lighting conditions, obtain the multi-light defect phase response index.
[0035] Step 4: Based on the area overlap ratio, direction consistency, boundary width deviation, and boundary expansion degree between the suspected defective area and the normal structural boundary in the mold structure area map, obtain the structural prior overlap inhibition coefficient.
[0036] Step 5: Map the suspected defect areas in multiple frames of test images or multiple viewpoint test images to the same mold area coordinate system to obtain the mold coordinate anchoring stability coefficient;
[0037] Step 6: Obtain the surface defect discrimination index based on the multi-light defect phase response index, the structural prior coincidence suppression coefficient, and the mold coordinate anchoring stability coefficient;
[0038] Step 7: Identify the types of defects on the surface of the mold to be tested based on the surface defect discrimination index and the shape, location, grayscale polarity, and edge continuity of the suspected defect area;
[0039] Step 8: Based on the type, location, area, length, width, degree of boundary loss, and surface defect discrimination index of the actual defect area, perform quality inspection on the mold to be tested and output the inspection results.
[0040] Example 1
[0041] This embodiment corresponds to step one and is used to illustrate the method of acquiring the template image set, the image set to be tested, and the mold structure region map. This embodiment follows the unified application scenario described above. The inspection station applies forward lighting, left oblique lighting, right oblique lighting, and low-angle grazing lighting to the same mold, and acquires template images and images to be tested under each lighting condition. The specific steps are as follows.
[0042] S101. Fix the normal mold and the mold to be tested in the same positioning fixture, so that the mold reference edge, positioning pin hole and parting surface reference line are under the same mechanical coordinate reference. The optical axis of the industrial camera and the mold reference surface keep the angle between them unchanged, preferably vertical or approximately vertical shooting; for the bottom of the deep cavity and the curved transition area, supplementary local view images are collected.
[0043] S102. Under normal lighting, left-oblique lighting, right-oblique lighting, and low-angle grazing lighting, acquire template images of the normal mold and test images of the mold under test, respectively. Normal lighting is used to reflect the overall grayscale and contamination spots; left-oblique lighting and right-oblique lighting are used to reflect the edge shadows caused by scratches, indentations, chipping, and uneven wear; low-angle grazing lighting is used to magnify the undulation response of microcracks, shallow pits, pinholes, blocked venting channels, and shallow depressions on curved surfaces.
[0044] Multiple illumination conditions are formed by a multi-illumination image acquisition component, which includes a controllable light source component capable of projecting detection light onto the surface of the mold under test from different incident directions. In specific implementation, a coaxial ring light source, strip oblique light sources set on the left and right sides of the industrial camera, and a low-angle strip light source arranged below the side of the mold surface are used to form forward illumination, left oblique illumination, right oblique illumination, and low-angle grazing illumination, respectively. The light source controller switches the start / stop state and illumination intensity of each light source in a preset sequence. The angle between the light-emitting centerline of the coaxial forward light source and the surface normal is set to 0°–10° to form forward illumination. Left and right oblique light sources are respectively arranged on the left and right sides of the industrial camera, with their light-emitting centerlines forming an angle of 30°–60°, preferably 45°, and the left and right oblique light sources are symmetrically arranged relative to the optical axis of the industrial camera. The angle between the light-emitting centerline of the low-angle grazing light source and the surface of the mold under test is set to 5°–20°, preferably 10°, i.e., its angle with the surface normal is 70°–85°. The light source controller switches between the light sources in the order of forward illumination, left oblique illumination, right oblique illumination, and low-angle grazing illumination to obtain images of the same area under different incident directions.
[0045] Multiple frames or multiple viewpoint images to be tested are obtained through an image acquisition component. Specifically, the angle between the optical axis of the fixed industrial camera and the surface normal of the area to be tested on the mold is set to 0°–10°, and multiple frames of images to be tested are continuously acquired from the same shooting position. For the bottom of deep cavities, curved transition areas, and sidewall areas, auxiliary acquisition viewpoints can be set on both sides of the frontal acquisition position, so that the angle between the optical axis of the auxiliary industrial camera and the surface normal is 15°–35°, preferably 25° on the left and 25° on the right, thereby obtaining multiple viewpoint images to be tested. The multiple viewpoint images can also be acquired by a single industrial camera mounted on a rotating bracket, linear slide, or the end of a robotic arm, which is then sequentially moved to the aforementioned preset angle positions.
[0046] S103. Perform region segmentation on the template image, extracting region masks for the cavity surface, core surface, parting surface, gate area, runner area, venting groove, ejector pin hole, insert seam, slider contact surface, inclined ejector contact surface, deep cavity bottom, and curved transition area. The region masks are denoted as... ,in Indicates the lower-level region number.
[0047] S104. Perform an admission judgment on the image quality of each lower region. To avoid subsequent detection distortion due to out-of-focus, overexposure, occlusion, or insufficient effective coverage, calculate the... The lower region in the first Image access coefficient under various lighting conditions The formula is as follows:
[0048]
[0049] In the formula, Indicates the first The lower region in the first Image admission coefficients under various lighting conditions; It represents the edge sharpness within the region, with the dimension being gray levels / pixel, and is obtained by the mean of the gray level gradient; This represents the preset resolution reference value, measured in gray levels per pixel. Dividing the two values results in a dimensionless value. This represents the average gray level of the region, with the dimension being gray level. This represents the standard exposure grayscale, with the dimension being grayscale levels. Indicates the percentage of overexposed area; dimensionless. Indicates effective coverage rate, dimensionless; , , and The weights are dimensionless. The physical principle behind the formula is that the higher the sharpness, the closer the average gray level is to the standard exposure gray level, the smaller the overexposed area, and the higher the effective coverage, the more suitable the image area is for image matching and defect detection.
[0050] Preferably, the weighting coefficients in the image admission coefficients are taken as follows: , , , Preset resolution reference value Gray level / pixel, standard exposure gray level Gray level, overexposure gray level threshold Grayscale levels.
[0051] S105, Image admission coefficient With preset admission threshold In comparison, among which, Indicates the first The lower region in the first The overall entry-level criteria for sharpness, exposure status, overexposure, and effective coverage under various lighting conditions. When, it indicates the first The lower region in the first If the image quality under certain lighting conditions fails to meet the admission requirements, and there is a risk of at least one of the following: out of focus, overexposure, occlusion, or insufficient effective coverage, a reshoot will be triggered in the corresponding area under the corresponding lighting conditions; when When, it indicates the first The lower region in the first The image quality under the given lighting conditions meets the entry requirements and can be used as valid input for matching the template image with the image to be tested, thus entering the subsequent matching process. Preferably, .
[0052] To clarify the source of the lower-level parameters in S104 and S105, this embodiment performs pixel-level statistical calculations based on a pixel calibration board and a lower-level region mask. For the first... The lower region and the first Under certain lighting conditions, the set of pixels corresponding to the lower region mask is denoted as... The set of effective pixels is denoted as The grayscale value of a pixel is denoted as The gradient magnitude is denoted as The expression for the lower-order parameter is as follows:
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060] In the formula, p represents the pixel scale, with the dimension mm / pixel; L cal N represents the calibration length on the pixel calibration board, in mm. cal This indicates the number of pixels corresponding to the calibration length, measured in pixels; M l (p) represents the mask value of the l-th lower region; This represents the effective pixel determination rule for the l-th lower region under the r-th illumination condition; N l This indicates the total number of pixels within the lower-level region mask; This indicates that the grayscale level is not lower than the overexposure threshold I. sat The number of pixels; This indicates the number of effective pixels after deducting occluded pixels, overexposed pixels, and invalid covered pixels; G l,r B l,r O l,r and C l,r The corresponding area edge sharpness, area average gray level, overexposed area ratio, and effective coverage are all obtained from the pixel set statistics.
[0061] S106. Based on the region mask, structural outline, and normal boundaries in the template image, establish a mold structure region map. Normal structural boundaries include parting line boundaries, gate boundaries, runner boundaries, venting groove boundaries, ejector pin hole boundaries, insert joint boundaries, slider contact boundaries, inclined ejector contact boundaries, deep cavity bottom boundaries, and curved surface transition boundaries.
[0062] S107. Store the centerline, standard width, standard extension direction, and adjacent area relationships of each normal structural boundary in the mold structure area map for subsequent differentiation between real defects and pseudo-anomalies in normal structures. Sample diagrams from Example 1 are shown in Table 1.
[0063] Table 1: Example Table of Multi-Illumination Image Acquisition, Access Control, and Sample Collection Link
[0064]
[0065] Table 1 shows that: M 01 To M 10 M 12 and M 13The image acceptance coefficients are all no less than 0.70, indicating that the sharpness, exposure, and effective coverage of the corresponding lower-level region meet the subsequent matching requirements. M 11 For the initial sample acquired at the bottom of the deep cavity, the image admission coefficient was 0.69, which is lower than the preset admission threshold. Therefore, a control signal was sent to the image acquisition terminal to perform a re-image verification. After the re-image, an M image was generated. 13 Then proceed to the matching process.
[0066] Example 2
[0067] This embodiment corresponds to step two, illustrating the process of image matching and generating suspected defect areas under the same lighting conditions and within the same lower-level region. This embodiment uses a unified application scenario and takes the previously approved region image as input. The specific steps are as follows.
[0068] S201, Read the... The lower region in the first Template images under various lighting conditions and the image to be tested Based on the mold positioning datum, regional contour, and local boundary features, the two are mapped to the same mold region coordinate system. Affine registration is used for planar regions; local mesh registration is used for curved transition areas and the bottom of deep cavities.
[0069] S202. Calculate the grayscale difference map in the same mold area coordinate system. For any pixel point The grayscale difference is obtained using the following formula:
[0070]
[0071] In the formula, Represents pixels The grayscale difference is expressed in grayscale levels. Represents the pixels in the image under test The grayscale value, with the dimension of grayscale level; This represents the grayscale value of the corresponding pixel in the template image, measured in gray levels. The physical principle behind this formula is that if the same physical location of the mold is contaminated, pitted, burned, or scratched in the image to be tested, its grayscale value will shift relative to the template image.
[0072] S203. Calculate the edge difference map in the same mold area coordinate system. Specifically, extract the edge intensity of the template image and the image to be tested, respectively, to obtain... and Edge differences are obtained through absolute differences. Edge differences are used to reflect chipped edges, rounded edges, burrs in pin holes, wear in venting grooves, and misalignment of inserts.
[0073] S204. Calculate the texture difference map in the same mold area coordinate system. Specifically, the texture features of the template area and the area to be tested are obtained by using the local gray-level co-occurrence matrix, local variance or local gradient direction histogram. The texture difference is used to reflect pitting, flow channel carbon deposits, residual material adhesion, deep cavity corrosion and uneven wear texture.
[0074] S205, Regarding the first A number of connected candidate regions are used to fuse grayscale differences, edge differences, and texture differences to obtain the suspected defect response value, as shown in the following formula:
[0075]
[0076] In the formula, Indicates the first The suspected defective response values of each connected candidate region are dimensionless. This represents the average gray level difference within the candidate region. Its dimension is gray level, and it becomes dimensionless after being divided by 255. This represents the average edge difference within the candidate region, measured in gray levels per pixel. This represents a reference value for edge differences, measured in gray levels per pixel. This represents the average texture difference within the candidate region, and is dimensionless. This represents a dimensionless reference value for texture differences. , and These are dimensionless weighting coefficients, and The physical principle behind the formula is that real surface defects typically cause at least one anomaly in grayscale, edge, or texture. These three types of differences are normalized and fused to form a unified suspected defect response value. Preferably, the weighting coefficients in the suspected defect response value are b1=0.40, b2=0.35, and b3=0.25; the edge difference reference value is 15 gray levels / pixel, and the texture difference reference value is 0.30.
[0077] S206, Response value for suspected defects Compared with the preset suspected response threshold In comparison, among which, Indicates the first Each connected candidate region is a suspected defect response value formed by grayscale differences, edge differences, and texture differences. When When the connected candidate region exhibits detectable grayscale anomalies, contour anomalies, or texture anomalies compared to the template image, it is considered a suspected defect region and included in subsequent processing. Numbered sample link; when If the difference intensity of the connected candidate region is insufficient to support the suspicion of a defect, it is recorded only as normal grayscale fluctuation, texture noise or minor registration error, and the region is removed as a normal fluctuation region.
[0078] Preferably, the preset suspected response threshold D0 is set to 0.30; for connected candidate regions below D0, they are only recorded as normal grayscale fluctuations or texture noise and are not passed to subsequent C-numbered sample links.
[0079] S207. Merge connected components and remove small-area noise from adjacent suspected defective regions to obtain the set of suspected defective regions required for subsequent index calculation. Sample charts for Example 2 are shown in Table 2.
[0080] Table 2: Example Table of Image Matching and Suspected Defect Screening
[0081]
[0082] As can be seen from Table 2: C 01 To C 08 All samples were obtained from the already approved samples listed in Table 1, where C 01 C 02 C03, C 04 and C 05 The response values of obvious suspected defects corresponding to the cavity, parting surface, gate, runner, and ejector pin hole are used for subsequent identification of actual defects; C 06 Although the response value is higher than the suspected response threshold, it is located at the insert joint and requires prior structural rejection; C 07 Originating from M 13 Samples taken from the bottom of the deep cavity are not immediately ruled out; C 08 Located in the curved transition zone, it is necessary to determine whether it is a specular pseudo-anomaly by examining multiple illumination phases and anchoring stability.
[0083] Example 3
[0084] This embodiment corresponds to step three, illustrating the calculation method for the phase response index of multi-illumination defects. The technical objective of this embodiment is to distinguish between genuine surface undulation defects and reflective pseudo-anomalies generated under single illumination. The specific steps are as follows.
[0085] S301. Read the matching results of the same suspected defect area under forward lighting, left oblique lighting, right oblique lighting and low angle grazing lighting, and map each lighting result to the same mold area coordinate system.
[0086] S302. Count the number of times the suspected defective area is extracted as a connectivity anomaly region under different lighting conditions. And calculate the defect occurrence frequency, using the following formula:
[0087]
[0088] In the formula, Indicates the first The defect frequency of a suspected defect area is dimensionless. This indicates the number of times the suspected defective area was extracted under different lighting conditions, with the dimension being times; This represents the total number of lighting conditions, with the dimension of "degree". The result of dividing the degree by the degree is dimensionless. The physical principle is that real defects can usually reappear in the same mold position under different lighting conditions, while random noise or occasional reflections usually appear at a lower frequency.
[0089] S303. Calculate the degree of overlap between suspected defect areas under different lighting conditions and use it as the phase stability value of the defect location. The more stable the location, the more likely the anomaly originates from the physical surface of the mold, rather than from light source reflection.
[0090] S304. Determine the grayscale peak position, grayscale valley position, and direction of the line connecting the grayscale peaks and valleys of the suspected defect area under different lighting conditions. Dimples, cracks, and scratches typically exhibit an interchange of bright and dark positions or a change in edge enhancement direction under left-slanted and right-slanted lighting. This regular bright-dark transition is a response to real surface undulations. The obtained position coordinate differences, orientation angles, and intensity amplitudes are used for feature dimensionality reduction mapping: the coordinate difference between the grayscale peak position and the grayscale valley position is used to construct a peak-valley response vector. The vector cosine similarity is compared with the standard peak-valley response direction, and the similarity is reduced from... Linear mapping to The grayscale peak and valley response direction values are obtained by weighted fusion with the truncated normalized value of the coordinate difference modulus length relative to the diagonal length of the suspected defect area. Normalize the gradient inner product of the average edge gradient vectors under different illuminations, and then convert the inner product result from... Linear mapping to The edge enhancement phase value is obtained by weighted fusion with the truncated normalized value of the edge enhancement amplitude relative to the preset reference amplitude. The average grayscale difference between the bright and dark areas is divided by 255, and a brightness-dark transition sequence is formed according to a preset lighting order. This sequence is then weighted and fused with a standard brightness-dark transition sequence after vector cosine similarity calculation to obtain the brightness-dark transition phase value. The sum of all weighting coefficients is 1. The standard peak-valley response direction and standard brightness-dark transition sequence are statistically obtained from typical defect calibration samples under the same illumination conditions, and are then used... Will , and Limited to between.
[0091] S305. Calculate the phase response index of multi-illumination defects using the following formula:
[0092]
[0093] In the formula, Indicates the first The phase response index of multi-light defects in a suspected defect area is dimensionless. Indicates the frequency of defect occurrence; dimensionless. It represents the degree of overlap between regions under different lighting conditions and is dimensionless. This represents the direction value of grayscale peak and valley response, and is dimensionless. This represents the edge-enhanced phase value, which is dimensionless. This represents the phase value of the brightness transition, and is dimensionless. to All are dimensionless weighting coefficients, and The physical principle behind the formula is that real defects not only appear under multiple illuminations, but their brightness variations, edge enhancements, and peak-valley directions should also conform to the illumination response laws of surface micro-undulations or fracture boundaries. Preferably, the weighting coefficients in the multi-illumination defect phase response index are β1=0.20, β2=0.25, β3=0.20, β4=0.20, and β5=0.15.
[0094] S306, Phase Response Index of Multi-Illumination Defects With the first phase threshold Second phase threshold In comparison, among which, Indicates the first Comprehensive phase evidence of the manifestation frequency, positional phase stability, peak-valley response direction, edge enhancement phase, and brightness-dark transition patterns of a suspected defective area under various lighting conditions.
[0095] when When the suspected area is stably visible under multiple lighting conditions, and its brightness transitions or edge enhancement patterns conform to the optical response of surface undulations, fractures, or wear of the mold, it is recorded as a phase-supported true defect; when When this occurs, it indicates that the suspected area possesses some stability under various illumination conditions but lacks sufficient phase evidence; this is recorded as a phase-based sample requiring further comprehensive judgment and is subsequently passed to structural priors and coordinate anchoring for determination. When this occurs, it indicates that the suspected area lacks a stable phase response or shifts with illumination, and is denoted as having a phase response that does not support a true defect, tending towards reflective bright spots, shadows, dust, or random noise. Preferably, , .
[0096] S307, will This serves as positive optical evidence for subsequent surface defect discrimination indices. However, phase support for real defects is not solely equivalent to the final conclusion of real defects; it still requires comprehensive judgment in conjunction with the structural prior coincidence suppression coefficient and the mold coordinate anchoring stability coefficient. Sample charts from Example 3 are shown in Table 3.
[0097] Table 3: Example Table for Calculating Phase Response Index of Multi-Illumination Defects
[0098]
[0099] Table 3 shows that: C 01 To C 05 The phase response indexes are all not lower than the first phase threshold. Therefore, at this stage, it only indicates that "phase supports true defects," rather than directly outputting the final conclusion of true defects; C 07 Its phase response index is 0.61, which is between and Between these two conditions, it indicates insufficient phase evidence but still requires comprehensive judgment; C 06 The phase response index of C08 is lower than C 06 It is more likely to be a pseudo-anomaly of normal seams, while C08 is more likely to be a pseudo-anomaly of specular reflection. Both need to be further processed in subsequent comprehensive judgment.
[0100] Example 4
[0101] This embodiment corresponds to step four, illustrating the calculation method of the structural prior overlap suppression coefficient. The purpose of this embodiment is to prevent normal structural features such as parting lines, ejector pin holes, venting channels, insert joints, and gate edges from being misjudged as cracks, scratches, or chipping. The specific steps are as follows.
[0102] S401, Read the mold structure area map and the first For each suspected defective area, obtain the standard position, standard width, standard extension direction, and allowable expansion range of the normal structural boundary adjacent to or overlapping with it.
[0103] S402. Calculate the area overlap ratio between the suspected defective area and the normal structural boundary. The higher the area overlap ratio, the more likely the suspected anomaly is caused by the normal structural boundary.
[0104] S403. Calculate the degree of consistency between the main extension direction of the suspected defect area and the standard extension direction of the normal structural boundary. The more consistent the directions, the more likely it is to be a normal structural boundary; if the directions deviate significantly, it is more likely to be a new crack, scratch, or edge chipping.
[0105] S404. Calculate the width deviation between the suspected defect area and the standard width of the normal structural boundary, and calculate the extent to which the suspected defect area extends beyond the normal boundary. The greater the width deviation and extension, the more likely the area, although close to the normal boundary, may have experienced wear, widening gaps, chipping, or blockage.
[0106] S405. Calculate the prior overlap suppression coefficient of the structure, using the following formula:
[0107]
[0108] In the formula, Indicates the first The structural prior coincidence suppression coefficient of a suspected defective region is dimensionless. This indicates the proportion of the area of suspected defective regions overlapping with the boundary of normal structures; it is dimensionless. Indicates the degree of alignment between the suspected defective area and the boundary of the normal structure; dimensionless. It indicates the degree of width deviation, is dimensionless, and is obtained by dividing the difference between the width of the suspected area and the standard width of the normal structure boundary by the reference width; It represents the degree of boundary expansion, is dimensionless, and is obtained by dividing the area beyond the normal structural boundary by the area of the suspected region; to These are dimensionless weighting coefficients, and The physical principle behind the formula is that the closer the suspected anomaly overlaps with the normal structure, the more consistent their directions, the closer their widths, and the smaller their outward expansion, the more likely it is to be a pseudo-anomaly within the normal structure and should be suppressed in the final judgment. Preferably, the weighting coefficients in the prior overlap suppression coefficient are γ1=0.30, γ2=0.25, γ3=0.25, and γ4=0.20; the width deviation from the reference width is taken as 20% of the standard width of the corresponding normal structure boundary.
[0109] S406, Structural prior coincidence suppression coefficient With the first structural threshold Second structural threshold In comparison, among which, The larger the value, the higher the value. The closer a suspected defective area is to a normal structural boundary, the more likely it is to become a pseudo-anomaly. When the suspected defect area coincides with the boundary of the normal structure in height, direction, and width without any effective anomaly, it is recorded as a strong structural pseudo-anomaly tendency and is used as a strong negative suppression term in subsequent surface defect discrimination; when When the suspected defective area is associated with the normal structural boundary, but may still be accompanied by width expansion, boundary expansion, roughening, or local filling, it is recorded as a candidate for structural association anomaly and is not directly eliminated; when When this occurs, it indicates that the suspected defective area has a low degree of overlap with the boundary of the normal structure and does not constitute a significant structural pseudo-anomaly, and continues to be passed on as a candidate for non-structural pseudo-anomaly. Preferably, , .
[0110] S407, will As a negative suppression term in the surface defect discrimination index, the strong structural pseudo-anomaly tendency only indicates that subsequent discrimination should be weakened, and does not replace the final pseudo-anomaly conclusion. Sample charts are shown in Table 4.
[0111] Table 4: Example Table for Calculating the Prior Coincidence Suppression Coefficient of Structures
[0112]
[0113] Table 4 shows that: C 06 The prior structural overlap suppression coefficient is 0.82, which is not lower than the first structural threshold. This indicates a strong tendency for structural pseudo-anomalies; the suppression coefficient of CO2 is 0.47, which is between... and The interval between these two indicates that although it is related to the fractal line, it is still retained as a candidate for structural correlation anomaly; C 01 C 03 C 04 C 05 C 07 and C 08 The inhibition coefficient is lower than the second structure threshold. This indicates that the structural inhibition effect is weak and cannot be used as the sole basis for excluding normal structures.
[0114] Example 5
[0115] This embodiment corresponds to step five, illustrating the calculation method for the mold coordinate anchoring stability coefficient. The purpose of this embodiment is to determine whether suspected defects are stably anchored at the same physical surface position of the mold, thereby distinguishing between genuine defects and dust, oil stains, reflections, random noise, and temporary shadows. The specific steps are as follows.
[0116] S501. Continuously acquire multiple frames of images to be tested under the same lighting conditions, or acquire multiple images to be tested from different perspectives, and map the suspected defect areas in each frame or each perspective to the same mold area coordinate system through image matching results.
[0117] S502. Calculate the offset distance between the center positions of the suspected defective areas after mapping to obtain the position anchoring deviation value. Actual defects should maintain a small positional deviation in the mold coordinate system; reflections and shadows often drift significantly with changes in viewing angle or light source.
[0118] S503. Calculate the contour overlap ratio between the mapped suspected defect areas to obtain the contour anchoring coincidence value. Specifically, calculate the ratio of the intersection area to the union area of the mapped contours of the same suspected defect area in different frames or different viewpoints, and take the arithmetic mean of the contour overlap ratios of each group to obtain the contour anchoring coincidence value; the contour anchoring coincidence value is a dimensionless value with a value range of [0,1]. The larger the value, the more stable the contour of the mapped suspected defect area; the contours of real cracks, pits, chipped edges and blockages are relatively stable; dust and oil stains may show edge shape changes.
[0119] S504. Based on the area variation range between the mapped suspected defective areas, obtain the area drift value, and based on the variation range of the main edge direction between the mapped suspected defective areas, obtain the edge direction drift value. Specifically, calculate the variation range of the area of the suspected defective area relative to the area reference value under different frames or different viewpoints, and normalize it using the area variation reference value to obtain the area drift value with a value range of [0,1]; calculate the variation range of the included angle between the main edge directions of the suspected defective areas under different frames or different viewpoints, and normalize it using the direction variation reference value to obtain the edge direction drift value with a value range of [0,1]. The smaller the area drift value and the edge direction drift value, the more stable the area and main edge direction of the suspected defective area. The position offset reference distance is taken as 0.10mm, the area variation reference value is taken as 0.05mm², and the direction variation reference value is taken as 15°.
[0120] S505. Calculate the mold coordinate anchoring stability coefficient based on the position anchoring deviation value, contour anchoring coincidence value, area drift value, and edge direction drift value, using the following formula:
[0121]
[0122] In the formula, Indicates the first The mold coordinate anchoring stability coefficient for a suspected defect area is dimensionless. This indicates the position anchoring deviation value; This represents the contour anchoring coincidence value, which is dimensionless. Indicates the area drift value; Indicates the drift value in the edge direction; to These are dimensionless weighting coefficients, and The physical principle behind the formula is that the position, contour, area, and edge direction of a real defect on the physical surface of the mold should remain stable. Therefore, the smaller the offset distance, area drift, and direction drift, the higher the anchoring stability coefficient.
[0123] Preferably, the weighting coefficients in the mold coordinate anchoring stability coefficient are δ1=0.30, δ2=0.30, δ3=0.20, and δ4=0.20; the position offset reference distance is 0.10mm, the area change reference value is 0.05mm², and the direction change reference value is 15°.
[0124] S506, Anchor the mold coordinate stability coefficient With the first anchoring threshold Second anchoring threshold In comparison, among which, Indicates the first The degree to which a suspected defective region maintains the same physical location, stable contour, stable area, and stable edge direction after multi-frame or multi-view mapping. When When the suspected defect area is stably anchored to the same physical surface position of the mold under test, it is denoted as coordinate anchoring supporting the actual defect; when When the suspected defect area has a certain degree of positional stability but its outline, area, or direction still fluctuates, it is recorded as an anchored sample to be comprehensively judged; when When the suspected defect area shows significant position or outline drift across multiple frames or viewpoints, it is denoted as "anchoring does not support true defects" and tends to be due to reflections, shadows, shooting noise, or movable contaminants. Preferably, , .
[0125] S507, will As a positive physical location evidence for subsequent surface defect discrimination indices, anchoring support for real defects still requires the combined effect of multi-illumination phase response and structural prior suppression. Sample charts are shown in Table 5.
[0126] Table 5: Example Table for Calculating Mold Coordinate Anchoring Stability Coefficient
[0127]
[0128] Table 5 shows that: C 01 To C 05 The anchoring stability coefficients are all no less than the first anchoring threshold. This indicates that it supports real defects in the coordinate anchoring dimension; C 06 and C 07 The anchoring stability coefficient is between and The value between these two values indicates that it can only serve as evidence for comprehensive evaluation and cannot be used alone to confirm a genuine defect; the anchoring stability coefficient of C08 is lower than [a certain value]. This indicates that its position drifts significantly with the viewing angle, and the anchored dimension does not support real defects.
[0129] Example 6
[0130] This embodiment corresponds to step six, which explains the calculation of the surface defect discrimination index and the classification methods for real defects, anomalies awaiting re-inspection, and pseudo-anomalies. The specific steps are as follows.
[0131] S601, Read the first Multi-light defect phase response index of suspected defect areas Structural prior coincidence suppression coefficient and mold coordinate anchoring stability coefficient .
[0132] S602. Using the multi-lighting defect phase response index as the optical true response term, the mold coordinate anchoring stability coefficient as the physical position stability term, and the structural prior coincidence suppression coefficient as the normal structure suppression term, calculate the surface defect discrimination index using the following formula:
[0133]
[0134] In the formula, Indicates the first The surface defect discrimination index for a suspected defect area is dimensionless. The phase response index for multi-illumination defects is dimensionless. This represents the mold coordinate anchoring stability coefficient, which is dimensionless. This represents the structural prior coincidence inhibition coefficient, which is dimensionless. , and These are dimensionless weighting coefficients, and The physical principle behind the formula is that a true defect must simultaneously satisfy three conditions: a clear multi-illumination response pattern, stable physical coordinates, and not being a pseudo-anomaly of a normal structure. Therefore... and Positively improves the discriminant index, while The higher the value, the lower the discrimination index should be. Preferably, the weighting coefficients in the surface defect discrimination index are λ1=0.40, λ2=0.35, and λ3=0.25.
[0135] S603, compare the surface defect discrimination index with the first discrimination threshold. Second discrimination threshold A comparison is made. Preferably, Take 0.72, Take 0.45.
[0136] when When the optical response and physical position stability of the suspected defect area both support the judgment of a real defect and are not significantly suppressed by the prior knowledge of the normal structure, the corresponding suspected defect area is judged as a real defect area; when When this occurs, it indicates that there is still some abnormal evidence in the suspected defect area, but the strength of the evidence is insufficient to directly confirm the actual defect, and the corresponding suspected defect area is judged as an abnormal area to be re-inspected; when If the overall credibility of the suspected defect area is insufficient, or if it is significantly affected by normal structure, high light reflection, shadow, or noise, the corresponding suspected defect area will be judged as a pseudo-abnormal area.
[0137] S604. For real defect areas, retain their location, area, length, width, boundary direction, and subordinate region; generate re-shoot, post-cleaning re-inspection, or manual verification marks for abnormal areas to be re-inspected; record the source of false abnormalities for false abnormal areas, including normal structural boundaries, specular reflection, shadows, or noise. Transfer the real defect areas and abnormal areas to be re-inspected to the defect type identification step. Sample charts for Example 6 are shown in Table 6.
[0138] Table 6: Examples of Surface Defect Identification and Sample Transfer
[0139]
[0140] Table 6 shows that: C 01 To C 05 The surface defect discrimination index all reached or exceeded the first discrimination threshold. Therefore, a final real defect sample chain is formed and enters the type identification in Table 7; C 07 The discriminant index is at and The values between these thresholds indicate that the abnormal evidence is insufficient for direct identification, therefore a clean re-examination is required; the discriminant indices for C06 and C08 are not higher than the second discriminant threshold. These are recorded as normal seam pseudo-anomalies and specular reflection pseudo-anomalies, respectively, and are not included in the output of real defect samples.
[0141] Example 7
[0142] This embodiment corresponds to step seven, which explains the method for identifying the types of surface defects on the mold to be tested. The specific steps are as follows.
[0143] S701. Establish a defect type library, which shall include at least the following types: cracks, scratches, pits, boundary wear, hole and groove anomalies, gate and runner anomalies, joint misalignment, sliding contact wear, deep cavity contamination and corrosion, and shallow surface pits.
[0144] S702. For actual defect areas, extract morphological features, including length, width, aspect ratio, area, roundness, continuous length of the skeleton, and proportion of missing boundaries. Cracks typically have a large aspect ratio and high skeleton continuity; pits and pits are usually dot-shaped or elliptical; chipped edges and wear are usually located near edges or parting boundaries.
[0145] S703. Extract grayscale polarity features, including lower grayscale at the center than at the periphery, paired distribution of bright and dark areas at the edges, high-brightness and rough edges from ablation, and continuity of dark spots from carbon deposits. Pits often appear as dark centers and bright edges; carbon deposits in flow channels often appear as continuous dark spots; and ablation at the gate often appears as a mixture of bright and dark areas with a rough texture.
[0146] S704. Extract location features, including the subordinate region to which the actual defect area belongs and its relative position to the normal structure boundary, edge, hole edge, groove bottom, and seam. Burrs in ejector pin holes must be located near the ejector pin hole boundary, blockages in venting grooves must be located within the venting groove, and misalignment of inserts must be located on both sides of the insert seam.
[0147] S705. Extract edge continuity features, including edge direction stability, contour interruption degree, boundary expansion degree, and edge blunting degree. Edge blunting is suitable for judging edge rounding; contour interruption is suitable for judging edge chipping; boundary expansion is suitable for judging hole enlargement or gap enlargement.
[0148] S706, No. The set of pixels representing a real defect area is denoted as . The reference features for the z-th candidate defect type are provided by the defect type library. This library is built offline before online detection. Specifically, it involves collecting typical defect samples (cracks, scratches, dents, wear, burrs, blockages, ablation, residual material adhesion, and misaligned joints) that have been manually verified. These samples are then combined with mold design drawings, quality inspection specifications, maintenance records, and historical inspection data to determine the defect type label. Under the same camera position, lighting conditions, and image processing parameters as online detection, features such as aspect ratio, area, roundness, skeleton continuity, brightness polarity, grayscale contrast, texture roughness, location in the lower region, edge direction fluctuation, and boundary missing proportion are extracted from various defect samples. Then, mean statistics, quantile intervals, standard deviation analysis, and outlier removal methods are used to determine the reference feature center value and allowable fluctuation range for each candidate defect type. These features are then solidified and stored in the defect type library after verification by standard samples and manual review, serving as a reference for subsequent type matching and defect identification. For the z-th... For the first candidate defect type, Measured feature values of a real defect area , No. Reference feature values of candidate defect types and allowable deviation The expression for the feature similarity function is as follows:
[0149]
[0150] In the formula, It represents the similarity between measured feature values and reference feature values, and is dimensionless; Indicates the first Measured feature values of a real defect area; Indicates the first Reference feature values for candidate defect types; Indicates the first The permissible characteristic deviation range for candidate defect types is obtained through offline calibration and standard sample library construction before detection. Specifically, the structural dimensions, positional relationships, and manufacturing tolerances in the mold CAD model, design drawings, and inspection specifications are read, and the mapping relationship between the mold's physical coordinate system and the image coordinate system is established using a pixel calibration board and positioning fixture. Then, normal molds that have passed manual inspection are selected, and multiple batches and multiple frames are acquired under the same camera position, lighting conditions, and acquisition parameters as online detection. The standard position, standard width, extension direction, grayscale range, texture features, and repeated acquisition fluctuation range of the normal structural boundary of each lower region are statistically analyzed. Based on the repeatability statistical results of design tolerances and qualified samples, the reference distance of position offset, reference value of area change, reference value of direction change, and corresponding judgment tolerance are determined using the mean, standard deviation, quantile interval, or maximum permissible deviation. After verification by standard samples, these are solidified into the mold structural area map and benchmark parameter library as a unified reference for subsequent online matching, anchoring stability analysis, and defect discrimination. The closer When the similarity is closer to 1, the closer it is to 1; when the deviation reaches or exceeds 1, the closer it is to 1. When the similarity is zero, the similarity is set to 0.
[0151] S707, Calculate the morphological matching value. According to the... The aspect ratio, area, roundness, and skeleton continuity of each real defect area are used to calculate its relationship with the first defect area. The morphological matching value between candidate defect types is calculated using the following formula:
[0152]
[0153] In the formula, Indicates the first The first real defect area and the first The morphological matching value between candidate defect types is dimensionless. Indicates the first The aspect ratio of a real defect area is obtained by dividing the length of the major axis of the smallest bounding rectangle by the length of its minor axis; Indicates the first The area of each real defective region is determined by The number of pixels in the matrix is multiplied by the area of a single pixel; Indicates the first The roundness of each real defect area is determined by... Calculations show that This indicates the perimeter of the area; Indicates the first The degree of skeleton continuity of a real defect region is obtained by dividing the continuous length of the region skeleton by the main extension length; , , and They represent the first Reference aspect ratio, reference area, reference roundness, and reference skeleton continuity for candidate defect types; , , and These represent the allowable deviations for the corresponding features; , , and These are dimensionless weighting coefficients, and Preferably, , , , .
[0154] S708, Calculate the grayscale polarity matching value. According to the... The brightness polarity, center-to-periphery grayscale difference, regional grayscale contrast, and texture roughness of each real defect area are used to calculate its relationship with the first... The formula for the grayscale polarity matching value between candidate defect types is as follows:
[0155]
[0156] In the formula, Indicates the first The first real defect area and the first The grayscale polarity matching value between candidate defect types, dimensionless; Indicates the uniformity of brightness and darkness polarity, when the first... The actual defect area exhibits a paired distribution of dark center, bright center, and bright / dark edges, or a localized highlighting and roughening pattern, similar to the first... The value is 1 when the candidate defect types are the same, and 0 when they are different. The difference in grayscale between the center and the surrounding area is represented by dividing the absolute value of the difference between the average grayscale within the region and the average grayscale of the surrounding annular neighborhood by 255. Represents the grayscale contrast of a region, by The difference between the maximum and minimum grayscale values is obtained by dividing by 255. Indicates the roughness of the texture, by It is obtained by normalizing the local gray-level variance or the mean of the local gradient magnitude; , and They represent the first Reference grayscale difference, reference grayscale contrast, and reference texture roughness for candidate defect types; , and These represent the allowable deviations for the corresponding features; , , and These are dimensionless weighting coefficients, and Preferably, , , , .
[0157] S709, Calculate the position matching value. According to the... Calculate the distance between the lower region to which the first real defect region belongs, the distance to the boundary of the associated structure, and the angle with the process direction. The positional matching value between candidate defect types is calculated using the following formula:
[0158]
[0159] In the formula, Indicates the first The first real defect area and the first Positional matching values between candidate defect types, dimensionless; Indicates the first The set of sub-regions that are allowed to appear for each candidate defect type; This represents the percentage of the actual defective area that falls within the set of allowed subordinate areas; Indicates the first The first real defect area to the first The minimum distance between the associated structural boundaries of the candidate defect type, in millimeters. The associated structural boundaries include parting lines, hole edges, groove edges, gate boundaries, runner boundaries, insert joint boundaries, slider contact boundaries, or inclined top contact boundaries. Indicates the first Reference distance for candidate defect types, in millimeters; Indicates the first The main extension direction of a real defect area; Indicates the first The reference direction corresponding to the candidate defect type includes the machining direction, demolding direction, sliding friction direction, hole edge tangential direction, or groove extension direction; Indicates the permissible directional deviation; , and These are dimensionless weighting coefficients, and Preferably, , , .
[0160] S710, Calculate the edge continuity matching value. According to the... The edge direction fluctuation, edge interruption ratio, boundary missing ratio, and edge blunting degree of each real defect area are calculated and compared with the first... Edge continuity matching values between candidate defect types. To avoid excessively long formulas, we first define directional continuity terms, edge unbroken terms, boundary missing similarity terms, and edge blunting similarity terms, as follows:
[0161]
[0162]
[0163]
[0164] In the formula, Indicates the first The first real defect area and the first Edge continuity matching values between candidate defect types, dimensionless; It represents a continuous term with a direction and is dimensionless. This indicates a dimensionless term that does not break at the edge. This indicates that the boundary is missing similar terms and is dimensionless. This represents the edge blunting similarity term, which is dimensionless. Indicates the first The standard deviation of the edge direction angle of a real defect area; the smaller the standard deviation, the more continuous the edge direction. Indicates the first Reference value for allowable edge direction fluctuations for candidate defect types; Indicates the first The number of edge interruption pixels in a real defect area; Indicates the first The total number of edge pixels in a real defect area; Indicates the first The boundary missing ratio of a real defect area relative to the template boundary is obtained by dividing the number of missing pixels at the template boundary by the total number of pixels at the template boundary. Indicates the first The degree of edge blunting of a real defect area is obtained by the increase ratio of the width of the edge to be tested to the width of the template edge; and They represent the first The proportion of missing reference boundaries and the degree of reference edge blunting for candidate defect types; and These represent the allowable deviations for the corresponding features; , , and These are dimensionless weighting coefficients, and Preferably, , , , .
[0165] S711, targeting the first For each candidate defect type, the type matching score is calculated using the following formula:
[0166]
[0167] In the formula, Indicates the first The first real defect area and the first Type matching score for each candidate defect type, dimensionless; Represents the morphological matching value, dimensionless; This represents the grayscale polarity matching value, which is dimensionless. This represents the positional matching value, which is dimensionless. Represents the edge continuity matching value, dimensionless; , , and These are dimensionless weighting coefficients, and The physical principle behind the formula is that the same grayscale anomaly may correspond to different defect types in different mold sub-regions; therefore, four types of information—shape, grayscale, location, and edge—must be considered simultaneously. Preferably, , , , The preset type confirmation threshold is used as the third threshold. When the maximum type matching score is lower than the third threshold, the determined type is not directly output.
[0168] S712. Determine the first from all candidate defect types. The maximum type match score for each real defect area and their corresponding candidate defect types The expression is as follows:
[0169]
[0170] when When, it indicates the first The first real defect area differs from the second in four categories of features: shape, grayscale polarity, location, and edge continuity. The candidate defect types are sufficiently consistent to identify them as the first. Class of defects; when When this occurs, it indicates that although the actual defect area has been identified as a real defect, its type characteristics do not meet the confirmation requirements for any single type in the defect type library. The defect is then marked as an undefined defect and enters the manual review process. Preferably, the third threshold... The sample charts are shown in Table 7.
[0171] Table 7: Example Table of Real Defect Type Identification
[0172]
[0173] Please see Figure 6 , Figure 7 As can be seen from Table 7, Table 7 only includes the actual defect sample C from Table 6. 01 To C 05 No longer will false anomalies or anomalies awaiting re-examination be mixed in. C 01 Based on the dotted dark spots, low central grayscale, and grazing enhancement, they were identified as pits / pockmarks; C 02 Parting surface wear is identified by widening of the parting surface boundary and blunting of the edges; C 03 Based on the highlighted rough edges and localized gaps in the gate area, it was identified as gate ablation / defect; C 04 Based on the blocky dark spots adhering to the flow channel, it was identified as residual material adhering to the flow channel; C 05 Based on the local outward convexity of the orifice and the abrupt change in the annular edge, it was identified as a pinhole burr.
[0174] Example 8
[0175] This embodiment corresponds to step eight, which explains the output method of the quality inspection results of the mold under test. The specific steps are as follows.
[0176] S801: Read the surface defect discrimination index, defect type, subordinate region, area, length, width, and boundary missing degree of all real defect areas.
[0177] S802. Determine the risk weight of the area based on the subordinate area to which the actual defect area belongs. The parting surface, gate area, venting groove, ejector pin hole, and insert seam are directly related to the product's flash, venting, ejection, and assembly accuracy, and have a higher risk weight. The cavity surface, core surface, and curved transition area are related to the product's appearance quality, and the risk weight of the area is set according to the product's appearance grade. The slider contact surface and the inclined ejector contact surface are related to motion stability, and the risk weight is set according to the degree of motion wear.
[0178] S803. Calculate the severity value of a single true defect area using the following formula:
[0179]
[0180] In the formula, Indicates the first The severity value of each real defect area is dimensionless. This represents the actual area of the defective region, with the dimension of square millimeters. Indicates the first The area reference value of each lower region is in the dimension of square millimeters; Indicates the length of the defect, measured in millimeters; Indicates the first Reference values for the length of each lower region, in millimeters; Indicates the width of the defect, measured in millimeters; Indicates the first Reference values for the width of each lower region, in millimeters; Indicates the degree of boundary missingness; dimensionless. to These are dimensionless weighting coefficients, and The physical principle behind the formula is that the larger the defect area, the longer the length, the wider the width, and the more obvious the boundary defects, the more likely they are to affect the surface of the product, the mold closing accuracy, the feeding stability, or the ejection stability. Preferably, the weighting coefficients in the severity value of a single real defect area are ξ1=0.30, ξ2=0.25, ξ3=0.20, and ξ4=0.25.
[0181] S804. Calculate the surface quality risk value of the mold to be tested, using the following formula:
[0182]
[0183] In the formula, This represents the surface quality risk value of the mold under test, and is dimensionless. This represents the total number of actual defective areas, with the dimension being "units". Indicates the first The regional risk weight of the subordinate region to which a real defective region belongs is dimensionless. Indicates the first The surface defect discrimination index for a real defect area is dimensionless. Indicates the first The severity value for each real defect area is dimensionless. The physical principle behind this formula is that high-confidence real defects in high-risk areas should contribute more to the overall mold quality risk, while minor defects in low-risk areas contribute less to the overall risk.
[0184] S805, The surface quality risk value of the mold to be tested. With the first quality threshold Second mass threshold In comparison, among which, This represents the overall mold quality risk level, formed by the combined factors of the actual number of defects, the reliability of the actual defects, the regional risk weight, and the severity of the defects. Preferably, , The regional risk weights are set according to the principle that the risk weights of key functional areas are higher than those of ordinary appearance areas. The regional risk weights of the gate area, venting groove, ejector pin hole, insert joint and parting surface are preferably set to 1.20 to 1.50.
[0185] S806, when When the test indicates that the overall quality risk of the mold under test exceeds the non-conformance threshold, the test result of the mold under test is output as non-conforming, and repair or replacement suggestions are generated; when When the test result indicates that the mold under test has a medium quality risk and cannot be directly judged as qualified, the test result indicates that the mold under test needs to be re-inspected or partially repaired; when When the test result is obtained, it indicates that the actual defect risk of the mold under test is within an acceptable range, and the test result of the mold under test is qualified.
[0186] S807. Generate a mold quality inspection report by combining the inspection results, defect location, defect type, surface defect discrimination index, and repair suggestions. The sample charts for Example 8 are shown in Table 8.
[0187] Table 8: Example of Quality Risk Output for Real Defect Samples
[0188]
[0189] As can be seen from Table 8: Table 8 ultimately only outputs C. 01 To C 05 Five real-world defect samples, and C 06 C 08 As a pseudo-anomaly exclusion, C 07 A separate re-inspection marker will be generated for any abnormalities pending re-inspection. 01 To C 05 The total defect risk value is 2.68, which is higher than the first quality threshold. ,correspond The test results for this mold are deemed unqualified due to the defined non-conforming range. Therefore, the test mold outputs unqualified test results and provides suggestions for localized repair or grinding verification of the parting surface, gate area, runner area, and ejector pin holes. This sample chain ensures a one-to-one correspondence between initial data collection, suspected defect screening, actual defect confirmation, type identification, and final quality output in terms of serial numbers.
[0190] Through the above embodiments one to eight, this method forms a complete closed loop from multi-light acquisition, regional map establishment, image matching, differential response extraction, multi-light phase response judgment, structural prior coincidence suppression, mold coordinate anchoring stability judgment, surface defect discrimination, defect type identification to quality risk output. Compared with methods that rely solely on single image difference or single feature point correction, this method can perform differential identification of cavity surfaces, core surfaces, parting surfaces, gate areas, runner areas, venting grooves, ejector pin holes, insert seams, slider contact surfaces, inclined ejector contact surfaces, deep cavity bottoms, and curved transition areas in precision molds. It is particularly suitable for surface defects that are difficult to identify manually and stably, such as microcracks, thermal fatigue cracks, crazing, fine scratches, pits, pinholes, chipping, parting surface wear, venting groove blockage, ejector pin hole burrs, gate ablation, runner residual material adhesion, insert gap enlargement, slider contact surface wear, inclined ejector contact surface wear, deep cavity bottom corrosion, and shallow depressions in curved transition areas.
[0191] All formulas in this method are fused using dimensionless normalization: parameters involving length are expressed in millimeters and divided by the corresponding millimeter reference value; parameters involving area are expressed in square millimeters and divided by the corresponding square millimeter reference value; parameters involving grayscale are expressed in grayscale levels and divided by 255 or the corresponding grayscale reference value; and parameters involving angles are expressed in degrees and divided by the corresponding angle reference value. Through the above dimensional processing, all indices, coefficients, and risk values are dimensionless, enabling unified comparisons under different mold sizes, camera resolutions, and lighting conditions.
[0192] It should be noted that all calculation formulas in this application employ regression analysis, including but not limited to machine learning algorithms, to deeply analyze the collected parameters and identify their natural trends and interrelationships. Specialized software, such as Python's Scikit-learn library or the R language, is used to automatically generate mathematical models that match the data. Then, cross-validation and other methods are used to objectively evaluate the model performance, and continuous feedback and optimization are combined to ensure that the created formulas truly reflect the inherent laws of the data, thereby guaranteeing their effectiveness and accuracy. In all calculation formulas in this application, the parameters in each formula undergo dimensionless processing within a consistent range to ensure that different physical quantities are compared on the same scale; dimensionless processing techniques include, but are not limited to, min-max-normalization and Z-score standardization.
[0193] The algorithm of this invention is implemented as a Python script. Before executing the core logic, the program first executes a data loading module (e.g., using the widely used pandas library in Python) configured to read the aforementioned spreadsheet file and load its contents into the program's working memory (e.g., a DataFrame data structure). Subsequent algorithm steps will directly query and retrieve the required configuration parameters from this in-memory data structure.
[0194] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for identifying and detecting surface defects in molds based on image matching, characterized in that, Includes the following steps: The template image set of the normal mold under various lighting conditions is acquired, and the test image set of the mold under test under the same lighting conditions, which includes multiple frames of test images or multiple view test images, is acquired through continuous frame acquisition or multi-view collaborative acquisition. The template image set and the test image set are judged for image admission. If the image quality does not meet the preset admission requirements, reshoot is performed. If the image quality meets the preset admission requirements, the subsequent matching process is entered. Based on the template image set, a mold structure area map is established. The mold structure area map is used to mark the normal structural boundaries in the cavity surface, core surface, parting surface, gate area, runner area, venting groove, ejector pin hole, insert joint, slider contact surface, inclined ejector contact surface, deep cavity bottom and curved transition area. The test image set and the template image set are matched under the same lighting conditions and the same lower region to obtain gray level difference, edge difference and texture difference. The suspected defect response value formed by the gray level difference, edge difference and texture difference is compared with the preset suspected response threshold to generate suspected defect area. Based on the appearance frequency, positional phase stability, grayscale peak and valley response direction, edge enhancement direction, and brightness-dark transition law of suspected defect areas under different lighting conditions, a multi-lighting defect phase response index is obtained, and stage markers are formed for phase support of real defects, phase pending comprehensive judgment, or phase not support of real defects. Based on the area overlap ratio, direction consistency, boundary width deviation, and boundary expansion of the suspected defect area and the normal structural boundary in the mold structure area map, the structural prior overlap inhibition coefficient is obtained, and stage markers for strong structural pseudo-anomaly tendency, structural correlation anomaly candidate, or non-structural pseudo-anomaly candidate are formed. The suspected defect areas in at least one image in the image set to be tested are mapped to the same mold area coordinate system. Based on the positional anchoring deviation, contour anchoring overlap, area drift and edge direction drift of the mapped suspected defect areas, the mold coordinate anchoring stability coefficient is obtained, and stage markers are formed for coordinate anchoring that supports real defects, anchoring that needs to be comprehensively judged or anchoring that does not support real defects. Based on the multi-light defect phase response index, the structural prior coincidence suppression coefficient, and the mold coordinate anchoring stability coefficient, the surface defect discrimination index is obtained, and the suspected defect area is divided into the real defect area, the abnormal area to be re-inspected, or the pseudo-abnormal area according to the surface defect discrimination index. The morphological features, gray-level polarity features, positional features, and edge continuity features of the real defect areas are extracted to obtain the defect type identification results; The quality inspection results of the mold under test are obtained based on the defect type, the subordinate region, area, length, width, degree of boundary loss, and surface defect discrimination index of the actual defect area.
2. The method for identifying and detecting surface defects in molds based on image matching according to claim 1, characterized in that, Image admission criteria are applied to the template image set and the image set to be tested, including: For any lower region under any lighting condition, statistically analyze the region edge sharpness, average gray level, overexposed area ratio, and effective coverage. The image admission coefficient is obtained based on the region edge sharpness, region average gray level, overexposed area ratio, and effective coverage. The image admission coefficient is compared with the preset admission threshold. When the image admission coefficient is less than the preset admission threshold, it means that the image quality of the corresponding lower region under the corresponding lighting conditions does not meet the admission requirements, and a control signal is sent to the image acquisition terminal to perform a re-shooting action. When the image admission coefficient is not less than the preset admission threshold, it means that the corresponding image can be used as a valid input and enter the subsequent matching process. Among them, the regional edge sharpness, regional average gray level, overexposed area ratio, and effective coverage are obtained by statistical analysis of the pixel set corresponding to the lower-level regional mask.
3. The method for identifying and detecting surface defects in molds based on image matching according to claim 1, characterized in that, Generate suspected defect areas, including: The template image and the image to be tested under the same lighting conditions are mapped to the same mold area coordinate system; In the same mold area coordinate system, the grayscale difference map, edge difference map and texture difference map between the template image and the image to be tested are calculated according to the same lower region. The grayscale difference map determines the areas of abnormal brightness and darkness, the edge difference map determines the areas of abnormal contours, and the texture difference map determines the areas of abnormal surface texture. Connectivity components are merged into bright / dark anomaly regions, contour anomaly regions, and surface texture anomaly regions to obtain connected candidate regions. The suspected defect response value is obtained based on the average gray level difference, average edge difference, and average texture difference within the connected candidate region. The suspected defect response value is compared with the preset suspected response threshold. When the suspected defect response value is not less than the preset suspected response threshold, it indicates that the corresponding connected candidate region has formed a detectable gray-scale abnormality, contour abnormality, or texture abnormality, and it is regarded as a suspected defect region. When the suspected defect response value is less than the preset suspected response threshold, it indicates that the corresponding connected candidate region belongs to normal gray-scale fluctuation, texture noise, or registration error, and it is removed.
4. The method for identifying and detecting surface defects in molds based on image matching according to claim 1, characterized in that, Obtain the phase response index of multi-illumination defects, including: The frequency of defect appearance was obtained by counting the number of times the same suspected defect area was extracted as a connected anomaly area under different lighting conditions. Calculate the degree of regional overlap of the same suspected defect area after it is mapped to the same mold area coordinate system under different lighting conditions, and obtain the phase stability value of the defect location; The grayscale peak and valley response direction values are obtained by analyzing the grayscale peak position, grayscale valley position, and grayscale peak and valley connection direction of the same suspected defect area under different lighting conditions. The edge enhancement phase value is obtained based on the edge enhancement direction and edge enhancement intensity of the same suspected defect area under different lighting conditions; Based on the sequence of bright and dark transitions of the same suspected defect area under normal lighting, oblique lighting, and low-angle grazing lighting, the phase value of the bright-dark transition is obtained. Based on the defect appearance frequency, defect location phase stability value, grayscale peak and valley response direction value, edge enhancement phase value, and brightness-dark transition phase value, the multi-light defect phase response index is obtained. The phase response index of multi-light defects is compared with a first phase threshold and a second phase threshold. When the phase response index of multi-light defects is not less than the first phase threshold, a stage marker indicating that the phase supports the real defects is formed. When the phase response index of multi-light defects is less than the first phase threshold and not less than the second phase threshold, a stage marker indicating that the phase needs to be comprehensively judged is formed. When the phase response index of multi-light defects is less than the second phase threshold, a stage marker indicating that the phase does not support the real defects is formed.
5. The method for identifying and detecting surface defects in molds based on image matching according to claim 1, characterized in that, Obtain the prior structural coincidence suppression coefficient, including: The structural overlap value is obtained based on the area overlap ratio between the suspected defective area and the boundary of the normal structure. The structural orientation consistency value is obtained by the angle between the main extension direction of the suspected defective area and the standard extension direction of the corresponding normal structural boundary. The structural width deviation value is obtained by the difference between the width of the suspected defective area and the standard width of the corresponding normal structural boundary. The structural boundary expansion value is obtained based on the area of the suspected defective area that exceeds the corresponding normal structural boundary. The prior coincidence suppression coefficient of the structure is obtained based on the structural coincidence value, the structural orientation consistency value, the structural width deviation value, and the structural boundary expansion value. The prior structural coincidence suppression coefficient is compared with the first structural threshold and the second structural threshold. When the prior structural coincidence suppression coefficient is not less than the first structural threshold, a strong structural pseudo-anomaly tendency is formed. When the prior structural coincidence suppression coefficient is less than the first structural threshold and not less than the second structural threshold, a structural association anomaly candidate is formed. When the prior structural coincidence suppression coefficient is less than the second structural threshold, a non-structural pseudo-anomaly candidate is formed. Among them, the structural prior coincidence suppression coefficient is used as a negative suppression term in the subsequent surface defect discrimination.
6. The method for identifying and detecting surface defects in molds based on image matching according to claim 1, characterized in that, Obtain the mold coordinate anchoring stability coefficient, including: Map the suspected defective regions in at least one image in the image set to the same mold region coordinate system; The position anchoring deviation value is obtained based on the offset distance of the center position of the mapped suspected defective area; Based on the contour overlap ratio between the mapped suspected defective areas, the contour anchoring coincidence value is obtained; The area drift value is obtained based on the area change between the mapped suspected defective areas; The edge direction drift value is obtained based on the magnitude of change in the main edge direction between the mapped suspected defective areas; The mold coordinate anchoring stability coefficient is obtained based on the position anchoring deviation value, contour anchoring coincidence value, area drift value, and edge direction drift value. The mold coordinate anchoring stability coefficient is compared with the first anchoring threshold and the second anchoring threshold. When the mold coordinate anchoring stability coefficient is not less than the first anchoring threshold, a stage mark is formed indicating that the coordinate anchoring supports the real defect. When the mold coordinate anchoring stability coefficient is less than the first anchoring threshold and not less than the second anchoring threshold, a stage mark is formed indicating that the anchoring does not support the real defect.
7. The method for identifying and detecting surface defects in molds based on image matching according to claim 1, characterized in that, Obtain the surface defect discrimination index, and classify the suspected defect area into a true defect area, an abnormal area to be re-inspected, or a false abnormal area based on the surface defect discrimination index, including: The multi-light defect phase response index is used as the optical real response term, the mold coordinate anchoring stability coefficient is used as the physical position stability term, and the structural prior coincidence suppression coefficient is used as the normal structure suppression term to calculate the surface defect discrimination index. Among them, the phase response index of multi-light defects and the stability coefficient of mold coordinate anchoring are both positively correlated with the surface defect discrimination index, while the structure prior coincidence suppression coefficient is negatively correlated with the surface defect discrimination index. The surface defect discrimination index is compared with a first discrimination threshold and a second discrimination threshold. When the surface defect discrimination index is not less than the first discrimination threshold, the corresponding suspected defect area is determined as a real defect area. When the surface defect discrimination index is less than the first discrimination threshold but greater than the second discrimination threshold, the corresponding suspected defect area is determined as an abnormal area to be re-inspected. When the surface defect discrimination index is not greater than the second discrimination threshold, the corresponding suspected defect area is determined as a false abnormal area. For genuine defect areas, retain the location, area, length, width, boundary direction, and subordinate area; generate re-shoot, post-cleaning re-inspection, or manual verification marks for abnormal areas to be re-inspected; and record the source of false abnormalities for false abnormal areas.
8. The method for identifying and detecting surface defects in molds based on image matching according to claim 7, characterized in that, Obtain the defect type identification results, including: Establish a defect type library, which should include at least the following types: cracks, scratches, pits, boundary wear, hole and groove anomalies, gate and runner anomalies, joint misalignment, sliding contact wear, deep cavity contamination and corrosion, and shallow surface depressions. Extract morphological features, grayscale polarity features, positional features, and edge continuity features from real defect areas; The shape matching value is obtained based on the aspect ratio, area, roundness, and skeletal continuity of the actual defect area; The grayscale polarity matching value is obtained based on the brightness polarity of the actual defect area, the grayscale difference between the center and the periphery, the grayscale contrast of the area, and the texture roughness. The position matching value is obtained based on the lower region to which the actual defect area belongs, the distance from the boundary of the associated structure, and the angle with the process direction; Edge continuity matching values are obtained based on the edge direction fluctuation, edge interruption ratio, boundary missing ratio, and edge blunting degree of the actual defect area; The type matching score of the actual defect region relative to the candidate defect type is obtained based on the shape matching value, grayscale polarity matching value, position matching value, and edge continuity matching value. The maximum type matching score among all candidate defect types is compared with the third threshold. When the maximum type matching score is not less than the third threshold, the real defect area is identified as the defect type corresponding to the maximum type matching score. When the maximum type matching score is less than the third threshold, the real defect area is marked as an undefined defect and enters the review process.
9. The method for identifying and detecting surface defects in molds based on image matching according to claim 7, characterized in that, Obtain the quality inspection results of the mold to be tested, including: The regional risk weight is determined based on the subordinate region to which the actual defective area belongs. The severity value is obtained based on the area, length, width, and degree of boundary loss of the actual defective area; The surface quality risk value of the mold to be tested is obtained based on the regional risk weight, surface defect discrimination index and severity value. The surface quality risk value is compared with a first quality threshold and a second quality threshold. When the surface quality risk value is greater than the first quality threshold, the test result is output as unqualified. When the surface quality risk value is less than or equal to the first quality threshold and greater than the second quality threshold, the test result is output as requiring re-inspection or partial repair of the test mold. When the surface quality risk value is less than or equal to the second quality threshold, the test result is output as qualified. Defects include at least microcracks, thermal fatigue cracks, crazing, fine scratches, tears, pits, pits, indentations, dents, chipping, rounded edges, parting surface wear, cavity wear, core wear, ejector hole burrs, ejector hole enlargement, venting channel blockage, venting channel wear, gate erosion, gate defects, runner residue adhesion, runner carbon buildup, enlarged insert gaps, insert misalignment, uneven wear on slider contact surface, uneven wear on angled ejector contact surface, corrosion at the bottom of deep cavity, residual glue at the bottom of deep cavity, and shallow depressions in the curved transition area.
10. The method for identifying and detecting surface defects in molds based on image matching according to claim 1, characterized in that, Multiple lighting conditions include at least frontal lighting, left-slanted lighting, right-slanted lighting, and low-angle grazing lighting; Forward lighting is used to collect the overall grayscale changes of the cavity surface, core surface, parting surface, and curved transition area; Left and right oblique lighting are used to capture the edge shadow changes corresponding to fine scratches, scratches, dents, indentations, bumps, chipped edges, rounded edges, parting surface wear, insert misalignment, uneven wear of slider contact surface and uneven wear of oblique top contact surface; Low-angle grazing illumination is used to collect subtle surface undulations corresponding to microcracks, thermal fatigue cracks, crazing, shallow depressions, pitting, venting channel blockage, pin hole burrs, flow channel residual material adhesion, deep cavity bottom corrosion, and shallow depressions in curved transition areas. Under different lighting conditions, the template image and the image to be tested are matched according to the same lower region, so that the same suspected defect area is mapped to the same mold area coordinate system under different lighting conditions.