Intelligent detection method for surface defects of plastic parts

By controlling the adjustable directional light source and image registration technology, defect areas on the surface of plastic parts are identified and confirmed, solving the problem of detection instability caused by differences in image reflection in the existing technology, and achieving more accurate defect identification.

CN123028960APending Publication Date: 2026-11-03DONGGUAN BOLIKAI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611237301.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-14
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

In existing technologies, the surface images of plastic parts acquired under single illumination conditions do not reflect the differences in reflection in local areas. This results in discontinuous differences in the distribution of images in scenes with slight undulations or local reflection changes, making it difficult to stably distinguish the boundaries of abnormal areas and affecting the consistency of the discrimination results.

Method used

By controlling an adjustable directional light source to sequentially illuminate the detection area, surface images under multiple illumination states are acquired. An industrial camera is used for image registration and brightness change analysis to identify abnormal areas and generate defect candidate area information. The defect location is confirmed by combining the characteristics of brightness change stages, and the surface defect detection results of the plastic parts are generated.

Benefits of technology

It enables stable identification of surface defects in plastic parts, reduces the impact of local reflection differences on the discrimination process, and improves the continuity and consistency of detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123028960A_ABST
    Figure CN123028960A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of surface defect detection, in particular to a plastic part surface defect intelligent detection method, which controls light source irradiation and image acquisition in a preset order, determines corresponding positions based on contour registration, forms a brightness change sequence, generates surface reflection change information by associating positions, identifies abnormalities by comparing the brightness changes of adjacent positions, forms a candidate region by connection, forms a stage expression by merging the brightness changes, marks a conversion position, confirms a defect region by comparing the consistency of stages, generates a defect detection result by associating the detection positions and the region range, and the like. According to the application, a brightness response track is constructed by sequentially irradiating multi-direction light sources, cross-image correspondence is established based on unified contour positions, local abnormalities are separated by combining neighborhood change direction differences, brightness change stages are divided and switching positions are recorded, continuous abnormal regions are confirmed by verifying the consistency of stage sequences of adjacent positions, unified identification is realized in and out of the regions, and the influence of random fluctuations and local reflection differences on the judgment result is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of surface defect detection technology, and in particular to an intelligent detection method for surface defects in plastic parts. Background Technology

[0002] The field of surface defect detection technology encompasses machine vision-based industrial product appearance quality inspection, image acquisition and processing, defect feature analysis and discrimination, etc. It utilizes industrial cameras to acquire images of the surface of the object under test, and processes the image information through methods such as grayscale transformation, threshold segmentation, edge detection, morphological processing, and feature extraction. Based on features such as texture, shape, size, and brightness distribution, it identifies abnormal areas on the surface. It is widely used in the production and inspection of products such as plastic parts, metal parts, and electronic devices, involving light source arrangement, imaging mode selection, and image data processing flow, forming a complete technical system from image acquisition to defect discrimination.

[0003] Among them, the intelligent detection method for surface defects of plastic parts refers to the process of acquiring images of the surface of plastic parts for defects such as scratches, bubbles, dents, burrs and color differences, and then performing grayscale processing, filtering and noise reduction, binarization segmentation and edge extraction on the images. Based on parameters such as the area of ​​connected regions, contour shape and grayscale distribution, the defect regions are extracted and marked, and different types of defects are distinguished according to preset judgment rules. It involves specific technical matters such as image acquisition, image preprocessing, defect region segmentation and defect feature discrimination.

[0004] In existing technologies, when surface images are acquired under a single illumination condition and processed based on a fixed grayscale distribution, there is a lack of information to support the process of changes with illumination. This results in the failure to reflect the differences in reflection in different directions in local areas. In scenarios where there are slight undulations or local reflection changes on the surface, the image shows a discontinuous distribution of differences. For example, local depressions and normal areas may appear to have similar grayscale values ​​under a single illumination, making it difficult to distinguish them stably during the segmentation process. Subsequent discrimination based on contours or areas may result in mixed regions, causing unstable boundaries of abnormal regions and affecting the consistency of the overall discrimination results. Summary of the Invention

[0005] To address the technical problems existing in the prior art, this invention provides an intelligent detection method for surface defects in plastic parts. The technical solution is as follows:

[0006] A smart detection method for surface defects in plastic parts includes the following steps:

[0007] S1. Control the adjustable direction light source to illuminate the detection area and acquire images according to the preset sequence. Complete the registration with the outline of the plastic part, determine the corresponding image position of the same detection position, extract the brightness in sequence and form a change sequence, associate the position and the sequence, and generate surface reflection change information.

[0008] S2. Call the surface position reflection change description in the surface reflection change information, compare the brightness change of the target with that of the adjacent position, identify anomalies based on reverse change, local abrupt change or direction change, connect them according to spatial adjacency and determine the boundary, and generate defect candidate region information.

[0009] S3. Call the abnormal location distribution range in the defect candidate region information, read the brightness change sequence of the abnormal location in the same region, identify enhancement, weakening or stabilization, merge continuous similar changes, form a stage expression and mark the change of irradiation state, and generate abnormal response feature information.

[0010] S4. Read the brightness change stage expression and stage transition irradiation state of the abnormal response features in the abnormal response feature information, compare adjacent abnormal positions, and when the two are consistent and the transition positions are the same, confirm and connect the defect position, determine the area boundary, and generate defect confirmation area information.

[0011] S5. Call the defect confirmation location and defect confirmation area boundary in the defect confirmation area information, and the surface position reflection change description in the surface reflection change information, associate the detection location, area range and defect status, and generate the surface defect detection result of the plastic part.

[0012] As a further aspect of the present invention, the surface reflection change information includes multi-state reflection characteristics, surface optical response characteristics, and positional correlation characteristics; the defect candidate region information includes abnormal region range, candidate defect distribution characteristics, and region boundary characteristics; the abnormal response characteristic information includes brightness evolution pattern, stage change law, and state transition characteristics; the defect confirmation region information includes defect region range, defect continuous distribution characteristics, and region contour characteristics; and the plastic part surface defect detection result includes defect judgment category, defect spatial distribution information, and detection status information.

[0013] As a further aspect of the present invention, the step of obtaining the surface reflection change information is as follows:

[0014] S11: Collect surface images of plastic parts under multiple illumination states, control the adjustable direction light source to illuminate the detection area of ​​the plastic parts in sequence according to the preset light source change order, and use an industrial camera to collect surface images of the injection molded shell corresponding to each illumination state. Perform uniform grayscale processing on the images corresponding to each illumination state and extract the brightness distribution. Organize the brightness distribution of each image in sequence according to the light source change order, and establish the correspondence between the image sequence and the light source change order to generate an illumination brightness sequence.

[0015] S12: Based on the irradiation brightness sequence, using the outline edge of the plastic part as a position reference, perform outline alignment processing on the surface images of the injection molded shell corresponding to different irradiation states, match the outline positions in each image one by one and complete spatial adjustment, so that the outlines maintain a consistent position under each irradiation state, and reposition the images on the basis of the unified position, establish cross-image position correspondence, and obtain outline registration relationship.

[0016] S13: Based on the contour registration relationship, the positions of the images under each illumination state are unified, and the illumination brightness sequence is called to read the brightness performance of the corresponding image area under the unified position. The brightness changes of the same surface detection position under different illumination states are organized according to the light source order, and the surface detection position, the corresponding image position and the brightness change are associated to generate surface reflection change information.

[0017] As a further aspect of the present invention, the step of obtaining the defect candidate region information is as follows:

[0018] S21: Call the surface position reflection change description in the surface reflection change information, select the target position according to the position order, and synchronously read the brightness change sequence corresponding to the position and the spatially adjacent position. Compare the brightness change direction of each position in the same irradiation change process. When the target position and the adjacent position have inconsistent change direction or inconsistent change state in the same irradiation stage, mark the position to obtain an abnormal position set.

[0019] S22: Read the image position corresponding to each abnormal position according to the abnormal position set, and make an adjacency judgment on the abnormal positions according to the image coordinate arrangement relationship. Connect the abnormal positions with adjacent coordinates and continuous distribution to form a continuous distribution area. At the same time, identify the boundary between this area and the surrounding unmarked positions to obtain the boundary of the abnormal connected area.

[0020] S23: Based on the boundary of the abnormal connected region, the range of abnormal locations inside the boundary is limited, and the coverage of abnormal locations is identified as a whole in combination with the image location distribution relationship. Each abnormal location, the corresponding image location and the boundary range are uniformly associated to generate defect candidate region information.

[0021] As a further aspect of the present invention, the step of obtaining the abnormal response feature information is as follows:

[0022] S31: Call the abnormal location distribution range in the defect candidate region information, select the abnormal location within the same abnormal location distribution range, and read the corresponding brightness change sequence from the surface reflection change information according to the image position corresponding to the abnormal location. Compare the brightness of adjacent irradiation states before and after according to the order of light source change, divide the brightness change state of each irradiation stage into enhancement, weakening or stabilization, and organize the change state sequence in order to generate a brightness change sequence identifier.

[0023] S32: Based on the brightness change sequence identifier, the change states of each abnormal position during continuous illumination are merged, adjacent illumination intervals with the same change state are connected, and the merged intervals are arranged according to the order of light source change to form a sequential distribution of change stages. At the same time, the corresponding illumination positions where the change occurs between each change stage are recorded to obtain a change stage division set.

[0024] S33: Based on the set of change stages, read the change stage expression corresponding to each abnormal position, and combine it with the corresponding irradiation position for switching between stages to make a one-to-one correspondence between the change stage expression and the stage switching position, and form a complete response description for the same abnormal position to generate abnormal response feature information.

[0025] As a further aspect of the present invention, the step of obtaining the defect confirmation area information is as follows:

[0026] S41: Read the brightness change stage expression and stage transition illumination state of the abnormal response features in the abnormal response feature information, select adjacent abnormal positions along the light source change sequence, and perform segment-by-segment correspondence comparison of the brightness change stage expression of each position. At the same time, perform consistency check on the illumination positions corresponding to the stage transition illumination state, and mark the positions where the stage expression and the transition position simultaneously meet the consistency condition to generate a set of consistent response positions.

[0027] S42: Based on the consistent response location set, read the image coordinates corresponding to each location, and perform connection processing on adjacent locations according to the spatial arrangement of the images. Combine regions that are continuous and meet the consistency condition, and identify the boundary between the combined region and the surrounding unmarked locations to form a continuous distribution region boundary, thus obtaining the confirmed connected region boundary.

[0028] S43: Based on the confirmed connected region boundary, the range of the internal position of the boundary is limited, and the region coverage is uniformly identified by combining the image coordinate relationship. The confirmed positions are associated with the boundary range to generate defect confirmation region information.

[0029] As a further aspect of the present invention, the step of obtaining the surface defect detection results of the plastic part is as follows:

[0030] S51: Call the defect confirmation location and defect confirmation area boundary in the defect confirmation area information, and the surface position reflection change description in the surface reflection change information. Read the surface detection location in the order of location, and judge each surface detection location one by one according to the spatial range enclosed by the defect confirmation area boundary. Mark the location inside the boundary range to obtain the set of area coverage locations.

[0031] S52: Based on the corresponding comparison between the set of area coverage locations and the defect confirmation locations, perform state discrimination processing on each surface detection location. When the surface detection location corresponds to the defect confirmation location or is located in the middle of the coverage area, mark it as present. When the surface detection location does not fall into the coverage area, mark it as excluded. Organize the position marking status of each location in order of location to obtain a set of position status markings.

[0032] S53: Based on the set of location status markers, combined with the defect confirmation location and the defect confirmation area boundary, the detection locations of each surface are sequentially associated and organized, the location identifiers, area ranges and corresponding states are uniformly matched, and a complete distribution description is formed to generate the surface defect detection results of the plastic parts.

[0033] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:

[0034] In this invention, multiple light sources are applied sequentially to the same detection area to form a brightness response trajectory that changes with the irradiation sequence. A cross-image correspondence is established based on the unified position of the contour, so that the change process of each position has continuous correlation characteristics. By combining the differences in the change direction of adjacent spatial positions for comparison screening, local abnormal responses are separated from the overall changes. The brightness change process is then divided into stages and the stage switching positions are recorded, so that abnormal positions have stage sequence characteristics. The consistency of stage expression and switching position is checked between adjacent positions to form a continuously distributed confirmation area. The positions inside and outside the area are uniformly marked to reduce the impact of random fluctuations and local reflection differences on the discrimination process. Attached Figure Description

[0035] Figure 1 This is a flowchart of the method of the present invention;

[0036] Figure 2 This is a flowchart illustrating the process of obtaining surface reflection change information according to the present invention.

[0037] Figure 3 This is a flowchart illustrating the process of obtaining defect candidate region information in this invention.

[0038] Figure 4 This is a flowchart illustrating the process of obtaining abnormal response feature information according to the present invention.

[0039] Figure 5This is a flowchart illustrating the process of obtaining defect confirmation area information for this invention.

[0040] Figure 6 This is a flowchart illustrating the process of obtaining surface defect detection results for plastic parts according to the present invention. Detailed Implementation

[0041] The technical solution of the present invention will now be described with reference to the accompanying drawings.

[0042] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.

[0043] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.

[0044] Please see Figure 1 This invention provides a technical solution: an intelligent detection method for surface defects in plastic parts, comprising the following steps:

[0045] S1. Acquire surface images of plastic parts under multiple illumination states. Control the adjustable direction light source to illuminate the detection area of ​​the plastic parts sequentially according to the preset light source change sequence. Use an industrial camera to acquire surface images of the injection-molded shell corresponding to each illumination state. Use the outline of the plastic part as the position positioning reference. Perform position registration on the surface images of the injection-molded shell corresponding to different illumination states. Adjust the outline of the plastic part in different injection-molded shell surface images to the corresponding positions. Determine the corresponding image position of the same surface detection position in different injection-molded shell surface images. Read the brightness information of the corresponding image position sequentially according to the light source change sequence to form a brightness change sequence. Associate the surface detection position, the corresponding image position, and the brightness change sequence to form a surface position reflection change description and generate surface reflection change information.

[0046] S2. Call the surface position reflection change description in the surface reflection change information, select the target position according to the position order, and compare it with the brightness change sequence of the spatially adjacent positions. When the brightness change direction is opposite, the adjacent positions remain stable while the target position is enhanced or weakened, or the target position changes direction while the adjacent positions remain in the original direction during the same illumination change process, it is determined as an abnormal position. Read the image position corresponding to the abnormal position, connect the abnormal positions according to the spatial adjacency relationship between the corresponding image positions, form an abnormal position connected region, form the abnormal region boundary along the boundary position with the surrounding non-abnormal positions, limit the distribution range of abnormal positions, and generate defect candidate region information.

[0047] S3. Call the abnormal location distribution range in the defect candidate region information, select the abnormal location within the same abnormal location distribution range, and read the corresponding brightness change sequence from the surface position reflection change description in the surface reflection change information according to the image position corresponding to the abnormal location. Compare the brightness information of adjacent illumination states according to the order of light source change, identify brightness enhancement, weakening or stabilization, and group the illumination processes that maintain the same change relationship into brightness change stages. Arrange them according to the order of light source change to form a brightness change stage expression. When the previous brightness change stage transitions to the next brightness change stage, mark the starting illumination state of the next brightness change stage as the stage transition illumination state. Correspond the brightness change stage expression with the stage transition illumination state to form abnormal response features and generate abnormal response feature information.

[0048] S4. Read the brightness change stage expression and stage transition illumination state of the abnormal response features in the abnormal response feature information. Compare the brightness change stage expression of adjacent abnormal positions segment by segment along the light source change sequence, and check the illumination position corresponding to the stage transition illumination state. When the brightness change stage expression is consistent and the stage transition illumination state is located at the same illumination position, determine the adjacent abnormal positions as defect confirmation positions, connect them to form a defect confirmation connected region, determine the boundary of the defect confirmation region along the intersection of the defect confirmation connected region and the surrounding unconfirmed positions, and generate defect confirmation region information.

[0049] S5. Call the defect confirmation location and defect confirmation area boundary from the defect confirmation area information, and the surface position reflection change description from the surface reflection change information. Read the surface detection locations in the order of location, determine the surface area enclosed by the defect confirmation area boundary as the defect confirmation area range, and associate the surface detection location with the defect confirmation location and the defect confirmation area range. When the surface detection location coincides with the defect confirmation location or is within the defect confirmation area range, mark it as a defect existence state. When the surface detection location is outside the defect confirmation area range, mark it as a defect non-existence state. Associate the surface detection location, defect confirmation location, defect confirmation area range and corresponding defect status in the order of location to generate the surface defect detection results of the plastic part.

[0050] Surface reflection change information includes multi-state reflection characteristics, surface optical response characteristics, and location correlation characteristics; defect candidate region information includes abnormal region range, candidate defect distribution characteristics, and region boundary characteristics; abnormal response characteristic information includes brightness evolution pattern, stage change law, and state transition characteristics; defect confirmation region information includes defect region range, defect continuous distribution characteristics, and region contour characteristics; and plastic part surface defect detection results include defect judgment category, defect spatial distribution information, and detection status information.

[0051] Please see Figure 2 The steps for obtaining information on changes in surface reflection are as follows:

[0052] S11: Collect surface images of plastic parts under multiple illumination states, control the adjustable direction light source to illuminate the detection area of ​​the plastic parts in sequence according to the preset light source change order, and use an industrial camera to collect surface images of the injection molded shell corresponding to each illumination state. Perform uniform grayscale processing on the images corresponding to each illumination state and extract the brightness distribution. Organize the brightness distribution of each image in sequence according to the light source change order, and establish the correspondence between the image sequence and the light source change order to generate an illumination brightness sequence.

[0053] Based on multi-view feature data acquisition targets, an adjustable directional light source composed of four independent LED arrays is controlled. The first illumination state parameters are retrieved according to the first clock cycle preset by the controller using an FPGA high-speed timing control board. The incident angle of the light source is set to 45 degrees and the azimuth angle to 0 degrees, with an output current of 500 mA. A CMOS gigabit network industrial camera supporting the GigEVision protocol (e.g., equipped with a Sony IMX250 sensor) is used with HALCON image acquisition interface technology to perform the first exposure acquisition, obtaining a first-view image of the injection-molded shell surface with a pixel resolution of 2448 pixels horizontally and 2048 pixels vertically. The second to fourth illumination state parameters are retrieved, and the azimuth angle is adjusted sequentially to 90 degrees, 180 degrees, and 270 degrees. The acquisition and exposure actions of the gigabit network industrial camera are executed cyclically, acquiring a cumulative four-frame image feature matrix. OpenCV color processing is then used. Spatial reading technology extracts the red, green, and blue color values ​​of each specific pixel within a four-frame matrix. The extracted color values ​​of the center pixel are 125, 128, and 132 respectively. The brightness conversion weight constants for the red channel are set to 0.299, for the green channel to 0.587, and for the blue channel to 0.114. These weight constants (0.299, 0.587, and 0.114) were determined through a general color space conversion experiment. They were calculated by reading the grayscale gradient extrema of 1000 sets of standard color correction board images using an illuminance meter and color calibrator. The red, green, and blue channel color values ​​are then multiplied and added to their corresponding weight constants. The formula is: 125 × 0.299 + 128 × 0.587 + 132 × 0.114 = 37.375 + 75.136 + 15.048 = 127.The value 559, after rounding, yields a uniform grayscale value of 128 for the center pixel. For each pixel within a 2448-pixel horizontal and 2048-pixel vertical area, the aforementioned multiplication and addition operations are performed sequentially to construct a uniform grayscale two-dimensional matrix corresponding to the four frames. The grayscale values ​​of each coordinate point within this matrix are read, and the quantization interval is set to a minimum of 0 and a maximum of 255 (in grayscale levels). All grayscale values ​​are filtered and stored according to the extreme values ​​of the quantization interval. A timeline index table is generated according to the light angle changes of 0 degrees, 90 degrees, 180 degrees, and 270 degrees. The uniform grayscale two-dimensional matrix corresponding to each angle is then mounted and stored in the timeline index table. In the corresponding time node memory address, the timestamp system parameters associated with each frame image are extracted. These parameters are compared with the trigger delay time parameters output by the light source controller. The absolute time difference between the two is calculated, and it is determined whether this absolute time difference is less than a baseline value of 5 milliseconds. This baseline value of 5 milliseconds was obtained through 100 shutter trigger delay experiments on the hardware system. The maximum value of 4.2 milliseconds from all delay time data was read and rounded up to establish 5 milliseconds. The matched unified grayscale two-dimensional matrices with absolute time differences less than this baseline value of 5 milliseconds are subjected to binary packing and merging calculation. Based on the time axis index table, a memory mapping pointer relationship is established between the matrix data blocks and the light source illumination angle parameters to generate an illumination brightness sequence.

[0054] S12: Based on the illumination brightness sequence, using the outline edge of the plastic part as a position reference, perform outline alignment processing on the surface images of the injection molded shell corresponding to different illumination states, match the outline positions in each image one by one and complete spatial adjustment, so that the outlines maintain a consistent position under each illumination state, and reposition the images on the basis of the unified position, establish cross-image position correspondence, and obtain the outline registration relationship.

[0055] Extract the aforementioned associated illumination brightness sequence matrix block, read the unified grayscale two-dimensional matrix corresponding to the 0-degree azimuth angle of the first frame, and perform two-dimensional spatial convolution operation on the pixel grayscale values ​​along the horizontal and vertical axes of this grayscale two-dimensional matrix using existing technologies such as the Canny edge detection operator or the Sobel operator kernel matrix technique. Extract the set of pixel coordinates whose grayscale gradient values ​​within the convolution result matrix are greater than the reference value of 45 and mark them as the initial selection of contour edge points. The aforementioned reference value of 45 was determined by the contour regions of 500 qualified injection molded part samples extracted in the previous stage, and its average grayscale difference was calculated to be 42.3. Overlay the set range The value is rounded down to 45 after a 5% tolerance. This set of edge point coordinates is selected as the spatial reference base array. The image matrices corresponding to the remaining 90°, 180°, and 270° azimuth angles are extracted, and coordinate system alignment is performed. The edge coordinate set extracted from the second frame image matrix is ​​read. The geometric translation deviation parameters between the centroid coordinates of the second frame set and the first frame's centroid coordinates in the horizontal and vertical axes are calculated using the centroid moment calculation function of the OpenCV library. The first frame's centroid horizontal coordinate is read as 1224 and its vertical coordinate as 102. 4. Read the centroid of the second frame: horizontal coordinate 1228 and vertical coordinate 1021. Perform subtraction on the corresponding coordinates to obtain a horizontal translation of 1224 - 1228 = -4 pixels and a vertical translation of 1024 - 1021 = 3 pixels. Extract all pixel coordinates within the second frame image and perform linear addition and subtraction algebraic operations with these translation values. Calculate the spatial rotation angle deviation parameter between the major axis direction vector of the second frame edge and the major axis direction vector of the first frame edge. Read the rotation angle deviation parameter value as 0.5 degrees. Construct a two-dimensional spatial rotation affine transformation matrix. After performing translation operations on the frame, the set of all pixel coordinates is multiplied by the affine transformation matrix in the two-dimensional space. This makes the overlap ratio of the contour pixel coordinates of the second frame image with the reference base array of the first frame reach a threshold of 98%. The edge coordinate sets of the third and fourth frame image matrices are extracted in a loop. The translation deviation parameter calculation and the dot product operation with the affine transformation matrix are repeated. The spatial distribution position parameters of the pixels in each frame image after coordinate system alignment are extracted. The overlapping positions of the corresponding pixel coordinates of the four frames are uniformly marked on the shared absolute coordinate system base map to obtain the contour registration relationship.

[0056] S13: Based on the contour registration relationship, the positions of the images under each illumination state are unified, and the illumination brightness sequence is called to read the brightness performance of the corresponding image area under the unified position. The brightness changes of the same surface detection position under different illumination states are organized according to the light source order, and the surface detection position, the corresponding image position and the brightness change are associated to generate surface reflection change information.

[0057] Retrieve the absolute coordinate system contour registration relationship data record obtained from the aforementioned steps, read the unified spatial position coordinate mapping table after performing coordinate affine algebra transformation on each frame, extract the coordinates of the current specified surface detection site under the absolute coordinate system base map, read the horizontal coordinate of the extracted site as 1500 and the vertical coordinate as 800, retrieve the two-dimensional array record of grayscale values ​​of four frames of images encapsulated and stored in the illumination brightness sequence, extract the grayscale value of the current specified surface detection site within the corresponding 0-degree azimuth angle image matrix as 135, and extract the grayscale value of the site within the corresponding 90-degree azimuth angle image matrix. The grayscale value within the image matrix is ​​110. The grayscale value extracted for this location within the image matrix at the corresponding 180-degree azimuth angle is 85, and the grayscale value extracted for this location within the image matrix at the corresponding 270-degree azimuth angle is 140. These four discrete grayscale values ​​are then sequentially filled into a pre-allocated one-dimensional floating-point array according to the time sequence of the associated illumination parameters at 0 degrees, 90 degrees, 180 degrees, and 270 degrees. The complete dataset within this one-dimensional floating-point array represents the light intensity characteristic change at a specific spatial location, which is relevant to the detection target. The extraction and array writing operations are performed iteratively on all two million consecutive pixel coordinate nodes within the surface region. The brightness evolution array with four floating-point data corresponding to all specific pixel coordinate nodes is recorded. A two-dimensional mapping structured form record is constructed to record this data mounting and binding architecture. The horizontal and vertical spatial coordinate parameters of the current specified surface detection site are serialized and encoded. Using existing displacement splicing and hexadecimal ASCII code formatted output technology, they are converted into a dedicated hexadecimal string lookup index. The horizontal coordinate 1500 and the vertical coordinate 800 are extracted and converted into the hexadecimal string 0x05DC0320 (horizontal coordinate 1500 corresponds to hexadecimal 05DC, vertical coordinate 800 corresponds to 0320, and the two are seamlessly spliced ​​and combined). The corresponding four grayscale values ​​135, 110, 85 and 140 are binary forcibly converted and mounted in the stack memory register space pointed to by the hexadecimal string lookup index. The node hash mapping association calculation of the overall target surface pixel map is completed. The contents of the structured form mapping dataset bound to the memory region are summarized to generate surface reflection change information.

[0058] Please see Figure 3 The steps for obtaining defect candidate region information are as follows:

[0059] S21: Call the surface position reflection change description in the surface reflection change information, select the target position according to the position order, and synchronously read the brightness change sequence corresponding to the position and the spatially adjacent position. Compare the brightness change direction of each position in the same irradiation change process. When the target position and the adjacent position have inconsistent change direction or inconsistent change state in the same irradiation stage, mark the position to obtain the abnormal position set.

[0060] Access the surface position reflection change description dataset from the surface reflection change information recorded in the aforementioned database. Set the iteration coordinate movement step size parameter to 1 pixel span unit. Within the absolute two-dimensional image coordinate system space, select a pixel with a horizontal coordinate value of 100 and a vertical coordinate value of 200 along the positive directions of the horizontal and vertical axes and set it as the first target analysis node. Read the four grayscale value groups bound in the one-dimensional floating-point data array of the first target analysis node and extract them as 135, 110, 85, and 140. According to the preset iteration step size parameter, extract the adjacent comparison node in the horizontal orthogonal direction of the first target analysis node, that is, the horizontal coordinate 101 and the vertical coordinate 200. Read the one-dimensional floating-point data of the adjacent comparison node. The four grayscale value groups extracted from the array are 134, 111, 84, and 139. For the time-series data within these two grayscale value groups, pairwise subtraction is performed to calculate the difference. The brightness difference between adjacent time-series data of the target analysis node (value 110 minus 135) is 110 - 135 = -25. The brightness difference between adjacent comparison nodes (value 111 minus 134) is 111 - 134 = -23. Comparing the sign of the two brightness difference calculation results, since both are negative and less than 0, the decreasing direction of the values ​​in the first time-series stages is determined to be consistent. The brightness difference for the second time-series stage of the target analysis node is calculated to be 8. 5-110=-25, the brightness difference value of the adjacent comparison nodes in the second time stage is calculated as 84-111=-27. It is determined that the features are both negative, indicating that the weakening direction is consistent. The brightness difference value of the target analysis node in the third time stage is calculated as 140-85=55. The brightness difference value of the adjacent comparison nodes in the third time stage is calculated as 139-84=55. It is determined that the features are both positive, indicating that the enhancement direction is consistent. The second target analysis node with horizontal coordinate 300 and vertical coordinate 400 is selected, and its gray value groups 180, 170, 150, and 160 are read. The gray value groups 180, 150, 160, and 170 of the adjacent comparison nodes are extracted, and the difference value of the second target analysis node in the second time stage is calculated. The value is 150-170=-20. The difference between adjacent comparison nodes in the second time-series stage is calculated as 160-150=10. Comparing the sign bits of the differences, one is negative and the other positive, and the product is less than 0. This indicates a difference in the direction of change between the two values ​​in the second illumination stage. When the direction of brightness change at different locations is inconsistent during the same illumination process, it indicates a sudden change in reflectivity at that spatial coordinate. This is usually revealed as abnormal scattering caused by the edges of three-dimensional morphological defects such as scratches or pits on the physical surface. These need to be marked and extracted as suspected defect points. In addition to the sign bit NOT gate logic determination, the absolute value parameter of the above difference is extracted simultaneously and subtracted. The result of the absolute value subtraction is -20-10=10.The system determines whether the result of the absolute value subtraction (10) is greater than the preset baseline deviation value (15). (In this case, the result is no, indicating no high deviation in another dimension, but the marking condition is met due to the directional anomaly.) The preset baseline deviation value (15) is calculated by extracting the maximum grayscale fluctuation variance limit value (12.6) from 100 standard flat sample measurement data. This limit value (12.6) is then multiplied by an additional 20% increment and rounded to obtain 15. For spatial node coordinate data where a state difference is determined or the result of the absolute value subtraction is greater than the preset baseline deviation value (15), a binary flip flag operation is performed. The horizontal and vertical coordinates of the nodes with the attached flags are pushed into a dedicated anomaly detection stack, resulting in a set of anomaly locations.

[0061] S22: Read the image position corresponding to each abnormal position according to the abnormal position set, and make an adjacency judgment on the abnormal positions according to the image coordinate arrangement relationship. Connect the abnormal positions with adjacent coordinates and continuous distribution to form a continuous distribution area. At the same time, identify the boundary between this area and the surrounding unmarked positions to obtain the boundary of the abnormal connected area.

[0062] Retrieve the dataset of all the horizontal and vertical coordinate records of the attached identifiable status nodes pushed into the aforementioned anomaly detection stack. Pop the node coordinate pairs from the stack sequence in a loop. Extract the horizontal coordinate value of the first anomaly node (300) and the vertical coordinate value of the second anomaly node (301) and the vertical coordinate value of the second anomaly node (400). Perform the absolute difference operation on the two sets of horizontal coordinate values ​​to obtain the horizontal result data value 300-301=1. Perform the absolute difference operation on the two sets of vertical coordinate values ​​to obtain the vertical result data value 400-400=0. Determine whether the horizontal and vertical result data are less than or equal to the pre-defined topological adjacency connectivity threshold value 1. This topological adjacency connectivity threshold value 1 represents the span distance of the core single pixel in the eight directions of the spatial grid. Since the determination result satisfies the condition that both the horizontal and vertical absolute values ​​are less than or equal to the threshold value 1, merge and record these two anomaly nodes into the newly created first connected domain tracking record queue memory area.

[0063] Table 1: Calculation table of coordinate distances for abnormal connected points;

[0064]

[0065] As shown in Table 1, the absolute distance subtraction calculation and threshold data comparison operation are performed on all coordinate records extracted from the stack table sequence. The coordinates of nodes that meet the adjacent connected distance limit are iteratively pushed into the connected domain tracking record queue. Isolated coordinates whose calculation results are all greater than the threshold value of 1 are removed from the valid queue. Several sets of one-dimensional data columns storing connected cluster coordinates are generated. For the first connected domain tracking record queue containing fifty nodes, the set of node envelope coordinates in the outermost position of the queue coordinate cluster is extracted. For the set of envelope coordinates, a set of blank background coordinates with a distance of 1 pixel in the four extension directions of up, down, left and right is selected, which are not recorded in the anomaly detection stack table. Based on the spatial trend of the blank background coordinate set, the vector closed loop line segment parameters are extracted. For the extracted closed loop line segment parameters, the dilate function of the OpenCV image processing library in the prior art is called to perform morphological dilation convolution mathematical operation based on a 3x3 matrix of structuring elements composed of all 1 values. This causes the closed loop line segment to expand outward by 1 coordinate unit distance value, generating the boundary of the abnormal connected region.

[0066] S23: Based on the boundary of the abnormal connected region, the range of abnormal locations inside the boundary is limited, and the coverage of abnormal locations is identified as a whole by combining the image location distribution relationship. Each abnormal location, the corresponding image location and the boundary range are uniformly associated to generate defect candidate region information.

[0067] The data of the closed loop segment of the boundary vector of the abnormal connected region generated by the aforementioned dilated convolution mathematical operation is analyzed. The horizontal and vertical coordinate values ​​of all edge vertices associated with the loop segment are extracted. The minimum horizontal coordinate value of 250 and the maximum horizontal coordinate value of 350 are compared and extracted. Similarly, the minimum vertical coordinate value of 350 and the maximum vertical coordinate value of 450 are compared and extracted. Using these four sets of extreme values, the minimum orthogonal bounding rectangle of the boundary is constructed as the measurement range envelope. Within the envelope, starting from the maximum vertical coordinate value of 350, a horizontal cutoff line for the test scan is generated by traversing downwards with a step size of 1 pixel. The current traversal step is read. The ordinate parameter of the long horizontal cross-section is used to extract the geometric intersection coordinates of the horizontal cross-section and the loop segment using ray casting and scan-line polygon fill techniques. The horizontal cross-section with a ordinate of 400 is extracted, and the horizontal coordinates of the two intersection points with the loop segment are calculated to be 280 and 320. The horizontal coordinate values ​​280 and 320 are then sorted by size, and all integer coordinates within the entire horizontal interval between the two intersection points (between 280 and 320) are highlighted. The system assigns a binary anomaly mask attribute flag, reads the number of intersection points obtained when the scan horizontal cutoff line coincides with the loop line segment, and determines the parity feature of the number. The parity correction constant baseline value parameter is set to 2. When the number of intersection points is odd (e.g., 3), the horizontal difference between these three intersection points is extracted. This parity correction represents the solution to the boundary misjudgment and penetration problem caused when the scan line intersects exactly at a polygon vertex. Two adjacent overlapping intersection points with a horizontal difference result less than 0.01 pixels are merged and reduced to a single data point in the array to correct the parity determination and restore it to an even number baseline value. A new system memory is created. A zero-based two-dimensional base map data matrix with 2448 horizontal pixels and 2048 vertical pixels is used to store all coordinate points with mask attribute flags within the range of 280 to 320. The values ​​of these points are modified from 0 to 255 in the horizontal and vertical addressing space corresponding to this zero-based two-dimensional base map data matrix, thus completing the format transfer and conversion operation from vector boundary parameters to two-dimensional raster placeholder map data. The coordinate point indices of all points within the zero-based two-dimensional base map data matrix that have been modified to 255, along with the associated first connected component label numbers, are packaged into the final output feature container table to generate defect candidate region information.

[0068] Please see Figure 4 The steps for obtaining abnormal response feature information are as follows:

[0069] S31: Call the abnormal location distribution range in the defect candidate area information, select the abnormal location within the same abnormal location distribution range, and read the corresponding brightness change sequence from the surface reflection change information according to the image position corresponding to the abnormal location. Compare the brightness of adjacent irradiation states before and after according to the order of light source change, divide the brightness change state of each irradiation stage into enhancement, weakening or stabilization, and organize the change state sequence in order to generate brightness change sequence identifier.

[0070] The system retrieves the defect candidate region mask base map data matrix with attached label numbers and highlighted status indicators stored within the aforementioned output feature container table. It extracts all internal coordinate points within the base map data matrix with a value of 255 and associated with the label number of the first connected component as the analysis object. The system reads the horizontal coordinate value of the first selected anomaly object (290 and 410). Based on the time sequence of actions triggered by four light sources (0°, 90°, 180°, and 270°), it uses directional addressing and backtracking to access the hexadecimal string query index register to retrieve the one-dimensional floating-point array of the coordinate. The system then reads and extracts the four physical grayscale values ​​as 160. And 150, 130, and 132 (parameters have been checked and corrected to synchronize with subsequent concatenated segments), extract the adjacent first state stage value 160 and second state stage value 150, perform subtraction on values ​​150 and 160 to obtain the numerical difference 150-160=-10, extract the second state stage value 150 and third state stage value 130, perform subtraction on values ​​130-150=-20, extract the third state stage value 130 and fourth state stage value 132, perform subtraction on values ​​132-130=2, set grayscale change stabilization feature. The threshold range for the evaluation is defined as a range from a lower bound of -5 to an upper bound of +5. This threshold range is determined by reading and analyzing the grayscale discrete range records of dark field noise from the image sensor. Fifty frames of black image data under standard shading conditions are retrieved, and pixel range samples are extracted using existing sensor noise floor evaluation standards. The maximum upper limit of the range within the confidence range distribution area, measured at 5, is set as the upper and lower extreme values ​​of the threshold range. The first numerical difference result, -10, is extracted and compared with the threshold range. If the result is less than the lower bound of -5, the first time interval from 0 to 90 degrees is assigned the attribute name "reduction attribute". The string label identifier is used to extract the second numerical difference result -20 and perform a comparison judgment. If the judgment result is also less than the lower limit value of -5, then the next time series interval from 90 degrees to 180 degrees is assigned a string label identifier named weakening attribute. The third numerical difference result 2 is extracted and compared judgment. If the judgment result is within the range of -5 to +5, then the last time series interval from 180 degrees to 270 degrees is assigned a string label identifier named stable attribute. These three time series-related string labels (i.e. weakening, weakening, and stable) are connected in sequence and written into the corresponding coordinate register unit space record set to generate brightness change sequence identifier.

[0071] S32: Based on the brightness change sequence identifier, the change state of each abnormal position during continuous illumination is merged, adjacent illumination intervals with the same change state are connected, and the merged intervals are arranged according to the order of light source change to form a sequential distribution of change stages. At the same time, the corresponding illumination positions of the switching between each change stage are recorded to obtain the change stage division set.

[0072] Access the brightness change string sequence identifier data corresponding to each coordinate in the aforementioned record set written to the register unit space. Set up an adjacent character matching and deduplication merging mechanism and start the sequence verification process. This merging mechanism uses a sliding window state machine algorithm based on linked list traversal for matching. Read the extracted first coordinate identifier data and extract the characters in the order of weakening, weakening, and stable. Extract the attribute string at the first time period sequence position, which is weakening, and push it into the memory space at the head position of the newly created temporary merge linked list. Extract the attribute string at the second time period sequence position, which is weakening. Perform a text equality matching comparison between this second time period string and the string stored in the memory space at the head position of the temporary merge linked list. If the text encoding is determined to be equal, the second time period string is directly discarded and not added to the linked list. Update and extend the upper limit of the span coverage parameter of the node at the head position of the temporary merge linked list to cover the light source angle value of 180 degrees corresponding to the second time period. Extract the attribute string at the third time period sequence position, which is stable. Perform a text equality matching comparison between this and the valid string weakening at the tail of the current temporary merge linked list. If the result is not equal, then... Expand the temporary merged linked list to create a new data node, and write a stable attribute string into the memory area of ​​the new data node. After performing all judgment operations, the original three independent time periods are compressed and merged into two groups of segments. The first segment records a range parameter of 0 degrees to 180 degrees and a state parameter of weakening. The second segment records a range parameter of 180 degrees to 270 degrees and a state parameter of stable. Simultaneously extract the lower limit light source angle of the time period sequence associated with the node replacement and creation in the merged linked list as the jump switching angle parameter. Extract the angle value of 180 degrees that caused the creation of the new data node in this example and mark it as the corresponding time period. For the segment switching node feature position, the second coordinate identifier data is extracted and arranged as weakening, strengthening and stabilizing. When performing text equal matching, the judgment result is false. Then, each independent state is retained and the corresponding switching node feature position value is extracted as 90 degrees and 180 degrees. The merging mechanism operation and parameter recording are performed on all abnormal coordinates in the data matrix that have been modified to 255. The continuous state interval boundary angle parameters and span parameters generated by the merging operation, together with the jump switching angle parameters, are output and arranged into a row and column relationship comparison database table file to obtain the change stage division set.

[0073] S33: Based on the set of change stages, read the change stage expression corresponding to each abnormal location, and combine it with the corresponding irradiation position between each stage to make an association and organize it. Make the change stage expression correspond one-to-one with the stage switching position, and form a complete response description for the same abnormal location to generate abnormal response feature information.

[0074] Extract the stage division set parameter information of each record row node loaded in the aforementioned row-column relation database table file. Perform reorganization and structured feature encapsulation algorithms on the row and column data in the table. Extract the comprehensive change stage span parameter of the first row of the database associated coordinate system node, i.e., horizontal 290 and vertical 410. Extract the interval start value 0 and interval end value 180 of the record, as well as the corresponding weakened state indicator text character. Extract the jump switching node angle parameter value of the synchronously recorded coordinate node, i.e., 180. Construct a multi-level key-value pair mapping feature description document memory model. Set the extracted coordinate system node string content, such as the text 290 hyphen 410, as the unique root-level key name index item in the feature description document. Under the node branch of this root-level key name index item, create the first secondary dictionary object named continuous stage distribution spectrum. Assign the start value 0, the interval end value 180, and the corresponding weakened state indicator as triple values ​​and mount them in the secondary dictionary object space. Under the same root-level key name index item, create a second secondary dictionary object named trigger transition position parameter set. Read the extracted angle The parameter value 180 is assigned to the memory space of this second secondary dictionary object. A data noise reduction, filtering, and cleaning process is executed. The interval end value stored in the secondary dictionary object is extracted, and the interval start value is subtracted to obtain the absolute difference of the interval angle span: 180 - 0 = 180. It is then determined whether this absolute difference of 180 is less than the baseline tolerance lower limit of 45 degrees (here, the determination is no, it is not less than). Since the light source shift interval is set to an absolute value of 90, any abnormal jumps less than half the shift interval are directly identified as... The unstable acquisition noise of optoelectronic devices means that false defects caused by hardware thermal noise or high-frequency light intensity fluctuations need to be filtered out. When the absolute difference is less than 45, the data pointer is directly called to clear and erase the root-level key name index item along with all internal secondary dictionary object data. All real physical feature record branches with absolute difference greater than or equal to the lower limit of the benchmark tolerance are retained. The root-level key name index item datasets that have not been cleared in all memory models are integrated into a persistent record file block of a single text stream to generate abnormal response feature information.

[0075] Please see Figure 5 The steps for obtaining defect confirmation area information are as follows:

[0076] S41: Read the brightness change stage expression and stage transition illumination state of the abnormal response features in the abnormal response feature information, select adjacent abnormal positions along the light source change sequence, and compare the brightness change stage expression of each position segment by segment. At the same time, check the consistency of the illumination position corresponding to the stage transition illumination state, mark the positions where the stage expression and the transition position simultaneously meet the consistency condition, and generate a set of consistent response positions.

[0077] The function calls the previously encapsulated feature description single text stream persistent record file block, parses the internal tree data structure, reads the first root-level key-name associated feature dictionary to extract the first anomaly detection node parameter with horizontal coordinate value 290 and vertical coordinate value 410, extracts the second root-level key-name associated feature dictionary to extract the adjacent second anomaly detection node parameter with horizontal coordinate value 291 and vertical coordinate value 410, accesses the first secondary dictionary of the first anomaly detection node to extract weakened attribute text characters within the value range of 0 to 180, accesses the first secondary dictionary of the second anomaly detection node to extract weakened attribute text characters within the value range of 0 to 180, performs a complete match string judgment operation on these two sets of extracted attribute text characters, and outputs a logical true match result to confirm that both have similar gray-scale decreasing characteristics within the same physical observation angle range. Then, it accesses the second secondary dictionary of the first anomaly detection node to extract the trigger change angle value set to 180, accesses the second secondary dictionary of the second anomaly detection node to extract the trigger change angle value set to 180, and so on. The angle value is also set to 180. The difference is calculated by subtracting the difference between the two sets of extracted angle values. The difference is 180-180=0. It is determined whether the absolute value of the difference is less than or equal to the preset conversion deviation control constant threshold of 0. Since the actual multi-directional light source projection only has four hard gear switching and no intermediate smoothness, the consistency of the timing of the change of light reflection characteristics at the two physical positions must be required to be without any deviation. The preset conversion deviation control constant threshold is set to an absolute value of 0. If the comparison result is less than or equal to the threshold value of 0, the two conditions are considered to be consistent. The first and second abnormal node coordinate groups that meet the string matching and deviation judgment are assigned a highlight association determination code with a value of 2. The string matching operation and the angle subtraction difference comparison judgment operation are performed on each pair of adjacent node coordinates in the remaining text stream. The coordinate system node position parameters assigned to the highlight association determination code with a value of 2 are summarized into a spatial point cloud parameter table, and a consistent response position set is generated.

[0078] S42: Based on the consistent response location set, read the image coordinates corresponding to each location, and perform connection processing on adjacent locations according to the spatial arrangement of the image. Combine regions that are continuous and meet the consistency condition, and identify the boundary between the combined region and the surrounding unmarked locations to form the boundary of the continuously distributed region, thus obtaining the confirmed connected region boundary.

[0079] The coordinate system point cloud data set with highlighted association determination codes generated from the aforementioned parameter table is analyzed, and video memory resources are reallocated to create a set of horizontally sized pixels. And vertical pixels A clean array of zero-grayscale mask layers is used to extract the horizontal coordinates of the first node from the point cloud dataset. and vertical coordinate values Retrieve the original value of the corresponding memory address within the mask layer matrix. Overwrite to numerical value The white pixel color block identifiers are used to perform the same overwrite transformation calculation on the coordinates of all remaining point cloud data until the mask layer presents a discrete white pixel distribution group. Then, the existing density-based clustering-based DBSCAN algorithm is invoked.

[0080] The (Density-Based Spatial Clustering of Applications with Noise) spatial distance aggregation classification algorithm performs a merging operation on this discrete distribution population. It extracts the horizontal and vertical coordinates of any two white-field color blocks in the mask layer and substitutes them into the Euclidean distance square and square root algebraic expression to obtain the spatial straight-line distance parameter. The distance calculation formula is the square root of the sum of the squares of the differences between the coordinates of the two points. ,

[0081] Table 2: Pixel Distance and Connectivity Classification Data Table

[0082]

[0083] Table 2 lists the specific values ​​of the algebraic calculation of some color block distances and the constant of the fixed clustering distance upper limit control parameter. The logical relationship of numerical comparison, such as operations The upper limit control parameter constant Based on laboratory measurements of the gap width of real physical damage fracture points and conversion of pixel dimensions, the calculated spatial straight-line distance parameter is determined to be less than or equal to... The color block coordinate groups are forcibly combined and bound to the same tracking index identifier code, such as the first independent community. After the white field color blocks of the whole image are divided into communities, the first-order differential edge operator kernel of mathematical morphology is called. The outer contour of the first independent community with the same tracking index identifier code is filtered and the partial derivative operation is performed. The pixel spatial coordinate data of the gradient change zero crossing point are extracted and combined to construct a continuous perimeter loop. The coordinates of all the inflection points of the continuous perimeter loop are called to perform polynomial spline parameterized curve approximation fitting mathematical operation calculation using the existing technology of B-spline curve fitting. The original inflection point peaks are smoothed so that the loop has a differentiable tangent feature parameter set, and the boundary of the confirmed connected region is obtained.

[0084] S43: Based on the confirmed connected region boundary, the range of the internal location of the boundary is limited, and the region coverage is uniformly identified by combining the image coordinate relationship. The confirmed locations are associated with the boundary range to generate defect confirmation region information.

[0085] Loading the continuous perimeter tangent equation and inflection point coordinate parameter set generated by the aforementioned polynomial spline parameterized curve approximation mathematical operation, the ray penetration verification core algorithm based on polygon region attributes in computer graphics is called to test and determine the subordinate logical correspondence between all pixels in the target plane of the image and the internal range of the curve. The absolute negative polar coordinates outside the spatial target are determined as the test emission source position. A single test image node is extracted from the two-dimensional spatial global image. This node is set to have specific horizontal and vertical values. The solution set of the binary simultaneous equations formed by the test ray equation connecting the test emission source position and the test image node and the above perimeter tangent parameter equations is calculated and solved. The parity mathematical characteristic value of the total number of real intersections output by the simultaneous solution set is determined. If the total number of real intersections is odd, the spatial coordinates of the test image node are directly attached and added to the solid filling of the current detection target, i.e., the first independent community. Inside the node array register, the aforementioned simultaneous solution of ray equations and the parity judgment of the total number of real intersection points are executed for all two-dimensional pixel position coordinates within the target area. To ensure that the output architecture has a high degree of standardization to facilitate storage, flow, and interactive processing, existing JSON or XML data serialization technology is used to call memory to establish a standard hypertext extensible structured storage node object. Inside the object, a top-level directory node named with the tracking index identifier of each independent community is created. The first branch path below this directory node stores the coordinate parameter system of all the substantial defect accounting confirmation mounted inside the node array register. The second branch path below this directory node stores the edge range description data parameter group, such as the control vertex of the perimeter ring tangent and the coefficient term of the cubic smooth polynomial. This completes the task of merging and assembling all the scattered node data into a unified specification file stream, generating defect confirmation area information.

[0086] Please see Figure 6 The steps for obtaining the surface defect detection results of plastic parts are as follows:

[0087] S51: Call the defect confirmation location and defect confirmation area boundary in the defect confirmation area information, and the surface position reflection change description in the surface reflection change information. Read the surface detection location in the order of location, and judge each surface detection location one by one according to the spatial range enclosed by the defect confirmation area boundary. Mark the location within the range enclosed by the boundary to obtain the set of area coverage locations.

[0088] The process involves parsing and accessing a hypertext-based, extensible, structured storage node object file containing assembled data to read information. It retrieves the calculated and confirmed coordinate parameter system data for all independent communities stored within the file, as well as the perimeter ring edge range description data parameter group feature information. Simultaneously, it establishes a query connection with the node hash mapping association information database of the specific pixel map constructed in the front-end process. It extracts the spatial array data table of all two-dimensional planar spatial horizontal and vertical surface detection position nodes contained within the connected database, performs a node-by-node iterative traversal check and spatial range logical judgment verification operation, and sets the horizontal anti-shake deviation protection boundary value to be equal to the horizontal coordinate of the community's far left control node minus... The upper limit value for lateral anti-shake deviation protection is set equal to the x-coordinate of the control node at the far right of the community plus... The deviation protection constant value here The calibration is based on the millimeter-level pixel drift displacement caused by the vibration of the conveyor belt in the automated production line. For the coordinates of a single surface detection site extracted in the current loop, the horizontal and vertical coordinate position data are read and it is determined whether the value falls within the floating frame of the aforementioned anti-vibration deviation protection upper and lower limit control range. For the detection sites that fall within the floating frame and are deemed to have passed, the right-hand rule calculation technique of vector cross product in the existing technology is used to adjust the algebraic determinant sign detection method to perform cross product determinant calculation and comparison test on its actual spatial vector. The vectors of the site and the adjacent points of the perimeter ring edge are extracted and the cross product values ​​of all vectors are calculated to determine the consistency of the positive and negative signs. If the signs of all cross product results are the same and non-zero, it proves that the site strictly falls into the curved polygon. A new hash mapping linked list storage architecture is established in the system memory. The coordinate characters of all surface detection sites that pass the strict cross product determination test are converted into corresponding key name information items. The independent community tracking index identifier to which the site belongs is encoded and converted into corresponding key value information items and written in pairs to obtain the set of regional coverage locations.

[0089] S52: Based on the correspondence between the set of area coverage locations and the defect confirmation locations, perform status discrimination processing on each surface detection location. When the surface detection location corresponds to the defect confirmation location or is located in the middle of the coverage area, mark it as present. When the surface detection location does not fall into the coverage area, mark it as excluded. Organize the status of each location mark in the order of location to obtain the location status mark set.

[0090] The system accesses and extracts the data dictionary containing key names and key values ​​of the area covered by the location coordinates stored within the previously constructed hash map linked list. It then performs state sorting, evaluation, classification, and state assignment operations on all surface detection sites within the full-resolution two-dimensional coordinate matrix area. It extracts the horizontal and vertical coordinate strings of the current surface detection site obtained through arbitrary traversal. Finally, it performs a string equality exact match within the coordinate parameter system provided by the hypertext extensible structured storage file. If the function returns a truth value after the comparison operation, proving that an identical coordinate record has been found, it directly assigns an internally set value to the surface detection site. The existence status is marked by a digital tag. If the first round of comparison operation returns a false value, the coordinate string is instead pushed into the hash mapping linked list using the existing hash table structure to trigger a key name query retrieval action. If the retrieval action returns a specific independent community tracking index identifier encoding a non-empty key value, it is confirmed that the coordinate point is within the scope of substantial damage-derived coverage, and it is also assigned a set value. The existence status digital tag is marked. If both the comparison and search operations in the double rounds output a null pointer result, an exclusive assignment action is performed to set the configuration value of this point. The status digital label is excluded. A memory matrix block is allocated to create a data container containing two-dimensional coordinate axes and a dedicated three-dimensional depth tensor for storing depth. For each surface detection site status label obtained after processing, the labels are scanned row by row from left to right according to the spatial order. or The numerical identifier values ​​are sequentially pushed into the internal storage of the corresponding address index position of the three-dimensional depth tensor data container and permanently stored to obtain a set of position status markers.

[0091] S53: Based on the set of location status markers, combined with the defect confirmation location and the defect confirmation area boundary, the detection locations of each surface are sequentially associated and organized, the location identifiers, area ranges and corresponding statuses are uniformly matched, and a complete distribution description is formed to generate the surface defect detection results of the plastic parts.

[0092] Retrieve the internal identifier values ​​of the 3D depth tensor data container containing global labeling information, and specify the stored values ​​as follows: The associated independent community tracking index identifies the encoded region. Arithmetic, statistical, and algebraic operations are performed to sum the coordinates within the region, and the mask state belonging to the first identifier community is calculated. The total enclosed area is equal to Based on the total number of pixels, the mask state belonging to the second identifier cluster region is calculated as follows: The total enclosed area is equal to The total pixel dimension is used to extract the area discrimination interception threshold limit reference constant value set by the control parameters of the pre-introduced inspection procedure. The calculated cumulative area value and the threshold limit benchmark constant value are subtracted to calculate the difference and perform size comparison and judgment operations.

[0093] Table 3: Classification Table for Calculating the Area Threshold of Defect Connectivity Patches

[0094]

[0095] Table 3 shows the entire process of calculating and comparing the sum of pixels with a label value of 1 within different connected patches with the difference calculated by subtracting the value from the threshold constant. Patches with excessively small threshold areas represent false information points caused by environmental dust or thermal noise from the image sensor. For patches with difference calculation results of 58-10=48 and 25-10=15, the original mask configuration and label record configuration information are retained and not changed. For patches with difference calculation results of 5- The third-class identifier group object, whose output is negative (10=-5), is rejected due to insufficient area. The original existence status label with a value of 1 in its area is forcibly corrected and overwritten to an exclusion status label with a value of 0 to perform the filtering of dirt and redundant interference. The dataset of all identifiers with a value of 1 that successfully passed the threshold interception screening test is summarized and exported along with the corresponding external closed polynomial boundary equation parameter table. The resulting standard graphic inspection report data file is stored on the physical disk to generate the surface defect detection results of the plastic parts.

[0096] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for intelligent detection of surface defects in plastic parts, characterized in that, Includes the following steps: S1. Control the adjustable direction light source to illuminate the detection area and acquire images according to the preset sequence. Complete the registration with the outline of the plastic part, determine the corresponding image position of the same detection position, extract the brightness in sequence and form a change sequence, associate the position and the sequence, and generate surface reflection change information. S2. Call the surface position reflection change description in the surface reflection change information, compare the brightness change of the target with that of the adjacent position, identify anomalies based on reverse change, local abrupt change or direction change, connect them according to spatial adjacency and determine the boundary, and generate defect candidate region information. S3. Call the abnormal location distribution range in the defect candidate region information, read the brightness change sequence of the abnormal location in the same region, identify enhancement, weakening or stabilization, merge continuous similar changes, form a stage expression and mark the change of irradiation state, and generate abnormal response feature information. S4. Read the brightness change stage expression and stage transition irradiation state of the abnormal response features in the abnormal response feature information, compare adjacent abnormal positions, and when the two are consistent and the transition positions are the same, confirm and connect the defect position, determine the area boundary, and generate defect confirmation area information. S5. Call the defect confirmation location and defect confirmation area boundary in the defect confirmation area information, and the surface position reflection change description in the surface reflection change information, associate the detection location, area range and defect status, and generate the surface defect detection result of the plastic part.

2. The intelligent detection method for surface defects of plastic parts according to claim 1, characterized in that: The surface reflection change information includes multi-state reflection characteristics, surface optical response characteristics, and location correlation characteristics. The defect candidate region information includes abnormal region range, candidate defect distribution characteristics, and region boundary characteristics. The abnormal response characteristic information includes brightness evolution pattern, stage change law, and state transition characteristics. The defect confirmation region information includes defect region range, defect continuous distribution characteristics, and region contour characteristics. The plastic part surface defect detection result includes defect judgment category, defect spatial distribution information, and detection status information.

3. The intelligent detection method for surface defects of plastic parts according to claim 1, characterized in that: The steps for obtaining the surface reflection change information are as follows: S11: Collect surface images of plastic parts under multiple illumination states, control the adjustable direction light source to illuminate the detection area of ​​the plastic parts in sequence according to the preset light source change order, and use an industrial camera to collect surface images of the injection molded shell corresponding to each illumination state. Perform uniform grayscale processing on the images corresponding to each illumination state and extract the brightness distribution. Organize the brightness distribution of each image in sequence according to the light source change order, and establish the correspondence between the image sequence and the light source change order to generate an illumination brightness sequence. S12: Based on the irradiation brightness sequence, using the outline edge of the plastic part as a position reference, perform outline alignment processing on the surface images of the injection molded shell corresponding to different irradiation states, match the outline positions in each image one by one and complete spatial adjustment, so that the outlines maintain a consistent position under each irradiation state, and reposition the images on the basis of the unified position, establish cross-image position correspondence, and obtain outline registration relationship. S13: Based on the contour registration relationship, the positions of the images under each illumination state are unified, and the illumination brightness sequence is called to read the brightness performance of the corresponding image area under the unified position. The brightness changes of the same surface detection position under different illumination states are organized according to the light source order, and the surface detection position, the corresponding image position and the brightness change are associated to generate surface reflection change information.

4. The intelligent detection method for surface defects of plastic parts according to claim 1, characterized in that: The steps for obtaining the defect candidate region information are as follows: S21: Call the surface position reflection change description in the surface reflection change information, select the target position according to the position order, and synchronously read the brightness change sequence corresponding to the position and the spatially adjacent position. Compare the brightness change direction of each position in the same irradiation change process. When the target position and the adjacent position have inconsistent change direction or inconsistent change state in the same irradiation stage, mark the position to obtain an abnormal position set. S22: Read the image position corresponding to each abnormal position according to the abnormal position set, and make an adjacency judgment on the abnormal positions according to the image coordinate arrangement relationship. Connect the abnormal positions with adjacent coordinates and continuous distribution to form a continuous distribution area. At the same time, identify the boundary between this area and the surrounding unmarked positions to obtain the boundary of the abnormal connected area. S23: Based on the boundary of the abnormal connected region, the range of abnormal locations inside the boundary is limited, and the coverage of abnormal locations is identified as a whole in combination with the image location distribution relationship. Each abnormal location, the corresponding image location and the boundary range are uniformly associated to generate defect candidate region information.

5. The intelligent detection method for surface defects of plastic parts according to claim 1, characterized in that: The steps for obtaining the abnormal response feature information are as follows: S31: Call the abnormal location distribution range in the defect candidate region information, select the abnormal location within the same abnormal location distribution range, and read the corresponding brightness change sequence from the surface reflection change information according to the image position corresponding to the abnormal location. Compare the brightness of adjacent irradiation states before and after according to the order of light source change, divide the brightness change state of each irradiation stage into enhancement, weakening or stabilization, and organize the change state sequence in order to generate a brightness change sequence identifier. S32: Based on the brightness change sequence identifier, the change states of each abnormal position during continuous illumination are merged, adjacent illumination intervals with the same change state are connected, and the merged intervals are arranged according to the order of light source change to form a sequential distribution of change stages. At the same time, the corresponding illumination positions where the change occurs between each change stage are recorded to obtain a change stage division set. S33: Based on the set of change stages, read the change stage expression corresponding to each abnormal position, and combine it with the corresponding irradiation position for switching between stages to make a one-to-one correspondence between the change stage expression and the stage switching position, and form a complete response description for the same abnormal position to generate abnormal response feature information.

6. The intelligent detection method for surface defects of plastic parts according to claim 1, characterized in that: The steps for obtaining the defect confirmation area information are as follows: S41: Read the brightness change stage expression and stage transition illumination state of the abnormal response features in the abnormal response feature information, select adjacent abnormal positions along the light source change sequence, and perform segment-by-segment correspondence comparison of the brightness change stage expression of each position. At the same time, perform consistency check on the illumination positions corresponding to the stage transition illumination state, and mark the positions where the stage expression and the transition position simultaneously meet the consistency condition to generate a set of consistent response positions. S42: Based on the consistent response location set, read the image coordinates corresponding to each location, and perform connection processing on adjacent locations according to the spatial arrangement of the images. Combine regions that are continuous and meet the consistency condition, and identify the boundary between the combined region and the surrounding unmarked locations to form a continuous distribution region boundary, thus obtaining the confirmed connected region boundary. S43: Based on the confirmed connected region boundary, the range of the internal position of the boundary is limited, and the region coverage is uniformly identified by combining the image coordinate relationship. The confirmed positions are associated with the boundary range to generate defect confirmation region information.

7. The intelligent detection method for surface defects of plastic parts according to claim 1, characterized in that: The steps for obtaining the surface defect detection results of the plastic parts are as follows: S51: Call the defect confirmation location and defect confirmation area boundary in the defect confirmation area information, and the surface position reflection change description in the surface reflection change information. Read the surface detection location in the order of location, and judge each surface detection location one by one according to the spatial range enclosed by the defect confirmation area boundary. Mark the location inside the boundary range to obtain the set of area coverage locations. S52: Based on the corresponding comparison between the set of area coverage locations and the defect confirmation locations, perform state discrimination processing on each surface detection location. When the surface detection location corresponds to the defect confirmation location or is located in the middle of the coverage area, mark it as present. When the surface detection location does not fall into the coverage area, mark it as excluded. Organize the position marking status of each location in order of location to obtain a set of position status markings. S53: Based on the set of location status markers, combined with the defect confirmation location and the defect confirmation area boundary, the detection locations of each surface are sequentially associated and organized, the location identifiers, area ranges and corresponding states are uniformly matched, and a complete distribution description is formed to generate the surface defect detection results of the plastic parts.