A multispectral-based automobile part defect detection method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JILIN CHANGGUANG JINGYI INTELLIGENT TECHNOLOGY CO LTD
- Filing Date
- 2026-03-23
- Publication Date
- 2026-06-19
Smart Images

Figure CN121904040B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spectral detection technology, specifically to a method for detecting defects in automotive parts based on multispectral methods. Background Technology
[0002] In the detection of scratches on components such as air vents in automotive dashboards, collaborative recognition based on dual features of texture grayscale changes and surface height depressions is the core approach to improving detection accuracy. However, existing technologies exhibit the following shortcomings: First, most existing technologies employ single-dimensional feature recognition or simple feature overlay, lacking verification of the spatial correlation between texture grayscale changes and surface height depressions, and thus failing to distinguish between dual-feature anomalies in the same physical area and independent anomalies in different locations. Second, existing solutions ignore the natural fluctuation characteristics of normal texture areas and fail to correlate statistical attributes such as the grayscale fluctuation range and height fluctuation range of normal textures, resulting in a mismatch between threshold settings and the actual scenario.
[0003] Therefore, there is an urgent need for a detection scheme with dual-feature spatial correlation verification, normal fluctuation adaptive threshold, and accurate filtering of false defects to solve the above-mentioned technical bottlenecks and achieve accurate scratch identification based on texture grayscale changes and surface height depression. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a multispectral-based method for detecting defects in automotive parts, which solves the problem that existing technologies struggle to identify scratches based on texture grayscale changes and surface height depressions.
[0005] To achieve the above objectives, the present invention is implemented through the following technical solution: a multispectral-based method for detecting defects in automotive parts, comprising the following steps: based on the full-band spectral image of the instrument panel air conditioning vent detection area, evaluating the spectral response discrimination of each band to normal texture and scratch defects, and selecting the optimal band combination with the best sensitivity to scratch defects.
[0006] Texture feature vectors are extracted from the spectral texture images of the air vents under the optimal band combination, and density clustering algorithm is used to distinguish normal texture areas and suspected scratch areas within the detection area of the air vents of the car dashboard.
[0007] For areas suspected of being scratched, texture grayscale variation features and 3D surface height depression features are extracted by combining the corresponding 3D surface height data and the spectral texture image of the air outlet.
[0008] The deviation between the texture grayscale variation features and the 3D surface height depression features and the reference baseline features of the normal texture area is calculated, and the correlation is checked to determine whether the suspected scratch area is a real scratch defect.
[0009] Compared with existing technologies, this invention has the following advantages: It filters the optimal band from the data source using spectral response discrimination, enhancing the spectral texture difference between scratches and normal textures; then, it accurately divides normal textures and suspected scratch areas through density clustering, focusing on the target area and reducing irrelevant data interference, ensuring more targeted dual-feature extraction; furthermore, it simultaneously extracts the texture grayscale change features and 3D surface height depression features of suspected areas, capturing the dual attributes of scratches—two-dimensional texture anomalies and three-dimensional physical morphological depressions; finally, through deviation calculation and correlation verification with the baseline features of normal areas, it quantifies the degree of anomaly of the dual features and ensures through spatial correlation that the two types of anomalies correspond to the same physical area, effectively eliminating false defects caused by production line reflections, point cloud noise, etc., and solving the problem that existing technologies cannot identify scratches based on texture grayscale changes and surface height depressions. Attached Figure Description
[0010] Figure 1 This is a flowchart of the multispectral-based defect detection method for automotive parts according to the present invention.
[0011] Figure 2 This is a visual schematic diagram illustrating the detection of scratches and defects in the air vents of an automotive dashboard according to the present invention.
[0012] Figure 3 This is a flowchart illustrating the extraction of texture grayscale variation features and 3D surface height depression features in the multispectral-based automotive component defect detection method of this invention.
[0013] Figure 4 This is a flowchart illustrating the deviation calculation process in the multispectral-based automotive component defect detection method of this invention. Detailed Implementation
[0014] The present invention will now be described in detail with reference to the accompanying drawings and embodiments. Please refer to the accompanying drawings. Figures 1-2 The present invention provides a technical solution: a multispectral method for detecting defects in automotive parts, comprising the following steps: S1, based on the full-band spectral image of the instrument panel air conditioning vent detection area, evaluating the spectral response discrimination of each band to normal texture and scratch defects, and selecting the optimal band combination with the best sensitivity to scratch defects.
[0015] Air vent scratch detection requires simultaneously capturing the grayscale differences between the natural texture of the plastic substrate and the scratch, as well as the surface reflectivity differences corresponding to the scratch indentation. Furthermore, the air vent detection environment suffers from production line glare and interference from the natural texture of the plastic. Single-band detection has unavoidable drawbacks. However, considering that automotive dashboard air vent detection is an online production line inspection, strict requirements are placed on processing efficiency. Pairwise pairing has clear logic and controllable complexity, allowing for redundancy verification to be completed quickly. In contrast, overall verification with three or more bands significantly increases the computational load, making the detection speed unable to match the production line pace and hindering engineering feasibility.
[0016] Furthermore, considering the fundamental difference in spectral reflectance characteristics between the normal texture and scratched areas of the plastic substrate of the car dashboard air conditioning vent, and the fact that scratches alter the light reflection path due to surface depressions, resulting in a quantifiable inherent difference in spectral response values compared to the normal texture area, spectral response values can more accurately capture this essential difference in surface reflectance characteristics compared to simple visible light grayscale values. This effectively distinguishes the characteristics of the natural texture of the plastic substrate from scratches, avoiding feature confusion caused by visual similarity of textures and surface reflection under visible light. Therefore, the process of selecting the optimal band combination with the best sensitivity to scratch defects is as follows: Gaussian smoothing is performed on the full-band spectral image of the car dashboard air conditioning vent detection area. A 3×3 sliding window is constructed with each pixel as the center, and the mean spectral response value of all pixels within the sliding window is calculated. The mean spectral response value is used to replace the original spectral response value of the center pixel. This process is repeated for all pixels in the full-band image to eliminate isolated noise interference caused by dust and slight reflections in the production line environment.
[0017] Traverse each pixel in the spectral image of each band, calculate the difference in spectral response value between the pixel and its 8 neighboring pixels, and use the sum of the absolute values of the spectral response value differences as the pixel texture fluctuation value.
[0018] Collect the texture fluctuation values of all pixels in the full-band image, arrange them in ascending order to form a numerical sequence, divide the numerical sequence into four equal parts, and take the starting value of the third part as the texture fluctuation threshold.
[0019] Continuous regions where pixel texture fluctuation values are below the texture fluctuation threshold and adjacent pixels have a consistent texture distribution are classified as normal texture sub-regions. Continuous regions where pixel texture fluctuation values are above the texture fluctuation threshold and exhibit texture breaks or abrupt grayscale changes are classified as potential defect candidate sub-regions.
[0020] Calculate the difference between the spectral response value of each pixel in the normal texture sub-region and the mean spectral response value of the region where the pixel is located, respectively.
[0021] Dividing the sum of squares of the differences by the total number of pixels in the corresponding region yields the dispersion of the regional spectral response for the normal texture sub-region and the potential defect candidate sub-region, respectively.
[0022] Calculate the absolute value of the difference between the mean spectral response values of the normal texture sub-region and the potential defect candidate sub-region for each band. Use the ratio of this absolute difference to the sum of the dispersions of the spectral responses of the two regions as the spectral response discrimination index. A higher spectral response discrimination index indicates a stronger sensitivity of the corresponding band in identifying the normal texture sub-region and the potential defect candidate sub-region.
[0023] To avoid invalid data processing caused by the duplication of information from multiple bands and to balance the accuracy and efficiency of online detection of air vents in automotive production lines, the process of determining the optimal band combination based on spectral response discrimination is as follows: S101, the entire band is sorted in descending order of spectral response discrimination value, and the total number of the entire band is counted. The overlap of spectral response trends of each adjacent band is calculated (i.e., the proportion of pixels in the same pixel area where the spectral response of adjacent bands has the same trend of increase or decrease). The average value of the overlap of spectral response trends of all adjacent bands is taken as the initial information redundancy ratio.
[0024] S102. For each band combination, construct the grayscale response matrix corresponding to the spectral image of the air outlet of the two bands (the matrix elements are the spectral response values of the corresponding pixels).
[0025] S103. Compare the spectral response values of the two bands at the same pixel location one by one (select 5 consecutive pixels as a group; if both groups of bands show an increasing trend, a decreasing trend, or a fluctuation range of less than 0.02 within the same group of pixels, they are considered to have the same trend. Otherwise, they are considered to have different trends). The proportion of groups with the same trend is used as the correlation coefficient between the two bands. The higher the coefficient value, the higher the overlap and redundancy of the image information of the two bands.
[0026] S104. Divide 0 to 1 into several intervals (0-0.1, 0.1-0.2, ..., 0.9-1.0) according to a set interval, count the number of correlation coefficients in each interval, and take the median of the interval with the highest number of correlation coefficients as the correlation judgment threshold.
[0027] S105. If there are more than a few bands whose correlation coefficients with a certain band are higher than the correlation judgment threshold, then retain the band with the highest spectral response discrimination, remove the other redundant bands, and check all bands one by one until the correlation coefficients of any two bands are lower than the judgment threshold, thus obtaining the optimal band combination.
[0028] It should be noted that if only 1-2 bands have a correlation with a certain band that is higher than the correlation threshold, then the redundant band with the relatively higher correlation coefficient will be removed.
[0029] By prioritizing the selection of highly sensitive bands through spectral response discrimination, the feature discrimination of scratches and normal textures in the spectral texture image of the air outlet is improved, avoiding noise interference from low-discrimination bands. The objectively determined correlation judgment threshold and redundant band removal rules ensure the consistency and repeatability of the optimal band combination selection results, avoiding band selection deviations caused by subjective factors.
[0030] If multiple intervals have the same number of correlation coefficients, the average of the median values of these intervals is taken as the correlation threshold. If the number of correlation coefficients in all intervals is 0, the interval division interval is readjusted to 0.05 and the statistics are performed again.
[0031] It should be added that, based on the optimal band combination obtained through screening, the spectral image information corresponding to each band is extracted one by one from the full-band spectral image data. For each band image information, weights are assigned according to its corresponding spectral response discrimination index: first, the sum of the discrimination indices of all bands is calculated, and then the discrimination index of each band is divided by the sum to obtain the weight ratio of that band, ensuring that bands with high sensitivity to defects dominate in the fusion process.
[0032] A pixel-level multi-band fusion strategy is adopted. It iterates through all pixel locations, multiplies the spectral response value of each band at that pixel location by its corresponding weight, and then sums all the products to obtain the fused grayscale value for that pixel location. This fusion calculation is performed sequentially for all pixel locations to generate the spectral texture image of the air outlet under the optimal band.
[0033] S2. Extract texture feature vectors from the spectral texture image of the air outlet under the optimal band combination, and combine them with density clustering algorithm to distinguish normal texture areas and suspected scratch areas in the detection area of the air conditioning vent of the car dashboard.
[0034] To comprehensively and quantitatively transform the texture differences between normal and scratched areas into clusterable feature dimensions, avoiding the problem that a single feature cannot distinguish visually similar but fundamentally different regions, and to provide a highly discriminative feature basis for density clustering algorithms, ensuring accurate and objective differentiation between normal texture areas and suspected scratched areas within the air vent detection area, the process of extracting texture feature vectors is as follows: First, noise is suppressed on the air vent spectral texture image under the optimal band combination. Then, the spectral response values of all pixels in the air vent spectral texture image are normalized and divided into several square sub-blocks. These square sub-blocks are fixed-size and non-overlapping, each containing multiple consecutive pixels, serving as the basic unit for subsequent texture feature extraction.
[0035] S201. Calculate the gray-level mean, gray-level variance, gray-level entropy, and local contrast based on the normalized spectral response values of all pixels within each square sub-block, and use these as the texture features of the square sub-block.
[0036] S202. Convert each texture feature into a relative value (convert each texture feature into a relative value using the Z-score normalization algorithm) to eliminate the influence of differences in the numerical range between different feature dimensions on subsequent clustering, and combine the normalized features of each square sub-block to form a 1×5 dimensional texture feature vector.
[0037] By extracting four complementary texture features—grayscale mean, grayscale variance, grayscale entropy, and local contrast—and standardizing them to construct a 1×4-dimensional texture feature vector, the essential differences between normal textures and scratched areas are comprehensively and quantitatively characterized from multiple dimensions, including overall intensity, internal fluctuations, distribution patterns, and differences between adjacent pixels. This avoids the problem that a single feature cannot distinguish between visually similar but essentially different texture regions, providing a feature basis with strong discriminative power and no dimensional numerical interference for density clustering algorithms.
[0038] It's important to note that the grayscale mean refers to the average of the normalized spectral response values of all pixels within a square sub-block, reflecting the overall spectral reflectance intensity of that area and distinguishing the plastic substrate from potential scratch areas. Grayscale variance refers to the degree to which the normalized spectral response value deviates from the grayscale mean, reflecting the spectral texture roughness of that area; scratched areas typically have higher variance. Grayscale entropy refers to the uniformity of the distribution of the normalized spectral response value, reflecting the texture complexity of that area; normal textures have stable entropy values, while scratched areas experience abrupt changes in entropy. Local contrast refers to the degree of difference in the normalized spectral response values between adjacent pixels, reflecting the texture sharpness of that area; scratched areas have higher contrast than normal texture areas.
[0039] Considering that normal textures in automotive dashboard air vents are repetitive, uniform, and highly clustered in the feature space, while scratched areas exhibit abnormal textures and low-density discrete distributions in the feature space; and taking into account the need for similarity measurement of spectral texture feature vectors, cosine similarity is chosen to accurately quantify the correlation between texture feature vectors, adapting to the comparative characteristics of multi-dimensional spectral texture features. The process of distinguishing normal texture areas from suspected scratch areas within the detection area of automotive dashboard air vents is as follows: Using the K-distance method, the distance to the k-th nearest neighbor vector is calculated for each texture feature vector. All distances are arranged in ascending order, and the value corresponding to the point of abrupt change in distance is selected as the neighborhood radius. This ensures that the neighborhood radius covers the feature vector clustering range of normal texture sub-blocks while also distinguishing abnormal sub-blocks. In the K-distance method, the K value is set to 5.
[0040] Based on the repetitive characteristics of normal textures in historical air vents, the average cluster density of sub-blocks in normal texture regions is statistically analyzed. The minimum number of core points is set to 1.2 times this average cluster density to ensure that only high-density regions of normal textures can form core clusters, thus avoiding isolated sub-blocks being misidentified as core points.
[0041] Traverse all unvisited texture feature vectors and calculate the cosine similarity with the remaining texture feature vectors. Combine the neighborhood range and the minimum number of core points to determine the independent clusters and the set of remaining temporary noise points: Calculate the cosine similarity between an unvisited texture feature vector and the remaining texture feature vectors, and take the texture feature vectors whose cosine similarity is within the neighborhood range as the neighborhood vector set.
[0042] If the number of vectors in the neighborhood vector set is not less than the minimum number of core points, mark the unvisited texture feature vectors as core points, create a new cluster, and add the unvisited texture feature vectors and all texture feature vectors in the neighborhood vector set to the new cluster. If the number is less than the minimum number of core points, mark the unvisited texture feature vectors as temporary noise points.
[0043] For each texture feature vector within a new cluster, search for texture feature vectors in the neighborhood. If a new kernel point is found, the corresponding neighborhood vector is added to the current cluster. Continue to expand the cluster range until no new vectors can be added.
[0044] Iterate through all unvisited texture feature vectors until all unvisited texture feature vectors have been visited, forming multiple independent clusters and a set of remaining temporary noise points. For the set of remaining temporary noise points, calculate the texture grayscale variation feature and 3D surface height depression feature of the square sub-block corresponding to each temporary noise point. If the deviation ratio of both features exceeds the upper limit of the set fluctuation range, then mark it separately as a suspected fine scratch area and include it in the subsequent correlation verification process.
[0045] For each independent cluster, the average eigenvector (center vector) of all texture feature vectors within the cluster is calculated. The average cosine similarity between each texture feature vector and the average eigenvector is taken as the intra-cluster similarity index. The closer the index value is to 1, the stronger the texture consistency within the cluster. Based on historical detection data of normal textures at the air vents, a minimum similarity threshold for normal texture clusters is determined. Clusters below this threshold are marked as texture aberration clusters, which may contain scratched areas.
[0046] For all independent clusters, pair them up and calculate the cosine similarity of the center vectors of each pair of independent clusters. This cosine similarity serves as an index of inter-cluster dispersion; the closer the index value is to 0, the greater the texture difference between the two clusters. Based on the texture difference data between the normal texture of the air outlet and the known scratched area, a minimum dispersion threshold is determined. Cluster pairs exceeding this threshold are marked as texture-similar clusters, possibly belonging to the same normal texture area. Cluster pairs below this threshold are marked as texture-dissimilar clusters, possibly corresponding to the normal texture and scratched areas, respectively.
[0047] Independent clusters whose cluster size is greater than a set multiple of the average cluster size are classified as normal region clusters. The intra-cluster similarity index of all normal region clusters is calculated, and the minimum value is taken as the intra-cluster threshold. The set multiple is 1.5.
[0048] Independent clusters with intra-cluster similarity indices not less than the intra-cluster threshold are marked as normal texture candidate clusters. Independent clusters with intra-cluster similarity indices less than the intra-cluster threshold and inter-cluster dispersion indices among all normal texture candidate clusters not greater than a set threshold are marked as suspected scratch candidate clusters.
[0049] The square sub-blocks contained in the normal texture candidate cluster and the suspected scratch candidate cluster are mapped back to the corresponding positions in the spectral texture image of the air outlet, forming the normal texture area and the suspected scratch area.
[0050] This approach balances local consistency and global diversity within clusters. Intra-cluster similarity characterizes the uniformity of texture within a cluster, while inter-cluster dispersion measures the texture differences between different clusters. Simultaneously, cluster size is used to filter clusters representing normal regions. This ensures the clustering rules perfectly align with the texture distribution patterns of the plastic substrate at the air vent and the core requirements of scratch detection, guaranteeing the clustering process accurately adapts to the actual scenario of air vent detection. Furthermore, multi-dimensional analysis using intra-cluster similarity, inter-cluster dispersion, and cluster size layer by layer filters between candidate clusters representing normal textures and suspected scratches, further enhancing the differentiation accuracy between the two types of regions and avoiding confusion between similar texture clusters and misjudgment of abnormal clusters. Finally, the clusters are mapped back to the spectral texture image to form corresponding normal texture regions and suspected scratch regions, achieving objective and accurate division of the two types of regions. This not only defines precise local ranges for subsequent extraction of texture grayscale variation features and 3D surface height depression features but also reduces invalid data processing in irrelevant regions, providing a reliable regional basis for subsequent real scratch determination based on dual-feature collaborative verification. From the clustering level, this ensures the overall accuracy and objectivity of air vent scratch recognition.
[0051] S3. For suspected scratched areas, combine the corresponding 3D surface height data and the spectral texture image of the air outlet to extract texture grayscale change features and 3D surface height depression features respectively.
[0052] Considering the inherent physical properties of scratches on car dashboard air vents, namely that scratches necessarily possess both two-dimensional texture anomalies and three-dimensional physical depressions, and also considering the spatial correlation between two-dimensional spectral texture images and 3D surface height data, such as... Figure 3 As shown, the specific process of extracting texture grayscale variation features and 3D surface height depression features is as follows: S301, spatially register the 3D surface height data with the air outlet spectral texture image, and crop out the sub-image corresponding to the suspected scratch area.
[0053] S302. The Sobel operator is used to calculate the gray-level change rate of pixels in the region sub-image in the horizontal and vertical directions. The gray-level change rates in the horizontal and vertical directions are squared and summed. The square root of the sum is then taken, and the result is the gray-level gradient magnitude of the corresponding pixel. The mean and maximum values of the gray-level gradient magnitude are used as gray-level gradient magnitude feature parameters.
[0054] S303. Calculate the grayscale difference between adjacent pixels based on the continuous pixel rows and columns within the region sub-image, and count the proportion of pixel pairs with grayscale differences below a set range to the total number of pixel pairs in the region. Use this as a grayscale continuity parameter to characterize the coherence of grayscale distribution within the region. This parameter is usually lower in scratched regions than in normal texture regions.
[0055] S304. Calculate the difference between the height value of each point cloud in the sub-map of the region and the average height value. Process the absolute value of the negative difference and then take the average value as the average depression depth to represent the overall depression degree of the region.
[0056] S305. The Canny operator is used to obtain the two-dimensional contour of the concave region and mapped to a 3D point cloud space to obtain a 3D contour point cloud. The spatial distance between adjacent contour points in the 3D contour point cloud is calculated. The proportion of point pairs with spatial distances below a set threshold to the total number of contour point pairs is calculated as a continuity parameter of the concave region contour, characterizing the completeness and coherence of the concave contour. The high threshold of the Canny operator is set to 150, and the low threshold is set to 50.
[0057] Extracting texture grayscale variation features and 3D surface height depression features is crucial because scratches on automotive dashboard air conditioning vents are essentially defects exhibiting both two-dimensional spectral texture anomalies and three-dimensional spatial physical morphological depressions. Scratches directly alter the light reflection patterns of the vent's plastic surface, manifesting as abnormal texture grayscale changes and disruptions in grayscale continuity. Simultaneously, they create actual surface depressions, characterized by 3D surface height depression anomalies in depression depth and contour continuity. Since single-dimensional features cannot accurately determine true scratches, extracting these two types of features combines the two-dimensional visual texture differences of scratches with three-dimensional physical morphological features, serving as the core dual basis for determining true scratches. This fundamentally avoids the problem of false defect misjudgments caused by interference from production line reflections and point cloud noise when relying solely on single features, thus meeting the need for accurate scratch identification based on texture grayscale variations and surface height depressions.
[0058] By extracting texture grayscale variation features and 3D surface height depression features, the quantitative and complementary extraction of two-dimensional texture features and three-dimensional physical features of air outlet scratches is achieved. This avoids interference from single-dimensional pseudo-defects in the production line, such as reflections causing only grayscale anomalies or point cloud noise causing only height anomalies, which significantly reduce the false judgment rate of scratch identification. At the same time, each feature parameter visualizes and quantifies the degree of scratch anomaly from different dimensions, providing a precise and comparable quantitative data foundation for subsequent dynamic deviation calculation with the benchmark features of normal texture areas and dual-feature correlation verification, so that the judgment of real scratches has a clear numerical basis.
[0059] In addition, the local feature extraction of suspected scratch areas based on spatial registration only performs feature calculations on the target area, avoiding interference from irrelevant area data, reducing the amount of invalid data processing, improving the efficiency of feature extraction, and adapting to the real-time requirements of online inspection in automotive production lines.
[0060] S4. The deviation between the texture grayscale variation features and the 3D surface height depression features and the reference baseline features of the normal texture area is calculated. Combined with correlation verification, the suspected scratch area is determined to be a real scratch defect. The reference baseline features adopt a dynamic update mechanism. After each set number of samples is tested, such as 100 pieces, the mean, standard deviation and natural fluctuation range of the features of the normal texture area are recalculated and the original reference baseline features are replaced to adapt to the texture feature drift of different batches of test objects.
[0061] Furthermore, such as Figure 4 As shown, the process of deviation calculation is as follows: S401, calculate the mean and maximum values of the gray-level gradient magnitude and the absolute value of the gray-level difference between the gray-level continuity parameter and the corresponding gray-level reference feature.
[0062] S402. Calculate the absolute value of the difference between the mean depth of the depression and the contour continuity parameter of the depression region and the corresponding depression reference feature.
[0063] S403. Combine the absolute values of grayscale difference and indentation difference with the corresponding natural fluctuation range of features to obtain the proportion of grayscale change feature deviation and the proportion of high indentation feature deviation.
[0064] Taking the proportion of grayscale variation feature deviation as an example, the calculation process involves dividing each grayscale variation feature deviation value by the value of the natural fluctuation range of the corresponding feature in the normal texture region to obtain the proportion of grayscale variation feature deviation in each dimension. The calculation method for the proportion of height concavity feature deviation is the same as that for the proportion of grayscale variation feature deviation. The natural fluctuation range of the feature is determined by statistically analyzing the corresponding feature values of several normal texture region sub-blocks and calculating the difference between their maximum and minimum values.
[0065] This embodiment considers the inherent natural fluctuations in the texture grayscale variation characteristics of the normal texture area of the air conditioning vents on a car dashboard and the inherent natural fluctuations in the 3D surface depression characteristics, which are not absolutely constant values. The relative deviation ratio is calculated by combining the natural fluctuation range of the corresponding features. Simultaneously, the independence of each dimension of the dual features in representing scratch anomalies is considered. Deviations are calculated separately for grayscale gradient amplitude, grayscale continuity, average depression depth, and contour continuity, ensuring no abnormal detail in suspected scratch areas is overlooked. The quantified deviation ratio provides a clear numerical basis for determining whether a feature is abnormal in subsequent correlation verification, upgrading scratch anomaly judgment from qualitative analysis to quantitative judgment. This lays a reliable quantitative data foundation for the final accurate determination of real scratch defects by combining spatial location correlation verification, further improving the overall accuracy and scientific rigor of scratch recognition.
[0066] Considering that real scratches inevitably have both texture grayscale changes and 3D surface depressions, and that the two types of anomalies originate from the same physical area, the process of determining whether a suspected scratch area is a real scratch defect is as follows, combined with correlation verification: S404, if either the grayscale change feature deviation ratio or the depression feature deviation ratio is not greater than the upper limit of the set fluctuation range, it is determined to be a pseudo scratch defect.
[0067] S405. Conversely, calculate the overlap ratio between pixel regions with abnormal texture grayscale changes and point cloud regions with abnormal 3D surface height depressions.
[0068] S406. If the overlap ratio is less than the set ratio threshold, it is determined to be a false scratch defect; otherwise, it is a real scratch defect. The ratio threshold is 85%.
[0069] First, by using a quantitative threshold to determine the proportion of dual-feature deviation, false defects with only single-dimensional feature anomalies are directly excluded, reducing subsequent invalid spatial location verification operations. Then, by verifying the overlap ratio between texture grayscale anomaly areas and 3D height concavity anomaly areas, the results of the two types of feature anomalies are strictly limited to the same physical area from a spatial dimension. This avoids the situation where independent grayscale anomalies and height anomalies at different locations are misjudged as real scratches. This achieves dual avoidance of false defects from both feature and spatial dimensions, reducing the misjudgment rate of scratch recognition and improving the accuracy of real scratch determination.
[0070] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, in the form of a computer program product.
[0071] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0072] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0073] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0074] Finally, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A multispectral based method for defect detection in automotive parts, characterized in that, Includes the following steps: Based on the full-band spectral image of the instrument panel air conditioning vent detection area, the spectral response discrimination of each band to normal texture and scratch defects is evaluated, and the optimal band combination with the best sensitivity to scratch defects is selected. Based on the spectral texture image of the air outlet under the optimal band combination, texture feature vectors are extracted, and density clustering algorithm is used to distinguish normal texture areas and suspected scratch areas in the detection area of the air outlet of the car dashboard. For areas suspected of being scratched, texture grayscale variation features and 3D surface height depression features are extracted by combining the corresponding 3D surface height data and the spectral texture image of the air outlet. The deviation between the texture grayscale variation features and the 3D surface height depression features and the reference baseline features of the normal texture area is calculated, and the correlation is checked to determine whether the suspected scratch area is a real scratch defect. The process of evaluating the spectral response discrimination of each band to normal texture and scratch defects, and selecting the optimal band combination with the best sensitivity to scratch defects, is as follows: The normal texture sub-region and potential defect candidate sub-region in the spectral image of each band are determined based on the adaptive texture thresholding segmentation algorithm. The spectral response discrimination of each band is calculated based on the spectral response value of each pixel in the normal texture sub-region and the potential defect candidate sub-region. The entire band is sorted in descending order of spectral response discrimination value, and the total number of the entire band is counted. The overlap of spectral response trends of each adjacent band is calculated, and the average value of the overlap of spectral response trends of all adjacent bands is taken as the initial information redundancy ratio. The top N bands are selected sequentially and paired up in pairs. The correlation coefficient between the two bands is calculated, and the optimal band combination is obtained.
2. A multispectral based automobile component defect detection method as claimed in claim 1, wherein, The process of determining the normal texture sub-region and potential defect candidate sub-region in the spectral image of each band based on the adaptive texture threshold segmentation algorithm is as follows: Traverse each pixel in the spectral image of each band, calculate the difference in spectral response value between the pixel and its 8 neighboring pixels, and use the sum of the absolute values of the spectral response value differences as the pixel texture fluctuation value; Collect the texture fluctuation values of all pixels in the full-band image, arrange them in ascending order to form a numerical sequence, divide the numerical sequence into four equal parts, and take the starting value of the third part as the texture fluctuation threshold. Continuous regions with pixel texture fluctuation values below the texture fluctuation threshold and adjacent pixel texture distributions being consistent are classified as normal texture sub-regions; continuous regions with pixel texture fluctuation values above the texture fluctuation threshold and exhibiting texture breaks or abrupt grayscale changes are classified as potential defect candidate sub-regions.
3. A multispectral based automobile component defect detection method as claimed in claim 1, wherein, The process of calculating the spectral response discrimination of each band based on the spectral response value of each pixel in the normal texture sub-region and the potential defect candidate sub-region is as follows: Calculate the difference between the spectral response value of each pixel in the normal texture sub-region and the mean spectral response value of the region where the pixel is located, respectively. Divide the sum of squares of the differences by the total number of pixels in the corresponding region to obtain the dispersion of the regional spectral response for the normal texture sub-region and the potential defect candidate sub-region, respectively. Calculate the absolute value of the difference between the mean spectral response values of the normal texture sub-region and the potential defect candidate sub-region for each band, and use the ratio of the absolute value of the difference to the sum of the dispersion of the spectral response of the two regions as the spectral response discrimination.
4. The multispectral based automotive component defect detection method as claimed in claim 1, wherein, The process of sequentially selecting the top N bands, pairing them up in pairs, calculating the correlation coefficient between the two bands, and selecting the optimal band combination is as follows: For each band combination, construct the grayscale response matrix corresponding to the spectral images of the air outlet of the two bands respectively; Compare the spectral response values of the two bands at the same pixel location one by one, and use the proportion of groups with consistent trends as the correlation coefficient between the two bands. Divide 0 to 1 into several intervals according to a set interval, count the number of correlation coefficients in each interval, and take the median of the interval with the highest number of correlation coefficients as the correlation judgment threshold. If more than one band has a correlation coefficient with a certain band that is higher than the correlation threshold, then the band with the highest spectral response discrimination is retained, the remaining redundant bands are removed, and all bands are checked one by one until the correlation coefficient of any two bands is lower than the threshold, thus obtaining the optimal band combination.
5. The method for detecting defects in automotive parts based on multispectral imaging according to claim 1, characterized in that, The process of extracting texture feature vectors from the spectral texture image of the air outlet based on the optimal band combination is as follows: After normalizing the spectral response values of all pixels in the spectral texture image of the air outlet, it is divided into several square sub-blocks; The gray-level mean, gray-level variance, gray-level entropy, and local contrast are calculated based on the normalized spectral response values of all pixels within each square sub-block, and used as the texture features of the square sub-block. The texture feature vector is obtained by combining the texture features of all square sub-blocks.
6. The method for detecting defects in automotive parts based on multispectral imaging according to claim 1, characterized in that, The process of using density clustering algorithm to distinguish normal texture areas from suspected scratch areas within the detection area of the car dashboard air conditioning vents is as follows: Traverse all unvisited texture feature vectors and calculate the cosine similarity with the remaining texture feature vectors. Combine the neighborhood range and the minimum number of core points to determine the independent clusters and the set of remaining temporary noise points. Independent clusters whose cluster size is greater than a set multiple of the average cluster size are considered normal region clusters. The intra-cluster similarity index of all normal region clusters is calculated, and the minimum value is taken as the intra-cluster threshold. Pair all independent clusters together and calculate the cosine similarity of the center vectors of each pair of independent clusters as an index of inter-cluster dispersion. Independent clusters with intra-cluster similarity indices not less than the intra-cluster threshold are marked as normal texture candidate clusters; independent clusters with intra-cluster similarity indices less than the intra-cluster threshold and inter-cluster dispersion indices between all normal texture candidate clusters not greater than the set threshold are marked as suspected scratch candidate clusters. The square sub-blocks contained in the normal texture candidate cluster and the suspected scratch candidate cluster are mapped back to the corresponding positions in the spectral texture image of the air outlet, forming the normal texture area and the suspected scratch area.
7. The multispectral based automotive component defect detection method as claimed in claim 1, wherein, The process of extracting texture grayscale variation features and 3D surface height depression features for suspected scratch areas, combining the corresponding 3D surface height data and the spectral texture image of the air outlet, is as follows: Spatial registration was performed between the 3D surface height data and the spectral texture image of the air outlet, and the sub-image corresponding to the suspected scratch area was cropped out. The Sobel operator is used to calculate the gray-level change rate of pixels in the horizontal and vertical directions in the sub-image of the region, and the gray-level gradient magnitude of each pixel is synthesized. The mean and maximum values of the gray-level gradient magnitude are used as gray-level gradient magnitude feature parameters. The grayscale difference between adjacent pixels is calculated based on the continuous pixel rows and columns within the region sub-image. The proportion of pixel pairs with grayscale differences below a set range to the total number of pixel pairs in the region is used as a grayscale continuity parameter. Calculate the difference between the height value of each point cloud in the sub-map of the region and the average height value. Take the absolute value of the difference for negative values and then take the average value as the average depth of the depression. The Canny operator is used to obtain the two-dimensional contour of the concave region and map it to the 3D point cloud space to obtain the 3D contour point cloud. The spatial distance between adjacent contour points in the 3D contour point cloud is calculated. The proportion of point pairs with spatial distances below a set threshold to the total number of contour point pairs is calculated as the contour continuity parameter of the concave region.
8. The multispectral based automotive component defect detection method as claimed in claim 1, wherein, The process of calculating the deviation between the texture grayscale variation features and the 3D surface height concavity features and the reference baseline features of the normal texture area is as follows: Calculate the mean and maximum values of the gray-level gradient magnitude, as well as the absolute values of the gray-level difference between the gray-level continuity parameter and the corresponding gray-level reference feature; Calculate the absolute value of the difference between the mean depth of the depression and the contour continuity parameter of the depression region and the corresponding depression reference feature; By combining the absolute values of grayscale difference and indentation difference with the corresponding natural fluctuation range of features, we can obtain the proportion of grayscale change feature deviation and the proportion of high indentation feature deviation.
9. The multispectral based automotive component defect detection method as claimed in claim 8, wherein, The process of determining whether a suspected scratch area is a genuine scratch defect by combining correlation verification is as follows: If either the percentage of grayscale change feature deviation or the percentage of height depression feature deviation is not greater than the upper limit of the set fluctuation range, it is judged as a false scratch defect. Conversely, calculate the overlap ratio between pixel regions with abnormal texture grayscale changes and point cloud regions with abnormal 3D surface depressions. If the overlap ratio is less than the set threshold, it is determined to be a false scratch defect; otherwise, it is a real scratch defect.