Film cutting product defect detection method and system based on visual detection
By analyzing the changes in the light refraction angle of the cut film product using high-resolution imaging and optical flow tracing technology, a path deviation distribution map is constructed. Combined with the characteristics of light intensity and boundary curvature, the defect boundary is optimized, enabling accurate identification and location of bubble defects in the cut film product, thus solving the problem of insufficient detection accuracy in existing technologies.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN SHUNWENJIA TECH CO LTD
- Filing Date
- 2026-05-19
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies lack sufficient precision in detecting bubble defects in film-cut products, making it difficult to accurately identify and spatially locate microscopic bubble defects, resulting in a high misjudgment rate.
High-resolution imaging equipment is used to acquire surface images of the cut film product, and light intensity correction and bubble defect verification are performed. Optical flow tracing technology is used to analyze the refraction angle change, construct a path deviation spatial mapping distribution map, and combine the light intensity fluctuation characteristics and boundary curvature characteristics to optimize the defect boundary. Pixel-level segmentation and coordinate calibration are performed to finally determine the precise location of the bubble defect.
It significantly improves the accuracy and anti-interference ability of defect detection, realizes precise mapping from image features to spatial coordinates, and enhances the quantitative level of the detection system and the direct application value of automated quality control.
Smart Images

Figure CN122391185A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of industrial visual inspection and modern industrial manufacturing, and in particular to a method and system for detecting defects in cut film products based on visual inspection. Background Technology
[0002] Currently, in the fields of industrial visual inspection and modern industrial manufacturing, quality inspection of film-cut products is a crucial link in ensuring product performance and market competitiveness. With the popularization of intelligent and automated technologies, defect detection technology based on machine vision has become a focus of industry attention due to its non-contact and high-efficiency characteristics.
[0003] However, these methods have significant limitations when dealing with microscopic defects such as bubbles in cut products. Bubble defects cause localized changes in the material's refractive index, leading to subtle shifts in the light propagation path. This change in optical properties manifests as slight variations in grayscale distribution and blurred boundaries in images. Traditional methods rely on apparent grayscale or contrast features, making it difficult to capture these subtle changes caused by optical mechanisms. This results in insufficient accuracy in identifying bubble defects, especially for tiny bubbles with grayscale levels close to the background, which are prone to missed detections or misjudgments.
[0004] In summary, existing technologies suffer from insufficient utilization of the deep optical mechanisms of defects, difficulty in accurately identifying and spatially locating microscopic bubble defects, resulting in a high false positive rate and insufficient detection accuracy. Summary of the Invention
[0005] This invention provides a visual inspection-based method and system for detecting defects in cut film products, in order to solve the technical problems of insufficient accuracy and difficulty in precise positioning of bubble defects in cut film products in the prior art.
[0006] In a first aspect, to solve the above-mentioned technical problems, the present invention provides a method for detecting defects in film-cut products based on visual inspection, comprising: Acquire high-resolution surface images of the cut film product and perform light intensity correction. Perform bubble defect verification processing on the corrected image. If the verification is successful, the verified image is determined as the initial image data. Optical flow tracing is performed on the changes in the refraction angle of light in the initial image data to analyze the distribution of differences in refraction angles, determine the refraction difference region, perform path deviation analysis on the refraction difference region, and construct a spatial mapping distribution map of the path deviation. Identify local light-gathering areas in the spatial mapping distribution map and filter out candidate locations for bubble defects. Extract the light intensity fluctuation characteristics and initial contours of the region boundaries of the candidate locations for bubble defects and perform spatial integration processing to determine the preliminary defect range. For the initial defect range, boundary curvature features are extracted from the spatial mapping distribution map. Based on the boundary curvature features, the boundary details of the initial defect range are optimized to obtain a boundary enhancement image. Based on the enhanced boundary image, the defect boundary is accurately extracted to obtain the precise defect boundary; Based on the precise defect boundary, vector distribution weight data and coordinate point mapping calibration data are obtained from the spatial mapping distribution map. The vector distribution weight data and coordinate point mapping calibration data are fused together and deviation analysis is performed to obtain deviation distribution information. The offset correction process is performed on the precise defect boundary based on the deviation distribution information to determine the final position coordinates of the bubble defect. Then, a spatial transformation process is performed on the final position coordinates to determine the final position of the defect.
[0007] In one optional implementation, the process of acquiring a high-resolution surface image of the cut film product and performing light intensity correction, then performing bubble defect verification processing on the corrected image, and if the verification passes, determining the verified image as the initial image data, includes: The surface images of the cut film product are acquired using a high-resolution imaging device to obtain the first image set; The first image set is subjected to light intensity fluctuation correction to obtain the second image set; For the second image set, edge detection is used to extract the angle change of light refraction. If the angle change exceeds a preset angle change threshold, it is determined that there is a potential bubble defect and the potential defect area is marked to obtain the marked third image set. The potential defect region in the third image set is verified by grayscale distribution detection. If the verification is successful, it is determined that there is a bubble defect, and the third image set is determined as the initial image data.
[0008] In one optional implementation, the step of performing optical flow tracing on the changes in the refraction angle of light in the initial image data, analyzing the distribution of differences in refraction angles, determining regions of refraction difference, performing path deviation analysis on the regions of refraction difference, and constructing a spatial mapping distribution map of the path deviation includes: Optical flow tracing is performed on the initial image data to obtain offset vector data corresponding to the change in the light refraction angle, forming an offset vector distribution set; Based on the set of offset vector distributions, offset density and directional consistency are calculated. Regions with uneven distribution are screened and marked based on the offset density and directional consistency to identify potential regions with refraction differences. Based on the refractive difference region, path deviation analysis is performed to generate path deviation mapping data; A spatial mapping distribution map of path deviations is constructed based on the path deviation mapping data.
[0009] In one optional implementation, the step of identifying local light-gathering areas in the spatial mapping distribution map and filtering candidate locations for bubble defects from them, extracting the light intensity fluctuation characteristics and initial contours of the region boundaries of the candidate locations for bubble defects and performing spatial integration processing to determine the preliminary defect range includes: Based on the spatial mapping distribution map, local light gathering regions are identified, and the light distribution characteristics of the local light gathering regions are obtained to form a feature set; If the features in the feature set exceed a preset feature threshold, the offset vector density of the local light-gathering region is calculated. If the offset vector density exceeds a preset density threshold, the corresponding region is marked as a candidate location for bubble defects. Extract the light intensity fluctuation features of the candidate locations of the bubble defects, and simultaneously extract the initial contour of the region boundary of the candidate locations of the bubble defects to determine the boundary feature set; Based on the boundary feature set and the light intensity fluctuation features, spatial mapping and integration processing is performed to obtain the preliminary defect range.
[0010] In one optional implementation, the step of extracting boundary curvature features from the spatial mapping distribution map for the initial defect range, and optimizing the boundary details of the initial defect range based on the boundary curvature features to obtain a boundary-enhanced image, includes: From the spatial mapping distribution map, boundary curvature features are extracted for the preliminary defect range to obtain an initial boundary feature set; Based on the boundary curvature characteristics, the boundary of the initial defect range is smoothed and optimized to generate an optimized boundary data set; If the feature values in the optimized boundary data set do not meet the preset standard, then the boundary data is subjected to image enhancement processing to obtain a boundary enhanced image.
[0011] In one optional implementation, the step of accurately extracting the defect boundary based on the boundary enhancement image to obtain the accurate defect boundary includes: Set a grayscale threshold, and perform preliminary segmentation of the boundary enhancement image based on the grayscale threshold to obtain an initial boundary region; The light intensity characteristics of the initial boundary region are obtained, and the initial boundary region is adjusted according to the light intensity characteristics to obtain the adjusted boundary region; Pixel-level analysis is performed on the grayscale change information of the adjusted boundary region, and the adjusted boundary region is segmented based on the grayscale change information to obtain the precise defect boundary.
[0012] In one optional implementation, the step of obtaining vector distribution weight data and coordinate point mapping calibration data from the spatial mapping distribution map based on the precise defect boundary, fusing the vector distribution weight data and the coordinate point mapping calibration data, and performing deviation analysis to obtain deviation distribution information includes: Based on the precise defect boundary, extract vector distribution data and coordinate point data from the spatial mapping distribution map; The vector distribution data is weighted and fused to obtain vector distribution weight data, and the coordinate point data is mapped and calibrated to obtain coordinate point mapping calibration data. The vector distribution weight data and the coordinate point mapping calibration data are fused together, and then deviation analysis is performed to generate the deviation distribution information.
[0013] Secondly, the present invention provides a visual inspection-based defect detection system for cut film products, comprising: The data acquisition module is used to acquire high-resolution surface images of the film-cut products and perform light intensity correction. The corrected images are then subjected to bubble defect verification processing. If the verification is successful, the verified image is determined as the initial image data. The optical flow tracing module is used to perform optical flow tracing on the changes in the refraction angle of light in the initial image data, analyze the distribution of differences in refraction angles, determine the refraction difference region, perform path deviation analysis on the refraction difference region, and construct a spatial mapping distribution map of the path deviation. The candidate localization module is used to identify local light gathering areas in the spatial mapping distribution map and filter candidate locations of bubble defects from them. It extracts the light intensity fluctuation characteristics and initial contours of the region boundaries of the candidate locations of bubble defects and performs spatial integration processing to determine the preliminary defect range. The boundary optimization module is used to extract boundary curvature features from the spatial mapping distribution map for the initial defect range, and optimize the boundary details of the initial defect range according to the boundary curvature features to obtain a boundary enhancement image; The contour extraction module is used to accurately extract the defect boundary based on the boundary enhancement image to obtain the accurate defect boundary; The data fusion module is used to obtain vector distribution weight data and coordinate point mapping calibration data from the spatial mapping distribution map based on the precise defect boundary, fuse the vector distribution weight data and the coordinate point mapping calibration data and perform deviation analysis to obtain deviation distribution information; The precise positioning module is used to perform offset correction processing on the precise defect boundary according to the deviation distribution information, determine the final position coordinates of the bubble defect, and perform spatial transformation processing on the final position coordinates to determine the final position of the defect.
[0014] Thirdly, the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement a visual inspection-based defect detection method for film-cut products as described in any one of the above.
[0015] Fourthly, the present invention also provides a computer-readable storage medium comprising a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform any of the above-described visual inspection-based defect detection method for film-cut products.
[0016] Compared with the prior art, the present invention has the following beneficial effects: (1) This invention acquires surface images of the cut film product using a high-resolution imaging device, and performs light intensity correction and bubble defect verification processing based on the changes in light refraction angle and intensity fluctuations at the material interface. This effectively eliminates interference caused by uneven ambient lighting and surface reflection, and solves the problems of low signal-to-noise ratio and blurred defect features caused by light fluctuations in the original image data. By analyzing the refractive index difference distribution through optical flow tracing technology, calculating the offset vector density and direction consistency characteristics, and constructing a path deviation spatial mapping distribution map, the microscopic and invisible light path offset is quantified into visualized spatial deviation data. This process achieves deep feature extraction from the original image to the physical mechanism of the defect. By removing surface interference through optical correction and optical flow analysis, the essential optical anomalies caused by bubbles are directly captured, providing stable and reliable deviation distribution information for subsequent defect identification, and significantly improving the accuracy and anti-interference ability of the initial defect location.
[0017] (2) This invention accurately determines the candidate locations of bubble defects by detecting local light aggregation patterns in the path deviation spatial mapping distribution map and filtering them in combination with the offset vector density threshold. This effectively focuses on the real optical anomaly areas, avoiding the waste of computational resources in global image analysis and the risk of misjudgment due to texture interference. By extracting the light intensity fluctuation features and the initial contour of the region boundary of the candidate locations and performing spatial integration processing, the preliminary defect range is determined. Then, the boundary curvature features extracted from the path deviation map are further used in combination with the region boundary smoothing processing technology to optimize the boundary details and generate a boundary enhancement image. This process realizes the step-by-step focusing and boundary optimization of the defect area. By using multi-feature (optical flow, intensity, curvature) fusion and spatial integration, false defect interference is eliminated. By using curvature analysis and smoothing processing, boundary burrs caused by noise or irregular light spots are corrected, thereby improving the accuracy of defect range delineation and boundary clarity, laying a solid foundation for subsequent pixel-level fine extraction.
[0018] (3) This invention analyzes the boundary curvature features and light interaction intensity distribution characteristics through boundary enhancement images, and uses pixel-level segmentation technology to complete the precise extraction of boundary pixels, obtaining accurate defect boundary contours. This solves the problem of insufficient accuracy of traditional edge detection methods in areas with blurred boundaries and low contrast. Based on the accurate defect boundary contours, the vector distribution weight fusion results in the path deviation spatial mapping distribution map and the coordinate point mapping calibration data are fused together, and offset correction spatial transformation processing is performed to accurately map the pixel coordinates in the image to the real physical space coordinate system of the product. This process realizes accurate mapping and closed-loop positioning from image features to spatial coordinates. Pixel-level segmentation ensures the fidelity of the boundary geometry, and vector weight fusion and coordinate calibration eliminate systematic and random errors. Finally, the precise spatial coordinates of the bubble defect on the film-cut product are output, thus realizing a closed loop from defect "identification" to "positioning", which greatly improves the quantitative level of the detection system and its direct application value in automated quality control. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the visual inspection-based defect detection method for film-cut products provided in the first embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of the visual inspection-based defect detection system for film-cut products provided in the second embodiment of the present invention. Detailed Implementation
[0020] 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Reference Figure 1 The first embodiment of the present invention provides a method for detecting defects in film-cut products based on visual inspection, comprising the following steps: S101: Acquire a high-resolution surface image of the film-cut product and perform light intensity correction. Perform bubble defect verification processing on the corrected image. If the verification is successful, the verified image is determined as the initial image data. S102, perform optical flow tracing on the changes in the light refraction angle in the initial image data, analyze the difference distribution of the refraction angle, determine the refraction difference region, perform path deviation analysis on the refraction difference region, and construct a spatial mapping distribution map of the path deviation. S103, identify local light gathering areas in the spatial mapping distribution map and filter candidate locations of bubble defects from them, extract the light intensity fluctuation characteristics and initial contours of the region boundaries of the candidate locations of bubble defects and perform spatial integration processing to determine the preliminary defect range; S104, for the preliminary defect range, extract boundary curvature features from the spatial mapping distribution map, and optimize the boundary details of the preliminary defect range according to the boundary curvature features to obtain a boundary enhancement image; S105, Based on the boundary enhancement image, the defect boundary is accurately extracted to obtain the accurate defect boundary; S106, Based on the precise defect boundary, obtain vector distribution weight data and coordinate point mapping calibration data from the spatial mapping distribution map, fuse the vector distribution weight data and coordinate point mapping calibration data and perform deviation analysis to obtain deviation distribution information; S107, perform offset correction processing on the precise defect boundary according to the deviation distribution information, determine the final position coordinates of the bubble defect, and perform spatial transformation processing on the final position coordinates to determine the final position of the defect.
[0022] In step S101, a high-resolution surface image of the cut film product is acquired and light intensity correction is performed. The corrected image is then subjected to bubble defect verification processing. If the verification passes, the verified image is determined as the initial image data, including: The surface images of the cut film product are acquired using a high-resolution imaging device to obtain the first image set; The first image set is subjected to light intensity fluctuation correction to obtain the second image set; For the second image set, edge detection is used to extract the angle change of light refraction. If the angle change exceeds a preset angle change threshold, it is determined that there is a potential bubble defect and the potential defect area is marked to obtain the marked third image set. The potential defect region in the third image set is verified by grayscale distribution detection. If the verification is successful, it is determined that there is a bubble defect, and the third image set is determined as the initial image data.
[0023] In the step of acquiring images of the cut film product surface using a high-resolution imaging device to obtain the first image set, an industrial-grade CCD camera with a resolution of 4096×4096 pixels is used, covering a 100mm×100mm area on the cut film product surface. The camera is equipped with a ring LED light source to ensure illumination uniformity of over 95%. The image acquisition frequency is 30 frames per second, generating the first image set containing the surface microstructure, providing a high-quality data foundation for subsequent defect detection.
[0024] In the step of correcting light intensity fluctuations in the first image set to obtain the second image set, for example, to address the uneven brightness caused by changes in ambient light in the first image set, an adaptive histogram equalization algorithm is used. For example, the block size is set to a commonly used engineering setting of 8×8. Specifically, the image grayscale distribution is analyzed. If the standard deviation of the grayscale value exceeds a preset threshold (e.g., 25), this threshold is set based on statistical analysis of the grayscale distribution of 200 normal film-cut product images acquired under standard lighting conditions (illuminance 500 lux), with a confidence level of 95%. The standard deviation of grayscale in normal images is concentrated between 15 and 20; to allow for margin, it is set to 25, adjusting the overall brightness to the standard range (grayscale value 0-255), generating a second image set with uniform illumination. This correction effectively eliminates shadow and reflection interference, improving the accuracy of subsequent analysis.
[0025] For the second image set, edge detection is used to extract the change in the angle of light refraction. If the angle change exceeds a preset angle change threshold, a potential bubble defect is identified and the potential defect area is marked, resulting in a marked third image set. For example, the Canny edge detection algorithm is used to analyze the second image set, extract edge features, and calculate the change in the angle of light refraction. The preset angle change threshold is set based on the optical properties of the material. For example, for PET optical films, based on their refractive index and the angle of light incidence, it is found that the normal range of light refraction angle change is 5%, therefore the preset angle change threshold is set to 5°. If an angle change of 8° is detected in a certain area, it is marked as a potential bubble defect area, and a third image set is generated.
[0026] In the step of verifying the potential defect region in the third image set through grayscale distribution detection, if the verification passes, the presence of a bubble defect is confirmed, and the third image set is determined as the initial image data, for example, grayscale distribution statistical analysis is performed on the marked region to calculate the mean and standard deviation of grayscale within the region. If the grayscale variance exceeds the normal range (e.g., the standard deviation of the normal region is 7, while the standard deviation of the defect region reaches 11), this data is based on statistics of 300 sample images after light intensity correction, with a confidence level of 95%. The grayscale standard deviation of the normal region is concentrated between 6 and 8, while the standard deviation of the bubble defect region usually exceeds 10, and the distribution shows typical bubble characteristics (dark center, bright edges), then the presence of a bubble defect is confirmed. After successful verification, the third image set is determined as the initial image data to provide reliable input for subsequent optical flow tracing. If the verification fails, the potential defect region is excluded and does not proceed to subsequent processing.
[0027] In step S102, optical flow tracing is performed on the changes in the light refraction angle in the initial image data to analyze the distribution of differences in refraction angles, determine the regions of refraction difference, perform path deviation analysis on the regions of refraction difference, and construct a spatial mapping distribution map of the path deviation, including: Optical flow tracing is performed on the initial image data to obtain offset vector data corresponding to the change in the light refraction angle, forming an offset vector distribution set; Based on the set of offset vector distributions, offset density and directional consistency are calculated. Regions with uneven distribution are screened and marked based on the offset density and directional consistency to identify potential regions with refraction differences. Based on the refractive difference region, path deviation analysis is performed to generate path deviation mapping data; A spatial mapping distribution map of path deviations is constructed based on the path deviation mapping data.
[0028] In the step of performing optical flow tracing on the initial image data to obtain offset vector data corresponding to changes in the light refraction angle and forming an offset vector distribution set, the Lucas-Kanade optical flow algorithm is used, for example, to process the initial image data and track the motion trajectory of pixels between adjacent frames. The algorithm parameters are set to a window size of 15×15 pixels and a maximum pyramid level of 3. By calculating the optical flow field, offset vector data is generated, recording the motion direction and amplitude of each pixel to form an offset vector distribution set. This processing can effectively capture subtle changes in the light path caused by bubbles.
[0029] In the step of determining potential refractive difference regions by calculating the offset density and directional consistency based on the offset vector distribution set, and filtering and labeling unevenly distributed regions based on the offset density and directional consistency, for example, the offset vector density and directional consistency index of each local region (e.g., a 10×10 pixel block) are calculated. The directional consistency index is measured by calculating the variance of the offset vector direction angle within the local region; the smaller the variance, the higher the directional consistency. The preset density threshold is 5 vectors per pixel block. Based on the analysis of 150 normal cut film product images, the vector density of normal regions is usually 2-3 vectors / pixel block, with a confidence level of 95%. The directional consistency threshold is set to a variance of 0.3 (unit: radians²), based on the fact that the directional consistency variance of normal regions is usually below 0.3. If a region has a vector density of 8 vectors / pixel block and a directional consistency of only 0.6, it is marked as a refractive difference region.
[0030] In the step of generating path deviation mapping data based on the refractive difference region, path deviation quantification analysis is performed on the marked refractive difference region, for example. The difference between the actual optical path and the ideal optical path is compared. The ideal optical path is obtained by acquiring 50 images of the same defect-free cut film product under the same imaging conditions, and calculating the average value of the optical flow vector at each pixel. The path deviation value is obtained by calculating the Euclidean distance between the actual optical flow vector and the reference vector, in pixels. For example, in the bubble defect region, the path deviation can reach 3-5 pixels, while the deviation in the normal region is less than 1 pixel. Path deviation mapping data containing the deviation amplitude and location is generated, providing a basis for constructing a spatial distribution map.
[0031] In the step of constructing a spatial distribution map of path deviations based on the path deviation mapping data, an interpolation algorithm is used to convert the discrete path deviation mapping data into a continuous spatial distribution map. A bicubic interpolation method is used with a kernel size of 16×16 pixels and a smoothing parameter of 0.5 to balance smoothness and detail preservation, generating a spatial distribution map with the same resolution as the original image. In the map, color intensity represents the magnitude of the deviation; for example, blue represents low deviation (0-1 pixel) and red represents high deviation (>3 pixels). This visual distribution map intuitively shows the distribution of defects, facilitating subsequent analysis and processing.
[0032] In step S103, local light-gathering regions in the spatial mapping distribution map are identified, and candidate locations for bubble defects are selected from them. The light intensity fluctuation characteristics and initial contours of the region boundaries of the candidate locations are extracted and spatially integrated to determine the preliminary defect range, including: Based on the spatial mapping distribution map, local light gathering regions are identified, and the light distribution characteristics of the local light gathering regions are obtained to form a feature set; If the features in the feature set exceed a preset feature threshold, the offset vector density of the local light-gathering region is calculated. If the offset vector density exceeds a preset density threshold, the corresponding region is marked as a candidate location for bubble defects. Extract the light intensity fluctuation features of the candidate locations of the bubble defects, and simultaneously extract the initial contour of the region boundary of the candidate locations of the bubble defects to determine the boundary feature set; Based on the boundary feature set and the light intensity fluctuation features, spatial mapping and integration processing is performed to obtain the preliminary defect range.
[0033] In the step of identifying local light-gathering regions based on the spatial mapping distribution map and obtaining the light distribution characteristics of these regions to form a feature set, a region growing algorithm is used, for example, to identify these regions from the spatial mapping distribution map. The pixel with the largest path deviation value is used as the seed point, and the growth condition is that the deviation between adjacent pixels is less than 1 pixel. Connected regions are identified as light-gathering areas. The light distribution characteristics of each region are extracted, including the average deviation value, region area, shape factor, etc., to form a feature set. This identification method can effectively locate regions with concentrated optical anomalies.
[0034] If the features in the feature set exceed a preset feature threshold, the offset vector density of the local light-gathering region is calculated. If the offset vector density exceeds a preset density threshold, the corresponding region is marked as a candidate location for a bubble defect. For example, the preset feature thresholds include: a region area greater than 50 pixels and an average deviation value greater than 2.5 pixels. This threshold is based on the analysis of 100 known defect samples with a confidence level of 95%. The region area is greater than 50 pixels to exclude noise points, and the average deviation value is greater than 2.5 pixels because the deviation of a normal region is usually less than 1 pixel. If a region has an area of 80 pixels and an average deviation of 3.0 pixels, the offset vector data of that region is extracted from the offset vector distribution set to calculate its offset vector density. The preset density threshold is 6 per pixel block. If the actual density reaches 8 per pixel block, it is marked as a candidate location for a bubble defect.
[0035] In the step of extracting the light intensity fluctuation features of the candidate locations of the bubble defects and simultaneously extracting the initial contour of the region boundary of the candidate locations to determine the boundary feature set, for example, light intensity fluctuation features are extracted for each candidate location, including the mean intensity, variance, and gradient change. Simultaneously, the Moore neighborhood tracing algorithm is used to extract the region contour and calculate geometric features such as boundary curvature and perimeter. For example, bubble defects typically exhibit circular or elliptical boundaries with gentle curvature changes. These features are integrated to form a boundary feature set, providing a basis for defect confirmation.
[0036] In the step of spatial mapping and integration based on the boundary feature set and the light intensity fluctuation features to obtain the preliminary defect range, for example, a feature fusion algorithm is used to spatially integrate the boundary features and the light intensity fluctuation features. The preliminary defect range is determined by a weighted average method, combining boundary shape consistency and intensity fluctuation pattern. Boundary shape consistency is obtained by calculating the variance of boundary curvature. Specifically, curvature features of boundary points are extracted, and the central difference method is used to process discrete boundary points to calculate curvature values, then the variance of these curvature values is calculated. Intensity fluctuation amplitude is measured by the range of gray values within the calculation area, i.e., the difference between the maximum and minimum gray values. Based on feature importance allocation, the weight of the boundary curvature feature is set to 0.6, and the weight of the intensity fluctuation feature is set to 0.4. Based on regression analysis of 100 defect samples, it was found that the influence of boundary curvature on the division of the defect range is slightly higher than that of intensity fluctuation; therefore, a weight combination of 0.6 and 0.4 is set. For each candidate region, the curvature variance and intensity range values are first normalized to the range [0,1] using min-max normalization. Then, the normalized curvature consistency feature value and the normalized intensity fluctuation feature value are multiplied by their respective weights. These two weighted values are then summed to obtain a comprehensive score. If the comprehensive score exceeds a threshold of 0.5, it is confirmed as a defect range; otherwise, the candidate region is excluded, thus generating preliminary defect range data including location, shape, and size.
[0037] In step S104, for the preliminary defect range, boundary curvature features are extracted from the spatial mapping distribution map. Based on the boundary curvature features, the boundary details of the preliminary defect range are optimized to obtain a boundary enhancement image, including: From the spatial mapping distribution map, boundary curvature features are extracted for the preliminary defect range to obtain an initial boundary feature set; Based on the boundary curvature characteristics, the boundary of the initial defect range is smoothed and optimized to generate an optimized boundary data set; If the feature values in the optimized boundary data set do not meet the preset standard, then the boundary data is subjected to image enhancement processing to obtain a boundary enhanced image.
[0038] In the step of extracting boundary curvature features from the spatial mapping distribution map to obtain an initial boundary feature set for the initial defect range, exemplarily, the curvature features of boundary points are extracted from the spatial mapping distribution map for the initial defect range. The curvature value of each boundary point is calculated using a differential geometry method, specifically by calculating the first and second derivatives of the boundary points to estimate the curvature. The central difference method is used to process discrete boundary points to generate the initial boundary feature set. For bubble defects, the boundary curvature typically exhibits a continuous and gradual change, while the curvature of boundaries caused by noise changes drastically. This feature extraction provides key parameters for subsequent optimization.
[0039] In the step of smoothing and optimizing the boundary of the initial defect range based on the boundary curvature characteristics to generate an optimized boundary data set, for example, points with drastic curvature changes are identified as noise points based on the boundary curvature characteristics, and a Gaussian filtering algorithm is used to smooth the boundary. The filter size is set to 5×5, and the standard deviation is 1.5, effectively removing boundary burrs while preserving the main shape features. After smoothing, the boundary point coordinates are recalculated to generate the optimized boundary data set. This optimization can significantly improve the boundary quality and enhance the accuracy of the defect contour.
[0040] If the feature values in the optimized boundary data set do not meet the preset standards, image enhancement processing is performed on the boundary data to obtain a boundary enhanced image. For example, the preset standards include a boundary continuity index greater than 0.8 and curvature consistency less than 0.1. These thresholds are determined based on ROC curve analysis of 500 normal and defective samples to balance false negative and false positive rates. The boundary continuity index is measured by calculating the connectivity between boundary points, specifically by calculating the proportion of continuous segments. Continuous segments are identified using an 8-neighborhood connected component labeling algorithm, with a minimum continuous segment length of 5 pixels to avoid noise interference. Curvature consistency is measured by calculating the variance of boundary curvature; the smaller the value, the more consistent the boundary. The preset standards are based on the assumption that normal boundaries typically have a continuity index greater than 0.9 and a curvature consistency less than 0.1. If the optimized boundary data still does not meet the standards (e.g., a continuity index of only 0.6), image enhancement processing is performed. A contrast-limited adaptive histogram equalization (CLAHE) algorithm is used, with a block size of 8×8 and a contrast limit of 2.0, to enhance the contrast between the boundary and the background, generating a boundary enhanced image. This processing can further improve boundary visibility and detectability.
[0041] In step S105, based on the boundary enhancement image, the defect boundary is precisely extracted to obtain the precise defect boundary, including: Set a grayscale threshold, and perform preliminary segmentation of the boundary enhancement image based on the grayscale threshold to obtain an initial boundary region; The light intensity characteristics of the initial boundary region are obtained, and the initial boundary region is adjusted according to the light intensity characteristics to obtain the adjusted boundary region; Pixel-level analysis is performed on the grayscale change information of the adjusted boundary region, and the adjusted boundary region is segmented based on the grayscale change information to obtain the precise defect boundary.
[0042] In the step of setting a grayscale threshold and performing preliminary segmentation of the boundary enhancement image based on the grayscale threshold to obtain the initial boundary region, Otsu's Method is used, for example, to automatically calculate the optimal grayscale threshold for the boundary enhancement image. This algorithm finds the threshold point that maximizes the inter-class variance based on the image's grayscale histogram. Based on the calculated threshold (e.g., a grayscale value of 128), the image is binarized, converting the grayscale image to a black and white image. Pixels with grayscale values greater than the threshold are set to white, and others to black, thus initially segmenting the boundary region and obtaining the initial boundary region data. This method can adapt to image segmentation under different lighting conditions.
[0043] In the step of obtaining the light intensity characteristics of the initial boundary region and adjusting the initial boundary region based on these characteristics, for example, the light intensity distribution characteristics of the initial boundary region are analyzed, including intensity gradient and local contrast. Based on these characteristics, morphological operations (such as opening and closing operations) are used to adjust the boundary region, remove isolated noise points, and fill small holes. For example, a 3×3 circular structuring element is used to perform a closing operation to smooth the boundary and connect broken parts, generating the adjusted boundary region.
[0044] In the step of performing pixel-level analysis on the grayscale change information of the adjusted boundary region and segmenting the adjusted boundary region based on the grayscale change information to obtain the accurate defect boundary, for example, pixel-level grayscale analysis is performed on the adjusted boundary region to calculate the gradient magnitude and direction of each pixel. The Canny edge detection algorithm is used, and the Sobel operator is used to calculate the gradient magnitude. Then, the gradient magnitude is normalized to the [0,1] interval through min-max normalization. A low threshold of 0.1 and a high threshold of 0.3 are set. These thresholds are based on the statistical distribution of the image gradient magnitude. The low threshold corresponds to the 20th percentile of the gradient magnitude, and the high threshold corresponds to the 80th percentile. The boundary pixels are accurately extracted, and the output is a binary image with connected edges, which is directly used as the accurate defect boundary.
[0045] In step S106, based on the precise defect boundary, vector distribution weight data and coordinate point mapping calibration data are obtained from the spatial mapping distribution map. The vector distribution weight data and the coordinate point mapping calibration data are fused and deviation analysis is performed to obtain deviation distribution information, including: Based on the precise defect boundary, extract vector distribution data and coordinate point data from the spatial mapping distribution map; The vector distribution data is weighted and fused to obtain vector distribution weight data, and the coordinate point data is mapped and calibrated to obtain coordinate point mapping calibration data. The vector distribution weight data and the coordinate point mapping calibration data are fused together, and then deviation analysis is performed to generate the deviation distribution information.
[0046] In the step of extracting vector distribution data and coordinate point data from the spatial mapping distribution map based on the precise defect boundary, exemplarily, vector distribution data and coordinate point data for the corresponding region are extracted from the spatial mapping distribution map based on the location information of the precise defect boundary. The vector distribution data includes the direction, magnitude, and density information of the offset vector; the coordinate point data records the spatial position of each boundary point. This extraction ensures that subsequent analysis is based on the most relevant optical feature data.
[0047] In the step of weighted fusion of the vector distribution data to obtain vector distribution weighted data, and mapping calibration of the coordinate point data to obtain coordinate point mapping calibration data, Principal Component Analysis (PCA) is used for weighted fusion of the vector distribution data. Specifically, the vector distribution data (including features such as vector direction and amplitude) is Z-score standardized to reduce dimensionality, and principal components are extracted. The variance contribution rate of each principal component is used as the feature weight. For example, the first principal component has a weight of 0.7, and the second principal component has a weight of 0.3, generating vector distribution weighted data. Simultaneously, the coordinate point data is mapped and calibrated. Using the internal parameters (such as focal length and principal point) and external parameters (such as rotation matrix and translation vector) obtained from camera calibration, an affine transformation model is used to convert the image coordinates into world coordinates. The affine transformation model is obtained through calibration using a calibration board, and its parameters include scaling, rotation, and translation matrices. This eliminates the influence of lens distortion, resulting in accurate coordinate point mapping calibration data.
[0048] In the step of fusing the vector distribution weight data and the coordinate point mapping calibration data, and then performing deviation analysis to generate the deviation distribution information, for example, the vector distribution weight data and the coordinate point mapping calibration data are weighted and fused. Specifically, the coordinate point data is multiplied by the vector weights to obtain weighted coordinate data. A Kalman filter algorithm is used to eliminate measurement noise. Here, the Kalman filter is used to smooth the measurement error of the static image. The state transition matrix is set as an identity matrix, and the process noise covariance is set according to the measurement accuracy. Then, deviation analysis is performed. The actual defect location is obtained from the weighted and fused coordinate data, and the theoretical location is obtained through a standard model of a defect-free product. The standard model is established by collecting images of 100 defect-free products and establishing an average boundary contour as a reference. The deviation between the actual defect location and the theoretical location is calculated, including parameters such as position offset and shape distortion, to generate comprehensive deviation distribution information. This analysis provides a quantitative basis for the final accurate positioning.
[0049] For example, S105 has output a circular outline containing 50 boundary points, with a center coordinate of approximately (100, 150) pixels and a precise defect boundary of 10 pixels in radius. Vector distribution data (including direction θ and amplitude d) and coordinate point data for the region corresponding to this boundary are extracted from the spatial mapping distribution map. For example, the standard deviation of direction θ in the vector data is 0.8 radians, the mean of amplitude d is 3.5 pixels, and the coordinate points are as follows (100, 150) pixels. Next, principal component analysis is performed on the vector distribution data, and weights are set according to the variance contribution rate of the principal components. For example, the first... The first principal component has a weight variance contribution rate of 70%, and the second principal component has a contribution rate of 30%, generating a weight vector [0.7, 0.3]. Simultaneously, the coordinate point data is calibrated by affine transformation using camera calibration parameters, converting the image coordinates to world coordinates, and calibrating the pixel coordinate point (100, 150) to (0.5mm, 0.75mm). Then, the weighted and calibrated data are fused, and the weighted coordinates (0.35mm, 0.225mm) are obtained through weighted calculation. Subsequently, Kalman filtering is used for smoothing to obtain enhanced coordinate data and generate comprehensive deviation distribution information.
[0050] In step S107, the precise defect boundary is offset and corrected according to the deviation distribution information to determine the final position coordinates of the bubble defect. Spatial transformation is then performed on the final position coordinates to determine the final position of the defect.
[0051] In the step of determining the final position coordinates of the bubble defect by performing offset correction processing on the precise defect boundary based on the deviation distribution information, for example, offset correction is performed on the adjusted boundary contour based on the position offset data in the deviation distribution information. The least squares method is used to fit the optimal correction parameters. Specifically, the actual coordinates of the precise defect boundary are matched with reference boundary points. The reference boundary points are obtained from the standard boundary model of a defect-free product. This model is obtained by averaging the boundary points of 50 defect-free samples. By minimizing the Euclidean distance error between the actual point and the reference point, the optimal translation vector and rotation matrix are solved to transform the boundary contour to the correct position. After correction, the centroid coordinates of the defect are calculated as the final position; for example, the center coordinates of the bubble defect are determined to be (x=245.36, y=132.75) pixels.
[0052] In the step of determining the final location of the defect by performing spatial transformation on the final position coordinates, for example, the pixel coordinates are converted into physical coordinates in the world coordinate system based on camera calibration parameters. These parameters are calculated using the Zhang Zhengyou calibration method by photographing a calibration board of known size (such as a checkerboard pattern) and calculating internal parameters and distortion coefficients. The conversion formula is based on a perspective projection model and considers lens distortion correction. For example, pixel coordinates (245.36, 132.75) are converted into physical coordinates (12.27mm, 6.64mm), accurately representing the actual location of the defect on the cut film product. This spatial transformation ensures that the inspection results can be directly used for production quality control and process optimization.
[0053] In summary, this invention discloses a visual inspection-based defect detection method for film-cut products. It acquires high-resolution surface images of the film-cut products and performs light intensity correction. The corrected images are then subjected to bubble defect verification processing. If the verification passes, the verified image is determined as the initial image data. Optical flow tracing is performed on the changes in the refraction angle of the light in the initial image data to analyze the distribution of refraction angle differences and identify refraction difference regions. Path deviation analysis is then performed on these regions to construct a spatial mapping distribution map of the path deviation. Local light convergence regions are identified in the spatial mapping distribution map, and candidate locations for bubble defects are selected from them. The light intensity fluctuation characteristics and initial contours of the region boundaries of the candidate bubble defect locations are extracted and spatially integrated to determine the preliminary defects. The process involves several steps: First, for the initial defect range, boundary curvature features are extracted from the spatial mapping distribution map. Based on these features, the boundary details of the initial defect range are optimized to obtain an enhanced boundary image. Then, based on this enhanced image, the defect boundary is precisely extracted to obtain the accurate defect boundary. Next, based on the accurate defect boundary, vector distribution weight data and coordinate point mapping calibration data are obtained from the spatial mapping distribution map. These data are then fused with the vector distribution weight data and coordinate point mapping calibration data, and deviation analysis is performed to obtain deviation distribution information. Finally, the accurate defect boundary is offset-corrected based on the deviation distribution information to determine the final position coordinates of the bubble defect. Spatial transformation is then performed on these final position coordinates to determine the final location of the defect, significantly improving the quality control efficiency and accuracy of the cut film products.
[0054] Reference Figure 2 The second embodiment of the present invention provides a visual inspection-based defect detection system for cut film products, comprising: The data acquisition module is used to acquire high-resolution surface images of the film-cut products and perform light intensity correction. The corrected images are then subjected to bubble defect verification processing. If the verification is successful, the verified image is determined as the initial image data. The optical flow tracing module is used to perform optical flow tracing on the changes in the refraction angle of light in the initial image data, analyze the distribution of differences in refraction angles, determine the refraction difference region, perform path deviation analysis on the refraction difference region, and construct a spatial mapping distribution map of the path deviation. The candidate localization module is used to identify local light gathering areas in the spatial mapping distribution map and filter candidate locations of bubble defects from them. It extracts the light intensity fluctuation characteristics and initial contours of the region boundaries of the candidate locations of bubble defects and performs spatial integration processing to determine the preliminary defect range. The boundary optimization module is used to extract boundary curvature features from the spatial mapping distribution map for the initial defect range, and optimize the boundary details of the initial defect range according to the boundary curvature features to obtain a boundary enhancement image; The contour extraction module is used to accurately extract the defect boundary based on the boundary enhancement image to obtain the accurate defect boundary; The data fusion module is used to obtain vector distribution weight data and coordinate point mapping calibration data from the spatial mapping distribution map based on the precise defect boundary, fuse the vector distribution weight data and the coordinate point mapping calibration data and perform deviation analysis to obtain deviation distribution information; The precise positioning module is used to perform offset correction processing on the precise defect boundary according to the deviation distribution information, determine the final position coordinates of the bubble defect, and perform spatial transformation processing on the final position coordinates to determine the final position of the defect.
[0055] It should be noted that the visual inspection-based film-cutting product defect detection system provided in this embodiment of the invention is used to execute all the process steps of the visual inspection-based film-cutting product defect detection method in the above embodiment. The working principles and beneficial effects of the two are one-to-one, so they will not be described again.
[0056] This invention also provides an electronic device. The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a polishing trajectory intelligent control program based on multi-sensor fusion. When the processor executes the computer program, it implements the steps in the various embodiments of the above-described polishing trajectory intelligent control method based on multi-sensor fusion, for example... Figure 1 The step S101 shown. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the above system embodiments, such as the spectrum feature acquisition module.
[0057] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.
[0058] The electronic device may be a desktop computer, laptop, handheld computer, or smart tablet, etc. The electronic device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. It may include more or fewer components than described above, or combine certain components, or different components. For example, the electronic device may also include input / output devices, network access devices, buses, etc.
[0059] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the electronic device, connecting all parts of the electronic device via various interfaces and lines.
[0060] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0061] If the modules / units integrated into the electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or system capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0062] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0063] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.
Claims
1. A method for detecting defects in cut film products based on visual inspection, characterized in that, include: Acquire high-resolution surface images of the cut film product and perform light intensity correction. Perform bubble defect verification processing on the corrected image. If the verification is successful, the verified image is determined as the initial image data. Optical flow tracing is performed on the changes in the refraction angle of light in the initial image data to analyze the distribution of differences in refraction angles, determine the refraction difference region, perform path deviation analysis on the refraction difference region, and construct a spatial mapping distribution map of the path deviation. Identify local light-gathering areas in the spatial mapping distribution map and filter out candidate locations for bubble defects. Extract the light intensity fluctuation characteristics and initial contours of the region boundaries of the candidate locations for bubble defects and perform spatial integration processing to determine the preliminary defect range. For the initial defect range, boundary curvature features are extracted from the spatial mapping distribution map. Based on the boundary curvature features, the boundary details of the initial defect range are optimized to obtain a boundary enhancement image. Based on the enhanced boundary image, the defect boundary is accurately extracted to obtain the precise defect boundary; Based on the precise defect boundary, vector distribution weight data and coordinate point mapping calibration data are obtained from the spatial mapping distribution map. The vector distribution weight data and coordinate point mapping calibration data are fused together and deviation analysis is performed to obtain deviation distribution information. The offset correction process is performed on the precise defect boundary based on the deviation distribution information to determine the final position coordinates of the bubble defect. Then, a spatial transformation process is performed on the final position coordinates to determine the final position of the defect.
2. The method for detecting defects in film-cut products based on visual inspection according to claim 1, characterized in that, The process involves acquiring a high-resolution surface image of the cut film product and performing light intensity correction. The corrected image is then subjected to bubble defect verification. If the verification passes, the verified image is determined as the initial image data, including: The surface images of the cut film product are acquired using a high-resolution imaging device to obtain the first image set; The first image set is subjected to light intensity fluctuation correction to obtain the second image set; For the second image set, edge detection is used to extract the angle change of light refraction. If the angle change exceeds a preset angle change threshold, it is determined that there is a potential bubble defect and the potential defect area is marked to obtain the marked third image set. The potential defect region in the third image set is verified by grayscale distribution detection. If the verification is successful, it is determined that there is a bubble defect, and the third image set is determined as the initial image data.
3. The method for detecting defects in film-cut products based on visual inspection according to claim 1, characterized in that, The step of performing optical flow tracing on the changes in the refraction angle of light in the initial image data, analyzing the distribution of differences in refraction angles, determining regions of refraction difference, performing path deviation analysis on the regions of refraction difference, and constructing a spatial mapping distribution map of the path deviation includes: Optical flow tracing is performed on the initial image data to obtain offset vector data corresponding to the change in the light refraction angle, forming an offset vector distribution set; Based on the set of offset vector distributions, offset density and directional consistency are calculated. Regions with uneven distribution are screened and marked based on the offset density and directional consistency to identify potential regions with refraction differences. Based on the refractive difference region, path deviation analysis is performed to generate path deviation mapping data; A spatial mapping distribution map of path deviations is constructed based on the path deviation mapping data.
4. The method for detecting defects in film-cut products based on visual inspection according to claim 1, characterized in that, The process of identifying local light-gathering regions in the spatial mapping distribution map and filtering candidate locations for bubble defects, extracting the light intensity fluctuation features and initial contours of the region boundaries of the candidate locations for bubble defects and performing spatial integration processing to determine the preliminary defect range includes: Based on the spatial mapping distribution map, local light gathering regions are identified, and the light distribution characteristics of the local light gathering regions are obtained to form a feature set; If the features in the feature set exceed a preset feature threshold, the offset vector density of the local light-gathering region is calculated. If the offset vector density exceeds a preset density threshold, the corresponding region is marked as a candidate location for bubble defects. Extract the light intensity fluctuation features of the candidate locations of the bubble defects, and simultaneously extract the initial contour of the region boundary of the candidate locations of the bubble defects to determine the boundary feature set; Based on the boundary feature set and the light intensity fluctuation features, spatial mapping and integration processing is performed to obtain the preliminary defect range.
5. The method for detecting defects in film-cut products based on visual inspection according to claim 1, characterized in that, The step of extracting boundary curvature features from the spatial mapping distribution map for the initial defect range, and optimizing the boundary details of the initial defect range based on the boundary curvature features to obtain a boundary enhancement image includes: From the spatial mapping distribution map, boundary curvature features are extracted for the preliminary defect range to obtain an initial boundary feature set; Based on the boundary curvature characteristics, the boundary of the initial defect range is smoothed and optimized to generate an optimized boundary data set; If the feature values in the optimized boundary data set do not meet the preset standard, then the boundary data is subjected to image enhancement processing to obtain a boundary enhanced image.
6. The method for detecting defects in film-cut products based on visual inspection according to claim 1, characterized in that, The step of accurately extracting the defect boundary based on the boundary enhancement image to obtain the accurate defect boundary includes: Set a grayscale threshold, and perform preliminary segmentation of the boundary enhancement image based on the grayscale threshold to obtain an initial boundary region; The light intensity characteristics of the initial boundary region are obtained, and the initial boundary region is adjusted according to the light intensity characteristics to obtain the adjusted boundary region; Pixel-level analysis is performed on the grayscale change information of the adjusted boundary region, and the adjusted boundary region is segmented based on the grayscale change information to obtain the precise defect boundary.
7. The method for detecting defects in film-cut products based on visual inspection according to claim 1, characterized in that, The step involves obtaining vector distribution weight data and coordinate point mapping calibration data from the spatial mapping distribution map based on the precise defect boundary, fusing the vector distribution weight data and the coordinate point mapping calibration data, and performing deviation analysis to obtain deviation distribution information, including: Based on the precise defect boundary, extract vector distribution data and coordinate point data from the spatial mapping distribution map; The vector distribution data is weighted and fused to obtain vector distribution weight data, and the coordinate point data is mapped and calibrated to obtain coordinate point mapping calibration data. The vector distribution weight data and the coordinate point mapping calibration data are fused together, and then deviation analysis is performed to generate the deviation distribution information.
8. A visual inspection-based defect detection system for cut film products, characterized in that, include: The data acquisition module is used to acquire high-resolution surface images of the film-cut products and perform light intensity correction. The corrected images are then subjected to bubble defect verification processing. If the verification is successful, the verified image is determined as the initial image data. The optical flow tracing module is used to perform optical flow tracing on the changes in the refraction angle of light in the initial image data, analyze the distribution of differences in refraction angles, determine the refraction difference region, perform path deviation analysis on the refraction difference region, and construct a spatial mapping distribution map of the path deviation. The candidate localization module is used to identify local light gathering areas in the spatial mapping distribution map and filter candidate locations of bubble defects from them. It extracts the light intensity fluctuation characteristics and initial contours of the region boundaries of the candidate locations of bubble defects and performs spatial integration processing to determine the preliminary defect range. The boundary optimization module is used to extract boundary curvature features from the spatial mapping distribution map for the initial defect range, and optimize the boundary details of the initial defect range according to the boundary curvature features to obtain a boundary enhancement image; The contour extraction module is used to accurately extract the defect boundary based on the boundary enhancement image to obtain the accurate defect boundary; The data fusion module is used to obtain vector distribution weight data and coordinate point mapping calibration data from the spatial mapping distribution map based on the precise defect boundary, fuse the vector distribution weight data and the coordinate point mapping calibration data and perform deviation analysis to obtain deviation distribution information; The precise positioning module is used to perform offset correction processing on the precise defect boundary according to the deviation distribution information, determine the final position coordinates of the bubble defect, and perform spatial transformation processing on the final position coordinates to determine the final position of the defect.