Vehicle-mounted battery gluing defect detection method based on machine vision

By constructing a dual-channel variance composite value and a structure tensor matrix, and combining an anomaly confidence model, the physical weights of edges in the graph theory algorithm are reshaped, solving the over-segmentation and missed detection problems of the Felzenszwalb-Huttenlocher algorithm in adhesive coating image segmentation, and realizing high-precision detection of adhesive coating defects in vehicle batteries.

CN121582243APending Publication Date: 2026-02-27施努卡(苏州)智能装备有限公司
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202610091247.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-23
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

The existing Felzenszwalb-Huttenlocher algorithm cannot effectively distinguish between unstructured differences and true boundaries within the glue overflow area when segmenting glue-coated images, leading to over-segmentation and missed detections, which affects the accuracy of identifying glue-coated defects in vehicle batteries.

Method used

By constructing a dual-channel variance composite value, a structural tensor matrix, and an anomaly confidence model, and combining graph theory algorithms, the physical weights of edges are reshaped to achieve accurate detection of adhesive coating defects.

Benefits of technology

It accurately distinguishes between non-structural differences and true boundaries within the glue overflow area, avoiding over-segmentation and missed detection, and improving the accuracy of glue coating defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121582243A_ABST
    Figure CN121582243A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a vehicle-mounted battery gluing defect detection method based on machine vision, and the method comprises the steps: obtaining an original image of a vehicle-mounted battery gluing region, generating color smoothness through a dual-channel variance fusing brightness and saturation, constructing structure tensor analysis to determine local gradient disorder degree, and determining the gluing defect of a vehicle-mounted battery. The method comprises the following steps of: generating abnormal confidence of pixel points by synthesizing color smoothness and local gradient disorder, remodeling gray difference among the pixel points by using the abnormal confidence as a physical modulation factor to obtain a physical remodeling weight of an edge, and realizing pseudo gradient shielding in a graph theory segmentation framework by using the physical remodeling weight to obtain a pseudo gradient shielding result. And accurate segmentation is carried out on the original image so as to realize gluing defect detection. According to the method, the complete connectivity of the glue overflow defect area is improved, the situation that the chaos texture in the defect is misjudged as the boundary is avoided, and the gluing defect detection result is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing. Specifically, it relates to a vehicle-mounted battery gluing defect detection method based on machine vision. BACKGROUND

[0002] In the automatic manufacturing scene of vehicle-mounted batteries, the detection of gluing quality is the key to ensuring product sealing and safety. Gluing patterns are usually divided into normal glue paths (smooth and homogeneous) and overflow defects (rough and chaotic). An ideal machine vision detection scheme must be able to accurately identify and distinguish between the two patterns, ensuring that no defects are reported when normal, and that defects are reported stably and completely when there is overflow.

[0003] In the field of image analysis, the Felzenszwalb-Huttenlocher algorithm is a graph-based image segmentation method used to segment an image into multiple sub-regions. The core idea of this algorithm is to treat the image as a graph structure, where pixels are nodes and the difference between pixels is the weight of the edge. The core assumption of the Felzenszwalb-Huttenlocher algorithm is that the internal difference of an object should be significantly smaller than the boundary difference between it and the background. It determines whether to merge two regions based on the following core judgment method: obtain the minimum value of the internal difference baseline of region and the internal difference baseline of region , which are both determined by the maximum internal difference of each region and a tolerance threshold inversely proportional to the size of each region. If the weight of the edge between region and region does not exceed the minimum value of the internal difference baseline, then region and region are merged. , is the weight of the edge between region and region , where is the gray value of region , and is the gray value of region . However, in the Felzenszwalb-Huttenlocher algorithm, the internal difference baseline of region is calculated as the maximum internal difference of region , which is not suitable for detecting the overflow defect of vehicle-mounted batteries.

[0004] However, in the Felzenszwalb-Huttenlocher algorithm, the internal difference baseline of region ​When the algorithm segments the gluing image, the physical characteristics of the overflow glue are highly chaotic inside, full of tiny shadows and highlights, resulting in a very large maximum weight of the edge inside the overflow glue area. The weight of the edge determined based on the grayscale difference cannot distinguish two different physical differences: one is the structural difference caused by the normal boundary, and the other is the non-structural difference caused by the shadows and highlights inside the overflow glue area. The algorithm mistakenly judges the non-structural difference inside the overflow glue area as a real boundary, causing over-segmentation and missed detection, dividing a complete overflow glue defect into hundreds of small fragments, affecting the accuracy of the vehicle-mounted battery gluing defect recognition. SUMMARY

[0005] To solve the problem that the existing Felzenszwalb-Huttenlocher algorithm cannot distinguish the non-structural difference inside the overflow glue area from the real boundary, resulting in over-segmentation and missed detection, the present application proposes a vehicle-mounted battery gluing defect detection method based on machine vision, comprising: Obtain the original image of the vehicle-mounted battery gluing area, separate the brightness channel and the saturation channel; Calculate the two-channel variance comprehensive value of each pixel point based on the local variance of the brightness channel and the saturation channel in the neighborhood window of each pixel point, perform a negative correlation mapping operation based on the two-channel variance comprehensive value to obtain the color smoothness of the pixel point, and determine the gradient vector of each pixel point based on the brightness channel to construct the structure tensor matrix of the pixel point, and determine the local gradient disorder degree of the pixel point according to the elements of the structure tensor matrix; Fuse the local gradient disorder degree and the color smoothness of each pixel point to generate the abnormal confidence of the pixel point; based on the spatial adjacency relationship of the pixel points, obtain two mutually connected pixel points and the edge between the two pixel points, and determine the physical remodeling weight of the edge according to the abnormal confidence and the grayscale value difference of the two pixel points; Based on the physical remodeling weight of all edges, construct a physical remodeling weight map, input the physical remodeling weight map into a graph-based image segmentation algorithm to segment the original image to obtain a segmentation region, and judge the gluing defect according to the abnormal confidence of the pixel points of the segmentation region to complete the gluing defect detection.

[0006] Preferably, the dual-channel variance comprehensive value is determined based on the following manner: traversing each pixel point of the original image, calculating the local variance of the luminance channel in the neighborhood window of the pixel point, denoted as the first local variance of the pixel point, and the local variance of the saturation channel in the neighborhood window of the pixel point, denoted as the second local variance of the pixel point; taking the mean value of the first local variances of all pixel points as the luminance noise reference, and the mean value of the second local variances of all pixel points as the saturation noise reference; summing the first local variance and the second local variance after being divided by the luminance noise reference and the saturation noise reference respectively to obtain the dual-channel variance comprehensive value of the pixel point.

[0007] The technical solution quantifies the confusion degree of local texture through the dual-channel variance comprehensive value, introduces the luminance noise reference and the saturation noise reference, and adaptively normalizes the local variance, so that the dual-channel variance comprehensive value becomes a relative fluctuation index that is not affected by global illumination or camera noise, and can accurately reflect the high-frequency texture fluctuation in the neighborhood window of the pixel point.

[0008] Preferably, the gradient vector of each pixel point is determined based on the luminance channel to construct the structure tensor matrix of the pixel point, including: obtaining the horizontal gradient and the vertical gradient of the luminance channel at each pixel point, denoted as the horizontal gradient component and the vertical gradient component respectively, and combining the horizontal gradient component and the vertical gradient component into the gradient vector of the pixel point; performing a weighted summation operation on the outer products of the gradient vectors of all pixel points in the neighborhood window of the pixel point to obtain the structure tensor matrix of the pixel point; wherein the weight involved in the weighted summation operation is determined based on the spatial distance between the pixel point and all pixel points in its neighborhood window.

[0009] The technical solution constructs the structure tensor matrix, the elements of which are obtained by weighted smoothing summation of the outer products (i.e. gradient products) of the gradient vectors of the luminance channel in the neighborhood, which converts the original pixel difference into a second-order feature with direction and intensity information, and provides an accurate data basis for subsequent accurate analysis of the geometric morphology and total energy distribution of the texture.

[0010] Preferably, the local gradient disorder degree is determined based on the following manner: the trace of the structure tensor matrix of each pixel point is extracted as the total gradient energy of the pixel point; the maximum value of the total gradient energy of all pixel points is counted, and the ratio of the total gradient energy of the pixel point to the maximum value of the total gradient energy is taken as the relative energy of the pixel point; the structure tensor matrix is subjected to eigenvalue decomposition to obtain a first eigenvalue and a second eigenvalue, and the square of the difference between the first eigenvalue and the second eigenvalue is taken as the anisotropy of the pixel point; the ratio of the anisotropy of the pixel point to the square value of the total gradient energy is determined as the structure coherence of the pixel point; and the product of 1 minus the structure coherence of the pixel point and the relative energy of the pixel point is determined as the local gradient disorder degree of the pixel point.

[0011] The technical solution defines the local gradient disorder degree as the product of the relative energy and the incoherence, the anisotropy is a pure geometric index of the shape of the texture, the total gradient energy is an intensity index of the shape, and through the product operation, the dual gating of energy saliency and geometric clutter is realized. Only the area with sufficient chaotic texture and high relative energy can obtain a greater local gradient disorder degree, thereby accurately distinguishing the background noise and the interference of the strong edge.

[0012] Preferably, the method for fusing the local gradient disorder degree and the color smoothness of each pixel point to generate the anomaly confidence of the pixel point comprises the following steps: 1 is subtracted from the color smoothness of each pixel point to obtain the color chaos degree of the pixel point; a weighted linear fusion model is used to perform weighted summation on the local gradient disorder degree and the color chaos degree of the pixel point to obtain a comprehensive anomaly feature value of the pixel point; and an S-type nonlinear mapping function is used to positively correlate the comprehensive anomaly feature value to the anomaly confidence of the pixel point, so as to represent the probability that the pixel point belongs to the gluing defect.

[0013] The technical solution adopts the weighted linear fusion model to integrate the local gradient disorder degree at the structure level and the disorder color chaos degree at the statistical level, solves the limitation of single feature judgment, and converts the comprehensive anomaly feature value into the anomaly confidence in the interval [0, 1] through the S-type nonlinear mapping function, thereby providing a reliable benchmark for subsequent segmentation.

[0014] Preferably, the physical remodeling weight of the edge is determined according to the anomaly confidence and the gray value difference of the two pixel points, and the method comprises the following steps: the absolute difference between the gray values of the two pixel points is calculated as the original gray difference of the edge; 1 is subtracted from the product of the anomaly confidence of the two pixel points as the physical modulation factor of the edge; and the original gray difference is multiplied by the physical modulation factor to obtain the physical remodeling weight of the edge.

[0015] The technical scheme realizes active intervention on a graph algorithm, designs physical remodeling weights, and through taking abnormal confidence as a physical modulation factor, the algorithm realizes pseudo-gradient shielding, when the confidence of two ends of an edge connecting two pixel points is high, the physical modulation factor tends to zero, so that the weight of the edge is forced to be low, ensuring that the graph algorithm preferentially performs internal connection, and ensuring the integrity of defect area segmentation.

[0016] Preferably, the physical remodeling weight graph is constructed based on all edges, including: based on the four-neighbor or eight-neighbor connection relationship of each pixel point in the original image, a undirected graph formed by pixel points connected by edges is constructed, the physical remodeling weight of each edge is determined according to the two pixel points corresponding to each edge in the undirected graph, and the physical remodeling weights of all edges in the undirected graph are used to generate the physical remodeling weight graph for graph cut segmentation.

[0017] Preferably, the physical remodeling weight graph is input into a graph theory-based image segmentation algorithm to perform region segmentation on the original image to obtain segmentation regions, including: each pixel point of the original image is initialized as a region, the physical remodeling weights of all edges in the undirected graph are sorted in ascending order, all the sorted edges are traversed, for two different regions corresponding to each edge, the internal maximum difference of each region and the adaptive tolerance threshold determined based on the region size are obtained respectively, the sum of the internal maximum difference of each region and the adaptive tolerance threshold is taken as a candidate merging judgment criterion of the region, and the smaller value in the candidate merging judgment criteria of the two regions is determined as a real merging judgment criterion; if the physical remodeling weight of the edge is not greater than the real merging judgment criterion, the two regions are merged, and the internal maximum difference of the region formed after merging is updated; after the traversal is completed, all the regions that do not intersect with each other are taken as all the segmentation regions in the original image.

[0018] Preferably, the glue overflow defect is judged according to the abnormal confidence of the pixel points of the segmentation region, including: calculating the average value of the abnormal confidence of all pixel points in each segmentation region as a region abnormal index of the segmentation region; determining an adaptive threshold, if the region abnormal index is not less than the adaptive threshold, it is determined that the segmentation region produces a glue overflow defect; and if the region abnormal index is less than the adaptive threshold, it is determined that the segmentation region is a normal glue path or background interference, and no glue overflow defect is produced.

[0019] Preferably, the luminance channel and the saturation channel are separated, including: performing a color space conversion operation on the original image to convert the original image into a color space containing a luminance component and a saturation component, so as to separate the luminance channel and the saturation channel.

[0020] The application has the following effects: The application generates a high-credibility abnormal confidence semantic graph through constructing an integrated method of double-orthogonal feature fusion mechanism and graph topology active intervention, and uses the abnormal confidence as a modulation factor to implement reverse physical remodeling on the weight of the edge in the graph structure, realizes the inhibition of the pseudo-gradient inside the defect, accurately distinguishes the non-structural difference and the real boundary inside the glue overflow area, avoids the problems of over-segmentation and missed detection, and improves the accuracy of the glue application defect detection. BRIEF DESCRIPTION OF DRAWINGS

[0021] Figure 1 is a flowchart of the application; Figure 2 is an original image of a vehicle-mounted battery glue application area of the application; Figure 3 is a glue defect segmentation effect schematic diagram based on a traditional Felzenszwalb-Huttenlocher algorithm; Figure 4 is a heat distribution graph of the abnormal confidence of each pixel point of the original image of the application; Figure 5 is a physical remodeling weight graph of each pixel point of the original image of the application; Figure 6 is a glue defect segmentation effect schematic diagram of the Felzenszwalb-Huttenlocher algorithm based on the physical remodeling weight of the application. DETAILED DESCRIPTION

[0022] The technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings in the embodiments of the application.

[0023] Referring to Figure 1 A vehicle-mounted battery glue application defect detection method based on machine vision, specifically comprising the following steps: S1: calculating a double-channel variance comprehensive value by using a double-channel variance model, and determining color smoothness according to an exponential decay function.

[0024] The starting point of vehicle-mounted battery glue application defect detection is the most intuitive first-order statistical characteristic, and in the glue overflow defect detection, the most significant feature is often the sharp fluctuation of color and brightness in the local area. In order to quickly capture such high-frequency noise, the scheme first constructs a statistical model based on variance.

[0025] This step considers that although a single variance index has the limitation of insufficient sensitivity in a low-contrast scene, it has very high response speed and certainty for strong texture with high contrast. Therefore, this step serves as the basic perception layer of the entire system, and aims to provide a robust statistical reference index for subsequent multi-dimensional fusion.

[0026] Specifically, an original image of a battery on a vehicle is acquired, as shown in the following figure, which is an original RGB image collected by the battery on the vehicle in the automatic production line of the embodiment, showing the black base of the battery pack surface, the gray normal heat-conducting glue path, and an obvious glue overflow defect, which presents the visual features of dark color, ring shape and extremely rough internal texture. Figure 2

[0027] The RGB image is converted into an HSI color space, H, S and I are hue, saturation and brightness respectively, and the brightness channel and the saturation channel are separated, so that each pixel point of the original image has three channel values.

[0028] The entire image is traversed, and a 7x7 pixel point range is divided as a neighborhood window of each pixel point, the local variance of the brightness channel in the neighborhood window of the pixel point is calculated, that is, the variance of the brightness channel values of all pixel points in the neighborhood window of the pixel point, which is recorded as the first local variance; the local variance of the saturation channel in the neighborhood window of the pixel point is calculated, that is, the variance of the saturation channel values of all pixel points in the neighborhood window of the pixel point, which is recorded as the second local variance of the pixel point.

[0029] The mean value of the first local variance of all pixel points is taken as the brightness noise reference , and the mean value of the second local variance of all pixel points is taken as the saturation noise reference , for the th pixel point, the first local variance is , the second local variance is , and the two-channel variance comprehensive value of the th pixel point is , wherein is a parameter for preventing the denominator from being 0, which is usually set to a very small positive number , directly assigning to the required minimum stable amount, which can prevent calculation errors and keep the dimension consistent with .

[0030] Then, based on the two-channel variance comprehensive value, a negative correlation mapping operation is performed to obtain the color smoothness of the pixel point, which is based on the following relationship:

[0031] , wherein is the color smoothness of the th pixel point, the larger the value, the closer to 1, indicating that the texture change in the neighborhood window of the pixel point is more stable, part of the ​a double-channel variance comprehensive value of the pixel point, to represent the chaotic degree of local texture, is a natural exponential function, is the first local variance of the pixel point, is the second local variance of the pixel point, is the first local variance of the pixel point, is the second local variance of the pixel point, is a luminance noise reference, is a saturation noise reference.

[0032] The relationship builds a color smoothness perception model: if a pixel point is located in a glue overflow area with sharp changes, its local variances and will be significantly greater than the global average level, resulting in a double-channel variance comprehensive value much greater than 0, after mapping by the negative correlation exponential function, the color smoothness will be smaller, and more close to , on the contrary, if the pixel point is located in a smooth area, such as a normal glue path or a background, its local variances and will be close to 0, resulting in a double-channel variance comprehensive value close to 0, after mapping by the negative correlation exponential function, the color smoothness will be greater, and more close to 1, indicating that the texture uniformity in the neighborhood window of the pixel point is more stable.

[0033] S2: Determine the gradient vector of each pixel point based on the luminance channel, to build a structure tensor matrix, and determine the local gradient disorder degree of the pixel point according to the elements of the structure tensor matrix.

[0034] The color smoothness determined by the double-channel variance can sensitively capture the sharp fluctuations of color and brightness in the image, and has a significant effect on distinguishing high-contrast glue overflow areas and flat backgrounds. However, in the glue coating detection scene, the pixel points in the normal glue path edge area also exhibit great color and brightness fluctuations within the pixel neighborhood, resulting in a very low calculated color smoothness. This means that the normal glue path edge area with high-frequency characteristics but regular structure has less difference in color smoothness with the glue overflow defect with chaotic structure.

[0035] Therefore, in order to further distinguish the normal glue path edge area and the glue overflow defect, this step introduces the local gradient disorder degree from the geometric structure level. The essence of the glue overflow defect is not only the sharp change of color, but also the chaotic texture direction, with low structural coherence, and the greater the local gradient disorder degree. Although the color of the normal glue path edge area changes sharply, the texture direction has a high consistency, with high structural coherence, and the smaller the local gradient disorder degree.

[0036] By constructing a structural tensor to analyze the gradient direction changes within the neighborhood window of a pixel, this step can effectively distinguish normal glue path edge areas with highly consistent gradient directions, as well as glue overflow defects with chaotic and disordered gradient directions, from the perspective of texture changes. This allows them to be removed from potential defects, achieving further differentiation between normal glue path edge areas and glue overflow defects.

[0037] Meanwhile, the structural tensor can also capture strong pseudo-edge interference generated by shadows and highlights inside the glue overflow defect. Since these pseudo-edges also exhibit structural disorder, this step can endow them with high-response local gradient disorder, thereby providing highly credible semantic evidence for the active masking of pseudo-gradients inside the defect in the subsequent physical reshaping weights.

[0038] First, the gradient vector of each pixel is determined based on the luminance channel to construct the structure tensor matrix of that pixel, including: Based on the luminance channel, the horizontal and vertical gradients of each pixel are calculated using the Sobel operator and synthesized into the gradient vector for that pixel. For the ... For each pixel, obtain the gradient vectors of all pixels within its neighborhood window (including its own gradient vector), and then compare each pixel within the neighborhood window with the gradient vector of the first pixel. The weights are determined by the Euclidean distance between the pixels. Typically, the Euclidean distance and weight are inversely proportional; the closer the distance, the greater the weight, and vice versa. Then, the outer product of the gradient vectors of each pixel within the neighborhood window is obtained. These outer products are then weighted and summed according to their respective weights to obtain the weighted sum of the outer products. The structure tensor matrix of the n pixels, where x represents the horizontal component of the structure tensor and y represents the vertical component of the structure tensor. The structure tensor matrix of each pixel for:

[0039] in, for The main diagonal elements (top left and bottom right elements). , for Non-main diagonal elements, The horizontal gradient of the brightness channel. This represents the vertical gradient of the brightness channel. Representative at the Neighborhood window of 1 pixel Weighted summation performed within (weights determined by spatial distance) )operate, For the first A neighborhood window of 1 pixel, is the weight of each pixel point in the neighborhood window in the weighted summation, is the square of the horizontal gradient of each pixel point in the neighborhood window for the luminance channel, is the square of the vertical gradient of each pixel point in the neighborhood window for the luminance channel, is the product of the horizontal gradient and the vertical gradient of each pixel point in the neighborhood window for the luminance channel, each element of the structure tensor matrix is obtained by accumulating all the elements of the structure tensor matrix corresponding to all the pixel points in the neighborhood window .

[0040] Then, the local gradient disorder degree of the pixel point is determined according to the elements of the structure tensor matrix: the trace of the structure tensor matrix of each pixel point is extracted as the total gradient energy of the pixel point; the maximum value of the total gradient energy of all the pixel points is counted, and the ratio of the total gradient energy of the pixel point to the maximum value of the total gradient energy is taken as the relative energy of the pixel point; the structure tensor matrix is subjected to eigenvalue decomposition to obtain a first eigenvalue and a second eigenvalue, and the square of the difference between the first eigenvalue and the second eigenvalue is taken as the anisotropy of the pixel point; the ratio of the anisotropy of the pixel point to the square of the total gradient energy is determined as the structure coherence of the pixel point; the local gradient disorder degree of the pixel point is determined by multiplying the structure coherence of the pixel point by the relative energy of the pixel point after subtracting 1 from the structure coherence of the pixel point.

[0041] Specifically, for the i-th pixel point, the trace of the structure tensor matrix of the i-th pixel point is extracted as the total gradient energy of the i-th pixel point, and the maximum value of the total gradient energy of all the pixel points in the original image is counted, and the local gradient disorder degree is calculated according to the following relationship:

[0042] wherein, is the local gradient disorder degree of the i-th pixel point, is the total gradient energy of the i-th pixel point, is the maximum value of the total gradient energy of all the pixel points in the original image, is the structure coherence of the i-th pixel point, is the anisotropy of the i-th pixel point, is the structure tensor matrix of the i-th pixel point, ​​​​​​, which represents the covariance of the horizontal and vertical gradients of the local region, the structure tensor matrix is constructed based on the weighted sum of the outer product of the gradients, which is a symmetric matrix in mathematics, and for any symmetric matrix, its non-diagonal elements must be equal, that is Therefore, only is used to represent this covariance term, and are the main diagonal elements (the upper left element and the lower right element) of is a parameter for preventing the denominator from being 0, usually set to a very small positive number .

[0043] In this relationship, as the relative energy of the pixel point, the greater the relative energy, the greater the brightness difference within the neighborhood window of the pixel point, the more likely it is in the area with significant gradient change in the image, such as the normal glue edge area or the overflow defect, otherwise, the more likely it is in the normal glue coating area or the background with uniform brightness; the feature decomposition is performed on to obtain the first eigenvalue and the second eigenvalue , the square of the difference between the first eigenvalue and the second eigenvalue is calculated , the square of the difference between the eigenvalues is an index for measuring the degree of local structure linearity (anisotropy), according to the relationship between the matrix elements and the decomposed eigenvalues, it is expanded as , which is the anisotropy of the pixel point, the anisotropy is used to accurately distinguish the isotropic chaotic texture and the anisotropic linear edge from the physical form by using the difference between the eigenvalues of the structure tensor matrix, the greater the anisotropy, the higher the gradient concentration, which means that the pixel point can better represent the structure or boundary in the image, and is more likely to be located in the normal glue edge area, otherwise, it means that the gradient is dispersed, the pixel point can better represent the chaotic texture, and is more likely to be located in the overflow defect, represents the structure coherence of the pixel point, which is normalized by dividing by the square of the total energy, so that the structure coherence becomes a pure geometric shape index and is not disturbed by the brightness, the greater the structure coherence, the closer to 1, which means that the gradient direction consistency within the neighborhood window of the pixel point is stronger, which can better represent the structure or boundary in the image, and the pixel point is more likely to be located in the normal glue edge area, otherwise, the structure coherence is weaker, which tends to 0, and the pixel point is more likely to be located in the overflow defect.

[0044] In summary, this step creates a filter with semantic understanding, which is dedicated to extracting structures with high intensity and high isotropy, which is a unique feature of overflow defects. By decoupling and normalization operations, the denominator part of the structure coherence uses the square of the total gradient energy, which is to eliminate the influence of brightness on the judgment of geometry. Through this normalization, it is first determined whether the shape is chaotic regardless of whether it is bright or dark. Finally, the value of 1 minus the structure coherence is multiplied by the relative energy to realize the logical AND operation.

[0045] Specifically: For the pixel points in the normal background or pure glue road area in the original image: due to uniform brightness, the relative energy is low and tends to 0, even if the local structure is chaotic (structure coherence is small), 1 minus the structure coherence value is large, but after multiplication with the relative energy which tends to 0, the amplitude gating of the local gradient disorder degree is realized, making the local gradient disorder degree tend to 0. For the pixel points in the normal glue road edge area in the original image, the brightness difference is large, the relative energy is large and tends to 1, and the structure coherence is large (the local gradient direction is highly consistent), the smaller the value of 1 minus the structure coherence, the smaller the local gradient disorder degree obtained after multiplication, which tends to 0; for the pixel points at the real overflow defect, the brightness difference is large, the relative energy is high, and the structure coherence is small, resulting in a larger value of 1 minus the structure coherence, and then multiplied by the high relative energy, making the local gradient disorder degree larger, which tends to 1, thereby realizing the further distinction between the normal glue road edge area and the overflow defect.

[0046] S3: Fuse the local gradient disorder degree and color smoothness of each pixel point to generate the abnormal confidence of the pixel point.

[0047] After obtaining the color smoothness of the gradient feature dimension of the pixel point, and the structure coherence determined by the energy feature dimension and the morphological feature dimension, this step enters the comprehensive decision-making stage.

[0048] A complementary multi-source feature fusion model is constructed, specifically including the local gradient disorder degree representing energy without direction and the color smoothness representing the degree of local color change. The color chaos degree of each pixel point is obtained by subtracting the color smoothness of each pixel point by 1. The local gradient disorder degree and the color chaos degree of the pixel point are weighted and summed by using a weighted linear fusion model to obtain the comprehensive abnormal feature value of the pixel point. The S-type nonlinear mapping function is used to positively correlate the comprehensive abnormal feature value to the abnormal confidence of the pixel point, to represent the probability of the pixel point belonging to the glue coating defect.

[0049] For the first pixel point, its abnormal confidence satisfies the following relationship:

[0050] in, It is the first Anomaly confidence level of each pixel, It is the first The local gradient disorder of a pixel represents the disorder at the structural level, specifically the degree of randomness in the texture orientation within the pixel's neighborhood window. It is the first Color smoothness per pixel For the first The weighted sum of the local gradient disorder and color chaos of each pixel. , Indicates the first The color chaos of a pixel represents the statistical disorder, which is the degree of fluctuation of color features within the neighborhood window of a pixel. Weighted fusion of orthogonal features was achieved, through The model can dynamically balance its dependence on structural and statistical information, generating an anomaly evidence score that reflects the pixels. For the first The structural coherence of each pixel (obtained directly from step three). This provides a score that reflects the non-abnormal evidence of each pixel. This measures whether a pixel belongs to a geometrically regular, oriented structure (such as a background or a clean adhesive path edge). The larger the value, approaching 1, the more it indicates that the pixel belongs to a high-completeness structure, and the model needs to highly suppress the final anomaly detection. The larger the denominator, the larger it becomes. The final score was lowered, ensuring that strong but well-formed structures (such as clearly defined glue lines) were not misjudged as high-confidence defects. The final... A probabilistic model was implemented to determine whether a pixel is more likely to be a defective glue overflow or a normal glue path. Only when the abnormal evidence score is... Significantly outweighed the score for non-abnormal evidence At that time, the final Only then will it approach 1, thus successfully transforming physical chaos into a quantifiable probability of defect.

[0051] For high-contrast applications with significant adhesive overflow, the color chaos and local gradient disorder are large, ultimately resulting in a very high anomaly confidence level. Approaching For strong edge interference, the anomaly confidence level is very small. Approaching 0.

[0052] like Figure 4As shown, a heat map of each anomaly confidence is displayed, the higher the anomaly confidence, the higher the highlight, and the glue overflow defect area presents a significant highlight response, clearly outlining the defect profile. By fusing color smoothness and local gradient disorder, the physical characteristics of the glue overflow area, such as chaotic texture direction and dramatic color fluctuations, are converted into high probability values in mathematics, Figure 4 The high contrast of different pixel points in the middle indicates that the anomaly confidence reflects the semantic information of the image, and the generated anomaly confidence map provides a high credibility basis for the subsequent step of pseudo-gradient shielding.

[0053] S4: Determine the physical remodeling weight of the edge based on the anomaly confidence, and inject the physical remodeling weight into the graph cut algorithm to generate a physical remodeling weight map.

[0054] This step aims to solve the over-segmentation problem caused by the traditional algorithm merging, and injects the pixel-level physical decision result (anomaly confidence) into the bottom edge weight formula of the algorithm. Through this active intervention, the algorithm is forced to perform shielding when facing the high gradient pseudo-boundary inside the glue overflow area.

[0055] Specifically, first, for each pixel point in the original image, according to the four-neighbor or eight-neighbor connection relationship of the pixel point, a undirected graph formed by the pixel points connected by edges is constructed, and the original gray difference of the edge connecting the pixel points and is calculated, and then the anomaly confidence of the two end points is used to reduce the weight of the original weight to generate the physical remodeling weight , which satisfies the following relationship:

[0056] Among them, is the physical remodeling weight of the edge connecting the pixel points and , is the original weight of the edge of the th pixel point and the th pixel point, is the anomaly confidence of the th pixel point, is the anomaly confidence of the th pixel point, is the absolute value symbol.

[0057] This way of remodeling the physical weight realizes an active intervention mechanism for the edge weight of graph theory, which uses the semantic judgment of the pixel point to modulate its geometric difference, reflecting the original segmentation cost, This is a physical modulation factor used to reduce segmentation costs; this multiplication operation implements a gating mechanism for suppression conditions. When the edge is completely inside the glue overflow defect, the... The pixel and the Anomaly confidence level of each pixel and All are very high, approaching 1, and the physical modulation factor approaches 1. This leads to the physical reshaping of weights regardless of the original weights (i.e., the pseudo-gradient inside the defect). They will all be forcibly reduced to zero. The algorithm treats zero-weight edges as costless connections, thereby forcibly merging them and successfully masking internal pseudo-boundaries caused by chaotic textures, ensuring the complete connectivity of defective regions. When an edge is located in a normal boundary region, for example, when the i-th pixel is a glue overflow defect... Very large, approaching 1, the first Each pixel represents the background area. When the value is very small, approaching 0, the physical modulation factor is very large, approaching 0. Physical reshaping weights The weights are almost identical to the original weights, which ensures that the true boundary gradient information is fully preserved, thus preventing graph theory algorithms from making erroneous straddle merges and achieving accurate preservation of edge structures.

[0058] Finally, the physical reshaping weight of each edge is determined based on the two pixels corresponding to each edge in the undirected graph. The physical reshaping weights of all edges in the undirected graph are used to generate a physical reshaping weight map for graph cut segmentation.

[0059] like Figure 5 As shown, a physically reshaped weight graph constructed based on anomaly confidence and spatial gating mechanism is presented. Only a specific glue-coating defect area in the middle of the image retains a bright weight response, while other background interference is filtered out. This graph intuitively illustrates the working mechanism of the physical modulation factor. Inside the defect, due to the extremely high anomaly confidence of adjacent pixels, the physical modulation factor approaches zero, forcibly reshaping the edge weights in this region to extremely low values. This is equivalent to artificially establishing a zero-cost connected path inside the defect in the graph theory topology, achieving pseudo-gradient shielding inside the defect. Through weight reshaping, the algorithm effectively isolates external environmental noise, ensuring that subsequent graph cut algorithms will focus on processing the real defect area without being biased by background textures.

[0060] S5: Input the physical reshaping weight map into the graph theory-based image segmentation algorithm to perform region segmentation on the original image to obtain segmented regions, and determine the glue coating defect detection result based on the segmented regions.

[0061] After physically reshaping the weights of all edges, the actual splitting operation is performed. Specifically, the physically reshaped weight graph is input... The algorithm framework performs region merging based on physically reshaping the weighted graph, including: The algorithm framework initializes each pixel of the original image as a region. It sorts the physical reshaping weights of all edges in the undirected graph in ascending order, traverses all sorted edges, and for each edge corresponding to two different regions, obtains the maximum internal difference between the two regions and an adaptive tolerance threshold determined based on the region size. The sum of the maximum internal difference and the adaptive tolerance threshold of each region is used as the candidate merging criterion for that region. The smaller value between the two candidate merging criterions is determined as the true merging criterion. If the physical reshaping weight of an edge is not greater than the true merging criterion, the two regions are merged, and the maximum internal difference of the merged region is updated. After traversal, all disjoint regions are used as all segmented regions in the original image, and the final output is a set of segmented regions. This is the classic process of the traditional Felzenszwalb-Huttenlocher algorithm. The improvement of this invention lies only in the physical reshaping of the edge weights; the rest of the process is the standard operation of this algorithm.

[0062] For the first edge connected by one edge The pixel and the Using a few pixels, this demonstrates the merging process of the algorithm, from the initialization phase to the phase of updating internal differences: Initialization phase: At the start of the algorithm, the first... One pixel is used as the region , No. One pixel is used as the region ,area and region All only contain Pixels, region and region Each of their internal maximum differences is set to 0 (because they have no internal boundaries), and the physical reshaping weight of the edge is determined to be 0.5 according to step five. This algorithm usually sets a scale control parameter of 100, which is typically used to determine the tolerance of the region.

[0063] Traversal and Decision Phase: Calculation Region and region The tolerances for regions A and B, respectively, are calculated as follows, since the region size is only 1. That is, the tolerance level is 100, the area The tolerance level is also .

[0064] Computational area and region The respective candidate merging reference is obtained by adding the maximum internal difference of the respective region to the tolerance threshold, and the candidate reference of region A is: , region The candidate reference of region B is: ; The true merging decision reference is determined by selecting the smaller value of the two candidate references of region A and region B, and the true merging decision reference is 100; The final decision stage: compare the physical remodeling weight 5 of the edge with the true merging decision reference 100, because The weight of the edge is not greater than the true merging decision reference, so the merging is allowed, and region A and region B are merged into a new region ; The update internal difference stage: The size of the internal difference of region A and region B is changed to 2 pixels, and the maximum value of the internal difference of region A before merging, the internal difference of region B, and the weight of the edge connecting them is taken, The internal maximum difference of region A is 5, which will be used for the next round of merging decision calculation.

[0065] Finally, for each segmented region, the average of the abnormal confidence of all pixel points in the segmented region is calculated as the abnormal index of the segmented region. 100 normal images without glue defects are collected as samples in advance, and each normal image is divided into multiple segmented regions according to the method of steps 1 to 5 of the present application. The average of the abnormal index of all segmented regions of each image is taken as the reference abnormal index of the image, and then the average and standard deviation of the reference abnormal index of the 100 images are calculated. According to the three standard deviation rule of statistics, the average of the reference abnormal index plus 3 times the standard deviation is set as the adaptive threshold.

[0066] Then, in the original image of the vehicle-mounted battery gluing area, for each segmented region, if the abnormal index of the segmented region is greater than the adaptive threshold, it is determined that the segmented region has overflow glue defect, and is marked and alarmed on the original image. If the region abnormal index is not greater than the adaptive threshold, it is determined that the segmented region is a normal glue path or background interference.

[0067] As shown in Figure 3 and Figure 6 , the final detection results of the traditional F-H graph-based segmentation algorithm and the improved F-H graph-based segmentation algorithm of the present application are shown. The region segmentation result of the present application clearly outlines the dark ring-shaped region in the middle of the image, and the region is filled as a single, complete connected domain, Figure 3It can be seen that the traditional algorithm produces serious over-segmentation inside the overflow glue area, and cuts a complete defect into dozens of fine fragments. Due to the physical remodeling mechanism of the application, the problem of complete connectivity detection under complex texture interference is solved, and the precise positioning of the glue coating defect is realized.

[0068] The above merely describes preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A machine vision-based method for detecting adhesive defects in automotive batteries, characterized in that, include: Obtain the original image of the adhesive coating area of ​​the vehicle battery and separate the brightness channel and saturation channel; The combined variance of the two channels for each pixel is calculated by using the local variance of the brightness and saturation channels within the neighborhood window. A negative correlation mapping operation is then performed based on the combined variance of the two channels to obtain the color smoothness of the pixel. The gradient vector of each pixel is determined based on the brightness channel to construct the structure tensor matrix of the pixel. The local gradient disorder of the pixel is determined based on the elements of the structure tensor matrix. The local gradient disorder and color smoothness of each pixel are fused to generate the abnormal confidence of that pixel; based on the spatial adjacency of the pixels, the two connected pixels and the edge between the two pixels are obtained, and the physical reshaping weight of the edge is determined according to the abnormal confidence and gray value difference of the two pixels. A physical reshaping weight graph is constructed based on the physical reshaping weights of all edges. The physical reshaping weight graph is then input into a graph-based image segmentation algorithm to segment the original image into regions. The abnormal confidence of the pixels in the segmented regions is used to determine the adhesive coating defects, thus completing the adhesive coating defect detection.

2. The method for detecting defects in adhesive coating on vehicle batteries according to claim 1, characterized in that, The combined variance of the two channels is determined based on the following method: For each pixel in the original image, calculate the local variance of the luminance channel within the neighborhood window of that pixel, denoted as the first local variance of that pixel, and the local variance of the saturation channel within the neighborhood window of that pixel, denoted as the second local variance of that pixel. Use the mean of the first local variances of all pixels as the luminance noise benchmark, and the mean of the second local variances of all pixels as the saturation noise benchmark. Divide the first local variance and the second local variance by the luminance noise benchmark and the saturation noise benchmark respectively, and then sum them to obtain the combined variance value of the two channels of that pixel.

3. The method for detecting defects in adhesive coating on vehicle batteries according to claim 1, characterized in that, The gradient vector of each pixel is determined based on the luminance channel to construct the structure tensor matrix of that pixel, including: Obtain the horizontal and vertical gradients of the brightness channel at each pixel, denoted as the horizontal gradient component and the vertical gradient component, respectively. Combine the horizontal and vertical gradient components to form the gradient vector of that pixel. Perform a weighted summation operation on the outer product of the gradient vectors of all pixels within the neighborhood window of that pixel, and use it as the structure tensor matrix of that pixel. The weights involved in the weighted summation operation are determined based on the spatial distance between that pixel and all pixels within its neighborhood window.

4. The method for detecting defects in adhesive coating on vehicle batteries according to claim 1, characterized in that, The local gradient disorder is determined based on the following method: Extract the trace of the structure tensor matrix of each pixel as the total gradient energy of that pixel; calculate the maximum total gradient energy of all pixels, and use the ratio of the total gradient energy of that pixel to the maximum total gradient energy as the relative energy of that pixel. The structure tensor matrix is ​​decomposed into eigenvalues ​​to obtain the first and second eigenvalues. The square of the difference between the first and second eigenvalues ​​is taken as the anisotropy of the pixel. The ratio of the anisotropy of the pixel to the square of the total gradient energy is taken as the structural coherence of the pixel. The local gradient disorder of a pixel is determined by multiplying the structural coherence of that pixel by 1 by its relative energy.

5. The method for detecting defects in adhesive coating on vehicle batteries according to claim 1, characterized in that, The method for generating the anomaly confidence of a pixel by fusing the local gradient disorder and color smoothness of each pixel is as follows: The color chaos degree of a pixel is obtained by subtracting the color smoothness of each pixel from 1. A weighted linear fusion model is used to sum the local gradient disorder and color chaos degree of the pixel to obtain the comprehensive abnormal feature value of the pixel. The comprehensive abnormal feature value is positively correlated with the abnormal confidence degree of the pixel through an S-shaped nonlinear mapping function to characterize the probability that the pixel belongs to the glue coating defect.

6. The method for detecting defects in adhesive coating on vehicle batteries according to claim 1, characterized in that, Based on the anomaly confidence level and grayscale value difference between two pixels, the physical reshaping weight of the edge is determined, including: Calculate the absolute difference between the gray values ​​of two pixels as the original gray value difference of the edge; subtract the product of the outlier confidence of the two pixels from 1 as the physical modulation factor of the edge; multiply the original gray value difference by the physical modulation factor to obtain the physical reshaping weight of the edge.

7. The method for detecting defects in adhesive coating on vehicle batteries according to claim 1, characterized in that, A physical reshaping weight graph is constructed based on the physical reshaping weights of all edges, including: Based on the four-neighbor or eight-neighbor connectivity of each pixel in the original image, an undirected graph is constructed, consisting of pixels connected by edges. The physical reshaping weight of each edge is determined according to the two pixels corresponding to each edge in the undirected graph. The physical reshaping weights of all edges in the undirected graph are used to generate a physical reshaping weight map for graph cut segmentation.

8. The method for detecting defects in adhesive coating on vehicle batteries according to claim 7, characterized in that, The physically reconstructed weight map is input into a graph-based image segmentation algorithm to perform region segmentation on the original image, resulting in segmented regions, including: Each pixel in the original image is initialized as a region. The physical reshaping weights of all edges in the undirected graph are sorted in ascending order. All edges are traversed. For each edge corresponding to two different regions, the maximum internal difference of each region and the adaptive tolerance threshold determined based on the region size are obtained. The sum of the maximum internal difference of each region and the adaptive tolerance threshold is used as the candidate merging criterion for that region. The smaller value of the two candidate merging criterions is determined as the true merging criterion. If the physical reshaping weight of the edge is not greater than the true merging criterion, the two regions are merged, and the maximum internal difference of the merged region is updated. After the traversal, all non-overlapping regions are taken as all segmented regions in the original image.

9. The method for detecting defects in adhesive coating on vehicle batteries according to claim 1, characterized in that, Defects in adhesive application are determined based on the outlier confidence level of pixels in the segmented region, including: Calculate the average of the anomaly confidence scores of all pixels within each segmented region as the region anomaly index for that segmented region; determine an adaptive threshold; if the region anomaly index is not less than the adaptive threshold, the segmented region is determined to have an adhesive overflow defect; if the region anomaly index is less than the adaptive threshold, the segmented region is determined to be a normal adhesive path or background interference, and no adhesive overflow defect has occurred.

10. The method for detecting defects in adhesive coating on vehicle batteries according to claim 1, characterized in that, Separating the luminance and saturation channels includes: performing a color space conversion operation on the original image to convert the original image into a color space containing luminance and saturation components, so as to separate the luminance and saturation channels.

Citation Information

Cited By

  • MBR produced water turbidity detection method and system based on image processing

    CN121811227A

  • Image processing-based MBR product water turbidity detection method and system

    CN121811227B

  • Visual detection method and system for screw dispensing

    CN121883488A