Real-time detection data processing method and system for welding surface defects of plastic steel profile

An adaptive detection algorithm based on pixel grid division and grayscale difference rate adjustment coefficient has solved the problems of misjudgment and missed detection in the welding quality inspection of PVC profiles, and achieved real-time, efficient and accurate detection of welding defects.

CN121504853APending Publication Date: 2026-02-10四川中德塑钢型材有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511655504.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing technologies for inspecting the welding quality of PVC profiles suffer from problems such as low efficiency, easy fatigue-induced missed detection, misjudgment of defects, and difficulty in quantifying the severity of defects. In particular, when faced with batch color differences in materials, weld slag residue, and light fluctuations, they cannot effectively distinguish between natural gray-scale gradations and abnormal diffusion defects.

Method used

A pixel-grid-based region partitioning method is adopted, combined with an adaptive detection algorithm based on grayscale difference rate and dynamic adjustment coefficient. Through grayscale gradient analysis and spatial continuity analysis, welding defects are identified, environmental interference is dynamically suppressed, and defect pixel clustering and proportional quantization are achieved.

Benefits of technology

It enables real-time and efficient detection of welded surfaces of PVC profiles, adapting to material properties and environmental interference, accurately quantifying the spatial distribution and severity of sheet defects, and improving the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121504853A_ABST
    Figure CN121504853A_ABST
Patent Text Reader

Abstract

The invention discloses a plastic steel profile welding surface defect real-time detection data processing method and system, and relates to the technical field of data processing, the method comprises the following steps: obtaining a to-be-processed area, and collecting a grayscale image of the to-be-processed area; obtaining a standard gray value, obtaining a gray difference rate of each pixel, and obtaining an adjustment coefficient of the gray image of each to-be-processed region; obtaining a typical gray scale gradient of a jth pixel in the gray scale image of the ith to-be-processed area, and obtaining a target gray scale gradient of the jth pixel in the gray scale image of the ith to-be-processed area; and obtaining a defect pixel set of each to-be-processed area according to the target gray gradient of each pixel in the gray image of each to-be-processed area, and obtaining a defect detection result of each to-be-processed area according to the number of pixels in the defect pixel set of each to-be-processed area. The method has the advantages of self-adaption, accurate quantification and real-time processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, specifically to a method and system for real-time detection and data processing of defects on the welded surface of PVC profiles. Background Technology

[0002] In the manufacturing field, the welding quality of PVC profiles directly determines the structural strength and design performance of the product. Currently, the detection of defects on the welded surface (such as cracks, porosity, poor fusion, etc.) on the production line mainly relies on manual visual inspection or optical inspection with fixed thresholds. Manual methods suffer from problems such as low efficiency and easy fatigue-induced missed detections, while existing automated inspection technologies have many technical shortcomings.

[0003] Specifically, localized grayscale variations in PVC profiles caused by batch-to-batch color differences, weld slag residue, or lighting fluctuations can lead fixed-threshold algorithms to misclassify normal textures as defects. Simultaneously, edge-blurred defects are difficult to quantify. Natural grayscale gradients exist in the transition zones of welded areas (such as the edges of fusion lines), and existing gradient detection methods cannot effectively distinguish between these gradients and anomalously diffused defects (such as microcracks), resulting in inaccurate assessments of defect severity. More critically, current technologies lack the ability to analyze the spatial continuity of local anomalies, failing to differentiate between isolated noise points and genuine sheet-like defects, making it difficult to accurately determine defect area and severity. Therefore, a real-time detection method that can adapt to material properties, dynamically suppress environmental interference, and accurately quantify the spatial distribution of sheet-like defects is urgently needed to meet the welding quality requirements of high-speed production lines. Summary of the Invention

[0004] In view of the technical problems described in the background section, the present invention provides a method and system for real-time detection and data processing of surface defects in PVC profile welding.

[0005] A method for real-time detection and data processing of surface defects in PVC profile welding includes: acquiring the welded area of ​​the PVC profile after welding, dividing the welded area into multiple areas to be processed, and acquiring grayscale images of each area to be processed; acquiring standard grayscale values, and obtaining the grayscale difference rate of each pixel in the grayscale image of each area to be processed based on the real-time grayscale value and the standard grayscale value of each pixel in the grayscale image of each area to be processed, and obtaining the adjustment coefficient of the grayscale image of each area to be processed based on the average grayscale difference rate of all pixels in each area to be processed; and based on the grayscale image of the i-th area to be processed... The typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed is obtained by using the gray-level difference rate between j pixels and its neighboring pixels. The target gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed is obtained based on the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed and the adjustment coefficient of the i-th region to be processed. The defect pixel set of each region to be processed is obtained based on the target gray-level gradient of each pixel in the gray-level image of each region to be processed. The defect detection result of each region to be processed is obtained based on the number of pixels in the defect pixel set of each region to be processed.

[0006] Optionally, obtaining the defect pixel set of each region to be processed based on the target gray-level gradient of each pixel in the gray-level image of each region to be processed includes: extracting multiple pixels from the gray-level image of each region to be processed and forming a defect pixel set of each region to be processed, wherein the target gray-level gradient of any pixel in the defect pixel set exceeds a first preset threshold, and any pixel in the defect pixel set is adjacent to at least one other pixel.

[0007] Optionally, obtaining the defect detection result of each region to be processed based on the number of pixels in the defect pixel set of each region to be processed includes: dividing the number of pixels in the defect pixel set of the i-th region to be processed by the number of pixels in the grayscale image of the i-th region to be processed, and obtaining the defect ratio, obtaining the defect detection level of the i-th region to be processed based on the defect ratio, and using the defect detection level as the defect detection result.

[0008] Optionally, obtaining the adjustment coefficient of the grayscale image of each region to be processed based on the average grayscale difference rate of all regions to be processed includes: obtaining the regions to be processed adjacent to the i-th region to be processed and using them as reference regions; obtaining the absolute difference between the average grayscale difference rate of all regions to be processed and the average grayscale difference rate of all regions to be processed; if the absolute difference exceeds a second preset threshold, then the absolute difference is used as the adjustment coefficient; if the absolute difference does not exceed the second preset threshold, then zero is used as the adjustment coefficient.

[0009] Optionally, obtaining the grayscale difference rate of each pixel in the grayscale image of each region to be processed based on the real-time grayscale value and the standard grayscale value of each pixel in the grayscale image of each region to be processed includes: subtracting the standard grayscale value from the real-time grayscale value of each pixel in the grayscale image of each region to be processed to obtain the grayscale difference of each pixel, and dividing the absolute value of the grayscale difference of each pixel by the standard grayscale value to obtain the grayscale difference rate of each pixel in the grayscale image of each region to be processed.

[0010] Optionally, obtaining the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed based on the gray-level difference rate between the j-th pixel and its neighboring pixels in the gray-level image of the i-th region to be processed includes: obtaining the difference rate between the gray-level difference rates of the j-th pixel and its neighboring pixels in the gray-level image of the i-th region to be processed, and taking the maximum value among the absolute values ​​of multiple difference rates as the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed.

[0011] Optionally, obtaining the target gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed based on the typical gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed and the adjustment coefficient of the i-th region to be processed includes: adding 1 to the adjustment coefficient of the i-th region to be processed to obtain the increase ratio of the i-th region to be processed; multiplying the typical gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed by the increase ratio of the i-th region to be processed to obtain the target gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed.

[0012] A real-time detection and data processing system for welded surface defects of PVC profiles is also provided. The system includes: an acquisition module for acquiring the welded area of ​​the PVC profile after welding, dividing the welded area into multiple areas to be processed, and acquiring grayscale images of each area to be processed; a first data processing module for acquiring standard grayscale values, and acquiring the grayscale difference rate of each pixel in the grayscale image of each area to be processed based on the real-time grayscale value and standard grayscale value of each pixel in the grayscale image of each area to be processed, and acquiring the adjustment coefficient of the grayscale image of each area to be processed based on the average grayscale difference rate of all grayscale values ​​in each area to be processed; and a second data processing module for acquiring the adjustment coefficient of the grayscale image of each area to be processed based on the i-th... The typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed is obtained by using the gray-level difference rate between the j-th pixel and its neighboring pixels in the gray-level image of the i-th region to be processed. The target gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed is obtained based on the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed and the adjustment coefficient of the i-th region to be processed. The defect detection module is used to obtain the defect pixel set of each region to be processed based on the target gray-level gradient of each pixel in the gray-level image of each region to be processed, and to obtain the defect detection result of each region to be processed based on the number of pixels in the defect pixel set of each region to be processed.

[0013] Optionally, the defect detection module is further configured to: extract multiple pixels from the grayscale images of each region to be processed and form a defect pixel set for each region to be processed, wherein the target grayscale gradient of any pixel in the defect pixel set exceeds a first preset threshold, and any pixel in the defect pixel set is adjacent to at least one other pixel.

[0014] Optionally, the defect detection module is further configured to: divide the number of pixels in the defect pixel set of the i-th region to be processed by the number of pixels in the grayscale image of the i-th region to be processed, and obtain the defect ratio, obtain the defect detection level of the i-th region to be processed based on the defect ratio, and use the defect detection level as the defect detection result.

[0015] The beneficial effects of this invention are reflected in: In the real-time detection data processing method for welded surface defects of PVC profiles, firstly, the pixel-grid-based region division decouples the global gray-level non-uniformity problem into locally manageable units, which adapts to material batch differences and suppresses the interference of illumination fluctuations, while laying a structural foundation for spatial continuity analysis. Furthermore, the combination of gray-level difference rate and dynamic adjustment coefficient eliminates the influence of overall color shift through relative deviation calculation, and identifies local uniform interference such as weld slag by comparing the mean values ​​of adjacent regions, achieving adaptive suppression of environmental noise. Further, the gradient compensation algorithm with integrated adjustment coefficient effectively distinguishes between natural gray-level gradients and defect abrupt changes, dynamically reducing the detection sensitivity of interfered areas while retaining sharp change signals such as microcracks. Finally, defect pixel clustering and proportional quantization based on spatial continuity accurately separate isolated noise points from real sheet-like defects, and objectively determines the crack area and severity through regional defect level assessment. Attached Figure Description

[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.

[0017] Figure 1 This is a partial flowchart of steps S1 to S3 in the real-time detection data processing method for welded surface defects of PVC profiles of the present invention. Figure 2 This is a partial flowchart of steps S3 to S4 in the real-time detection data processing method for welded surface defects of PVC profiles of the present invention. Figure 3 This is a schematic diagram illustrating the steps of the real-time detection and data processing method for welded surface defects of PVC profiles according to the present invention. Figure 4 This is a schematic diagram of a portion of step S4 in the real-time detection data processing method for welded surface defects of PVC profiles of the present invention; Figure 5 This is a schematic diagram of part of step S2 in the real-time detection data processing method for welded surface defects of PVC profiles of the present invention; Figure 6 This is a schematic diagram of part of step S3 in the real-time detection data processing method for welded surface defects of PVC profiles of the present invention; Detailed Implementation To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0018] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0019] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0020] like Figures 1 to 3 As shown, a method for real-time detection and data processing of welded surface defects in PVC profiles is provided. In one embodiment, the method includes: S1. Obtain the welding area of ​​the PVC profile after welding, divide the welding area into multiple areas to be processed, and collect the grayscale image of each area to be processed. S2. Obtain the standard gray value, and obtain the gray difference rate of each pixel in the gray image of each region to be processed based on the real-time gray value and the standard gray value of each pixel in the gray image of each region to be processed, and obtain the adjustment coefficient of the gray image of each region to be processed based on the average value of all gray difference rates in each region to be processed. S3. Obtain the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed based on the gray-level difference rate between the j-th pixel and its neighboring pixels in the gray-level image of the i-th region to be processed, and obtain the target gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed based on the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed and the adjustment coefficient of the i-th region to be processed. S4. Obtain the defect pixel set of each region to be processed based on the target gray level gradient of each pixel in the gray level image of each region to be processed, and obtain the defect detection result of each region to be processed based on the number of pixels in the defect pixel set of each region to be processed.

[0021] In this embodiment, it should be noted that in S1, image data of the welding area is acquired and preprocessed to build an efficient analysis foundation. Its core objective is to address the problem of uneven grayscale caused by interference factors such as batch color differences, lighting fluctuations, and residual weld slag, which may lead to global misjudgments across the entire image.

[0022] The specific process includes: After welding, a high-resolution industrial camera captures the raw image of the welded surface, represented in grayscale mode to simplify subsequent calculations. Then, the entire welded area is divided into multiple processing regions, ensuring each region corresponds to a fixed number of pixel grids. This division ensures all sub-regions have a consistent pixel scale, facilitating standardized processing. The grid division is designed to handle dynamic changes in the production environment: for example, natural color differences between different batches of profiles can cause some areas to be overall brighter or darker, while unstable lighting may cause local shadows or reflections. By decomposing into small units, each processing region can independently respond to local grayscale changes, rather than being affected by abnormalities in the entire image. This not only reduces the impact of environmental noise on subsequent steps but also supports parallel computing capabilities, improving real-time detection speed. When acquiring grayscale images of each region, the grayscale value of each pixel is retained, providing input for subsequent grayscale difference rate calculations.

[0023] Furthermore, the S1 partitioning operation specifically enhances the ability to identify the spatial distribution of defects, compensating for the inability of existing technologies to distinguish between isolated noise points and real sheet-like defects. The fixed pixel grid size for each region to be processed (e.g., a region covering 1000 pixels) ensures consistency in the analysis, preventing large-scale texture gradients (such as fusion line edges) from being misjudged as defects. In practical applications, if a natural transition zone exists in the welding area, its grayscale change is slow and uniform, but the partitioned small regions can locally isolate these gradients, allowing abnormal diffusion (such as microcracks) to form high-contrast changes within the pixel grid.

[0024] For example, when the welded surface produces spot-like grayscale fluctuations due to weld slag, these isolated points may be magnified as defects if not segmented; however, after segmentation, the image of each small region can be regarded as an independent sample, and in subsequent steps, by comparing adjacent regions (reflected in the calculation of the S2 adjustment coefficient), local noise and real patchy anomalies can be effectively distinguished.

[0025] Overall, S1 transforms complex problems into manageable local modules through spatial segmentation, implicitly linking it to the regulation mechanism of S2.

[0026] In S2, an adaptive grayscale compensation mechanism is established to address misjudgments caused by batch color differences and lighting fluctuations. After completing the region division in S1, a pre-stored standard grayscale value library (a grayscale benchmark for qualified welds stored according to profile color) is first retrieved. For all pixels within each processing area, the deviation between their real-time grayscale value and the corresponding standard value is calculated, i.e., the grayscale difference rate. This difference rate reflects a relative deviation rather than an absolute difference, automatically offsetting the influence of overall material brightness variations. For example, when a batch of profiles experiences a 20% general decrease in grayscale value across the entire welding area due to a darker pigment ratio, a fixed threshold algorithm might misjudge normal areas as shadow defects; however, through grayscale difference rate calculation, the 20% uniform offset is normalized, avoiding misjudgments.

[0027] Furthermore, the average grayscale difference rate of all pixels within the current region is calculated. This average value is used to characterize the overall grayscale shift characteristics of the sub-region. This step provides the basic data for the subsequent calculation of the adjustment coefficient. The implicit logic is that if a certain area to be processed experiences a uniform grayscale change due to welding slag residue or local reflection (such as the entire area becoming brighter year-on-year), this change is an environmental disturbance rather than a real defect feature and needs to be dynamically suppressed in subsequent gradient detection.

[0028] Furthermore, S2 defines the current area to be processed and its directly adjacent sub-regions as reference regions, and calculates the absolute difference between the average grayscale difference rate of the current area and the average of each reference region. If the difference exceeds a preset threshold, it indicates that there is a significant local grayscale anomaly in the current area (e.g., a whole low grayscale area is formed due to welding slag coverage), and the difference itself is used as an adjustment coefficient; if it does not exceed the threshold, the adjustment coefficient is set to zero.

[0029] This achieves two goals: First, when welding slag causes an overall grayscale anomaly in a certain area (such as the lower left corner of the image becoming dark due to a large amount of welding slag), the average grayscale difference rate will have a significant difference from the average of the surrounding normal areas. In this case, the generated positive adjustment coefficient will dynamically amplify the gradient detection threshold of that area in stage S3, avoiding misjudging uniform grayscale changes as defect gradients. Second, when the difference in average values ​​between areas is small (such as adjacent areas of a natural lighting gradient), the adjustment coefficient is zero, maintaining the original gradient sensitivity to capture true defects. For example, if area A experiences a 15% decrease in overall grayscale due to temporary shadows, while its adjacent areas B / C are not affected, the difference in the average grayscale difference rate between A and B / C will significantly increase. In this case, the adjustment coefficient will increase proportionally to the difference, and the gradient calculation results in subsequent stage S33 will be compensated for, thereby suppressing the interference of environmental shadows on defect detection.

[0030] In S3, grayscale gradient is normalized through spatial gradient analysis to address the key issue that existing technologies struggle to distinguish between natural transition zones and real defects. After calculating the adjustment coefficients in S2, for each pixel within the current processing area, the grayscale difference rate between it and its neighboring pixels (e.g., in the directions of top, bottom, left, and right) is calculated. The maximum absolute value of the difference across all directions is taken as the typical grayscale gradient of that pixel. This design is based on the abrupt changes in defects at the microscale: the grayscale difference rate changes smoothly in naturally transitioning regions such as weld fusion lines, with small and continuous differences between adjacent pixels; while real defects such as cracks and pores produce steep grayscale jumps, significantly increasing the difference rate between adjacent pixels.

[0031] For example, in the natural transition zone at the edge of the fusion line, the inter-pixel difference rate exhibits a uniform low-value distribution; however, if microcracks exist, the difference rate rate between adjacent pixels at the crack tip will suddenly increase, forming a local peak. By capturing the maximum difference rate rate within the pixel neighborhood, the typical gray-level gradient effectively amplifies the abnormal gradient features of the defect region while suppressing interference signals in the uniformly gradient region. This process implicitly inherits the gray-level difference rate data output by S2—because the gray-level difference rate has eliminated the global influence of batch color differences, it allows gradient analysis to focus more on local abrupt structures. It is worth noting that the calculation of typical gray levels depends only on the difference rate relationship between adjacent pixels, making it naturally robust to uniform brightness changes caused by illumination fluctuations, creating a foundation for subsequent adjustment and compensation.

[0032] Furthermore, based on the adjustment coefficient generated by S2 (characterizing the overall grayscale deviation between the current region and adjacent regions), it is converted into a region-specific scaling factor: when the adjustment coefficient is greater than zero (indicating the presence of uniform interference such as weld slag or shadows in the region), the scaling factor increases positively according to the coefficient value; if the adjustment coefficient is zero, the scaling factor remains unchanged. Multiplying the typical grayscale gradient by this scaling factor yields the target grayscale gradient.

[0033] This operation is essentially a dynamic calibration of the gradient threshold: for areas affected by local interference (such as areas darkened by weld slag), although the grayscale difference rate between pixels increases due to the overall offset, the actual gradient distribution remains uniform. In this case, amplifying the typical gradient through a scaling factor automatically relaxes the judgment criteria in the subsequent S4 threshold judgment, preventing uniform interference from being misjudged as a defect. Conversely, the original gradient sensitivity is maintained in interference-free areas. Taking a natural transition zone as an example: when the gradient region at the weld edge has a similar average grayscale difference rate to its adjacent regions (adjustment coefficient is zero), the target gradient directly reflects the true gradient intensity; however, if this gradient region is temporarily covered by a shadow (adjustment coefficient is non-zero), the target gradient will be compensatorily increased, preventing the gradient amplification effect caused by the shadow from triggering misjudgment. For genuine defects (such as microcracks spanning adjacent pixels), regardless of whether interference exists, their abnormally high gradient values ​​will still significantly exceed the threshold after scaling.

[0034] In S4, the spatial distribution of defects is accurately quantified through continuous pixel clustering, which to some extent solves the problem that existing technologies have difficulty distinguishing between isolated noise points and real sheet-like defects.

[0035] Based on the target grayscale gradient generated by S3 (which has dynamically suppressed environmental interference and amplified the real gradient features), all pixels in each processing area are screened in two stages: First, only pixels whose target gradient exceeds the first preset threshold are retained. This threshold setting can effectively intercept low gradient areas such as natural transition zones; Second, a continuous set of defective pixels is constructed through adjacency relationship verification. Each pixel in the set must be directly adjacent to at least one other high gradient pixel (such as connected above, below, left, or right) to ensure that all abnormal points form a continuous spatial structure.

[0036] This design implicitly contains two key logics: First, welding defects (such as cracks and poor fusion) must manifest as continuous anomalies in adjacent pixel groups at the microscopic level, while isolated noise points (such as weld slag reflections) may trigger gradient thresholds but cannot form continuous connections; second, the size of the sheet-like region directly reflects the severity of the defect. For example, when there are microcracks on the welded surface, pixels along the crack path not only exceed the gradient value limit but also form continuous, elongated pixel chains; while randomly distributed weld slag noise points may generate sporadic high-gradient pixels, but are excluded from the set due to the lack of adjacency. This process closely follows the adaptive gradient analysis in S3: because the target gradient has eliminated the risk of misjudgment in the weld slag-covered area by adjusting the coefficient (such as the compensatory amplification of the gradient in the weld slag region in S3 without exceeding the threshold), the construction of the defect set is entirely focused on the spatial continuity expression of the real anomalies.

[0037] Furthermore, S4's defect quantification mechanism combines pixel continuity analysis with region proportion calculation to achieve accurate defect level determination. After obtaining the defective pixel set, it calculates the proportion of the number of pixels in this set to the total number of pixels in the current processing area (defect ratio), and classifies the defect level (negligible / minor / severe) according to a preset ratio range. This design fully leverages the region division characteristics of S1: since the pixel size of each processing area is fixed (e.g., 1000 pixels), the ratio calculation is comparable across regions.

[0038] For example, if a dark spot several millimeters in diameter forms in a certain area due to porosity defects, the defect set in that area will contain dozens of adjacent consecutive pixels, significantly increasing the defect ratio. Conversely, while the grayscale gradient at the edge of a natural fusion line covers more pixels, its pixel gradient values ​​are generally below the threshold after S3 target gradient calibration, preventing it from entering the defect set and thus avoiding misjudgment. The assessment of defect severity is also based on spatial continuity—the larger the area of ​​a sheet-like defect and the more consecutive pixels it contains, the higher the defect ratio. For instance, a crack running through an entire area will cause the defect ratio to reach a dangerous level, while localized micropores only cause slight fluctuations in the ratio.

[0039] The entire process filters isolated noise points through spatial continuity, then quantifies the scale of sheet-like defects through proportional calculation, and finally outputs a regionalized defect level. This result directly supports production line process decisions: negligible defects are automatically released; minor defects trigger secondary inspection; and severe defects trigger real-time alarms and line shutdowns. The entire S4 seamlessly integrates the processing results of S1-S3, ultimately achieving closed-loop quantitative judgment of defect spatial distribution and severity on high-speed production lines.

[0040] In summary, the real-time detection data processing method for welded surface defects in PVC profiles firstly decouples the global grayscale non-uniformity problem into locally manageable units based on pixel grid-based region division. This adapts to batch differences in materials while suppressing interference from lighting fluctuations, and lays a structural foundation for spatial continuity analysis. Furthermore, the combination of grayscale difference rate and dynamic adjustment coefficient eliminates the influence of overall color shift through relative deviation calculation, and identifies local uniform interference such as weld slag by comparing the mean values ​​of adjacent regions, achieving adaptive suppression of environmental noise. Further, the gradient compensation algorithm, which integrates adjustment coefficients, effectively distinguishes between natural grayscale gradients and abrupt defect changes, dynamically reducing the detection sensitivity of interfered areas while preserving sharp change signals such as microcracks. Finally, defect pixel clustering and proportional quantization based on spatial continuity accurately separate isolated noise points from real sheet-like defects, and objectively determines the crack area and severity through regionalized defect level assessment. In conclusion, the entire process forms a closed-loop processing chain, achieving dynamic robustness to material properties and environmental interference, accurate discrimination of gradient and abrupt defects, and quantitative assessment of defect spatial distribution in a high-speed production line environment.

[0041] like Figure 4 As shown, in one embodiment, S4, obtaining the set of defective pixels for each region to be processed based on the target grayscale gradient of each pixel in the grayscale image of each region to be processed includes: S41. Extract multiple pixels from the grayscale images of each region to be processed and form a defect pixel set for each region to be processed. The target grayscale gradient of any pixel in the defect pixel set exceeds a first preset threshold, and any pixel in the defect pixel set is adjacent to at least one other pixel.

[0042] In this embodiment, it should be noted that when determining the value of the first preset threshold, a limited number of qualified weld samples are first collected, and the 95th percentile of the target grayscale gradient output by S3 (covering the maximum gradient of natural gradation) is calculated as a baseline value. Then, the minimum target gradient value of the defect region is determined by a limited number of minimum acceptable defect samples (such as microcracks with a width ≥ 0.1 mm). Finally, a margin of 15~20% is added to the baseline value (to avoid misjudgment of the transition zone), and it must be lower than the minimum target gradient value (to avoid missed detection). For example, if the 95th percentile of the target gradient of a qualified weld is 0.15 and the minimum defect gradient is 0.22, then the threshold value can be 0.18.

[0043] In S41, morphological screening of real defects is achieved through spatial continuity constraints. This step is located at the beginning of the S4 processing flow and is based on the target grayscale gradient data output from S3. The specific operational logic is as follows: For all pixels in a single processing area, pixels with target gradient values ​​exceeding a preset high threshold (representing significant anomalies) are first screened out. Then, morphological verification is performed on the screening results—only pixels directly adjacent to at least one high-gradient pixel of the same type (quadruple or octuplet neighborhood) are retained, ultimately forming a continuous sheet-like defect pixel set. This process directly addresses the problem of existing technologies being unable to distinguish isolated noise points: for example, when weld slag reflection produces sporadic high-gradient pixels, they are excluded because they do not meet the adjacent connection condition; while real crack defects, due to the continuous distribution of pixels along the crack direction, inevitably form connectable pixel chains. For example, surface pores usually exhibit a closed regional distribution, and their high-gradient pixels naturally form continuous blocks; conversely, randomly distributed dust noise cannot establish effective connections.

[0044] like Figure 4 As shown, in one embodiment, S4, obtaining the defect detection result of each region to be processed based on the number of pixels in the defect pixel set of each region to be processed includes: S42. Divide the number of pixels in the defect pixel set of the i-th region to be processed by the number of pixels in the grayscale image of the i-th region to be processed, and obtain the defect ratio. Based on the defect ratio, obtain the defect detection level of the i-th region to be processed, and use the defect detection level as the defect detection result.

[0045] In this embodiment, it should be noted that in S42, the spatial distribution of defects is transformed into a standardized severity index, which is based on the defect pixel set output in S41. The calculation process is as follows: take the total number of pixels in the defect set of the current area to be processed, divide it by the preset fixed total number of pixels in that area (determined by S1), and obtain the precise defect area ratio; determine the defect level according to the preset ratio threshold (e.g., <1% negligible, 1%-5% slight, >5% severe). The innovation of this design lies in transforming the physical defect size into a dimensionless ratio, eliminating the drawback of existing pixel counting being affected by image resolution.

[0046] For example, when a fusion defect of approximately 2 mm in diameter occurs in a certain area, its defect set covers 50 consecutive pixels (total area 1000 pixels), and a defect ratio of 5% triggers a minor defect level; while if a through-crack occurs covering 200 pixels, a ratio of 20% is directly judged as a serious defect. The key is that the area size standardization of S1 makes this ratio comparable across batches and devices, and the continuity verification of S41 ensures that the ratio calculation only includes real defect pixels, avoiding noise contamination of the statistical results.

[0047] like Figure 5 As shown, in one embodiment, obtaining the adjustment coefficient of the grayscale image of each region to be processed in S2 based on the average grayscale difference rate of all regions to be processed includes: S21. Obtain the region to be processed that is adjacent to the i-th region to be processed and use it as a reference region; S22. Obtain the absolute difference between the average value of all grayscale difference rates in the i-th region to be processed and the average value of all grayscale difference rates in each reference region. S23. If the absolute difference exceeds the second preset threshold, the absolute difference is used as an adjustment coefficient. S24. If the absolute difference does not exceed the second preset threshold, then zero is used as the adjustment coefficient.

[0048] In this embodiment, it should be noted that in S21, a spatial association model between regions is established to provide a neighborhood reference system for subsequent adjustment coefficient calculation. Specifically, taking the current region to be processed (denoted as region A) as the center, all regions to be processed that directly border its physical boundary (including at least the four directions of up, down, left, and right) are obtained as a set of reference regions. This step innovatively utilizes the grid topology relationship formed by S1 to construct a local environmental reference group through spatial adjacency.

[0049] For example, when region A is located at the edge of the weld fusion line, its reference region includes the regions inside and outside the fusion band; if A is located in the middle of the weld, the reference region is the homogeneous weld area.

[0050] In S22, the overall deviation between the current area and the surrounding environment is quantified. The input data is the average gray-scale difference rate calculated in S2 (characterizing the overall gray-scale shift of the area). Specifically, it calculates the absolute difference between the average gray-scale difference rate of the current area A and the average gray-scale difference rate of all reference areas (defined by S21), and then takes the arithmetic mean of these differences as the final output value.

[0051] This process reveals key characteristics: if region A experiences overall grayscale anomalies due to slag coverage, its average difference rate will be significantly different from the surrounding normal regions; conversely, in the natural transition zone, the average difference rate of adjacent regions shows a continuous change. For example, when region A is covered with a large amount of slag, its average grayscale difference rate may be 20% lower than that of adjacent regions, and the calculated absolute difference will be significantly larger; while in a qualified weld area with uniform illumination, the difference in the average difference rate between adjacent regions approaches zero.

[0052] In S23 and S24, when determining the value of the second preset threshold, firstly, the 99th percentile of the mean difference in grayscale difference rate between adjacent areas to be treated in a limited number of qualified welds is calculated (e.g., the difference between natural transition zone areas is ≤3%). Then, the difference between the mean grayscale difference rate of the slag-covered area and the adjacent areas is analyzed to determine its minimum statistical significance value (e.g., ≥5%). Finally, the value is determined. For example, if the 99th percentile of the difference between natural transition areas is 2.5% and the minimum difference in the slag area is 5.8%, then the threshold can be 4.0%.

[0053] When the absolute difference output by S22 exceeds the preset sensitivity threshold (indicating significant local interference), the difference itself is output as the adjustment coefficient (S23); if it does not exceed the threshold (indicating that the current area is in harmony with the surrounding environment), the output adjustment coefficient is zero (S24).

[0054] The threshold determination is essentially a binary judgment of the severity of interference: if the absolute difference in the slag coverage area reaches 15%, S23 is triggered, and the adjustment coefficient is set to 0.15; while in the gradient area of ​​the natural transition zone, the difference between adjacent areas is only 2% (below the threshold), so S24 outputs a zero coefficient. This mechanism intelligently distinguishes between uniform interference and real texture: the former (such as slag) generates a high coefficient to trigger gradient compensation in S3, while the latter (such as fusion lines) maintains a zero coefficient to maintain detection sensitivity.

[0055] like Figure 5 As shown, in one embodiment, S2, obtaining the grayscale difference rate of each pixel in the grayscale image of each region to be processed based on the real-time grayscale value and the standard grayscale value of each pixel in the grayscale image of each region to be processed includes: S25. Subtract the standard gray value from the real-time gray value of each pixel in the grayscale image of each region to be processed to obtain the grayscale difference of each pixel. Divide the absolute value of the grayscale difference of each pixel by the standard gray value to obtain the grayscale difference rate of each pixel in the grayscale image of each region to be processed.

[0056] In this embodiment, it should be noted that in S25, for each pixel, the absolute value deviation is obtained by subtracting the standard gray value of the same color profile from the real-time gray value, and then divided by the standard value to convert it into a relative ratio.

[0057] This process converts the existing absolute grayscale difference into a difference rate value that is insensitive to the material: when a batch of profiles is darker overall, causing all pixel grayscale values ​​to decrease by 20%, the pixel grayscale difference of the real-time grayscale value 180 (standard 200) is 20, and the grayscale difference rate is stable at 0.1 (20 / 200), eliminating the influence of color difference; conversely, the fixed threshold algorithm may misjudge this pixel as a defect.

[0058] like Figure 6 As shown, in one embodiment, S3, obtaining the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed based on the gray-level difference rate between the j-th pixel and its neighboring pixels in the gray-level image of the i-th region to be processed includes: S31. Obtain the difference between the grayscale difference rate of the j-th pixel and its neighboring pixels in the grayscale image of the i-th region to be processed, and take the maximum value among the absolute values ​​of multiple difference rates as the typical grayscale gradient of the j-th pixel in the grayscale image of the i-th region to be processed.

[0059] In this embodiment, it should be noted that in S31, microscopic gray-level abrupt changes are captured through neighborhood comparison, providing highly sensitive feature input for subsequent defect identification. Specifically, for a specific pixel in the region to be processed, the difference in gray-level difference rate between it and its directly adjacent pixels (usually taking four connected directions) is calculated; after obtaining the absolute value of the difference rate in all directions, the maximum value is taken as the typical gray-level gradient of the pixel.

[0060] This design is based on the physical characteristics of defect morphology: real cracks or pore edges inevitably exhibit steep grayscale jumps at the microscale, with adjacent pixel differences being much higher than in natural gradient regions. For example, in the natural transition zone of a fusion line, the difference rates between a pixel and its upper, lower, left, and right adjacent pixels are 0.01, 0.02, 0.03, and 0.01 (low and uniform values), respectively, with a typical gradient taking the maximum value of 0.03. However, at the tip of a microcrack, the difference rate between adjacent pixels may reach 0.01, 0.35, 0.02, and 0.01, with a typical gradient of 0.35, significantly exposing abrupt changes. This process implicitly inherits the grayscale difference rate data output by S2—because the difference rate has eliminated the global offset of material batch color differences, the gradient calculation focuses on local abrupt changes. It is worth noting that the design of only taking the maximum difference value can effectively resist gradient interference: the difference rate difference is small in all directions in the natural transition zone, while defects form high contrast in at least a single direction. This mechanism naturally enhances the signal-to-noise ratio of defect edges.

[0061] like Figure 6 As shown, in one embodiment, S3, obtaining the target grayscale gradient of the j-th pixel in the grayscale image of the i-th region to be processed based on the typical grayscale gradient of the j-th pixel in the grayscale image of the i-th region to be processed and the adjustment coefficient of the i-th region to be processed, includes: S32. Increment the adjustment coefficient of the i-th region to be processed by 1 and obtain the increase ratio of the i-th region to be processed; S33. Multiply the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed by the increase ratio of the i-th region to be processed, and obtain the target gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed.

[0062] In this embodiment, it should be noted that in S32, the regional adjustment coefficient (characterizing the severity of environmental interference) generated in S2 is converted into a gradient scaling coefficient. Specifically, the adjustment coefficient is linearly shifted to obtain a region-specific increase ratio. This step contains key design logic: when the adjustment coefficient is zero (indicating no significant interference in the current region), the increase ratio remains constant at the baseline value, maintaining the original gradient sensitivity; when the adjustment coefficient is positive (e.g., the slag coverage coefficient is 0.15), the increase ratio increases synchronously (here, 0.15 + the baseline value), forming a positive correlation compensation mechanism.

[0063] This conversion achieves a quantitative binding between environmental disturbances and gradient correction: for example, in areas with weld slag (adjustment coefficient 0.15), the ratio is increased to 1.15 times; while in areas without disturbance (adjustment coefficient 0), the ratio remains at the baseline value of 1. This process closely depends on the decision results of S23-S24—the adjustment coefficient is derived from the gray-scale consistency analysis of adjacent areas, making the ratio conversion spatially adaptive.

[0064] In S33, dynamic adaptation of the gradient threshold is achieved through scaling. Specifically, the typical gray-level gradient in S31 is multiplied by the scaling factor in S32 to generate the final target gray-level gradient. This operation achieves a triple calibration effect: in areas affected by local interference (such as areas covered by weld slag), although the value of the typical gradient is increased due to the original gray-level shift after scaling, the amplified gradient value can avoid the defect judgment threshold in S4; in areas without interference, the target gradient maintains the original value of the typical gradient; and for real defects, their inherently high typical gradient still far exceeds the threshold after scaling.

[0065] For example, a pixel in a slag-covered area typically has a gradient of 0.2 (actually, the gradient is artificially high due to uniform offset). After magnification by 1.15 times, the target gradient increases to 0.23. If the S4 threshold is set to 0.25, it will not be misjudged. If a real crack exists in the same area (typical gradient 0.4), the magnified gradient of 0.46 still exceeds the threshold and is identified. Pixels in the natural transition zone (typical gradient 0.05) are always below the threshold regardless of the scaling. This process perfectly connects to the defect determination in S4: the target gradient suppresses false positives caused by environmental interference (such as in the slag area) while retaining the gradient peak of real defects (such as microcracks). At the same time, it uses scaling to achieve differentiated sensitivity configuration for different areas, solving the problem that existing fixed gradient thresholds cannot adapt to local interference.

[0066] A real-time detection and data processing system for welded surface defects of PVC profiles is also provided. The system includes: The acquisition module is used to acquire the welding area of ​​the PVC profile after welding, divide the welding area into multiple areas to be processed, and acquire grayscale images of each area to be processed. The first data processing module is used to obtain standard gray values, and to obtain the gray difference rate of each pixel in the gray image of each region to be processed based on the real-time gray values ​​and standard gray values ​​of each pixel in the gray image of each region to be processed, and to obtain the adjustment coefficient of the gray image of each region to be processed based on the average value of all gray difference rates in each region to be processed. The second data processing module is used to obtain the typical gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed based on the gray level difference rate between the j-th pixel and its neighboring pixels in the gray level image of the i-th region to be processed, and to obtain the target gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed based on the typical gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed and the adjustment coefficient of the i-th region to be processed. The defect detection module is used to obtain the defect pixel set of each region to be processed based on the target gray-level gradient of each pixel in the gray-level image of each region to be processed, and to obtain the defect detection result of each region to be processed based on the number of pixels in the defect pixel set of each region to be processed.

[0067] In one embodiment, the defect detection module is further configured to: extract multiple pixels from the grayscale images of each region to be processed and form a defect pixel set for each region to be processed, wherein the target grayscale gradient of any pixel in the defect pixel set exceeds a first preset threshold, and any pixel in the defect pixel set is adjacent to at least one other pixel.

[0068] In one embodiment, the defect detection module is further configured to: divide the number of pixels in the defect pixel set of the i-th region to be processed by the number of pixels in the grayscale image of the i-th region to be processed, and obtain the defect ratio; obtain the defect detection level of the i-th region to be processed based on the defect ratio; and use the defect detection level as the defect detection result.

[0069] In this embodiment, it should be noted that the specific method of performing the above-mentioned real-time detection data processing system for welded surface defects of PVC profiles has been described in detail in the embodiments of the real-time detection data processing method for welded surface defects of PVC profiles, and will not be elaborated here.

[0070] The preferred embodiments of the present disclosure have been described in detail above with reference to the accompanying drawings. However, the present disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0071] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.

[0072] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.

[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be covered within the scope of the claims and specification of the present invention.

Claims

1. A method for real-time detection and data processing of surface defects in welded plastic steel profiles, characterized in that, include: The welding area of ​​the PVC profile after welding is obtained, and the welding area is divided into multiple areas to be processed, and grayscale images of each area to be processed are acquired. Obtain the standard gray value, and obtain the gray difference rate of each pixel in the gray image of each region to be processed based on the real-time gray value and the standard gray value of each pixel in the gray image of each region to be processed. Obtain the adjustment coefficient of the gray image of each region to be processed based on the average value of all gray difference rates in each region to be processed. The typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed is obtained based on the gray-level difference rate between the j-th pixel and its neighboring pixels in the gray-level image of the i-th region to be processed. The target gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed is obtained based on the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed and the adjustment coefficient of the i-th region to be processed. The defect pixel set of each region to be processed is obtained based on the target gray-level gradient of each pixel in the gray-level image of each region to be processed, and the defect detection result of each region to be processed is obtained based on the number of pixels in the defect pixel set of each region to be processed.

2. The method for real-time detection and data processing of surface defects in PVC profile welding according to claim 1, characterized in that, The step of obtaining the set of defective pixels for each region to be processed based on the target gray-level gradient of each pixel in the gray-level image of each region to be processed includes: Multiple pixels are extracted from the grayscale images of each region to be processed and a defect pixel set is formed for each region to be processed. The target grayscale gradient of any pixel in the defect pixel set exceeds a first preset threshold, and any pixel in the defect pixel set is adjacent to at least one other pixel.

3. The method for real-time detection and data processing of welded surface defects in PVC profiles according to claim 1, characterized in that, The step of obtaining the defect detection result of each region to be processed based on the number of pixels in the defect pixel set of each region to be processed includes: Divide the number of pixels in the defect pixel set of the i-th region to be processed by the number of pixels in the grayscale image of the i-th region to be processed to obtain the defect ratio. Obtain the defect detection level of the i-th region to be processed based on the defect ratio and use the defect detection level as the defect detection result.

4. The method for real-time detection and data processing of welded surface defects in PVC profiles according to claim 1, characterized in that, The step of obtaining the adjustment coefficient of the grayscale image of each region to be processed based on the average grayscale difference rate of all regions to be processed includes: Obtain the regions to be processed that are adjacent to the i-th region to be processed and use them as reference regions; Obtain the absolute difference between the average grayscale difference rate of all grayscale differences in the i-th region to be processed and the average grayscale difference rate of all grayscale differences in each reference region; If the absolute difference exceeds the second preset threshold, the absolute difference will be used as an adjustment coefficient. If the absolute difference does not exceed the second preset threshold, then zero is used as the adjustment coefficient.

5. The method for real-time detection and data processing of welded surface defects in PVC profiles according to claim 1, characterized in that, The step of obtaining the grayscale difference rate of each pixel in the grayscale image of each region to be processed based on the real-time grayscale value and the standard grayscale value of each pixel in the grayscale image of each region to be processed includes: Subtract the standard gray value from the real-time gray value of each pixel in the grayscale image of each region to be processed to obtain the grayscale difference of each pixel. Divide the absolute value of the grayscale difference of each pixel by the standard gray value to obtain the grayscale difference rate of each pixel in the grayscale image of each region to be processed.

6. The method for real-time detection and data processing of welded surface defects in PVC profiles according to claim 1, characterized in that, The step of obtaining the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed based on the gray-level difference rate between the j-th pixel and its neighboring pixels in the gray-level image of the i-th region to be processed includes: Obtain the difference between the grayscale difference rate of the j-th pixel and its neighboring pixels in the grayscale image of the i-th region to be processed, and take the maximum value among the absolute values ​​of multiple difference rates as the typical grayscale gradient of the j-th pixel in the grayscale image of the i-th region to be processed.

7. The method for real-time detection and data processing of welded surface defects in PVC profiles according to claim 1, characterized in that, The step of obtaining the target gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed based on the typical gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed and the adjustment coefficient of the i-th region to be processed includes: Increment the adjustment coefficient of the i-th region to be processed by 1 and obtain the increase ratio of the i-th region to be processed; Multiply the typical gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed by the increase ratio of the i-th region to be processed, and obtain the target gray-level gradient of the j-th pixel in the gray-level image of the i-th region to be processed.

8. A real-time detection and data processing system for surface defects in welded plastic steel profiles, characterized in that, The system includes: The acquisition module is used to acquire the welding area of ​​the PVC profile after welding, divide the welding area into multiple areas to be processed, and acquire grayscale images of each area to be processed. The first data processing module is used to obtain standard gray values, and to obtain the gray difference rate of each pixel in the gray image of each region to be processed based on the real-time gray values ​​and standard gray values ​​of each pixel in the gray image of each region to be processed, and to obtain the adjustment coefficient of the gray image of each region to be processed based on the average value of all gray difference rates in each region to be processed. The second data processing module is used to obtain the typical gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed based on the gray level difference rate between the j-th pixel and its neighboring pixels in the gray level image of the i-th region to be processed, and to obtain the target gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed based on the typical gray level gradient of the j-th pixel in the gray level image of the i-th region to be processed and the adjustment coefficient of the i-th region to be processed. The defect detection module is used to obtain the defect pixel set of each region to be processed based on the target gray-level gradient of each pixel in the gray-level image of each region to be processed, and to obtain the defect detection result of each region to be processed based on the number of pixels in the defect pixel set of each region to be processed.

9. The real-time detection data processing system for welded surface defects of PVC profiles according to claim 8, characterized in that, The defect detection module is also used for: Multiple pixels are extracted from the grayscale images of each region to be processed and a defect pixel set is formed for each region to be processed. The target grayscale gradient of any pixel in the defect pixel set exceeds a first preset threshold, and any pixel in the defect pixel set is adjacent to at least one other pixel.

10. The real-time detection data processing system for welded surface defects of PVC profiles according to claim 8, characterized in that, The defect detection module is also used for: Divide the number of pixels in the defect pixel set of the i-th region to be processed by the number of pixels in the grayscale image of the i-th region to be processed to obtain the defect ratio. Obtain the defect detection level of the i-th region to be processed based on the defect ratio and use the defect detection level as the defect detection result.